@@ -191,8 +191,16 @@ static void enic_udp_tunnel_add(struct net_device *netdev,
191191 goto error ;
192192 }
193193
194- if (ti -> sa_family != AF_INET ) {
195- netdev_info (netdev , "vxlan: only IPv4 offload supported" );
194+ switch (ti -> sa_family ) {
195+ case AF_INET6 :
196+ if (!(enic -> vxlan .flags & ENIC_VXLAN_OUTER_IPV6 )) {
197+ netdev_info (netdev , "vxlan: only IPv4 offload supported" );
198+ goto error ;
199+ }
200+ /* Fall through */
201+ case AF_INET :
202+ break ;
203+ default :
196204 goto error ;
197205 }
198206
@@ -271,22 +279,37 @@ static netdev_features_t enic_features_check(struct sk_buff *skb,
271279 struct enic * enic = netdev_priv (dev );
272280 struct udphdr * udph ;
273281 u16 port = 0 ;
274- u16 proto ;
282+ u8 proto ;
275283
276284 if (!skb -> encapsulation )
277285 return features ;
278286
279287 features = vxlan_features_check (skb , features );
280288
281- /* hardware only supports IPv4 vxlan tunnel */
282- if (vlan_get_protocol (skb ) != htons (ETH_P_IP ))
289+ switch (vlan_get_protocol (skb )) {
290+ case htons (ETH_P_IPV6 ):
291+ if (!(enic -> vxlan .flags & ENIC_VXLAN_OUTER_IPV6 ))
292+ goto out ;
293+ proto = ipv6_hdr (skb )-> nexthdr ;
294+ break ;
295+ case htons (ETH_P_IP ):
296+ proto = ip_hdr (skb )-> protocol ;
297+ break ;
298+ default :
283299 goto out ;
300+ }
284301
285- /* hardware does not support offload of ipv6 inner pkt */
286- if (eth -> h_proto != ntohs (ETH_P_IP ))
302+ switch (eth -> h_proto ) {
303+ case ntohs (ETH_P_IPV6 ):
304+ if (!(enic -> vxlan .flags & ENIC_VXLAN_INNER_IPV6 ))
305+ goto out ;
306+ /* Fall through */
307+ case ntohs (ETH_P_IP ):
308+ break ;
309+ default :
287310 goto out ;
311+ }
288312
289- proto = ip_hdr (skb )-> protocol ;
290313
291314 if (proto == IPPROTO_UDP ) {
292315 udph = udp_hdr (skb );
@@ -2914,9 +2937,11 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
29142937 netdev -> hw_features |= NETIF_F_RXCSUM ;
29152938 if (ENIC_SETTING (enic , VXLAN )) {
29162939 u64 patch_level ;
2940+ u64 a1 = 0 ;
29172941
29182942 netdev -> hw_enc_features |= NETIF_F_RXCSUM |
29192943 NETIF_F_TSO |
2944+ NETIF_F_TSO6 |
29202945 NETIF_F_TSO_ECN |
29212946 NETIF_F_GSO_UDP_TUNNEL |
29222947 NETIF_F_HW_CSUM |
@@ -2935,9 +2960,10 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
29352960 */
29362961 err = vnic_dev_get_supported_feature_ver (enic -> vdev ,
29372962 VIC_FEATURE_VXLAN ,
2938- & patch_level );
2963+ & patch_level , & a1 );
29392964 if (err )
29402965 patch_level = 0 ;
2966+ enic -> vxlan .flags = (u8 )a1 ;
29412967 /* mask bits that are supported by driver
29422968 */
29432969 patch_level &= BIT_ULL (0 ) | BIT_ULL (2 );
0 commit comments