diff options
author | Thomas Falcon <tlfalcon@linux.vnet.ibm.com> | 2016-12-13 19:15:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-17 10:23:28 -0500 |
commit | 94acf164dc8f1184e8d0737be7125134c2701dbe (patch) | |
tree | ada87fda86154b8f2ecf110d8fe5918d8abeedb2 /drivers/net/ethernet/ibm/ibmveth.c | |
parent | 026acd5f47340382844f0af73516cf7ae6cdc876 (diff) |
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>
Diffstat (limited to 'drivers/net/ethernet/ibm/ibmveth.c')
-rw-r--r-- | drivers/net/ethernet/ibm/ibmveth.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index fbece63395a8..a831f947ca8c 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -1181,7 +1181,9 @@ map_failed: | |||
1181 | 1181 | ||
1182 | static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt) | 1182 | static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt) |
1183 | { | 1183 | { |
1184 | struct tcphdr *tcph; | ||
1184 | int offset = 0; | 1185 | int offset = 0; |
1186 | int hdr_len; | ||
1185 | 1187 | ||
1186 | /* only TCP packets will be aggregated */ | 1188 | /* only TCP packets will be aggregated */ |
1187 | if (skb->protocol == htons(ETH_P_IP)) { | 1189 | 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) | |||
1208 | /* if mss is not set through Large Packet bit/mss in rx buffer, | 1210 | /* if mss is not set through Large Packet bit/mss in rx buffer, |
1209 | * expect that the mss will be written to the tcp header checksum. | 1211 | * expect that the mss will be written to the tcp header checksum. |
1210 | */ | 1212 | */ |
1213 | tcph = (struct tcphdr *)(skb->data + offset); | ||
1211 | if (lrg_pkt) { | 1214 | if (lrg_pkt) { |
1212 | skb_shinfo(skb)->gso_size = mss; | 1215 | skb_shinfo(skb)->gso_size = mss; |
1213 | } else if (offset) { | 1216 | } else if (offset) { |
1214 | struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset); | ||
1215 | |||
1216 | skb_shinfo(skb)->gso_size = ntohs(tcph->check); | 1217 | skb_shinfo(skb)->gso_size = ntohs(tcph->check); |
1217 | tcph->check = 0; | 1218 | tcph->check = 0; |
1218 | } | 1219 | } |
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 | } | ||
1219 | } | 1227 | } |
1220 | 1228 | ||
1221 | static int ibmveth_poll(struct napi_struct *napi, int budget) | 1229 | static int ibmveth_poll(struct napi_struct *napi, int budget) |