svn commit: r207255 - user/jmallett/octeon/sys/mips/cavium/octe

Juli Mallett jmallett at FreeBSD.org
Tue Apr 27 00:58:19 UTC 2010


Author: jmallett
Date: Tue Apr 27 00:58:19 2010
New Revision: 207255
URL: http://svn.freebsd.org/changeset/base/207255

Log:
  Turn on use of cvm_oct_common_set_multicast_list to handle IFF_ALLMULTI and
  IFF_PROMISC.
  
  Update a comment.  Fix some indentation.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 00:58:19 2010	(r207255)
@@ -98,9 +98,8 @@ static struct ifnet_stats *cvm_oct_commo
  *
  * @param dev    Device to work on
  */
-static void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
+void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
 {
-#if 0
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
@@ -111,13 +110,13 @@ static void cvm_oct_common_set_multicast
 		control.u64 = 0;
 		control.s.bcst = 1;     /* Allow broadcast MAC addresses */
 
-		if (ifp->mc_list || (ifp->flags&IFF_ALLMULTI) ||
-		    (ifp->flags & IFF_PROMISC))
+		if (/*ifp->mc_list || */(ifp->if_flags&IFF_ALLMULTI) ||
+		    (ifp->if_flags & IFF_PROMISC))
 			control.s.mcst = 2; /* Force accept multicast packets */
 		else
 			control.s.mcst = 1; /* Force reject multicat packets */
 
-		if (ifp->flags & IFF_PROMISC)
+		if (ifp->if_flags & IFF_PROMISC)
 			control.s.cam_mode = 0; /* Reject matches if promisc. Since CAM is shut off, should accept everything */
 		else
 			control.s.cam_mode = 1; /* Filter packets based on the CAM */
@@ -126,14 +125,13 @@ static void cvm_oct_common_set_multicast
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
 
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface), control.u64);
-		if (ifp->flags&IFF_PROMISC)
+		if (ifp->if_flags&IFF_PROMISC)
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 0);
 		else
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 1);
 
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 	}
-#endif
 }
 
 
@@ -262,7 +260,6 @@ int cvm_oct_common_init(struct ifnet *if
 #if 0
 	ifp->get_stats          = cvm_oct_common_get_stats;
 	ifp->set_mac_address    = cvm_oct_common_set_mac_address;
-	ifp->set_multicast_list = cvm_oct_common_set_multicast_list;
 	ifp->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	ifp->poll_controller    = cvm_oct_poll_controller;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Tue Apr 27 00:58:19 2010	(r207255)
@@ -31,6 +31,7 @@ int cvm_oct_common_init(struct ifnet *if
 void cvm_oct_common_uninit(struct ifnet *ifp);
 
 int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu);
+void cvm_oct_common_set_multicast_list(struct ifnet *ifp);
 
 int cvm_oct_init_module(device_t);
 void cvm_oct_cleanup_module(void);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 00:58:19 2010	(r207255)
@@ -238,8 +238,10 @@ octe_init(void *arg)
 	if (priv->miibus != NULL)
 		mii_mediachg(device_get_softc(priv->miibus));
 
-        ifp->if_drv_flags |= IFF_DRV_RUNNING;
-        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	cvm_oct_common_set_multicast_list(ifp);
+
+	ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
 
 static void
@@ -279,21 +281,15 @@ octe_start(struct ifnet *ifp)
 		 * two very good reasons:
 		 * (1) immediately after our inserting it another CPU may be
 		 *     kind enough to free it for us.
-		 * (2) m_defrag gets called on m and we don't get back the
+		 * (2) m_collapse gets called on m and we don't get back the
 		 *     modified pointer.
 		 *
-		 * We have some options other than this m_dup route:
+		 * We have some options other than an m_dup route:
 		 * (1) use a mutex or spinlock to prevent another CPU from
 		 *     freeing it.  We could lock the tx_free_list's lock,
 		 *     that would make sense.
 		 * (2) get back the new mbuf pointer.
-		 * (3) do the defrag here.
-		 *
-		 * #3 makes sense in the long run when we have code that can
-		 * load mbufs into any number of segments, but for now the
-		 * transmit code is called with the assumption that it knows
-		 * how to defrag mbufs for itself and that it will handle the
-		 * failure cases internally.
+		 * (3) do the collapse here.
 		 */
 
 		if (priv->queue != -1) {


More information about the svn-src-user mailing list