linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: saeed@marvell.com (Saeed Bishara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2 v3] mv643xx_eth: use sw csum for big packets
Date: Sun, 6 Jun 2010 14:40:49 +0300	[thread overview]
Message-ID: <mailman.53.1277034601.27306.linux-arm-kernel@lists.infradead.org> (raw)

Some controllers (KW, Dove) limits the TX IP/layer4 checksum
offloading to a max size.

Signed-off-by: Saeed Bishara <saeed@marvell.com>
---
 drivers/net/mv643xx_eth.c   |    9 +++++++--
 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 e345ec8..73bb8ea 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private {
 	unsigned int t_clk;
 	int extended_rx_coal_limit;
 	int tx_bw_control;
+	int tx_csum_limit;
 };

 #define TX_BW_CONTROL_ABSENT		0
@@ -776,13 +777,16 @@ static int txq_submit_skb(struct tx_queue *txq,
struct sk_buff *skb)
 	l4i_chk =3D 0;

 	if (skb->ip_summed =3D=3D CHECKSUM_PARTIAL) {
+		int hdr_len;
 		int tag_bytes;

 		BUG_ON(skb->protocol !=3D htons(ETH_P_IP) &&
 		       skb->protocol !=3D htons(ETH_P_8021Q));

-		tag_bytes =3D (void *)ip_hdr(skb) - (void *)skb->data - ETH_HLEN;
-		if (unlikely(tag_bytes & ~12)) {
+		hdr_len =3D (void *)ip_hdr(skb) - (void *)skb->data;
+		tag_bytes =3D hdr_len - ETH_HLEN;
+		if (skb->len - hdr_len > mp->shared->tx_csum_limit ||
+		    unlikely(tag_bytes & ~12)) {
 			if (skb_checksum_help(skb) =3D=3D 0)
 				goto no_csum;
 			kfree_skb(skb);
@@ -2666,6 +2670,7 @@ static int mv643xx_eth_shared_probe(struct
platform_device *pdev)
 	 * Detect hardware parameters.
 	 */
 	msp->t_clk =3D (pd !=3D NULL && pd->t_clk !=3D 0) ? pd->t_clk : 133000000=
;
+	msp->tx_csum_limit =3D pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
 	infer_hw_params(msp);

 	platform_set_drvdata(pdev, msp);
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index cbbbe9b..30b0c4e 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
 	struct mbus_dram_target_info	*dram;
 	struct platform_device	*shared_smi;
 	unsigned int		t_clk;
+	/*
+	 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
+	 * limit of 9KiB will be used.
+	 */
+	int			tx_csum_limit;
 };

 #define MV643XX_ETH_PHY_ADDR_DEFAULT	0
--=20
1.6.0.4

                 reply	other threads:[~2010-06-06 11:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.53.1277034601.27306.linux-arm-kernel@lists.infradead.org \
    --to=saeed@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).