Skip to content

Commit 403a728

Browse files
tlfalcongregkh
authored andcommitted
ibmveth: calculate gso_segs for large packets
commit 94acf164dc8f1184e8d0737be7125134c2701dbe upstream. 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> Reviewed-by: Jonathan Maxwell <jmaxwell37@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6559604 commit 403a728

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/net/ethernet/ibm/ibmveth.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
11791179

11801180
static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
11811181
{
1182+
struct tcphdr *tcph;
11821183
int offset = 0;
1184+
int hdr_len;
11831185

11841186
/* only TCP packets will be aggregated */
11851187
if (skb->protocol == htons(ETH_P_IP)) {
@@ -1206,14 +1208,20 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
12061208
/* if mss is not set through Large Packet bit/mss in rx buffer,
12071209
* expect that the mss will be written to the tcp header checksum.
12081210
*/
1211+
tcph = (struct tcphdr *)(skb->data + offset);
12091212
if (lrg_pkt) {
12101213
skb_shinfo(skb)->gso_size = mss;
12111214
} else if (offset) {
1212-
struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
1213-
12141215
skb_shinfo(skb)->gso_size = ntohs(tcph->check);
12151216
tcph->check = 0;
12161217
}
1218+
1219+
if (skb_shinfo(skb)->gso_size) {
1220+
hdr_len = offset + tcph->doff * 4;
1221+
skb_shinfo(skb)->gso_segs =
1222+
DIV_ROUND_UP(skb->len - hdr_len,
1223+
skb_shinfo(skb)->gso_size);
1224+
}
12171225
}
12181226

12191227
static int ibmveth_poll(struct napi_struct *napi, int budget)

0 commit comments

Comments
 (0)