Skip to content

Commit 94acf16

Browse files
tlfalcondavem330
authored andcommitted
ibmveth: calculate gso_segs for large packets
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>
1 parent 026acd5 commit 94acf16

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/net/ethernet/ibm/ibmveth.c

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

11821182
static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
11831183
{
1184+
struct tcphdr *tcph;
11841185
int offset = 0;
1186+
int hdr_len;
11851187

11861188
/* only TCP packets will be aggregated */
11871189
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)
12081210
/* if mss is not set through Large Packet bit/mss in rx buffer,
12091211
* expect that the mss will be written to the tcp header checksum.
12101212
*/
1213+
tcph = (struct tcphdr *)(skb->data + offset);
12111214
if (lrg_pkt) {
12121215
skb_shinfo(skb)->gso_size = mss;
12131216
} else if (offset) {
1214-
struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
1215-
12161217
skb_shinfo(skb)->gso_size = ntohs(tcph->check);
12171218
tcph->check = 0;
12181219
}
1220+
1221+
if (skb_shinfo(skb)->gso_size) {
1222+
hdr_len = offset + tcph->doff * 4;
1223+
skb_shinfo(skb)->gso_segs =
1224+
DIV_ROUND_UP(skb->len - hdr_len,
1225+
skb_shinfo(skb)->gso_size);
1226+
}
12191227
}
12201228

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

0 commit comments

Comments
 (0)