8
8
#include <linux/string.h>
9
9
#include <linux/etherdevice.h>
10
10
#include <linux/phylink.h>
11
+ #include <net/udp_tunnel.h>
11
12
#include <net/ip.h>
12
13
#include <linux/if_vlan.h>
13
14
@@ -537,6 +538,39 @@ void txgbe_do_reset(struct net_device *netdev)
537
538
txgbe_reset (wx );
538
539
}
539
540
541
+ static int txgbe_udp_tunnel_sync (struct net_device * dev , unsigned int table )
542
+ {
543
+ struct wx * wx = netdev_priv (dev );
544
+ struct udp_tunnel_info ti ;
545
+
546
+ udp_tunnel_nic_get_port (dev , table , 0 , & ti );
547
+ switch (ti .type ) {
548
+ case UDP_TUNNEL_TYPE_VXLAN :
549
+ wr32 (wx , TXGBE_CFG_VXLAN , ntohs (ti .port ));
550
+ break ;
551
+ case UDP_TUNNEL_TYPE_VXLAN_GPE :
552
+ wr32 (wx , TXGBE_CFG_VXLAN_GPE , ntohs (ti .port ));
553
+ break ;
554
+ case UDP_TUNNEL_TYPE_GENEVE :
555
+ wr32 (wx , TXGBE_CFG_GENEVE , ntohs (ti .port ));
556
+ break ;
557
+ default :
558
+ break ;
559
+ }
560
+
561
+ return 0 ;
562
+ }
563
+
564
+ static const struct udp_tunnel_nic_info txgbe_udp_tunnels = {
565
+ .sync_table = txgbe_udp_tunnel_sync ,
566
+ .flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY ,
567
+ .tables = {
568
+ { .n_entries = 1 , .tunnel_types = UDP_TUNNEL_TYPE_VXLAN , },
569
+ { .n_entries = 1 , .tunnel_types = UDP_TUNNEL_TYPE_VXLAN_GPE , },
570
+ { .n_entries = 1 , .tunnel_types = UDP_TUNNEL_TYPE_GENEVE , },
571
+ },
572
+ };
573
+
540
574
static const struct net_device_ops txgbe_netdev_ops = {
541
575
.ndo_open = txgbe_open ,
542
576
.ndo_stop = txgbe_close ,
@@ -545,6 +579,7 @@ static const struct net_device_ops txgbe_netdev_ops = {
545
579
.ndo_set_rx_mode = wx_set_rx_mode ,
546
580
.ndo_set_features = wx_set_features ,
547
581
.ndo_fix_features = wx_fix_features ,
582
+ .ndo_features_check = wx_features_check ,
548
583
.ndo_validate_addr = eth_validate_addr ,
549
584
.ndo_set_mac_address = wx_set_mac ,
550
585
.ndo_get_stats64 = wx_get_stats64 ,
@@ -632,6 +667,7 @@ static int txgbe_probe(struct pci_dev *pdev,
632
667
wx -> driver_name = txgbe_driver_name ;
633
668
txgbe_set_ethtool_ops (netdev );
634
669
netdev -> netdev_ops = & txgbe_netdev_ops ;
670
+ netdev -> udp_tunnel_nic_info = & txgbe_udp_tunnels ;
635
671
636
672
/* setup the private structure */
637
673
err = txgbe_sw_init (wx );
@@ -677,6 +713,7 @@ static int txgbe_probe(struct pci_dev *pdev,
677
713
netdev -> features |= NETIF_F_HIGHDMA ;
678
714
netdev -> hw_features |= NETIF_F_GRO ;
679
715
netdev -> features |= NETIF_F_GRO ;
716
+ netdev -> features |= NETIF_F_RX_UDP_TUNNEL_PORT ;
680
717
681
718
netdev -> priv_flags |= IFF_UNICAST_FLT ;
682
719
netdev -> priv_flags |= IFF_SUPP_NOFCS ;
0 commit comments