Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Apr 2015 03:55:03 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r281259 - in stable/10/sys/dev/cxgbe: . common
Message-ID:  <201504080355.t383t3Db050153@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Wed Apr  8 03:55:02 2015
New Revision: 281259
URL: https://svnweb.freebsd.org/changeset/base/281259

Log:
  MFC r278485:
  
  cxgbe(4): allow the SET_FILTER_MODE ioctl to change the mode when it's
  safe to do so.

Modified:
  stable/10/sys/dev/cxgbe/common/t4_hw.c
  stable/10/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/10/sys/dev/cxgbe/common/t4_hw.c	Wed Apr  8 02:43:05 2015	(r281258)
+++ stable/10/sys/dev/cxgbe/common/t4_hw.c	Wed Apr  8 03:55:02 2015	(r281259)
@@ -3108,6 +3108,31 @@ void t4_write_rss_pf_mask(struct adapter
 			  &pfmask, 1, A_TP_RSS_PF_MSK);
 }
 
+static void refresh_vlan_pri_map(struct adapter *adap)
+{
+
+        t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA,
+                         &adap->params.tp.vlan_pri_map, 1,
+                         A_TP_VLAN_PRI_MAP);
+
+	/*
+	 * Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field
+	 * shift positions of several elements of the Compressed Filter Tuple
+	 * for this adapter which we need frequently ...
+	 */
+	adap->params.tp.vlan_shift = t4_filter_field_shift(adap, F_VLAN);
+	adap->params.tp.vnic_shift = t4_filter_field_shift(adap, F_VNIC_ID);
+	adap->params.tp.port_shift = t4_filter_field_shift(adap, F_PORT);
+	adap->params.tp.protocol_shift = t4_filter_field_shift(adap, F_PROTOCOL);
+
+	/*
+	 * If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
+	 * represents the presense of an Outer VLAN instead of a VNIC ID.
+	 */
+	if ((adap->params.tp.ingress_config & F_VNIC) == 0)
+		adap->params.tp.vnic_shift = -1;
+}
+
 /**
  *	t4_set_filter_mode - configure the optional components of filter tuples
  *	@adap: the adapter
@@ -3131,6 +3156,8 @@ int t4_set_filter_mode(struct adapter *a
 		return -EINVAL;
 	t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, &mode_map, 1,
 			  A_TP_VLAN_PRI_MAP);
+	refresh_vlan_pri_map(adap);
+
 	return 0;
 }
 
@@ -5615,33 +5642,10 @@ int __devinit t4_init_tp_params(struct a
 	for (chan = 0; chan < NCHAN; chan++)
 		adap->params.tp.tx_modq[chan] = chan;
 
-	/*
-	 * Cache the adapter's Compressed Filter Mode and global Incress
-	 * Configuration.
-	 */
-        t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-                         &adap->params.tp.vlan_pri_map, 1,
-                         A_TP_VLAN_PRI_MAP);
 	t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA,
 			 &adap->params.tp.ingress_config, 1,
 			 A_TP_INGRESS_CONFIG);
-
-	/*
-	 * Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field
-	 * shift positions of several elements of the Compressed Filter Tuple
-	 * for this adapter which we need frequently ...
-	 */
-	adap->params.tp.vlan_shift = t4_filter_field_shift(adap, F_VLAN);
-	adap->params.tp.vnic_shift = t4_filter_field_shift(adap, F_VNIC_ID);
-	adap->params.tp.port_shift = t4_filter_field_shift(adap, F_PORT);
-	adap->params.tp.protocol_shift = t4_filter_field_shift(adap, F_PROTOCOL);
-
-	/*
-	 * If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
-	 * represents the presense of an Outer VLAN instead of a VNIC ID.
-	 */
-	if ((adap->params.tp.ingress_config & F_VNIC) == 0)
-		adap->params.tp.vnic_shift = -1;
+	refresh_vlan_pri_map(adap);
 
 	return 0;
 }

Modified: stable/10/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/10/sys/dev/cxgbe/t4_main.c	Wed Apr  8 02:43:05 2015	(r281258)
+++ stable/10/sys/dev/cxgbe/t4_main.c	Wed Apr  8 03:55:02 2015	(r281259)
@@ -7056,10 +7056,9 @@ get_filter_mode(struct adapter *sc, uint
 		log(LOG_WARNING, "%s: cached filter mode out of sync %x %x.\n",
 		    device_get_nameunit(sc->dev), sc->params.tp.vlan_pri_map,
 		    fconf);
-		sc->params.tp.vlan_pri_map = fconf;
 	}
 
-	*mode = fconf_to_mode(sc->params.tp.vlan_pri_map);
+	*mode = fconf_to_mode(fconf);
 
 	end_synchronized_op(sc, LOCK_HELD);
 	return (0);
@@ -7090,14 +7089,7 @@ set_filter_mode(struct adapter *sc, uint
 	}
 #endif
 
-#ifdef notyet
 	rc = -t4_set_filter_mode(sc, fconf);
-	if (rc == 0)
-		sc->filter_mode = fconf;
-#else
-	rc = ENOTSUP;
-#endif
-
 done:
 	end_synchronized_op(sc, LOCK_HELD);
 	return (rc);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504080355.t383t3Db050153>