Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Falcon and committed by
David S. Miller
94acf164 026acd5f

+10 -2
+10 -2
drivers/net/ethernet/ibm/ibmveth.c
··· 1181 1181 1182 1182 static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt) 1183 1183 { 1184 + struct tcphdr *tcph; 1184 1185 int offset = 0; 1186 + int hdr_len; 1185 1187 1186 1188 /* only TCP packets will be aggregated */ 1187 1189 if (skb->protocol == htons(ETH_P_IP)) { ··· 1210 1208 /* if mss is not set through Large Packet bit/mss in rx buffer, 1211 1209 * expect that the mss will be written to the tcp header checksum. 1212 1210 */ 1211 + tcph = (struct tcphdr *)(skb->data + offset); 1213 1212 if (lrg_pkt) { 1214 1213 skb_shinfo(skb)->gso_size = mss; 1215 1214 } else if (offset) { 1216 - struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset); 1217 - 1218 1215 skb_shinfo(skb)->gso_size = ntohs(tcph->check); 1219 1216 tcph->check = 0; 1217 + } 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); 1220 1224 } 1221 1225 } 1222 1226