aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-02-25 09:21:52 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-27 02:16:31 -0500
commitf7b493e02101bb5a0a69a91a8b4b7b002cd60eaf (patch)
tree1ef3a50ae84210499e231c7404b85ed21132cdd6 /drivers/net/tg3.c
parenta6435f3a53746a0eb687a9f636cf1941f35f935e (diff)
tg3: Drop non-VLAN rx pkts larger than the MTU
The hardware's MTU is configured so that it will accept packets whose VLAN tag is left inline. This means that the hardware will also accept other packets larger than the desired MTU size. This patch checks for and discards packets that are larger than the requested MTU but are not VLAN tagged frames. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index c7bbbb19f000..774a01ab03be 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4339,6 +4339,13 @@ static int tg3_rx(struct tg3 *tp, int budget)
4339 skb->ip_summed = CHECKSUM_NONE; 4339 skb->ip_summed = CHECKSUM_NONE;
4340 4340
4341 skb->protocol = eth_type_trans(skb, tp->dev); 4341 skb->protocol = eth_type_trans(skb, tp->dev);
4342
4343 if (len > (tp->dev->mtu + ETH_HLEN) &&
4344 skb->protocol != htons(ETH_P_8021Q)) {
4345 dev_kfree_skb(skb);
4346 goto next_pkt;
4347 }
4348
4342#if TG3_VLAN_TAG_USED 4349#if TG3_VLAN_TAG_USED
4343 if (tp->vlgrp != NULL && 4350 if (tp->vlgrp != NULL &&
4344 desc->type_flags & RXD_FLAG_VLAN) { 4351 desc->type_flags & RXD_FLAG_VLAN) {
@@ -6824,7 +6831,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6824 __tg3_set_mac_addr(tp, 0); 6831 __tg3_set_mac_addr(tp, 0);
6825 6832
6826 /* MTU + ethernet header + FCS + optional VLAN tag */ 6833 /* MTU + ethernet header + FCS + optional VLAN tag */
6827 tw32(MAC_RX_MTU_SIZE, tp->dev->mtu + ETH_HLEN + 8); 6834 tw32(MAC_RX_MTU_SIZE,
6835 tp->dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
6828 6836
6829 /* The slot time is changed by tg3_setup_phy if we 6837 /* The slot time is changed by tg3_setup_phy if we
6830 * run at gigabit with half duplex. 6838 * run at gigabit with half duplex.