diff options
-rw-r--r-- | drivers/net/mv643xx_eth.c | 9 | ||||
-rw-r--r-- | include/linux/mv643xx_eth.h | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index e345ec8cb473..73bb8ea6f54a 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private { | |||
289 | unsigned int t_clk; | 289 | unsigned int t_clk; |
290 | int extended_rx_coal_limit; | 290 | int extended_rx_coal_limit; |
291 | int tx_bw_control; | 291 | int tx_bw_control; |
292 | int tx_csum_limit; | ||
292 | }; | 293 | }; |
293 | 294 | ||
294 | #define TX_BW_CONTROL_ABSENT 0 | 295 | #define TX_BW_CONTROL_ABSENT 0 |
@@ -776,13 +777,16 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb) | |||
776 | l4i_chk = 0; | 777 | l4i_chk = 0; |
777 | 778 | ||
778 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 779 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
780 | int hdr_len; | ||
779 | int tag_bytes; | 781 | int tag_bytes; |
780 | 782 | ||
781 | BUG_ON(skb->protocol != htons(ETH_P_IP) && | 783 | BUG_ON(skb->protocol != htons(ETH_P_IP) && |
782 | skb->protocol != htons(ETH_P_8021Q)); | 784 | skb->protocol != htons(ETH_P_8021Q)); |
783 | 785 | ||
784 | tag_bytes = (void *)ip_hdr(skb) - (void *)skb->data - ETH_HLEN; | 786 | hdr_len = (void *)ip_hdr(skb) - (void *)skb->data; |
785 | if (unlikely(tag_bytes & ~12)) { | 787 | tag_bytes = hdr_len - ETH_HLEN; |
788 | if (skb->len - hdr_len > mp->shared->tx_csum_limit || | ||
789 | unlikely(tag_bytes & ~12)) { | ||
786 | if (skb_checksum_help(skb) == 0) | 790 | if (skb_checksum_help(skb) == 0) |
787 | goto no_csum; | 791 | goto no_csum; |
788 | kfree_skb(skb); | 792 | kfree_skb(skb); |
@@ -2666,6 +2670,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) | |||
2666 | * Detect hardware parameters. | 2670 | * Detect hardware parameters. |
2667 | */ | 2671 | */ |
2668 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; | 2672 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; |
2673 | msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024; | ||
2669 | infer_hw_params(msp); | 2674 | infer_hw_params(msp); |
2670 | 2675 | ||
2671 | platform_set_drvdata(pdev, msp); | 2676 | platform_set_drvdata(pdev, msp); |
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index cbbbe9bfecad..30b0c4e78f91 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data { | |||
19 | struct mbus_dram_target_info *dram; | 19 | struct mbus_dram_target_info *dram; |
20 | struct platform_device *shared_smi; | 20 | struct platform_device *shared_smi; |
21 | unsigned int t_clk; | 21 | unsigned int t_clk; |
22 | /* | ||
23 | * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default | ||
24 | * limit of 9KiB will be used. | ||
25 | */ | ||
26 | int tx_csum_limit; | ||
22 | }; | 27 | }; |
23 | 28 | ||
24 | #define MV643XX_ETH_PHY_ADDR_DEFAULT 0 | 29 | #define MV643XX_ETH_PHY_ADDR_DEFAULT 0 |