From: Thomas Falcon <hidden> Date: 2016-12-14 00:15:17
Include calculations to compute the number of segments
that comprise an aggregated large packet.
Signed-off-by: Thomas Falcon <redacted>
---
drivers/net/ethernet/ibm/ibmveth.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
@@ -1181,7 +1181,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,staticvoidibmveth_rx_mss_helper(structsk_buff*skb,u16mss,intlrg_pkt){+structtcphdr*tcph;intoffset=0;+inthdr_len;/* only TCP packets will be aggregated */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,*expectthatthemsswillbewrittentothetcpheaderchecksum.*/+tcph=(structtcphdr*)(skb->data+offset);if(lrg_pkt){skb_shinfo(skb)->gso_size=mss;}elseif(offset){-structtcphdr*tcph=(structtcphdr*)(skb->data+offset);-skb_shinfo(skb)->gso_size=ntohs(tcph->check);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);+}}staticintibmveth_poll(structnapi_struct*napi,intbudget)
@@ -1181,7 +1181,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,staticvoidibmveth_rx_mss_helper(structsk_buff*skb,u16mss,intlrg_pkt){+structtcphdr*tcph;intoffset=0;+inthdr_len;/* only TCP packets will be aggregated */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,*expectthatthemsswillbewrittentothetcpheaderchecksum.*/+tcph=(structtcphdr*)(skb->data+offset);if(lrg_pkt){skb_shinfo(skb)->gso_size=mss;}elseif(offset){-structtcphdr*tcph=(structtcphdr*)(skb->data+offset);-skb_shinfo(skb)->gso_size=ntohs(tcph->check);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);+}}staticintibmveth_poll(structnapi_struct*napi,intbudget)
@@ -1181,7 +1181,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,staticvoidibmveth_rx_mss_helper(structsk_buff*skb,u16mss,intlrg_pkt){+structtcphdr*tcph;intoffset=0;+inthdr_len;/* only TCP packets will be aggregated */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,*expectthatthemsswillbewrittentothetcpheaderchecksum.*/+tcph=(structtcphdr*)(skb->data+offset);if(lrg_pkt){skb_shinfo(skb)->gso_size=mss;}elseif(offset){-structtcphdr*tcph=(structtcphdr*)(skb->data+offset);-skb_shinfo(skb)->gso_size=ntohs(tcph->check);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);+}}staticintibmveth_poll(structnapi_struct*napi,intbudget)--