aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-01-24 18:02:17 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-24 18:02:17 -0500
commitbe1b6e8b5470e8311bfa1a3dfd7bd59e85a99759 (patch)
treebd9781e6686293b4cceeb6ee0b01ae517332bab8
parent1d174e95176dfe5bdcec78f2d5b9440dd79798c3 (diff)
parente0752a68d8de2a6fcb2909d86cab6b23896896de (diff)
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 100GbE Intel Wired LAN Driver Updates 2018-01-24 This series contains updates to fm10k only. Alex fixes MACVLAN offload for fm10k, where we were not seeing unicast packets being received because we did not correctly configure the default VLAN ID for the port and defaulting to 0. Jake cleans up unnecessary parenthesis in a couple of "if" statements. Fixed the driver to stop adding VLAN 0 into the VLAN table, since it would cause the VLAN table to be inconsistent between the PF and VF. Also fixed an issue where we were assuming that VLAN 1 is enabled when the default VLAN ID is not set, so resolve by not requesting any filters for the default_vid if it has not yet been assigned. Ngai fixes an issue which was generating a dmesg regarding unbale to kill a particular VLAN ID for the device. This is due to ndo_vlan_rx_kill_vid() exits with an error and the handler for this ndo is fm10k_update_vid() which exits prematurely under PF VLAN management. So to resolve, we must check the VLAN update action type before exiting fm10k_update_vid(), and act appropriately based on the action type. Also corrected code comment typos. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_iov.c4
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_netdev.c54
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pf.c2
3 files changed, 43 insertions, 17 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
index ea3ab24265ee..760cfa52d02c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
@@ -353,7 +353,7 @@ int fm10k_iov_resume(struct pci_dev *pdev)
353 struct fm10k_vf_info *vf_info = &iov_data->vf_info[i]; 353 struct fm10k_vf_info *vf_info = &iov_data->vf_info[i];
354 354
355 /* allocate all but the last GLORT to the VFs */ 355 /* allocate all but the last GLORT to the VFs */
356 if (i == ((~hw->mac.dglort_map) >> FM10K_DGLORTMAP_MASK_SHIFT)) 356 if (i == (~hw->mac.dglort_map >> FM10K_DGLORTMAP_MASK_SHIFT))
357 break; 357 break;
358 358
359 /* assign GLORT to VF, and restrict it to multicast */ 359 /* assign GLORT to VF, and restrict it to multicast */
@@ -511,7 +511,7 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs)
511 return err; 511 return err;
512 512
513 /* allocate VFs if not already allocated */ 513 /* allocate VFs if not already allocated */
514 if (num_vfs && (num_vfs != current_vfs)) { 514 if (num_vfs && num_vfs != current_vfs) {
515 /* Disable completer abort error reporting as 515 /* Disable completer abort error reporting as
516 * the VFs can trigger this any time they read a queue 516 * the VFs can trigger this any time they read a queue
517 * that they don't own. 517 * that they don't own.
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index adc62fb38c49..a38ae5c54da3 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -934,8 +934,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
934 if (vid >= VLAN_N_VID) 934 if (vid >= VLAN_N_VID)
935 return -EINVAL; 935 return -EINVAL;
936 936
937 /* Verify we have permission to add VLANs */ 937 /* Verify that we have permission to add VLANs. If this is a request
938 if (hw->mac.vlan_override) 938 * to remove a VLAN, we still want to allow the user to remove the
939 * VLAN device. In that case, we need to clear the bit in the
940 * active_vlans bitmask.
941 */
942 if (set && hw->mac.vlan_override)
939 return -EACCES; 943 return -EACCES;
940 944
941 /* update active_vlans bitmask */ 945 /* update active_vlans bitmask */
@@ -954,6 +958,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
954 rx_ring->vid &= ~FM10K_VLAN_CLEAR; 958 rx_ring->vid &= ~FM10K_VLAN_CLEAR;
955 } 959 }
956 960
961 /* If our VLAN has been overridden, there is no reason to send VLAN
962 * removal requests as they will be silently ignored.
963 */
964 if (hw->mac.vlan_override)
965 return 0;
966
957 /* Do not remove default VLAN ID related entries from VLAN and MAC 967 /* Do not remove default VLAN ID related entries from VLAN and MAC
958 * tables 968 * tables
959 */ 969 */
@@ -1040,14 +1050,13 @@ static int __fm10k_uc_sync(struct net_device *dev,
1040 const unsigned char *addr, bool sync) 1050 const unsigned char *addr, bool sync)
1041{ 1051{
1042 struct fm10k_intfc *interface = netdev_priv(dev); 1052 struct fm10k_intfc *interface = netdev_priv(dev);
1043 struct fm10k_hw *hw = &interface->hw;
1044 u16 vid, glort = interface->glort; 1053 u16 vid, glort = interface->glort;
1045 s32 err; 1054 s32 err;
1046 1055
1047 if (!is_valid_ether_addr(addr)) 1056 if (!is_valid_ether_addr(addr))
1048 return -EADDRNOTAVAIL; 1057 return -EADDRNOTAVAIL;
1049 1058
1050 for (vid = hw->mac.default_vid ? fm10k_find_next_vlan(interface, 0) : 1; 1059 for (vid = fm10k_find_next_vlan(interface, 0);
1051 vid < VLAN_N_VID; 1060 vid < VLAN_N_VID;
1052 vid = fm10k_find_next_vlan(interface, vid)) { 1061 vid = fm10k_find_next_vlan(interface, vid)) {
1053 err = fm10k_queue_mac_request(interface, glort, 1062 err = fm10k_queue_mac_request(interface, glort,
@@ -1106,14 +1115,13 @@ static int __fm10k_mc_sync(struct net_device *dev,
1106 const unsigned char *addr, bool sync) 1115 const unsigned char *addr, bool sync)
1107{ 1116{
1108 struct fm10k_intfc *interface = netdev_priv(dev); 1117 struct fm10k_intfc *interface = netdev_priv(dev);
1109 struct fm10k_hw *hw = &interface->hw;
1110 u16 vid, glort = interface->glort; 1118 u16 vid, glort = interface->glort;
1111 s32 err; 1119 s32 err;
1112 1120
1113 if (!is_multicast_ether_addr(addr)) 1121 if (!is_multicast_ether_addr(addr))
1114 return -EADDRNOTAVAIL; 1122 return -EADDRNOTAVAIL;
1115 1123
1116 for (vid = hw->mac.default_vid ? fm10k_find_next_vlan(interface, 0) : 1; 1124 for (vid = fm10k_find_next_vlan(interface, 0);
1117 vid < VLAN_N_VID; 1125 vid < VLAN_N_VID;
1118 vid = fm10k_find_next_vlan(interface, vid)) { 1126 vid = fm10k_find_next_vlan(interface, vid)) {
1119 err = fm10k_queue_mac_request(interface, glort, 1127 err = fm10k_queue_mac_request(interface, glort,
@@ -1157,10 +1165,12 @@ static void fm10k_set_rx_mode(struct net_device *dev)
1157 1165
1158 /* update xcast mode first, but only if it changed */ 1166 /* update xcast mode first, but only if it changed */
1159 if (interface->xcast_mode != xcast_mode) { 1167 if (interface->xcast_mode != xcast_mode) {
1160 /* update VLAN table */ 1168 /* update VLAN table when entering promiscuous mode */
1161 if (xcast_mode == FM10K_XCAST_MODE_PROMISC) 1169 if (xcast_mode == FM10K_XCAST_MODE_PROMISC)
1162 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL, 1170 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL,
1163 0, true); 1171 0, true);
1172
1173 /* clear VLAN table when exiting promiscuous mode */
1164 if (interface->xcast_mode == FM10K_XCAST_MODE_PROMISC) 1174 if (interface->xcast_mode == FM10K_XCAST_MODE_PROMISC)
1165 fm10k_clear_unused_vlans(interface); 1175 fm10k_clear_unused_vlans(interface);
1166 1176
@@ -1182,9 +1192,10 @@ static void fm10k_set_rx_mode(struct net_device *dev)
1182 1192
1183void fm10k_restore_rx_state(struct fm10k_intfc *interface) 1193void fm10k_restore_rx_state(struct fm10k_intfc *interface)
1184{ 1194{
1195 struct fm10k_l2_accel *l2_accel = interface->l2_accel;
1185 struct net_device *netdev = interface->netdev; 1196 struct net_device *netdev = interface->netdev;
1186 struct fm10k_hw *hw = &interface->hw; 1197 struct fm10k_hw *hw = &interface->hw;
1187 int xcast_mode; 1198 int xcast_mode, i;
1188 u16 vid, glort; 1199 u16 vid, glort;
1189 1200
1190 /* record glort for this interface */ 1201 /* record glort for this interface */
@@ -1211,11 +1222,8 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
1211 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL, 0, 1222 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL, 0,
1212 xcast_mode == FM10K_XCAST_MODE_PROMISC); 1223 xcast_mode == FM10K_XCAST_MODE_PROMISC);
1213 1224
1214 /* Add filter for VLAN 0 */
1215 fm10k_queue_vlan_request(interface, 0, 0, true);
1216
1217 /* update table with current entries */ 1225 /* update table with current entries */
1218 for (vid = hw->mac.default_vid ? fm10k_find_next_vlan(interface, 0) : 1; 1226 for (vid = fm10k_find_next_vlan(interface, 0);
1219 vid < VLAN_N_VID; 1227 vid < VLAN_N_VID;
1220 vid = fm10k_find_next_vlan(interface, vid)) { 1228 vid = fm10k_find_next_vlan(interface, vid)) {
1221 fm10k_queue_vlan_request(interface, vid, 0, true); 1229 fm10k_queue_vlan_request(interface, vid, 0, true);
@@ -1234,6 +1242,24 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
1234 __dev_uc_sync(netdev, fm10k_uc_sync, fm10k_uc_unsync); 1242 __dev_uc_sync(netdev, fm10k_uc_sync, fm10k_uc_unsync);
1235 __dev_mc_sync(netdev, fm10k_mc_sync, fm10k_mc_unsync); 1243 __dev_mc_sync(netdev, fm10k_mc_sync, fm10k_mc_unsync);
1236 1244
1245 /* synchronize macvlan addresses */
1246 if (l2_accel) {
1247 for (i = 0; i < l2_accel->size; i++) {
1248 struct net_device *sdev = l2_accel->macvlan[i];
1249
1250 if (!sdev)
1251 continue;
1252
1253 glort = l2_accel->dglort + 1 + i;
1254
1255 hw->mac.ops.update_xcast_mode(hw, glort,
1256 FM10K_XCAST_MODE_MULTI);
1257 fm10k_queue_mac_request(interface, glort,
1258 sdev->dev_addr,
1259 hw->mac.default_vid, true);
1260 }
1261 }
1262
1237 fm10k_mbx_unlock(interface); 1263 fm10k_mbx_unlock(interface);
1238 1264
1239 /* record updated xcast mode state */ 1265 /* record updated xcast mode state */
@@ -1490,7 +1516,7 @@ static void *fm10k_dfwd_add_station(struct net_device *dev,
1490 hw->mac.ops.update_xcast_mode(hw, glort, 1516 hw->mac.ops.update_xcast_mode(hw, glort,
1491 FM10K_XCAST_MODE_MULTI); 1517 FM10K_XCAST_MODE_MULTI);
1492 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, 1518 fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
1493 0, true); 1519 hw->mac.default_vid, true);
1494 } 1520 }
1495 1521
1496 fm10k_mbx_unlock(interface); 1522 fm10k_mbx_unlock(interface);
@@ -1530,7 +1556,7 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
1530 hw->mac.ops.update_xcast_mode(hw, glort, 1556 hw->mac.ops.update_xcast_mode(hw, glort,
1531 FM10K_XCAST_MODE_NONE); 1557 FM10K_XCAST_MODE_NONE);
1532 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, 1558 fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
1533 0, false); 1559 hw->mac.default_vid, false);
1534 } 1560 }
1535 1561
1536 fm10k_mbx_unlock(interface); 1562 fm10k_mbx_unlock(interface);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 425d814aed4d..d6406fc31ffb 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -866,7 +866,7 @@ static s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
866 /* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is 866 /* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is
867 * used here to indicate to the VF that it will not have privilege to 867 * used here to indicate to the VF that it will not have privilege to
868 * write VLAN_TABLE. All policy is enforced on the PF but this allows 868 * write VLAN_TABLE. All policy is enforced on the PF but this allows
869 * the VF to correctly report errors to userspace rqeuests. 869 * the VF to correctly report errors to userspace requests.
870 */ 870 */
871 if (vf_info->pf_vid) 871 if (vf_info->pf_vid)
872 vf_vid = vf_info->pf_vid | FM10K_VLAN_OVERRIDE; 872 vf_vid = vf_info->pf_vid | FM10K_VLAN_OVERRIDE;