aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2014-05-22 02:31:56 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-06-11 11:48:18 -0400
commit8c27d42ec61e9568fc24dbfb347d844252100765 (patch)
tree3d4cc8c686fee78a7667b0ddd9a90e416aa726a8
parent4d9b604353e65824e49a01ecf2b3f3bf329e6048 (diff)
i40e: Do not accept tagged packets by default
Remove the filter created by the firmware with the default MAC address it reads out of the NVM storage and a promiscuous VLAN tag and replace it with a filter that will not accept tagged packets by default. The system must request a VLAN tag packet filter to get packets with that tag. Change-ID: I119e6c3603a039bd68282ba31bf26f33a575490a Signed-off-by: Greg Rose <gregory.v.rose@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 676bebb97f6e..211684ce113a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1154,6 +1154,30 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr,
1154} 1154}
1155 1155
1156/** 1156/**
1157 * i40e_rm_default_mac_filter - Remove the default MAC filter set by NVM
1158 * @vsi: the PF Main VSI - inappropriate for any other VSI
1159 * @macaddr: the MAC address
1160 **/
1161static void i40e_rm_default_mac_filter(struct i40e_vsi *vsi, u8 *macaddr)
1162{
1163 struct i40e_aqc_remove_macvlan_element_data element;
1164 struct i40e_pf *pf = vsi->back;
1165 i40e_status aq_ret;
1166
1167 /* Only appropriate for the PF main VSI */
1168 if (vsi->type != I40E_VSI_MAIN)
1169 return;
1170
1171 ether_addr_copy(element.mac_addr, macaddr);
1172 element.vlan_tag = 0;
1173 element.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH |
1174 I40E_AQC_MACVLAN_DEL_IGNORE_VLAN;
1175 aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL);
1176 if (aq_ret)
1177 dev_err(&pf->pdev->dev, "Could not remove default MAC-VLAN\n");
1178}
1179
1180/**
1157 * i40e_add_filter - Add a mac/vlan filter to the VSI 1181 * i40e_add_filter - Add a mac/vlan filter to the VSI
1158 * @vsi: the VSI to be searched 1182 * @vsi: the VSI to be searched
1159 * @macaddr: the MAC address 1183 * @macaddr: the MAC address
@@ -6980,6 +7004,14 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
6980 if (vsi->type == I40E_VSI_MAIN) { 7004 if (vsi->type == I40E_VSI_MAIN) {
6981 SET_NETDEV_DEV(netdev, &pf->pdev->dev); 7005 SET_NETDEV_DEV(netdev, &pf->pdev->dev);
6982 memcpy(mac_addr, hw->mac.perm_addr, ETH_ALEN); 7006 memcpy(mac_addr, hw->mac.perm_addr, ETH_ALEN);
7007 /* The following two steps are necessary to prevent reception
7008 * of tagged packets - by default the NVM loads a MAC-VLAN
7009 * filter that will accept any tagged packet. This is to
7010 * prevent that during normal operations until a specific
7011 * VLAN tag filter has been set.
7012 */
7013 i40e_rm_default_mac_filter(vsi, mac_addr);
7014 i40e_add_filter(vsi, mac_addr, I40E_VLAN_ANY, false, true);
6983 } else { 7015 } else {
6984 /* relate the VSI_VMDQ name to the VSI_MAIN name */ 7016 /* relate the VSI_VMDQ name to the VSI_MAIN name */
6985 snprintf(netdev->name, IFNAMSIZ, "%sv%%d", 7017 snprintf(netdev->name, IFNAMSIZ, "%sv%%d",