Skip to content

Commit

Permalink
ibmveth: calculate gso_segs for large packets
Browse files Browse the repository at this point in the history
Include calculations to compute the number of segments
that comprise an aggregated large packet.

Signed-off-by: Thomas Falcon <[email protected]>
Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
Reviewed-by: Jonathan Maxwell <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tlfalcon authored and davem330 committed Dec 17, 2016
1 parent 026acd5 commit 94acf16
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/net/ethernet/ibm/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)
Expand Down

0 comments on commit 94acf16

Please sign in to comment.