diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2011-08-02 15:57:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-03 06:23:30 -0400 |
commit | 12004ae99c009a4ff3c8ea0843f1980aa5bcb4ea (patch) | |
tree | df510ef2be2eb17ca9e5bae681f27092e789729a /drivers/net | |
parent | 306f13487c9f7d6e3303a547e01e22958a04c666 (diff) |
be2net: drop pkts that do not belong to the port
On some BE skews, while in promiscuous mode, pkts that do not belong to a
port can arrive on that port. Drop such pkts.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/benet/be.h | 2 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 30 |
2 files changed, 24 insertions, 8 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 1e7f0094e382..12b5b5168dca 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -217,7 +217,7 @@ struct be_rx_compl_info { | |||
217 | u16 vlan_tag; | 217 | u16 vlan_tag; |
218 | u16 pkt_size; | 218 | u16 pkt_size; |
219 | u16 rxq_idx; | 219 | u16 rxq_idx; |
220 | u16 mac_id; | 220 | u16 port; |
221 | u8 vlanf; | 221 | u8 vlanf; |
222 | u8 num_rcvd; | 222 | u8 num_rcvd; |
223 | u8 err; | 223 | u8 err; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index dba6941f868a..1a3accab3d17 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1213,6 +1213,7 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter, | |||
1213 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, | 1213 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, |
1214 | compl); | 1214 | compl); |
1215 | } | 1215 | } |
1216 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl); | ||
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | static void be_parse_rx_compl_v0(struct be_adapter *adapter, | 1219 | static void be_parse_rx_compl_v0(struct be_adapter *adapter, |
@@ -1245,6 +1246,7 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter, | |||
1245 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, | 1246 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, |
1246 | compl); | 1247 | compl); |
1247 | } | 1248 | } |
1249 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); | ||
1248 | } | 1250 | } |
1249 | 1251 | ||
1250 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | 1252 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) |
@@ -1833,16 +1835,30 @@ static int be_poll_rx(struct napi_struct *napi, int budget) | |||
1833 | if (!rxcp) | 1835 | if (!rxcp) |
1834 | break; | 1836 | break; |
1835 | 1837 | ||
1836 | /* Ignore flush completions */ | 1838 | /* Is it a flush compl that has no data */ |
1837 | if (rxcp->num_rcvd && rxcp->pkt_size) { | 1839 | if (unlikely(rxcp->num_rcvd == 0)) |
1838 | if (do_gro(rxcp)) | 1840 | goto loop_continue; |
1839 | be_rx_compl_process_gro(adapter, rxo, rxcp); | 1841 | |
1840 | else | 1842 | /* Discard compl with partial DMA Lancer B0 */ |
1841 | be_rx_compl_process(adapter, rxo, rxcp); | 1843 | if (unlikely(!rxcp->pkt_size)) { |
1842 | } else if (rxcp->pkt_size == 0) { | ||
1843 | be_rx_compl_discard(adapter, rxo, rxcp); | 1844 | be_rx_compl_discard(adapter, rxo, rxcp); |
1845 | goto loop_continue; | ||
1844 | } | 1846 | } |
1845 | 1847 | ||
1848 | /* On BE drop pkts that arrive due to imperfect filtering in | ||
1849 | * promiscuous mode on some skews | ||
1850 | */ | ||
1851 | if (unlikely(rxcp->port != adapter->port_num && | ||
1852 | !lancer_chip(adapter))) { | ||
1853 | be_rx_compl_discard(adapter, rxo, rxcp); | ||
1854 | goto loop_continue; | ||
1855 | } | ||
1856 | |||
1857 | if (do_gro(rxcp)) | ||
1858 | be_rx_compl_process_gro(adapter, rxo, rxcp); | ||
1859 | else | ||
1860 | be_rx_compl_process(adapter, rxo, rxcp); | ||
1861 | loop_continue: | ||
1846 | be_rx_stats_update(rxo, rxcp); | 1862 | be_rx_stats_update(rxo, rxcp); |
1847 | } | 1863 | } |
1848 | 1864 | ||