mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "shesha bhushan" <bhushan_vadulas@hotmail.com>
To: kernelnewbies@nl.linux.org, linux-kernel@vger.kernel.org
Subject: disable TCP/IP checksum
Date: Fri, 04 Apr 2003 10:17:01 +0000	[thread overview]
Message-ID: <F109Dd3OJXsNQptgFrY00002ff5@hotmail.com> (raw)

Hi All,
  I am trying to disable the calculation of TCP/IP checksum so that it is 
calculated by the hardware. I did two things which I have discribed below. 
But I am not successful. Can any one please help me in this? I am using 
Intel pro 1000 GBE. I am stuck. All help are welcome.

Thanking You
Shesha

============
what I did
============

#1#
----
In the e1000_main.c
netdev->features = netdev->features | NETIF_F_HW_CSUM;

But when I check the value of skb->ip_summed in tcp.c its still 
CHECKSUM_NONE and not CHECKSUM_HW.
So I believe the checksum is still calculated by the software.

#2#
----
In linux/net/ipv4/tcp.c, tcp_sendmsg() makes calls to tcp_copy_to_page() and 
skb_add_data(); These two functions in turn makes calls to 
csum_and_copy_from_user(). I have modified the code of these two functions 
as follows. But it is NOT WORKING. If I do an FTP, the system just waits for 
response from the FTP server.

****************
MODIFIED CODE
****************

static inline int
tcp_copy_to_page(struct sock *sk, char *from, struct sk_buff *skb,
		 struct page *page, int off, int copy)
{
	int err = 0;
	unsigned int csum;


#ifdef MY_HACK
csum = copy_from_user(from, page_address(page)+off, copy);
err = csum = 0 ;
skb->ip_summed = CHECKSUM_HW;

#else
csum = csum_and_copy_from_user(from, page_address(page)+off, copy, 0, &err);

#endif


  if (!err) {

    if (skb->ip_summed == CHECKSUM_NONE)
	skb->csum = csum_block_add(skb->csum, csum, skb->len);

		skb->len += copy;
		skb->data_len += copy;
		skb->truesize += copy;
		sk->wmem_queued += copy;
		sk->forward_alloc -= copy;
	}
	return err;
}


static inline int
skb_add_data(struct sk_buff *skb, char *from, int copy)
{
	int err = 0;
	unsigned int csum;


	int off = skb->len;


#ifdef MY_HACK
csum = copy_from_user(from, skb_put(skb, copy), copy);
err = csum = 0;
skb->ip_summed = CHECKSUM_HW;

#else
csum = csum_and_copy_from_user(from, skb_put(skb, copy), copy, 0, &err);

#endif

   if (!err) {
     if (skb->ip_summed == CHECKSUM_NONE)
	skb->csum = csum_block_add(skb->csum, csum, off);
	return 0;
     }
	__skb_trim(skb, off);
	return -EFAULT;
   }




_________________________________________________________________
Say it now. Say it online. http://www.msn.co.in/ecards/ Send e-cards to your 
love


                 reply	other threads:[~2003-04-04 10:06 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=F109Dd3OJXsNQptgFrY00002ff5@hotmail.com \
    --to=bhushan_vadulas@hotmail.com \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®