svn commit: r268294 - head/sys/dev/etherswitch/rtl8366

Luiz Otavio O Souza loos at FreeBSD.org
Sat Jul 5 19:31:23 UTC 2014


Author: loos
Date: Sat Jul  5 19:31:22 2014
New Revision: 268294
URL: http://svnweb.freebsd.org/changeset/base/268294

Log:
  Allow the PVID setting on CPU port.
  
  Return our static list of supported media for the CPU port.
  
  Tested on TP-Link 1043ND.

Modified:
  head/sys/dev/etherswitch/rtl8366/rtl8366rb.c

Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c
==============================================================================
--- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c	Sat Jul  5 19:30:20 2014	(r268293)
+++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c	Sat Jul  5 19:31:22 2014	(r268294)
@@ -579,13 +579,19 @@ rtl_getport(device_t dev, etherswitch_po
 	} else {
 		/* fill in fixed values for CPU port */
 		p->es_flags |= ETHERSWITCH_PORT_CPU;
-		ifmr->ifm_count = 0;
 		smi_read(dev, RTL8366RB_PLSR_BASE + (RTL8366RB_NUM_PHYS)/2, &v, RTL_WAITOK);
 		v = v >> (8 * ((RTL8366RB_NUM_PHYS) % 2));
 		rtl8366rb_update_ifmedia(v, &ifmr->ifm_status, &ifmr->ifm_active);
 		ifmr->ifm_current = ifmr->ifm_active;
 		ifmr->ifm_mask = 0;
 		ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID;
+		/* Return our static media list. */
+		if (ifmr->ifm_count > 0) {
+			ifmr->ifm_count = 1;
+			ifmr->ifm_ulist[0] = IFM_MAKEWORD(IFM_ETHER, IFM_1000_T,
+			    IFM_FDX, 0);
+		} else
+			ifmr->ifm_count = 0;
 	}
 	return (0);
 }
@@ -598,7 +604,7 @@ rtl_setport(device_t dev, etherswitch_po
 	struct ifmedia *ifm;
 	struct mii_data *mii;
 
-	if (p->es_port < 0 || p->es_port >= RTL8366RB_NUM_PHYS)
+	if (p->es_port < 0 || p->es_port >= RTL8366RB_NUM_PORTS)
 		return (ENXIO);
 	sc = device_get_softc(dev);
 	vlangroup = -1;


More information about the svn-src-head mailing list