提交 0fc16ebf 编写于 作者: P Padmanabh Ratnakar 提交者: David S. Miller

be2net: Fix VLAN/multicast packet reception

VLAN and multicast hardware filters are limited and can get
exhausted in adapters with many PCI functions. If setting
a VLAN or multicast filter fails due to lack of sufficient
hardware resources, these packets get dropped. Fix this by
switching to VLAN or multicast promiscous mode so that these
packets are not dropped.
Signed-off-by: NPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9cf6ace5
...@@ -797,22 +797,30 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) ...@@ -797,22 +797,30 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
if (adapter->promiscuous) if (adapter->promiscuous)
return 0; return 0;
if (adapter->vlans_added <= adapter->max_vlans) { if (adapter->vlans_added > adapter->max_vlans)
/* Construct VLAN Table to give to HW */ goto set_vlan_promisc;
for (i = 0; i < VLAN_N_VID; i++) {
if (adapter->vlan_tag[i]) { /* Construct VLAN Table to give to HW */
vtag[ntags] = cpu_to_le16(i); for (i = 0; i < VLAN_N_VID; i++)
ntags++; if (adapter->vlan_tag[i])
} vtag[ntags++] = cpu_to_le16(i);
}
status = be_cmd_vlan_config(adapter, adapter->if_handle, status = be_cmd_vlan_config(adapter, adapter->if_handle,
vtag, ntags, 1, 0); vtag, ntags, 1, 0);
} else {
status = be_cmd_vlan_config(adapter, adapter->if_handle, /* Set to VLAN promisc mode as setting VLAN filter failed */
NULL, 0, 1, 1); if (status) {
dev_info(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n");
dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering.\n");
goto set_vlan_promisc;
} }
return status; return status;
set_vlan_promisc:
status = be_cmd_vlan_config(adapter, adapter->if_handle,
NULL, 0, 1, 1);
return status;
} }
static int be_vlan_add_vid(struct net_device *netdev, u16 vid) static int be_vlan_add_vid(struct net_device *netdev, u16 vid)
...@@ -862,6 +870,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, u16 vid) ...@@ -862,6 +870,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, u16 vid)
static void be_set_rx_mode(struct net_device *netdev) static void be_set_rx_mode(struct net_device *netdev)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status;
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
be_cmd_rx_filter(adapter, IFF_PROMISC, ON); be_cmd_rx_filter(adapter, IFF_PROMISC, ON);
...@@ -908,7 +917,14 @@ static void be_set_rx_mode(struct net_device *netdev) ...@@ -908,7 +917,14 @@ static void be_set_rx_mode(struct net_device *netdev)
} }
} }
be_cmd_rx_filter(adapter, IFF_MULTICAST, ON); status = be_cmd_rx_filter(adapter, IFF_MULTICAST, ON);
/* Set to MCAST promisc mode if setting MULTICAST address fails */
if (status) {
dev_info(&adapter->pdev->dev, "Exhausted multicast HW filters.\n");
dev_info(&adapter->pdev->dev, "Disabling HW multicast filtering.\n");
be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON);
}
done: done:
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册