mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
ibmveth: calculate gso_segs for large packets
[ Upstream commit 94acf164dc ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fb7c521a14
commit
3e5a7f5b95
@@ -1181,7 +1181,9 @@ map_failed:
|
|||||||
|
|
||||||
static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
|
static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
|
||||||
{
|
{
|
||||||
|
struct tcphdr *tcph;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
int hdr_len;
|
||||||
|
|
||||||
/* only TCP packets will be aggregated */
|
/* only TCP packets will be aggregated */
|
||||||
if (skb->protocol == htons(ETH_P_IP)) {
|
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)
|
|||||||
/* if mss is not set through Large Packet bit/mss in rx buffer,
|
/* if mss is not set through Large Packet bit/mss in rx buffer,
|
||||||
* expect that the mss will be written to the tcp header checksum.
|
* expect that the mss will be written to the tcp header checksum.
|
||||||
*/
|
*/
|
||||||
|
tcph = (struct tcphdr *)(skb->data + offset);
|
||||||
if (lrg_pkt) {
|
if (lrg_pkt) {
|
||||||
skb_shinfo(skb)->gso_size = mss;
|
skb_shinfo(skb)->gso_size = mss;
|
||||||
} else if (offset) {
|
} else if (offset) {
|
||||||
struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
|
|
||||||
|
|
||||||
skb_shinfo(skb)->gso_size = ntohs(tcph->check);
|
skb_shinfo(skb)->gso_size = ntohs(tcph->check);
|
||||||
tcph->check = 0;
|
tcph->check = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skb_shinfo(skb)->gso_size) {
|
||||||
|
hdr_len = offset + tcph->doff * 4;
|
||||||
|
skb_shinfo(skb)->gso_segs =
|
||||||
|
DIV_ROUND_UP(skb->len - hdr_len,
|
||||||
|
skb_shinfo(skb)->gso_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ibmveth_poll(struct napi_struct *napi, int budget)
|
static int ibmveth_poll(struct napi_struct *napi, int budget)
|
||||||
|
|||||||
Reference in New Issue
Block a user