diff options
author | Thomas Falcon <tlfalcon@linux.vnet.ibm.com> | 2017-03-16 20:48:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-22 07:43:37 -0400 |
commit | 3e5a7f5b95f00bf69e93a3b7019355ced807c3d0 (patch) | |
tree | 4d1234ff0f8c51335a27c91a999b1fab05c5721e /drivers/net | |
parent | fb7c521a1460ad46a17859274d79f30599bdb5ea (diff) |
ibmveth: calculate gso_segs for large packets
[ Upstream commit 94acf164dc8f1184e8d0737be7125134c2701dbe ]
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: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-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 a36022ba4e42..03dca732e4c6 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) |