@@ -201,6 +201,14 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue)
201201
202202 adapter -> link_speed = ret >> 16 ;
203203 if (ret & 1 ) { /* Link is up. */
204+ /*
205+ * From vmxnet3 v9, the hypervisor reports the speed in Gbps.
206+ * Convert the speed to Mbps before rporting it to the kernel.
207+ * Max link speed supported is 10000G.
208+ */
209+ if (VMXNET3_VERSION_GE_9 (adapter ) &&
210+ adapter -> link_speed < 10000 )
211+ adapter -> link_speed = adapter -> link_speed * 1000 ;
204212 netdev_info (adapter -> netdev , "NIC Link is Up %d Mbps\n" ,
205213 adapter -> link_speed );
206214 netif_carrier_on (adapter -> netdev );
@@ -1560,6 +1568,30 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb,
15601568 return (hlen + (hdr .tcp -> doff << 2 ));
15611569}
15621570
1571+ static void
1572+ vmxnet3_lro_tunnel (struct sk_buff * skb , __be16 ip_proto )
1573+ {
1574+ struct udphdr * uh = NULL ;
1575+
1576+ if (ip_proto == htons (ETH_P_IP )) {
1577+ struct iphdr * iph = (struct iphdr * )skb -> data ;
1578+
1579+ if (iph -> protocol == IPPROTO_UDP )
1580+ uh = (struct udphdr * )(iph + 1 );
1581+ } else {
1582+ struct ipv6hdr * iph = (struct ipv6hdr * )skb -> data ;
1583+
1584+ if (iph -> nexthdr == IPPROTO_UDP )
1585+ uh = (struct udphdr * )(iph + 1 );
1586+ }
1587+ if (uh ) {
1588+ if (uh -> check )
1589+ skb_shinfo (skb )-> gso_type |= SKB_GSO_UDP_TUNNEL_CSUM ;
1590+ else
1591+ skb_shinfo (skb )-> gso_type |= SKB_GSO_UDP_TUNNEL ;
1592+ }
1593+ }
1594+
15631595static int
15641596vmxnet3_rq_rx_complete (struct vmxnet3_rx_queue * rq ,
15651597 struct vmxnet3_adapter * adapter , int quota )
@@ -1873,6 +1905,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
18731905 if (segCnt != 0 && mss != 0 ) {
18741906 skb_shinfo (skb )-> gso_type = rcd -> v4 ?
18751907 SKB_GSO_TCPV4 : SKB_GSO_TCPV6 ;
1908+ if (encap_lro )
1909+ vmxnet3_lro_tunnel (skb , skb -> protocol );
18761910 skb_shinfo (skb )-> gso_size = mss ;
18771911 skb_shinfo (skb )-> gso_segs = segCnt ;
18781912 } else if ((segCnt != 0 || skb -> len > mtu ) && !encap_lro ) {
@@ -3599,8 +3633,6 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
35993633 struct vmxnet3_adapter * adapter = netdev_priv (netdev );
36003634 int err = 0 ;
36013635
3602- WRITE_ONCE (netdev -> mtu , new_mtu );
3603-
36043636 /*
36053637 * Reset_work may be in the middle of resetting the device, wait for its
36063638 * completion.
@@ -3614,6 +3646,7 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
36143646
36153647 /* we need to re-create the rx queue based on the new mtu */
36163648 vmxnet3_rq_destroy_all (adapter );
3649+ WRITE_ONCE (netdev -> mtu , new_mtu );
36173650 vmxnet3_adjust_rx_ring_size (adapter );
36183651 err = vmxnet3_rq_create_all (adapter );
36193652 if (err ) {
@@ -3630,6 +3663,8 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
36303663 "Closing it\n" , err );
36313664 goto out ;
36323665 }
3666+ } else {
3667+ WRITE_ONCE (netdev -> mtu , new_mtu );
36333668 }
36343669
36353670out :
0 commit comments