Merge branch 'udp_tunnel_nic-post-conversion-cleanup'

udp_tunnel_nic: post conversion cleanup

It has been two releases since we added the common infra for UDP
tunnel port offload, and we have not heard of any major issues.
Remove the old direct driver NDOs completely, and perform minor
simplifications in the tunnel drivers.

Link: https://lore.kernel.org/r/20210106210637.1839662-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2021-01-07 12:53:32 -08:00
Родитель ddb4d32ed6 b9ef3fecd1
Коммит 0b86235d8f
26 изменённых файлов: 22 добавлений и 106 удалений

Просмотреть файл

@ -2295,8 +2295,6 @@ static const struct net_device_ops xgbe_netdev_ops = {
.ndo_setup_tc = xgbe_setup_tc, .ndo_setup_tc = xgbe_setup_tc,
.ndo_fix_features = xgbe_fix_features, .ndo_fix_features = xgbe_fix_features,
.ndo_set_features = xgbe_set_features, .ndo_set_features = xgbe_set_features,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = xgbe_features_check, .ndo_features_check = xgbe_features_check,
}; };

Просмотреть файл

@ -13071,8 +13071,6 @@ static const struct net_device_ops bnx2x_netdev_ops = {
.ndo_get_phys_port_id = bnx2x_get_phys_port_id, .ndo_get_phys_port_id = bnx2x_get_phys_port_id,
.ndo_set_vf_link_state = bnx2x_set_vf_link_state, .ndo_set_vf_link_state = bnx2x_set_vf_link_state,
.ndo_features_check = bnx2x_features_check, .ndo_features_check = bnx2x_features_check,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
}; };
static int bnx2x_set_coherency_mask(struct bnx2x *bp) static int bnx2x_set_coherency_mask(struct bnx2x *bp)

Просмотреть файл

@ -12091,8 +12091,6 @@ static const struct net_device_ops bnxt_netdev_ops = {
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = bnxt_rx_flow_steer, .ndo_rx_flow_steer = bnxt_rx_flow_steer,
#endif #endif
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_bpf = bnxt_xdp, .ndo_bpf = bnxt_xdp,
.ndo_xdp_xmit = bnxt_xdp_xmit, .ndo_xdp_xmit = bnxt_xdp_xmit,
.ndo_bridge_getlink = bnxt_bridge_getlink, .ndo_bridge_getlink = bnxt_bridge_getlink,

Просмотреть файл

@ -3219,8 +3219,6 @@ static const struct net_device_ops lionetdevops = {
.ndo_do_ioctl = liquidio_ioctl, .ndo_do_ioctl = liquidio_ioctl,
.ndo_fix_features = liquidio_fix_features, .ndo_fix_features = liquidio_fix_features,
.ndo_set_features = liquidio_set_features, .ndo_set_features = liquidio_set_features,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_set_vf_mac = liquidio_set_vf_mac, .ndo_set_vf_mac = liquidio_set_vf_mac,
.ndo_set_vf_vlan = liquidio_set_vf_vlan, .ndo_set_vf_vlan = liquidio_set_vf_vlan,
.ndo_get_vf_config = liquidio_get_vf_config, .ndo_get_vf_config = liquidio_get_vf_config,

Просмотреть файл

@ -1879,8 +1879,6 @@ static const struct net_device_ops lionetdevops = {
.ndo_do_ioctl = liquidio_ioctl, .ndo_do_ioctl = liquidio_ioctl,
.ndo_fix_features = liquidio_fix_features, .ndo_fix_features = liquidio_fix_features,
.ndo_set_features = liquidio_set_features, .ndo_set_features = liquidio_set_features,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
}; };
static int lio_nic_info(struct octeon_recv_info *recv_info, void *buf) static int lio_nic_info(struct octeon_recv_info *recv_info, void *buf)

Просмотреть файл

@ -3882,8 +3882,6 @@ static const struct net_device_ops cxgb4_netdev_ops = {
#endif /* CONFIG_CHELSIO_T4_FCOE */ #endif /* CONFIG_CHELSIO_T4_FCOE */
.ndo_set_tx_maxrate = cxgb_set_tx_maxrate, .ndo_set_tx_maxrate = cxgb_set_tx_maxrate,
.ndo_setup_tc = cxgb_setup_tc, .ndo_setup_tc = cxgb_setup_tc,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = cxgb_features_check, .ndo_features_check = cxgb_features_check,
.ndo_fix_features = cxgb_fix_features, .ndo_fix_features = cxgb_fix_features,
}; };

Просмотреть файл

@ -2509,8 +2509,6 @@ static const struct net_device_ops enic_netdev_dynamic_ops = {
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer, .ndo_rx_flow_steer = enic_rx_flow_steer,
#endif #endif
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = enic_features_check, .ndo_features_check = enic_features_check,
}; };
@ -2535,8 +2533,6 @@ static const struct net_device_ops enic_netdev_ops = {
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer, .ndo_rx_flow_steer = enic_rx_flow_steer,
#endif #endif
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = enic_features_check, .ndo_features_check = enic_features_check,
}; };

Просмотреть файл

@ -5179,8 +5179,6 @@ static const struct net_device_ops be_netdev_ops = {
#endif #endif
.ndo_bridge_setlink = be_ndo_bridge_setlink, .ndo_bridge_setlink = be_ndo_bridge_setlink,
.ndo_bridge_getlink = be_ndo_bridge_getlink, .ndo_bridge_getlink = be_ndo_bridge_getlink,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = be_features_check, .ndo_features_check = be_features_check,
.ndo_get_phys_port_id = be_get_phys_port_id, .ndo_get_phys_port_id = be_get_phys_port_id,
}; };

Просмотреть файл

@ -1531,8 +1531,6 @@ static const struct net_device_ops fm10k_netdev_ops = {
.ndo_set_vf_rate = fm10k_ndo_set_vf_bw, .ndo_set_vf_rate = fm10k_ndo_set_vf_bw,
.ndo_get_vf_config = fm10k_ndo_get_vf_config, .ndo_get_vf_config = fm10k_ndo_get_vf_config,
.ndo_get_vf_stats = fm10k_ndo_get_vf_stats, .ndo_get_vf_stats = fm10k_ndo_get_vf_stats,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_dfwd_add_station = fm10k_dfwd_add_station, .ndo_dfwd_add_station = fm10k_dfwd_add_station,
.ndo_dfwd_del_station = fm10k_dfwd_del_station, .ndo_dfwd_del_station = fm10k_dfwd_del_station,
.ndo_features_check = fm10k_features_check, .ndo_features_check = fm10k_features_check,

Просмотреть файл

@ -12804,8 +12804,6 @@ static const struct net_device_ops i40e_netdev_ops = {
.ndo_set_vf_link_state = i40e_ndo_set_vf_link_state, .ndo_set_vf_link_state = i40e_ndo_set_vf_link_state,
.ndo_set_vf_spoofchk = i40e_ndo_set_vf_spoofchk, .ndo_set_vf_spoofchk = i40e_ndo_set_vf_spoofchk,
.ndo_set_vf_trust = i40e_ndo_set_vf_trust, .ndo_set_vf_trust = i40e_ndo_set_vf_trust,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_get_phys_port_id = i40e_get_phys_port_id, .ndo_get_phys_port_id = i40e_get_phys_port_id,
.ndo_fdb_add = i40e_ndo_fdb_add, .ndo_fdb_add = i40e_ndo_fdb_add,
.ndo_features_check = i40e_features_check, .ndo_features_check = i40e_features_check,

Просмотреть файл

@ -6790,6 +6790,4 @@ static const struct net_device_ops ice_netdev_ops = {
.ndo_bpf = ice_xdp, .ndo_bpf = ice_xdp,
.ndo_xdp_xmit = ice_xdp_xmit, .ndo_xdp_xmit = ice_xdp_xmit,
.ndo_xsk_wakeup = ice_xsk_wakeup, .ndo_xsk_wakeup = ice_xsk_wakeup,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
}; };

Просмотреть файл

@ -10278,8 +10278,6 @@ static const struct net_device_ops ixgbe_netdev_ops = {
.ndo_bridge_getlink = ixgbe_ndo_bridge_getlink, .ndo_bridge_getlink = ixgbe_ndo_bridge_getlink,
.ndo_dfwd_add_station = ixgbe_fwd_add, .ndo_dfwd_add_station = ixgbe_fwd_add,
.ndo_dfwd_del_station = ixgbe_fwd_del, .ndo_dfwd_del_station = ixgbe_fwd_del,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = ixgbe_features_check, .ndo_features_check = ixgbe_features_check,
.ndo_bpf = ixgbe_xdp, .ndo_bpf = ixgbe_xdp,
.ndo_xdp_xmit = ixgbe_xdp_xmit, .ndo_xdp_xmit = ixgbe_xdp_xmit,

Просмотреть файл

@ -2839,8 +2839,6 @@ static const struct net_device_ops mlx4_netdev_ops = {
.ndo_rx_flow_steer = mlx4_en_filter_rfs, .ndo_rx_flow_steer = mlx4_en_filter_rfs,
#endif #endif
.ndo_get_phys_port_id = mlx4_en_get_phys_port_id, .ndo_get_phys_port_id = mlx4_en_get_phys_port_id,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = mlx4_en_features_check, .ndo_features_check = mlx4_en_features_check,
.ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate, .ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate,
.ndo_bpf = mlx4_xdp, .ndo_bpf = mlx4_xdp,
@ -2873,8 +2871,6 @@ static const struct net_device_ops mlx4_netdev_ops_master = {
.ndo_rx_flow_steer = mlx4_en_filter_rfs, .ndo_rx_flow_steer = mlx4_en_filter_rfs,
#endif #endif
.ndo_get_phys_port_id = mlx4_en_get_phys_port_id, .ndo_get_phys_port_id = mlx4_en_get_phys_port_id,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = mlx4_en_features_check, .ndo_features_check = mlx4_en_features_check,
.ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate, .ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate,
.ndo_bpf = mlx4_xdp, .ndo_bpf = mlx4_xdp,

Просмотреть файл

@ -4621,8 +4621,6 @@ const struct net_device_ops mlx5e_netdev_ops = {
.ndo_change_mtu = mlx5e_change_nic_mtu, .ndo_change_mtu = mlx5e_change_nic_mtu,
.ndo_do_ioctl = mlx5e_ioctl, .ndo_do_ioctl = mlx5e_ioctl,
.ndo_set_tx_maxrate = mlx5e_set_tx_maxrate, .ndo_set_tx_maxrate = mlx5e_set_tx_maxrate,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = mlx5e_features_check, .ndo_features_check = mlx5e_features_check,
.ndo_tx_timeout = mlx5e_tx_timeout, .ndo_tx_timeout = mlx5e_tx_timeout,
.ndo_bpf = mlx5e_xdp, .ndo_bpf = mlx5e_xdp,

Просмотреть файл

@ -653,8 +653,6 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats, .ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats, .ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
.ndo_change_mtu = mlx5e_uplink_rep_change_mtu, .ndo_change_mtu = mlx5e_uplink_rep_change_mtu,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = mlx5e_features_check, .ndo_features_check = mlx5e_features_check,
.ndo_set_vf_mac = mlx5e_set_vf_mac, .ndo_set_vf_mac = mlx5e_set_vf_mac,
.ndo_set_vf_rate = mlx5e_set_vf_rate, .ndo_set_vf_rate = mlx5e_set_vf_rate,

Просмотреть файл

@ -3656,8 +3656,6 @@ const struct net_device_ops nfp_net_netdev_ops = {
.ndo_set_features = nfp_net_set_features, .ndo_set_features = nfp_net_set_features,
.ndo_features_check = nfp_net_features_check, .ndo_features_check = nfp_net_features_check,
.ndo_get_phys_port_name = nfp_net_get_phys_port_name, .ndo_get_phys_port_name = nfp_net_get_phys_port_name,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_bpf = nfp_net_xdp, .ndo_bpf = nfp_net_xdp,
.ndo_get_devlink_port = nfp_devlink_get_devlink_port, .ndo_get_devlink_port = nfp_devlink_get_devlink_port,
}; };

Просмотреть файл

@ -663,8 +663,6 @@ static const struct net_device_ops qede_netdev_ops = {
.ndo_get_vf_config = qede_get_vf_config, .ndo_get_vf_config = qede_get_vf_config,
.ndo_set_vf_rate = qede_set_vf_rate, .ndo_set_vf_rate = qede_set_vf_rate,
#endif #endif
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = qede_features_check, .ndo_features_check = qede_features_check,
.ndo_bpf = qede_xdp, .ndo_bpf = qede_xdp,
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
@ -688,8 +686,6 @@ static const struct net_device_ops qede_netdev_vf_ops = {
.ndo_fix_features = qede_fix_features, .ndo_fix_features = qede_fix_features,
.ndo_set_features = qede_set_features, .ndo_set_features = qede_set_features,
.ndo_get_stats64 = qede_get_stats64, .ndo_get_stats64 = qede_get_stats64,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = qede_features_check, .ndo_features_check = qede_features_check,
}; };
@ -707,8 +703,6 @@ static const struct net_device_ops qede_netdev_vf_xdp_ops = {
.ndo_fix_features = qede_fix_features, .ndo_fix_features = qede_fix_features,
.ndo_set_features = qede_set_features, .ndo_set_features = qede_set_features,
.ndo_get_stats64 = qede_get_stats64, .ndo_get_stats64 = qede_get_stats64,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = qede_features_check, .ndo_features_check = qede_features_check,
.ndo_bpf = qede_xdp, .ndo_bpf = qede_xdp,
.ndo_xdp_xmit = qede_xdp_transmit, .ndo_xdp_xmit = qede_xdp_transmit,

Просмотреть файл

@ -520,8 +520,6 @@ static const struct net_device_ops qlcnic_netdev_ops = {
.ndo_fdb_del = qlcnic_fdb_del, .ndo_fdb_del = qlcnic_fdb_del,
.ndo_fdb_dump = qlcnic_fdb_dump, .ndo_fdb_dump = qlcnic_fdb_dump,
.ndo_get_phys_port_id = qlcnic_get_phys_port_id, .ndo_get_phys_port_id = qlcnic_get_phys_port_id,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = qlcnic_features_check, .ndo_features_check = qlcnic_features_check,
#ifdef CONFIG_QLCNIC_SRIOV #ifdef CONFIG_QLCNIC_SRIOV
.ndo_set_vf_mac = qlcnic_sriov_set_vf_mac, .ndo_set_vf_mac = qlcnic_sriov_set_vf_mac,

Просмотреть файл

@ -612,8 +612,6 @@ static const struct net_device_ops efx_netdev_ops = {
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = efx_filter_rfs, .ndo_rx_flow_steer = efx_filter_rfs,
#endif #endif
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_xdp_xmit = efx_xdp_xmit, .ndo_xdp_xmit = efx_xdp_xmit,
.ndo_bpf = efx_xdp .ndo_bpf = efx_xdp
}; };

Просмотреть файл

@ -1851,16 +1851,10 @@ static int geneve_netdevice_event(struct notifier_block *unused,
{ {
struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct net_device *dev = netdev_notifier_info_to_dev(ptr);
if (event == NETDEV_UDP_TUNNEL_PUSH_INFO || if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
event == NETDEV_UDP_TUNNEL_DROP_INFO) { geneve_offload_rx_ports(dev, true);
geneve_offload_rx_ports(dev, event == NETDEV_UDP_TUNNEL_PUSH_INFO); else if (event == NETDEV_UDP_TUNNEL_DROP_INFO)
} else if (event == NETDEV_UNREGISTER) { geneve_offload_rx_ports(dev, false);
if (!dev->udp_tunnel_nic_info)
geneve_offload_rx_ports(dev, false);
} else if (event == NETDEV_REGISTER) {
if (!dev->udp_tunnel_nic_info)
geneve_offload_rx_ports(dev, true);
}
return NOTIFY_DONE; return NOTIFY_DONE;
} }

Просмотреть файл

@ -258,8 +258,6 @@ static const struct net_device_ops nsim_netdev_ops = {
.ndo_setup_tc = nsim_setup_tc, .ndo_setup_tc = nsim_setup_tc,
.ndo_set_features = nsim_set_features, .ndo_set_features = nsim_set_features,
.ndo_bpf = nsim_bpf, .ndo_bpf = nsim_bpf,
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_get_devlink_port = nsim_get_devlink_port, .ndo_get_devlink_port = nsim_get_devlink_port,
}; };

Просмотреть файл

@ -4521,17 +4521,12 @@ static int vxlan_netdevice_event(struct notifier_block *unused,
struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
if (event == NETDEV_UNREGISTER) { if (event == NETDEV_UNREGISTER)
if (!dev->udp_tunnel_nic_info)
vxlan_offload_rx_ports(dev, false);
vxlan_handle_lowerdev_unregister(vn, dev); vxlan_handle_lowerdev_unregister(vn, dev);
} else if (event == NETDEV_REGISTER) { else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
if (!dev->udp_tunnel_nic_info) vxlan_offload_rx_ports(dev, true);
vxlan_offload_rx_ports(dev, true); else if (event == NETDEV_UDP_TUNNEL_DROP_INFO)
} else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO || vxlan_offload_rx_ports(dev, false);
event == NETDEV_UDP_TUNNEL_DROP_INFO) {
vxlan_offload_rx_ports(dev, event == NETDEV_UDP_TUNNEL_PUSH_INFO);
}
return NOTIFY_DONE; return NOTIFY_DONE;
} }

Просмотреть файл

@ -1213,19 +1213,6 @@ struct netdev_net_notifier {
* struct netdev_phys_item_id *ppid) * struct netdev_phys_item_id *ppid)
* Called to get the parent ID of the physical port of this device. * Called to get the parent ID of the physical port of this device.
* *
* void (*ndo_udp_tunnel_add)(struct net_device *dev,
* struct udp_tunnel_info *ti);
* Called by UDP tunnel to notify a driver about the UDP port and socket
* address family that a UDP tunnel is listnening to. It is called only
* when a new port starts listening. The operation is protected by the
* RTNL.
*
* void (*ndo_udp_tunnel_del)(struct net_device *dev,
* struct udp_tunnel_info *ti);
* Called by UDP tunnel to notify the driver about a UDP port and socket
* address family that the UDP tunnel is not listening to anymore. The
* operation is protected by the RTNL.
*
* void* (*ndo_dfwd_add_station)(struct net_device *pdev, * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
* struct net_device *dev) * struct net_device *dev)
* Called by upper layer devices to accelerate switching or other * Called by upper layer devices to accelerate switching or other
@ -1464,10 +1451,6 @@ struct net_device_ops {
struct netdev_phys_item_id *ppid); struct netdev_phys_item_id *ppid);
int (*ndo_get_phys_port_name)(struct net_device *dev, int (*ndo_get_phys_port_name)(struct net_device *dev,
char *name, size_t len); char *name, size_t len);
void (*ndo_udp_tunnel_add)(struct net_device *dev,
struct udp_tunnel_info *ti);
void (*ndo_udp_tunnel_del)(struct net_device *dev,
struct udp_tunnel_info *ti);
void* (*ndo_dfwd_add_station)(struct net_device *pdev, void* (*ndo_dfwd_add_station)(struct net_device *pdev,
struct net_device *dev); struct net_device *dev);
void (*ndo_dfwd_del_station)(struct net_device *pdev, void (*ndo_dfwd_del_station)(struct net_device *pdev,

Просмотреть файл

@ -129,12 +129,16 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type);
static inline void udp_tunnel_get_rx_info(struct net_device *dev) static inline void udp_tunnel_get_rx_info(struct net_device *dev)
{ {
ASSERT_RTNL(); ASSERT_RTNL();
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev); call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev);
} }
static inline void udp_tunnel_drop_rx_info(struct net_device *dev) static inline void udp_tunnel_drop_rx_info(struct net_device *dev)
{ {
ASSERT_RTNL(); ASSERT_RTNL();
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev); call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev);
} }
@ -323,6 +327,8 @@ udp_tunnel_nic_set_port_priv(struct net_device *dev, unsigned int table,
static inline void static inline void
udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti)
{ {
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
if (udp_tunnel_nic_ops) if (udp_tunnel_nic_ops)
udp_tunnel_nic_ops->add_port(dev, ti); udp_tunnel_nic_ops->add_port(dev, ti);
} }
@ -330,6 +336,8 @@ udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti)
static inline void static inline void
udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti) udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti)
{ {
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
if (udp_tunnel_nic_ops) if (udp_tunnel_nic_ops)
udp_tunnel_nic_ops->del_port(dev, ti); udp_tunnel_nic_ops->del_port(dev, ti);
} }

Просмотреть файл

@ -10002,7 +10002,7 @@ int register_netdevice(struct net_device *dev)
dev->hw_features |= (NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF); dev->hw_features |= (NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF);
dev->features |= NETIF_F_SOFT_FEATURES; dev->features |= NETIF_F_SOFT_FEATURES;
if (dev->netdev_ops->ndo_udp_tunnel_add) { if (dev->udp_tunnel_nic_info) {
dev->features |= NETIF_F_RX_UDP_TUNNEL_PORT; dev->features |= NETIF_F_RX_UDP_TUNNEL_PORT;
dev->hw_features |= NETIF_F_RX_UDP_TUNNEL_PORT; dev->hw_features |= NETIF_F_RX_UDP_TUNNEL_PORT;
} }

Просмотреть файл

@ -90,15 +90,11 @@ void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct udp_tunnel_info ti; struct udp_tunnel_info ti;
if (!dev->netdev_ops->ndo_udp_tunnel_add ||
!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
ti.type = type; ti.type = type;
ti.sa_family = sk->sk_family; ti.sa_family = sk->sk_family;
ti.port = inet_sk(sk)->inet_sport; ti.port = inet_sk(sk)->inet_sport;
dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti); udp_tunnel_nic_add_port(dev, &ti);
} }
EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port); EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port);
@ -108,15 +104,11 @@ void udp_tunnel_drop_rx_port(struct net_device *dev, struct socket *sock,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct udp_tunnel_info ti; struct udp_tunnel_info ti;
if (!dev->netdev_ops->ndo_udp_tunnel_del ||
!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
return;
ti.type = type; ti.type = type;
ti.sa_family = sk->sk_family; ti.sa_family = sk->sk_family;
ti.port = inet_sk(sk)->inet_sport; ti.port = inet_sk(sk)->inet_sport;
dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti); udp_tunnel_nic_del_port(dev, &ti);
} }
EXPORT_SYMBOL_GPL(udp_tunnel_drop_rx_port); EXPORT_SYMBOL_GPL(udp_tunnel_drop_rx_port);
@ -134,11 +126,7 @@ void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type)
rcu_read_lock(); rcu_read_lock();
for_each_netdev_rcu(net, dev) { for_each_netdev_rcu(net, dev) {
if (!dev->netdev_ops->ndo_udp_tunnel_add) udp_tunnel_nic_add_port(dev, &ti);
continue;
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
continue;
dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
@ -158,11 +146,7 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type)
rcu_read_lock(); rcu_read_lock();
for_each_netdev_rcu(net, dev) { for_each_netdev_rcu(net, dev) {
if (!dev->netdev_ops->ndo_udp_tunnel_del) udp_tunnel_nic_del_port(dev, &ti);
continue;
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
continue;
dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti);
} }
rcu_read_unlock(); rcu_read_unlock();
} }