Skip to contentSkip to conversation

ibmveth gso fix.

PATCH Applied David Wilder 3 participants 7 messages Oct 13, 2020 – Oct 15, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover ibmveth gso fix.

The ibmveth driver is a virtual Ethernet driver used on IBM pSeries systems. Gso packets can be sent between LPARS (virtual hosts) without segmentation, by flagging gso packets using one of two methods depending on the firmware version. Some gso packet were not correctly identified by the receiver. This patch-set corrects this issue.

V2:
- Added fix tags.
- Byteswap the constant at compilation time.
- Updated the commit message to clarify what frame validation is performed by the hypervisor.

David Wilder (2):
ibmveth: Switch order of ibmveth_helper calls.
ibmveth: Identify ingress large send packets.

 drivers/net/ethernet/ibm/ibmveth.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/2 ibmveth: Switch order of ibmveth_helper calls.

ibmveth_rx_csum_helper() must be called after ibmveth_rx_mss_helper() as ibmveth_rx_csum_helper() may alter ip and tcp checksum values.

Fixes 66aa0678efc2 ("ibmveth: Support to enable LSO/CSO for Trunk

VEA.")

---
 drivers/net/ethernet/ibm/ibmveth.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/ibm/ibmveth.c +5 -5
index c5c732601e35..3935a7e22ce5 100644
@@ -1385,16 +1385,16 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 			skb_put(skb, length);
 			skb->protocol = eth_type_trans(skb, netdev);
 
-			if (csum_good) {
-				skb->ip_summed = CHECKSUM_UNNECESSARY;
-				ibmveth_rx_csum_helper(skb, adapter);
-			}
-
 			if (length > netdev->mtu + ETH_HLEN) {
 				ibmveth_rx_mss_helper(skb, mss, lrg_pkt);
 				adapter->rx_large_packets++;
 			}
 
+			if (csum_good) {
+				skb->ip_summed = CHECKSUM_UNNECESSARY;
+				ibmveth_rx_csum_helper(skb, adapter);
+			}
+
 			napi_gro_receive(napi, skb);	/* send it up */
 
 			netdev->stats.rx_packets++;
Signature · 1 line
1.8.3.1
Acked-by on v2 1/2
#2 lore raw

Re: [ PATCH v2 1/2] ibmveth: Switch order of ibmveth_helper calls.

Quoted 10 lines · David Wilder

ibmveth_rx_csum_helper() must be called after ibmveth_rx_mss_helper() as ibmveth_rx_csum_helper() may alter ip and tcp checksum values.

Fixes 66aa0678efc2 ("ibmveth: Support to enable LSO/CSO for Trunk

VEA.")

maintainer
#3 lore raw

Re: [ PATCH v2 1/2] ibmveth: Switch order of ibmveth_helper calls.

In reply to David Wilder
Quoted 2 lines · On Tue, 13 Oct 2020 16:20:13 -0700 David Wilder wrote:
Fixes 66aa0678efc2 ("ibmveth: Support to enable LSO/CSO for Trunk

VEA.")

Please make sure Fixes tags are not wrapped in the future.

#4 lore raw

PATCH v2 2/2 ibmveth: Identify ingress large send packets.

In reply to David Wilder

Ingress large send packets are identified by either:
The IBMVETH_RXQ_LRG_PKT flag in the receive buffer
or with a -1 placed in the ip header checksum.
The method used depends on firmware version. Frame geometry and sufficient header validation is performed by the hypervisor eliminating the need for further header checks here.

Fixes 7b5967389f5a ("ibmveth: set correct gso_size and gso_type")
---
 drivers/net/ethernet/ibm/ibmveth.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmveth.c +12 -1
index 3935a7e22ce5..7ef3369953b6 100644
@@ -1349,6 +1349,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 			int offset = ibmveth_rxq_frame_offset(adapter);
 			int csum_good = ibmveth_rxq_csum_good(adapter);
 			int lrg_pkt = ibmveth_rxq_large_packet(adapter);
+			__sum16 iph_check = 0;
 
 			skb = ibmveth_rxq_get_buffer(adapter);
 
@@ -1385,7 +1386,17 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 			skb_put(skb, length);
 			skb->protocol = eth_type_trans(skb, netdev);
 
-			if (length > netdev->mtu + ETH_HLEN) {
+			/* PHYP without PLSO support places a -1 in the ip
+			 * checksum for large send frames.
+			 */
+			if (skb->protocol == cpu_to_be16(ETH_P_IP)) {
+				struct iphdr *iph = (struct iphdr *)skb->data;
+
+				iph_check = iph->check;
+			}
+
+			if ((length > netdev->mtu + ETH_HLEN) ||
+			    lrg_pkt || iph_check == 0xffff) {
 				ibmveth_rx_mss_helper(skb, mss, lrg_pkt);
 				adapter->rx_large_packets++;
 			}
Signature · 1 line
1.8.3.1
Acked-by on v2 2/2
#5 lore raw

Re: [ PATCH v2 2/2] ibmveth: Identify ingress large send packets.

Quoted 8 lines · David Wilder

Ingress large send packets are identified by either:
The IBMVETH_RXQ_LRG_PKT flag in the receive buffer
or with a -1 placed in the ip header checksum.
The method used depends on firmware version. Frame geometry and sufficient header validation is performed by the hypervisor eliminating the need for further header checks here.

Quoted 5 lines
Fixes 7b5967389f5a ("ibmveth: set correct gso_size and gso_type")

Thanks for clarifying the header validation. I clearly had missed that :)

maintainer Applied
#6 lore raw
In reply to David Wilder
Quoted 11 lines · On Tue, 13 Oct 2020 16:20:12 -0700 David Wilder wrote:

The ibmveth driver is a virtual Ethernet driver used on IBM pSeries systems. Gso packets can be sent between LPARS (virtual hosts) without segmentation, by flagging gso packets using one of two methods depending on the firmware version. Some gso packet were not correctly identified by the receiver. This patch-set corrects this issue.

V2:
- Added fix tags.
- Byteswap the constant at compilation time.
- Updated the commit message to clarify what frame validation is performed by the hypervisor.

Applied, thanks everyone!