netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: marcelo.leitner@gmail.com
To: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org, brking@linux.vnet.ibm.com,
	pradeeps@linux.vnet.ibm.com, jmaxwell37@gmail.com,
	zdai@us.ibm.com, eric.dumazet@gmail.com
Subject: Re: [PATCH net] ibmveth: calculate gso_segs for large packets
Date: Wed, 14 Dec 2016 18:39:04 -0200	[thread overview]
Message-ID: <20161214203904.GA13422@localhost.localdomain> (raw)
In-Reply-To: <1481674509-14256-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

On Tue, Dec 13, 2016 at 06:15:09PM -0600, Thomas Falcon wrote:
> Include calculations to compute the number of segments
> that comprise an aggregated large packet.
> 
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>

Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>


> ---
>  drivers/net/ethernet/ibm/ibmveth.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index fbece63..a831f94 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1181,7 +1181,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
>  
>  static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
>  {
> +	struct tcphdr *tcph;
>  	int offset = 0;
> +	int hdr_len;
>  
>  	/* only TCP packets will be aggregated */
>  	if (skb->protocol == htons(ETH_P_IP)) {
> @@ -1208,14 +1210,20 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
>  	/* if mss is not set through Large Packet bit/mss in rx buffer,
>  	 * expect that the mss will be written to the tcp header checksum.
>  	 */
> +	tcph = (struct tcphdr *)(skb->data + offset);
>  	if (lrg_pkt) {
>  		skb_shinfo(skb)->gso_size = mss;
>  	} else if (offset) {
> -		struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
> -
>  		skb_shinfo(skb)->gso_size = ntohs(tcph->check);
>  		tcph->check = 0;
>  	}
> +
> +	if (skb_shinfo(skb)->gso_size) {
> +		hdr_len = offset + tcph->doff * 4;
> +		skb_shinfo(skb)->gso_segs =
> +				DIV_ROUND_UP(skb->len - hdr_len,
> +					     skb_shinfo(skb)->gso_size);
> +	}
>  }
>  
>  static int ibmveth_poll(struct napi_struct *napi, int budget)
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2016-12-14 20:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14  0:15 [PATCH net] ibmveth: calculate gso_segs for large packets Thomas Falcon
2016-12-14 20:39 ` marcelo.leitner [this message]
2016-12-15 21:49 ` Jonathan Maxwell
2016-12-17 15:23 ` David Miller

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=20161214203904.GA13422@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jmaxwell37@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pradeeps@linux.vnet.ibm.com \
    --cc=tlfalcon@linux.vnet.ibm.com \
    --cc=zdai@us.ibm.com \
    /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).