From: Alexander Duyck <hidden> Date: 2016-06-13 17:47:50
This patch is meant to address two things. First we are currently using
the ndo_add/del_vxlan_port calls with VXLAN-GPE tunnels and we cannot
really support that as it is likely to cause more harm than good since
VXLAN-GPE can support tunnels without a MAC address on the inner header.
As such we need to add a new offload to advertise this, but in doing so it
would mean introducing 3 new functions for the driver to request the ports,
and then for the tunnel to push the changes to add and delete the ports to
the device. However instead of taking that approach I think it would be
much better if we just made one common function for fetching the ports, and
provided a generic means to push the tunnels to the device. So in order to
make this work this patch set does several things.
First it merges the existing VXLAN and GENEVE functionality into one set of
functions and passes an enum in order to specify the type of tunnel we want
to offload. By doing this we only have to extend this enum in the future
if we want to add additional types.
Second it goes through the drivers replacing all of the tunnel specific
offload calls with implementations that support the generic calls so that
we can drop the VXLAN and GENEVE specific calls entirely.
Finally I go through in the last patch and replace the VXLAN specific
offload request that was being used for VXLAN-GPE with one that specifies
if we want to offload VXLAN or VXLAN-GPE so that the hardware can decide if
it can actually support it or not.
I also ended up with some minor clean-up built into the driver patches for
this. Most of it is to either fix misuse of build flags, specifying a type
to ignore instead of the type that should be used, or in the case of ixgbe
I actually moved a rtnl_lock/unlock in order to avoid taking it unless it
was actually needed.
---
Alexander Duyck (15):
net: Combine GENEVE and VXLAN port offload notifiers into single functions
net: Merge VXLAN and GENEVE push notifiers into a single notifier
bnx2x: Move all UDP port notifiers to single function
bnxt: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
benet: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
fm10k: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
i40e: Move all UDP port notifiers to single function
ixgbe: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
mlx4_en: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
mlx5_en: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
nfp: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
qede: Move all UDP port notifiers to single function
qlcnic: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port
net: Remove deprecated tunnel specific UDP offload functions
vxlan: Add new UDP encapsulation offload type for VXLAN-GPE
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 96 ++++++-------
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 ++-
drivers/net/ethernet/emulex/benet/be_main.c | 16 +-
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 18 ++
drivers/net/ethernet/intel/i40e/i40e_main.c | 148 +++++---------------
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 36 +++--
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 30 +++-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 18 ++
.../net/ethernet/netronome/nfp/nfp_net_common.c | 18 ++
drivers/net/ethernet/qlogic/qede/qede_main.c | 113 ++++++++-------
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 18 ++
drivers/net/geneve.c | 50 +------
drivers/net/vxlan.c | 56 ++------
include/linux/netdevice.h | 19 +--
include/net/geneve.h | 9 -
include/net/udp_tunnel.h | 19 +++
include/net/vxlan.h | 7 -
net/ipv4/udp_tunnel.c | 52 +++++++
18 files changed, 357 insertions(+), 388 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:03
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -76,6 +76,83 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,}EXPORT_SYMBOL_GPL(setup_udp_tunnel_sock);+voidudp_tunnel_push_rx_port(structnet_device*dev,structsocket*sock,+unsignedinttype)+{+structsock*sk=sock->sk;+sa_family_tsa_family=sk->sk_family;+__be16port=inet_sk(sk)->inet_sport;++switch(type){+caseUDP_ENC_OFFLOAD_TYPE_VXLAN:+if(!dev->netdev_ops->ndo_add_vxlan_port)+break;++dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,port);+break;+caseUDP_ENC_OFFLOAD_TYPE_GENEVE:+if(!dev->netdev_ops->ndo_add_geneve_port)+break;++dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);+break;+default:+break;+}+}+EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port);++/* Notify netdevs that UDP port started listening */+voidudp_tunnel_notify_add_rx_port(structsocket*sock,unsignedinttype)+{+structnet*net=sock_net(sock->sk);+structnet_device*dev;++rcu_read_lock();+for_each_netdev_rcu(net,dev)+udp_tunnel_push_rx_port(dev,sock,type);+rcu_read_unlock();+}+EXPORT_SYMBOL_GPL(udp_tunnel_notify_add_rx_port);++staticvoidudp_tunnel_pull_rx_port(structnet_device*dev,+structsocket*sock,unsignedinttype)+{+structsock*sk=sock->sk;+sa_family_tsa_family=sk->sk_family;+__be16port=inet_sk(sk)->inet_sport;++switch(type){+caseUDP_ENC_OFFLOAD_TYPE_VXLAN:+if(!dev->netdev_ops->ndo_del_vxlan_port)+break;++dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,port);+break;+caseUDP_ENC_OFFLOAD_TYPE_GENEVE:+if(!dev->netdev_ops->ndo_del_geneve_port)+break;++dev->netdev_ops->ndo_del_geneve_port(dev,sa_family,port);+break;+default:+break;+}+}++/* Notify netdevs that UDP port is no more listening */+voidudp_tunnel_notify_del_rx_port(structsocket*sock,unsignedinttype)+{+structnet_device*dev;+structnet*net=sock_net(sock->sk);++rcu_read_lock();+for_each_netdev_rcu(net,dev)+udp_tunnel_pull_rx_port(dev,sock,type);+rcu_read_unlock();+}+EXPORT_SYMBOL_GPL(udp_tunnel_notify_del_rx_port);+voidudp_tunnel_xmit_skb(structrtable*rt,structsock*sk,structsk_buff*skb,__be32src,__be32dst,__u8tos,__u8ttl,__be16df,__be16src_port,__be16dst_port,
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:11
This patch merges the notifiers for VXLAN and GENEVE into a single UDP
encapsulation notifier. The idea is that we will want to only have to make
one notifier call to receive the list of ports for VXLAN and GENEVE tunnels
that need to be offloaded.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 2 +-
drivers/net/vxlan.c | 2 +-
include/linux/netdevice.h | 11 +++++++++--
include/net/geneve.h | 6 +-----
include/net/udp_tunnel.h | 6 ++++++
include/net/vxlan.h | 4 ++--
net/ipv4/udp_tunnel.c | 12 ++++++++++++
7 files changed, 32 insertions(+), 11 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:18
This patch goes through and combines the notifiers for VXLAN and GENEVE
into a single function for each action. So there is now one combined
function for getting ports, one for adding the ports, and one for deleting
the ports.
While going through and updating this I also removed the use of IS_ENABLED
for the CONFIG_BNX2X_GENEVE checks and instead just checked for defined
since there is no option to have this as a module.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 96 ++++++++++------------
1 file changed, 44 insertions(+), 52 deletions(-)
@@ -10335,17 +10342,12 @@ sp_rtnl_not_reset:BNX2X_UDP_PORT_MAX);}else{/* Since we don't store additional port information,-*ifnoportisconfiguredforanyfeatureaskfor+*ifnoportsareconfiguredforanyfeatureaskfor*informationaboutcurrentlyconfiguredports.*/-#ifdef CONFIG_BNX2X_VXLAN-if(!bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count)-vxlan_get_rx_port(bp->dev);-#endif-#if IS_ENABLED(CONFIG_BNX2X_GENEVE)-if(!bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count)-geneve_get_rx_port(bp->dev);-#endif+if(!bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count&&+!bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count)+udp_tunnel_get_rx_port(bp->dev);}}#endif
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:26
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:36
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/emulex/benet/be_main.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:45
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:48:55
This patch goes through and combines the notifiers for VXLAN and GENEVE
into a single function for each action. So there is now one combined
function for getting ports, one for adding the ports, and one for deleting
the ports.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 148 ++++++---------------------
1 file changed, 35 insertions(+), 113 deletions(-)
@@ -8700,7 +8694,7 @@ static void i40e_add_vxlan_port(struct net_device *netdev,/* Check if port already exists */if(idx<I40E_MAX_PF_UDP_OFFLOAD_PORTS){-netdev_info(netdev,"vxlan port %d already offloaded\n",+netdev_info(netdev,"port %d already offloaded\n",ntohs(port));return;}
@@ -8709,112 +8703,46 @@ static void i40e_add_vxlan_port(struct net_device *netdev,next_idx=i40e_get_udp_port_idx(pf,0);if(next_idx==I40E_MAX_PF_UDP_OFFLOAD_PORTS){-netdev_info(netdev,"maximum number of vxlan UDP ports reached, not adding port %d\n",-ntohs(port));-return;-}--/* New port: add it and mark its index in the bitmap */-pf->udp_ports[next_idx].index=port;-pf->udp_ports[next_idx].type=I40E_AQC_TUNNEL_TYPE_VXLAN;-pf->pending_udp_bitmap|=BIT_ULL(next_idx);-pf->flags|=I40E_FLAG_UDP_FILTER_SYNC;-}--/**-*i40e_del_vxlan_port-GetnotificationsaboutVXLANportsthatgoaway-*@netdev:Thisphysicalport'snetdev-*@sa_family:SocketFamilythatVXLANisnotifyingusabout-*@port:UDPportnumberthatVXLANstoppedlisteningto-**/-staticvoidi40e_del_vxlan_port(structnet_device*netdev,-sa_family_tsa_family,__be16port)-{-structi40e_netdev_priv*np=netdev_priv(netdev);-structi40e_vsi*vsi=np->vsi;-structi40e_pf*pf=vsi->back;-u8idx;--idx=i40e_get_udp_port_idx(pf,port);--/* Check if port already exists */-if(idx<I40E_MAX_PF_UDP_OFFLOAD_PORTS){-/* if port exists, set it to 0 (mark for deletion)-*andmakeitpending-*/-pf->udp_ports[idx].index=0;-pf->pending_udp_bitmap|=BIT_ULL(idx);-pf->flags|=I40E_FLAG_UDP_FILTER_SYNC;-}else{-netdev_warn(netdev,"vxlan port %d was not found, not deleting\n",-ntohs(port));-}-}-#endif--#if IS_ENABLED(CONFIG_GENEVE)-/**-*i40e_add_geneve_port-GetnotificationsaboutGENEVEportsthatcomeup-*@netdev:Thisphysicalport'snetdev-*@sa_family:SocketFamilythatGENEVEisnotifyingusabout-*@port:NewUDPportnumberthatGENEVEstartedlisteningto-**/-staticvoidi40e_add_geneve_port(structnet_device*netdev,-sa_family_tsa_family,__be16port)-{-structi40e_netdev_priv*np=netdev_priv(netdev);-structi40e_vsi*vsi=np->vsi;-structi40e_pf*pf=vsi->back;-u8next_idx;-u8idx;--if(!(pf->flags&I40E_FLAG_GENEVE_OFFLOAD_CAPABLE))-return;--idx=i40e_get_udp_port_idx(pf,port);--/* Check if port already exists */-if(idx<I40E_MAX_PF_UDP_OFFLOAD_PORTS){-netdev_info(netdev,"udp port %d already offloaded\n",+netdev_info(netdev,"maximum number of offloaded UDP ports reached, not adding port %d\n",ntohs(port));return;}-/* Now check if there is space to add the new port */-next_idx=i40e_get_udp_port_idx(pf,0);--if(next_idx==I40E_MAX_PF_UDP_OFFLOAD_PORTS){-netdev_info(netdev,"maximum number of UDP ports reached, not adding port %d\n",-ntohs(port));+switch(type){+caseUDP_ENC_OFFLOAD_TYPE_VXLAN:+pf->udp_ports[next_idx].type=I40E_AQC_TUNNEL_TYPE_VXLAN;+break;+caseUDP_ENC_OFFLOAD_TYPE_GENEVE:+if(!(pf->flags&I40E_FLAG_GENEVE_OFFLOAD_CAPABLE))+return;+pf->udp_ports[next_idx].type=I40E_AQC_TUNNEL_TYPE_NGE;+break;+default:return;}/* New port: add it and mark its index in the bitmap */pf->udp_ports[next_idx].index=port;-pf->udp_ports[next_idx].type=I40E_AQC_TUNNEL_TYPE_NGE;pf->pending_udp_bitmap|=BIT_ULL(next_idx);pf->flags|=I40E_FLAG_UDP_FILTER_SYNC;--dev_info(&pf->pdev->dev,"adding geneve port %d\n",ntohs(port));}/**-*i40e_del_geneve_port-GetnotificationsaboutGENEVEportsthatgoaway+*i40e_del_udp_enc_port-GetnotificationsaboutUDPtunnelportsthatgoaway*@netdev:Thisphysicalport'snetdev-*@sa_family:SocketFamilythatGENEVEisnotifyingusabout-*@port:UDPportnumberthatGENEVEstoppedlisteningto+*@sa_family:SocketFamilythattunnelisnotifyingusabout+*@port:UDPportnumberthattunnelstoppedlisteningto+*@type:EnumeratedtypespecifyingUDPencapsulationtypetobeoffloaded**/-staticvoidi40e_del_geneve_port(structnet_device*netdev,-sa_family_tsa_family,__be16port)+staticvoidi40e_del_udp_enc_port(structnet_device*netdev,+sa_family_tsa_family,__be16port,+unsignedinttype){structi40e_netdev_priv*np=netdev_priv(netdev);structi40e_vsi*vsi=np->vsi;structi40e_pf*pf=vsi->back;u8idx;-if(!(pf->flags&I40E_FLAG_GENEVE_OFFLOAD_CAPABLE))-return;-idx=i40e_get_udp_port_idx(pf,port);/* Check if port already exists */
@@ -8825,13 +8753,11 @@ static void i40e_del_geneve_port(struct net_device *netdev,pf->udp_ports[idx].index=0;pf->pending_udp_bitmap|=BIT_ULL(idx);pf->flags|=I40E_FLAG_UDP_FILTER_SYNC;--dev_info(&pf->pdev->dev,"deleting geneve port %d\n",-ntohs(port));-}else{-netdev_warn(netdev,"geneve port %d was not found, not deleting\n",-ntohs(port));+return;}++netdev_warn(netdev,"UDP port %d was not found, not deleting\n",+ntohs(port));}#endif
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:08
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type is VXLAN we can maintain the same
functionality.
In addition I updated the socket address family check so that instead of
excluding IPv6 we instead abort of type is not IPv4. This makes much more
sense as we should only be supporting IPv4 outer addresses on this
hardware.
The last change is that I pulled the rtnl_lock/unlock into the conditional
statement for IXGBE_FLAG2_VXLAN_REREG_NEEDED. The motivation behind this
is to avoid unneeded bouncing of the mutex which will just slow down the
handling of this call anyway.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 36 ++++++++++++++-----------
1 file changed, 20 insertions(+), 16 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:14
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type is VXLAN we can maintain the same
functionality.
In addition I updated the socket address family check so that instead of
excluding IPv6 we instead abort of type is not IPv4. This makes much more
sense as we should only be supporting IPv4 outer addresses on this
hardware.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 30 +++++++++++++++---------
1 file changed, 19 insertions(+), 11 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:24
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type is VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:38
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type is VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
.../net/ethernet/netronome/nfp/nfp_net_common.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:45
This patch goes through and combines the notifiers for VXLAN and GENEVE
into a single function for each action. So there is now one combined
function for getting ports, one for adding the ports, and one for deleting
the ports.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/qlogic/qede/qede_main.c | 113 ++++++++++++++------------
1 file changed, 59 insertions(+), 54 deletions(-)
From: Alexander Duyck <hidden> Date: 2016-06-13 17:49:53
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type is VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
@@ -476,11 +476,15 @@ static int qlcnic_get_phys_port_id(struct net_device *netdev,#ifdef CONFIG_QLCNIC_VXLANstaticvoidqlcnic_add_vxlan_port(structnet_device*netdev,-sa_family_tsa_family,__be16port)+sa_family_tsa_family,__be16port,+unsignedinttype){structqlcnic_adapter*adapter=netdev_priv(netdev);structqlcnic_hardware_context*ahw=adapter->ahw;+if(type!=UDP_ENC_OFFLOAD_TYPE_VXLAN)+return;+/* Adapter supports only one VXLAN port. Use very first port*forenablingoffload*/
From: Alexander Duyck <hidden> Date: 2016-06-13 17:50:04
Now that we have all the drivers using udp_tunnel_get_rx_ports,
ndo_add_udp_enc_rx_port, and ndo_del_udp_enc_rx_port we can drop the
function calls that were specific to VXLAN and GENEVE.
Signed-off-by: Alexander Duyck <redacted>
---
include/linux/netdevice.h | 12 ------------
include/net/geneve.h | 5 -----
include/net/vxlan.h | 5 -----
net/ipv4/udp_tunnel.c | 41 ++---------------------------------------
4 files changed, 2 insertions(+), 61 deletions(-)
@@ -128,28 +110,9 @@ static void udp_tunnel_pull_rx_port(struct net_device *dev,sa_family_tsa_family=sk->sk_family;__be16port=inet_sk(sk)->inet_sport;-if(dev->netdev_ops->ndo_del_udp_enc_port){+if(dev->netdev_ops->ndo_del_udp_enc_port)dev->netdev_ops->ndo_del_udp_enc_port(dev,sa_family,port,type);-return;-}--switch(type){-caseUDP_ENC_OFFLOAD_TYPE_VXLAN:-if(!dev->netdev_ops->ndo_del_vxlan_port)-break;--dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,port);-break;-caseUDP_ENC_OFFLOAD_TYPE_GENEVE:-if(!dev->netdev_ops->ndo_del_geneve_port)-break;--dev->netdev_ops->ndo_del_geneve_port(dev,sa_family,port);-break;-default:-break;-}}/* Notify netdevs that UDP port is no more listening */
From: Alexander Duyck <hidden> Date: 2016-06-13 17:50:15
The fact is VXLAN with Generic Protocol Extensions cannot be supported by
the same hardware parsers as that support VXLAN. The protocol extensions
allow for things like a Next Protocol field which in turn allows for things
other than Ethernet to be passed over the tunnel. Most existing parsers
will not know how to interpret this.
To resolve this I am giving VXLAN-GPE its own UDP encapsulation offload
type. This way hardware that does support GPE can simply add this type to
the switch statement for VXLAN, and if they don't support it then this will
fix any issues where headers might be interpreted incorrectly.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/vxlan.c | 12 ++++++++++--
include/net/udp_tunnel.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
@@ -622,13 +622,19 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);+udp_tunnel_notify_add_rx_port(vs->sock,+(vs->flags&VXLAN_F_GPE)?+UDP_ENC_OFFLOAD_TYPE_VXLAN_GPE:+UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);+udp_tunnel_notify_del_rx_port(vs->sock,+(vs->flags&VXLAN_F_GPE)?+UDP_ENC_OFFLOAD_TYPE_VXLAN_GPE:+UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
What do you think about adding a struct as argument to
ndo_*_udp_enc_port? As a result we can much easier add new fields in
case future NICs allow us to e.g. specify a bound ip address?
Thanks,
Hannes
On Mon, Jun 13, 2016 at 10:48 AM, Alexander Duyck [off-list ref] wrote:
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
It looks like bnxt actually has a hardcoded offload of the Geneve port
rather than using the registration (maybe it predated it?). It would
be nice to incorporate that into your unified handler as well.
I think you could actually just kill all of these
CONFIG_VXLAN/CONFIG_GENEVE checks (across all the drivers, not just
this one). They shouldn't be necessary any more now that there's no
longer strong linkage to the tunnel drivers.
From: kbuild test robot <hidden> Date: 2016-06-13 18:48:33
Hi,
[auto build test ERROR on net/master]
[also build test ERROR on v4.7-rc3 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexander-Duyck/Future-proof-tunnel-offload-handlers/20160614-020534
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
quoted
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:13046:26: error: 'bnx2x_add_udp_enc_port' undeclared here (not in a function)
From: Hannes Frederic Sowa <hidden> Date: 2016-06-13 19:14:55
On 13.06.2016 20:41, Jesse Gross wrote:
On Mon, Jun 13, 2016 at 10:48 AM, Alexander Duyck [off-list ref] wrote:
quoted
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
It looks like bnxt actually has a hardcoded offload of the Geneve port
rather than using the registration (maybe it predated it?). It would
be nice to incorporate that into your unified handler as well.
I think you could actually just kill all of these
CONFIG_VXLAN/CONFIG_GENEVE checks (across all the drivers, not just
this one). They shouldn't be necessary any more now that there's no
longer strong linkage to the tunnel drivers.
Yes, agreed. We can remove the CONFIG_VXLAN and CONFIG_GENEVE stuff now.
But I think this can be a separate series.
Bye,
Hannes
From: Alex Duyck <hidden> Date: 2016-06-13 19:16:40
On Mon, Jun 13, 2016 at 12:14 PM, Hannes Frederic Sowa
[off-list ref] wrote:
On 13.06.2016 20:41, Jesse Gross wrote:
quoted
On Mon, Jun 13, 2016 at 10:48 AM, Alexander Duyck [off-list ref] wrote:
quoted
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
It looks like bnxt actually has a hardcoded offload of the Geneve port
rather than using the registration (maybe it predated it?). It would
be nice to incorporate that into your unified handler as well.
I think you could actually just kill all of these
CONFIG_VXLAN/CONFIG_GENEVE checks (across all the drivers, not just
this one). They shouldn't be necessary any more now that there's no
longer strong linkage to the tunnel drivers.
Yes, agreed. We can remove the CONFIG_VXLAN and CONFIG_GENEVE stuff now.
But I think this can be a separate series.
Actually it should be pretty easy to do all of this in the same
series. I am directly effecting the code where it is wrapped up
anyway. Dropping the defines will make this easier for me to test.
- Alex
From: Michael Chan <michael.chan@broadcom.com> Date: 2016-06-13 19:16:44
On Mon, Jun 13, 2016 at 11:41 AM, Jesse Gross [off-list ref] wrote:
On Mon, Jun 13, 2016 at 10:48 AM, Alexander Duyck [off-list ref] wrote:
quoted
This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type. As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.
Signed-off-by: Alexander Duyck <redacted>
It looks like bnxt actually has a hardcoded offload of the Geneve port
rather than using the registration (maybe it predated it?).
It's not hardcoded. The driver code just predated the ndo geneve calls.
It would
be nice to incorporate that into your unified handler as well.
I think you could actually just kill all of these
CONFIG_VXLAN/CONFIG_GENEVE checks (across all the drivers, not just
this one). They shouldn't be necessary any more now that there's no
longer strong linkage to the tunnel drivers.
What do you think about adding a struct as argument to
ndo_*_udp_enc_port? As a result we can much easier add new fields in
case future NICs allow us to e.g. specify a bound ip address?
This is why I think we should be using ntuple filtering for
encapsulation instead perpetuating the notion that encapsulation
offload can only be done based on receive ports.
Tom
From: kbuild test robot <hidden> Date: 2016-06-13 19:32:41
Hi,
[auto build test WARNING on net/master]
[also build test WARNING on v4.7-rc3 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexander-Duyck/Future-proof-tunnel-offload-handlers/20160614-020534
config: x86_64-randconfig-x018-06140233 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/net/ethernet/broadcom/bnxt/bnxt.c:10:
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_add_vxlan_port':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:14: error: 'UDP_ENC_OFFLOAD_TYPE_VXLAN' undeclared (first use in this function)
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^
include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
quoted
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:2: note: in expansion of macro 'if'
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:14: note: each undeclared identifier is reported only once for each function it appears in
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^
include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
quoted
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:2: note: in expansion of macro 'if'
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^~
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_del_vxlan_port':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6081:14: error: 'UDP_ENC_OFFLOAD_TYPE_VXLAN' undeclared (first use in this function)
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^
include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6081:2: note: in expansion of macro 'if'
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^~
vim +/if +6056 drivers/net/ethernet/broadcom/bnxt/bnxt.c
6040 netdev_info(bp->dev, "Receive PF driver unload event!");
6041 }
6042
6043 #else
6044
6045 static void bnxt_cfg_ntp_filters(struct bnxt *bp)
6046 {
6047 }
6048
6049 #endif /* CONFIG_RFS_ACCEL */
6050
6051 static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,
6052 __be16 port, unsigned int type)
6053 {
6054 struct bnxt *bp = netdev_priv(dev);
6055
6056 if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
6057 return;
6058
6059 if (sa_family != AF_INET6 && sa_family != AF_INET)
6060 return;
6061
6062 if (!netif_running(dev))
6063 return;
6064
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: kbuild test robot <hidden> Date: 2016-06-13 19:45:52
Hi,
[auto build test ERROR on net/master]
[also build test ERROR on v4.7-rc3 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexander-Duyck/Future-proof-tunnel-offload-handlers/20160614-020534
config: x86_64-randconfig-x014-06140233 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_add_vxlan_port':
quoted
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:14: error: 'UDP_ENC_OFFLOAD_TYPE_VXLAN' undeclared (first use in this function)
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6056:14: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_del_vxlan_port':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:6081:14: error: 'UDP_ENC_OFFLOAD_TYPE_VXLAN' undeclared (first use in this function)
if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/UDP_ENC_OFFLOAD_TYPE_VXLAN +6056 drivers/net/ethernet/broadcom/bnxt/bnxt.c
6050
6051 static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,
6052 __be16 port, unsigned int type)
6053 {
6054 struct bnxt *bp = netdev_priv(dev);
6055
6056 if (type != UDP_ENC_OFFLOAD_TYPE_VXLAN)
6057 return;
6058
6059 if (sa_family != AF_INET6 && sa_family != AF_INET)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
What do you think about adding a struct as argument to
ndo_*_udp_enc_port? As a result we can much easier add new fields in
case future NICs allow us to e.g. specify a bound ip address?
Actually that is probably a good idea. Suggestions on the name are
welcome. Otherwise I will try to come up with something in a bit as I
am currently going through and flushing out all the driver specific
VXLAN and GENEVE build flags.
- Alex
From: Tom Herbert <hidden> Date: 2016-06-13 19:55:43
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted hunk
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Tom
quoted hunk
+/* Notify network devices of offloadable types */
+void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock,
+ unsigned int type);
+void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned int type);
+void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned int type);
+
/* Transmit the skb using UDP encapsulation. */
void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
__be32 src, __be32 dst, __u8 tos, __u8 ttl,
@@ -76,6 +76,83 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,}EXPORT_SYMBOL_GPL(setup_udp_tunnel_sock);+voidudp_tunnel_push_rx_port(structnet_device*dev,structsocket*sock,+unsignedinttype)+{+structsock*sk=sock->sk;+sa_family_tsa_family=sk->sk_family;+__be16port=inet_sk(sk)->inet_sport;++switch(type){+caseUDP_ENC_OFFLOAD_TYPE_VXLAN:+if(!dev->netdev_ops->ndo_add_vxlan_port)+break;++dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,port);+break;+caseUDP_ENC_OFFLOAD_TYPE_GENEVE:+if(!dev->netdev_ops->ndo_add_geneve_port)+break;++dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);+break;+default:+break;+}+}+EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port);++/* Notify netdevs that UDP port started listening */+voidudp_tunnel_notify_add_rx_port(structsocket*sock,unsignedinttype)+{+structnet*net=sock_net(sock->sk);+structnet_device*dev;++rcu_read_lock();+for_each_netdev_rcu(net,dev)+udp_tunnel_push_rx_port(dev,sock,type);+rcu_read_unlock();+}+EXPORT_SYMBOL_GPL(udp_tunnel_notify_add_rx_port);++staticvoidudp_tunnel_pull_rx_port(structnet_device*dev,+structsocket*sock,unsignedinttype)+{+structsock*sk=sock->sk;+sa_family_tsa_family=sk->sk_family;+__be16port=inet_sk(sk)->inet_sport;++switch(type){+caseUDP_ENC_OFFLOAD_TYPE_VXLAN:+if(!dev->netdev_ops->ndo_del_vxlan_port)+break;++dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,port);+break;+caseUDP_ENC_OFFLOAD_TYPE_GENEVE:+if(!dev->netdev_ops->ndo_del_geneve_port)+break;++dev->netdev_ops->ndo_del_geneve_port(dev,sa_family,port);+break;+default:+break;+}+}++/* Notify netdevs that UDP port is no more listening */+voidudp_tunnel_notify_del_rx_port(structsocket*sock,unsignedinttype)+{+structnet_device*dev;+structnet*net=sock_net(sock->sk);++rcu_read_lock();+for_each_netdev_rcu(net,dev)+udp_tunnel_pull_rx_port(dev,sock,type);+rcu_read_unlock();+}+EXPORT_SYMBOL_GPL(udp_tunnel_notify_del_rx_port);+voidudp_tunnel_xmit_skb(structrtable*rt,structsock*sk,structsk_buff*skb,__be32src,__be32dst,__u8tos,__u8ttl,__be16df,__be16src_port,__be16dst_port,
From: kbuild test robot <hidden> Date: 2016-06-13 20:04:10
Hi,
[auto build test ERROR on net/master]
[also build test ERROR on v4.7-rc3 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexander-Duyck/Future-proof-tunnel-offload-handlers/20160614-020534
config: x86_64-randconfig-x015-06140233 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
In file included from include/net/vxlan.h:11:0,
from drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:53:
include/net/udp_tunnel.h: In function 'udp_tunnel_handle_offloads':
quoted
include/net/udp_tunnel.h:130:9: error: implicit declaration of function 'iptunnel_handle_offloads' [-Werror=implicit-function-declaration]
return iptunnel_handle_offloads(skb, type);
^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/iptunnel_handle_offloads +130 include/net/udp_tunnel.h
c29a70d2 Pravin B Shelar 2015-08-26 124 int md_size);
c29a70d2 Pravin B Shelar 2015-08-26 125
aed069df Alexander Duyck 2016-04-14 126 static inline int udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum)
6a93cc90 Andy Zhou 2014-09-16 127 {
6a93cc90 Andy Zhou 2014-09-16 128 int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
6a93cc90 Andy Zhou 2014-09-16 129
6fa79666 Edward Cree 2016-02-11 @130 return iptunnel_handle_offloads(skb, type);
6a93cc90 Andy Zhou 2014-09-16 131 }
6a93cc90 Andy Zhou 2014-09-16 132
6a93cc90 Andy Zhou 2014-09-16 133 static inline void udp_tunnel_encap_enable(struct socket *sock)
:::::: The code at line 130 was first introduced by commit
:::::: 6fa79666e24d32be1b709f5269af41ed9e829e7e net: ip_tunnel: remove 'csum_help' argument to iptunnel_handle_offloads
:::::: TO: Edward Cree [off-list ref]
:::::: CC: David S. Miller [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: Alexander Duyck <hidden> Date: 2016-06-13 20:24:43
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
At this point what we need to focus on is being able to show that this
feature is essentially a crutch. To that end I really think we need
to focus on enabling Tx checksum for all new UDP tunnels going forward
by default. That way we get the full benefits of the offload before
we even have to start thinking about adding this kind of code. It
isn't until we start having to deal with switches and other OSes that
cannot support the outer checksum on Tx that we need these kind of
workarounds in the hardware.
- Alex
From: Tom Herbert <hidden> Date: 2016-06-13 20:36:34
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Tom
At this point what we need to focus on is being able to show that this
feature is essentially a crutch. To that end I really think we need
to focus on enabling Tx checksum for all new UDP tunnels going forward
by default. That way we get the full benefits of the offload before
we even have to start thinking about adding this kind of code. It
isn't until we start having to deal with switches and other OSes that
cannot support the outer checksum on Tx that we need these kind of
workarounds in the hardware.
- Alex
What do you think about adding a struct as argument to
ndo_*_udp_enc_port? As a result we can much easier add new fields in
case future NICs allow us to e.g. specify a bound ip address?
Actually that is probably a good idea. Suggestions on the name are
welcome. Otherwise I will try to come up with something in a bit as I
am currently going through and flushing out all the driver specific
VXLAN and GENEVE build flags.
Hmmm... struct net_device_hw_offload, to be most generic? Maybe we can
even drop the udp_enc in the name and go completely generic:
int (*ndo_apply_offload)(..., struct hw_offload).
(enc reminded me too much at encryption)
Another idea, should we add error indications also for the future? We
can signal if a specific card was not able to enable offloading.
Different situations can be signaled: port list depleted, protocol
unsupported etc.
Might make sense for later postprocessing and signaling to user space.
Thanks,
Hannes
From: Alexander Duyck <hidden> Date: 2016-06-13 21:51:30
On Mon, Jun 13, 2016 at 1:36 PM, Tom Herbert [off-list ref] wrote:
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Right. That covers one tiny piece of the whole problem, but you are
holding out for hardware that may not be introduced for another 3 to 5
years. The fact is trying to getting NIC vendors to support
checksum-complete is all well and good, but you seem to have forgotten
that NIC vendors are incredibly slow when it comes to implementing
anything. In the meantime we will have the stuff that was already in
the pipeline coming out over the next several years.
How about the fact that we need to know that there is a tunnel there
if we want to do anything like try to parse the inner headers of a
given tunnel on Rx? How do you propose to solve the RSS problem?
Enabling hashing on UDP source and destination port is okay-ish but
runs into the issue that the tunnel can be potentially fragmented. In
addition any other fragmented UDP flows end up now being received with
potential out-of-order issues on the system.
There ends up being a number of reasons why you need to have this.
You can argue about checksum-complete all you want but in the end it
doesn't matter because simple things like flow identification and
steering will always be an issue regardless of how the checksum is
handled.
- Alex
What do you think about adding a struct as argument to
ndo_*_udp_enc_port? As a result we can much easier add new fields in
case future NICs allow us to e.g. specify a bound ip address?
Actually that is probably a good idea. Suggestions on the name are
welcome. Otherwise I will try to come up with something in a bit as I
am currently going through and flushing out all the driver specific
VXLAN and GENEVE build flags.
Hmmm... struct net_device_hw_offload, to be most generic? Maybe we can
even drop the udp_enc in the name and go completely generic:
int (*ndo_apply_offload)(..., struct hw_offload).
The only probably with generically using the offload keyword is it is
not very clear about what is going on.
For now I am just going with udp_enc_endpoint_info since that is
basically what we are passing. Then I just use the pointer variable
ei for passing it back and forth between the functions.
(enc reminded me too much at encryption)
I don't know. In a way that isn't too far off since we are looking at
packet data buried inside of a UDP packet. I thought it worked based
on the fact that we have hw_enc_features which is what is used to
indicate the hw features when a packet is encapsulated. I could add a
few more letters and move things over to "encap" if you prefer. It
just means adding 2 more letters.
Another idea, should we add error indications also for the future? We
can signal if a specific card was not able to enable offloading.
Different situations can be signaled: port list depleted, protocol
unsupported etc.
Might make sense for later postprocessing and signaling to user space.
The problem is we are using a notifier type setup. As such we cannot
really exit out if an error occurs on one of the ports.
- Alex
From: Tom Herbert <hidden> Date: 2016-06-13 22:17:39
On Mon, Jun 13, 2016 at 2:51 PM, Alexander Duyck
[off-list ref] wrote:
On Mon, Jun 13, 2016 at 1:36 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Right. That covers one tiny piece of the whole problem, but you are
holding out for hardware that may not be introduced for another 3 to 5
years. The fact is trying to getting NIC vendors to support
checksum-complete is all well and good, but you seem to have forgotten
that NIC vendors are incredibly slow when it comes to implementing
anything. In the meantime we will have the stuff that was already in
the pipeline coming out over the next several years.
How about the fact that we need to know that there is a tunnel there
if we want to do anything like try to parse the inner headers of a
given tunnel on Rx? How do you propose to solve the RSS problem?
Solved by doing RSS and ECMP hash over 3-tuple of IP addresses and
IPv6 flow label (not ports). Non-zero flow labels will soon be widely
used over the Internet. IOS already is already setting them, Android
should pick up support in the next rebase, and the MS guys have
assured me that they will add support to next version of Windows. Like
a generic checksum offload, flow label works with an IP protocol,
extension header, fragmentation, UDP encapsulation, etc. With this
there is no reason for devices to parse L4 headers just to forward a
packet. HW vendors (both switches and NICs) are strongly encouraged to
support them.
Enabling hashing on UDP source and destination port is okay-ish but
runs into the issue that the tunnel can be potentially fragmented. In
addition any other fragmented UDP flows end up now being received with
potential out-of-order issues on the system.
There ends up being a number of reasons why you need to have this.
You can argue about checksum-complete all you want but in the end it
doesn't matter because simple things like flow identification and
steering will always be an issue regardless of how the checksum is
handled.
- Alex
From: Alexander Duyck <hidden> Date: 2016-06-13 23:12:57
On Mon, Jun 13, 2016 at 3:17 PM, Tom Herbert [off-list ref] wrote:
On Mon, Jun 13, 2016 at 2:51 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:36 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Right. That covers one tiny piece of the whole problem, but you are
holding out for hardware that may not be introduced for another 3 to 5
years. The fact is trying to getting NIC vendors to support
checksum-complete is all well and good, but you seem to have forgotten
that NIC vendors are incredibly slow when it comes to implementing
anything. In the meantime we will have the stuff that was already in
the pipeline coming out over the next several years.
How about the fact that we need to know that there is a tunnel there
if we want to do anything like try to parse the inner headers of a
given tunnel on Rx? How do you propose to solve the RSS problem?
Solved by doing RSS and ECMP hash over 3-tuple of IP addresses and
IPv6 flow label (not ports). Non-zero flow labels will soon be widely
used over the Internet. IOS already is already setting them, Android
should pick up support in the next rebase, and the MS guys have
assured me that they will add support to next version of Windows. Like
a generic checksum offload, flow label works with an IP protocol,
extension header, fragmentation, UDP encapsulation, etc. With this
there is no reason for devices to parse L4 headers just to forward a
packet. HW vendors (both switches and NICs) are strongly encouraged to
support them.
Right so with all this encouragement, where are we at on getting the
switches out there to support this? The switches are what is pushing
most of the tunnel workloads and such, and it is the switches that are
going to be the painful interfaces for us to try to offload data from.
Also have you looked into the effect on regular traffic for trying to
deal with an extra IPv4 options header? The Intel NICs should be able
to deal with it, at least for Tx, but my concern would be the NICs
that perform parsing based offloads and such.
It seems like we might be arguing past each other as I am focused on
what we can do right now, and it seems like you are arguing the point
that we need features that probably won't be enabled in the ecosystem
for 5 to 10 years depending on the hardware release cycles. Hopefully
we can agree to disagree and can address this again when new features
start to become available. At that time we could probably look at
deprecating the driver API for the UDP ports assuming we have other
means of resolving this available by then.
- Alex
From: Tom Herbert <hidden> Date: 2016-06-14 00:28:23
On Mon, Jun 13, 2016 at 4:12 PM, Alexander Duyck
[off-list ref] wrote:
On Mon, Jun 13, 2016 at 3:17 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 2:51 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:36 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Right. That covers one tiny piece of the whole problem, but you are
holding out for hardware that may not be introduced for another 3 to 5
years. The fact is trying to getting NIC vendors to support
checksum-complete is all well and good, but you seem to have forgotten
that NIC vendors are incredibly slow when it comes to implementing
anything. In the meantime we will have the stuff that was already in
the pipeline coming out over the next several years.
How about the fact that we need to know that there is a tunnel there
if we want to do anything like try to parse the inner headers of a
given tunnel on Rx? How do you propose to solve the RSS problem?
Solved by doing RSS and ECMP hash over 3-tuple of IP addresses and
IPv6 flow label (not ports). Non-zero flow labels will soon be widely
used over the Internet. IOS already is already setting them, Android
should pick up support in the next rebase, and the MS guys have
assured me that they will add support to next version of Windows. Like
a generic checksum offload, flow label works with an IP protocol,
extension header, fragmentation, UDP encapsulation, etc. With this
there is no reason for devices to parse L4 headers just to forward a
packet. HW vendors (both switches and NICs) are strongly encouraged to
support them.
Right so with all this encouragement, where are we at on getting the
switches out there to support this? The switches are what is pushing
most of the tunnel workloads and such, and it is the switches that are
going to be the painful interfaces for us to try to offload data from.
Also have you looked into the effect on regular traffic for trying to
deal with an extra IPv4 options header? The Intel NICs should be able
to deal with it, at least for Tx, but my concern would be the NICs
that perform parsing based offloads and such.
It seems like we might be arguing past each other as I am focused on
what we can do right now, and it seems like you are arguing the point
that we need features that probably won't be enabled in the ecosystem
for 5 to 10 years depending on the hardware release cycles. Hopefully
we can agree to disagree and can address this again when new features
start to become available. At that time we could probably look at
deprecating the driver API for the UDP ports assuming we have other
means of resolving this available by then.
Alex,
I looked though the previous thread on protocol specific vs. generic
offloads in http://www.spinics.net/lists/netdev/msg354311.html and the
outcome from that. To quote davem:
"Doing anything other than providing 2's complement checksums in the
RX descriptor doesn't work. We know this.
So we will not add to our core architecture and frameworks anything
that directly facilitates designs which we know are suboptimal. And
protocol specific support for tunnel offloading is suboptimal and not
the way forward."
Unless Dave has changed his mind on this or you have new arguments or
new data, I really don't see point in participating in further
discussion on patches like this. Sorry.
Tom
From: Alexander Duyck <hidden> Date: 2016-06-14 02:50:05
On Mon, Jun 13, 2016 at 5:28 PM, Tom Herbert [off-list ref] wrote:
On Mon, Jun 13, 2016 at 4:12 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 3:17 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 2:51 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:36 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 1:24 PM, Alexander Duyck
[off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 12:55 PM, Tom Herbert [off-list ref] wrote:
quoted
On Mon, Jun 13, 2016 at 10:47 AM, Alexander Duyck [off-list ref] wrote:
quoted
This patch merges the GENEVE and VXLAN code so that both functions pass
through a shared code path. This way we can start the effort of using a
single function on the network device drivers to handle both of these
tunnel offload types.
Signed-off-by: Alexander Duyck <redacted>
---
drivers/net/geneve.c | 48 ++++-------------------------
drivers/net/vxlan.c | 46 ++++-----------------------
include/net/udp_tunnel.h | 12 +++++++
net/ipv4/udp_tunnel.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 80 deletions(-)
@@ -1165,29 +1140,20 @@ static struct device_type geneve_type = {.name="geneve",};-/* Calls the ndo_add_geneve_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningGENEVEudpports.Callersareexpected-*toimplementthendo_add_geneve_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidgeneve_push_rx_ports(structnet_device*dev){structnet*net=dev_net(dev);structgeneve_net*gn=net_generic(net,geneve_net_id);structgeneve_sock*gs;-sa_family_tsa_family;-structsock*sk;-__be16port;--if(!dev->netdev_ops->ndo_add_geneve_port)-return;rcu_read_lock();-list_for_each_entry_rcu(gs,&gn->sock_list,list){-sk=gs->sock->sk;-sa_family=sk->sk_family;-port=inet_sk(sk)->inet_sport;-dev->netdev_ops->ndo_add_geneve_port(dev,sa_family,port);-}+list_for_each_entry_rcu(gs,&gn->sock_list,list)+udp_tunnel_push_rx_port(dev,gs->sock,+UDP_ENC_OFFLOAD_TYPE_GENEVE);rcu_read_unlock();}
@@ -622,37 +622,13 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)/* Notify netdevs that UDP port started listening */staticvoidvxlan_notify_add_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_add_vxlan_port)-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_add_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Notify netdevs that UDP port is no more listening */staticvoidvxlan_notify_del_rx_port(structvxlan_sock*vs){-structnet_device*dev;-structsock*sk=vs->sock->sk;-structnet*net=sock_net(sk);-sa_family_tsa_family=vxlan_get_sk_family(vs);-__be16port=inet_sk(sk)->inet_sport;--rcu_read_lock();-for_each_netdev_rcu(net,dev){-if(dev->netdev_ops->ndo_del_vxlan_port)-dev->netdev_ops->ndo_del_vxlan_port(dev,sa_family,-port);-}-rcu_read_unlock();+udp_tunnel_notify_del_rx_port(vs->sock,UDP_ENC_OFFLOAD_TYPE_VXLAN);}/* Add new entry to forwarding table -- assumes lock held */
@@ -2525,30 +2501,22 @@ static struct device_type vxlan_type = {.name="vxlan",};-/* Calls the ndo_add_vxlan_port of the caller in order to+/* Calls the ndo_add_udp_enc_port of the caller in order to*supplythelisteningVXLANudpports.Callersareexpected-*toimplementthendo_add_vxlan_port.+*toimplementthendo_add_udp_enc_port.*/staticvoidvxlan_push_rx_ports(structnet_device*dev){structvxlan_sock*vs;structnet*net=dev_net(dev);structvxlan_net*vn=net_generic(net,vxlan_net_id);-sa_family_tsa_family;-__be16port;unsignedinti;-if(!dev->netdev_ops->ndo_add_vxlan_port)-return;-spin_lock(&vn->sock_lock);for(i=0;i<PORT_HASH_SIZE;++i){-hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist){-port=inet_sk(vs->sock->sk)->inet_sport;-sa_family=vxlan_get_sk_family(vs);-dev->netdev_ops->ndo_add_vxlan_port(dev,sa_family,-port);-}+hlist_for_each_entry_rcu(vs,&vn->sock_list[i],hlist)+udp_tunnel_push_rx_port(dev,vs->sock,+UDP_ENC_OFFLOAD_TYPE_VXLAN);}spin_unlock(&vn->sock_lock);}
@@ -84,6 +84,18 @@ struct udp_tunnel_sock_cfg {voidsetup_udp_tunnel_sock(structnet*net,structsocket*sock,structudp_tunnel_sock_cfg*sock_cfg);+/* List of offloadable UDP tunnel types */+enumudp_enc_offloads{+UDP_ENC_OFFLOAD_TYPE_VXLAN,/* RFC 7348 */+UDP_ENC_OFFLOAD_TYPE_GENEVE,/* draft-ietf-nvo3-geneve */+};+
We've already had a lot of discussion on this. The clear outcome from
netdev was that we need to support generic offloads and move away from
protocol specific offload. Generalizing the interface to allow vendors
to unnecessarily leak out protocol specific features undermines that
effort.
Then in turn we get dirty hacks like what we have right now where
VXLAN-GPE is attempting to reuse the VXLAN offload functions or
drivers that just hard-code GENEVE ports.
Going full obstructionist on this isn't going to work. We need to be
able to support these type of offloads because the switch vendors are
going to force the NIC vendors to do so. We will likely never be able
to convince Cisco to implement an outer transmit checksum on their
switches. In order to make offloads work without the outer checksum
we will need to be able to parse the frames in order to be able to
validate the inner checksum values.
NIC vendors can support checksum-complete. This works with any form of
UDP encapsulation, and IP protocol (like extension headers), and other
form of tunneling we can dream up. That was the whole point of Dave's
keynote at netdev.
Right. That covers one tiny piece of the whole problem, but you are
holding out for hardware that may not be introduced for another 3 to 5
years. The fact is trying to getting NIC vendors to support
checksum-complete is all well and good, but you seem to have forgotten
that NIC vendors are incredibly slow when it comes to implementing
anything. In the meantime we will have the stuff that was already in
the pipeline coming out over the next several years.
How about the fact that we need to know that there is a tunnel there
if we want to do anything like try to parse the inner headers of a
given tunnel on Rx? How do you propose to solve the RSS problem?
Solved by doing RSS and ECMP hash over 3-tuple of IP addresses and
IPv6 flow label (not ports). Non-zero flow labels will soon be widely
used over the Internet. IOS already is already setting them, Android
should pick up support in the next rebase, and the MS guys have
assured me that they will add support to next version of Windows. Like
a generic checksum offload, flow label works with an IP protocol,
extension header, fragmentation, UDP encapsulation, etc. With this
there is no reason for devices to parse L4 headers just to forward a
packet. HW vendors (both switches and NICs) are strongly encouraged to
support them.
Right so with all this encouragement, where are we at on getting the
switches out there to support this? The switches are what is pushing
most of the tunnel workloads and such, and it is the switches that are
going to be the painful interfaces for us to try to offload data from.
Also have you looked into the effect on regular traffic for trying to
deal with an extra IPv4 options header? The Intel NICs should be able
to deal with it, at least for Tx, but my concern would be the NICs
that perform parsing based offloads and such.
It seems like we might be arguing past each other as I am focused on
what we can do right now, and it seems like you are arguing the point
that we need features that probably won't be enabled in the ecosystem
for 5 to 10 years depending on the hardware release cycles. Hopefully
we can agree to disagree and can address this again when new features
start to become available. At that time we could probably look at
deprecating the driver API for the UDP ports assuming we have other
means of resolving this available by then.
Alex,
I looked though the previous thread on protocol specific vs. generic
offloads in http://www.spinics.net/lists/netdev/msg354311.html and the
outcome from that. To quote davem:
"Doing anything other than providing 2's complement checksums in the
RX descriptor doesn't work. We know this.
For Rx checksum I would agree with you there. Although I would argue
that we can solve much of this by just providing an outer UDP checksum
on Tx anyway. The one that annoys me the most is the ones that end up
using this for Tx, but that is a topic for another time.
The problem is this goes beyond just the Rx checksum. There end up
being a number of Rx offloads and the like that also need to figure
out where the inner headers start in order to handle things like MAC
based filtering, RSS, and the like.
So we will not add to our core architecture and frameworks anything
that directly facilitates designs which we know are suboptimal. And
protocol specific support for tunnel offloading is suboptimal and not
the way forward."
Yes, but then we still ended up with the GENEVE offloads being
accepted anyway. My concern is that we didn't spend enough time
talking about the implementation details of it because everything got
drowned out by the arguments for not accepting the offloads at all.
So we ended up just cloning what was already there for VXLAN which
ended up setting a bad precedent for how we should handle this going
forward. It would be just as easy for us to stop any future additions
after my changes as it would the current code. The only big
difference is that with my changes applied we can strip out all the
stupid defines and would likely be arguing over 1 or 2 patches rather
than a set of patches to accomplish the same task.
Unless Dave has changed his mind on this or you have new arguments or
new data, I really don't see point in participating in further
discussion on patches like this. Sorry.
I'm not going to speculate on what Dave's opinion on this is. I'll
wait to hear it from him.
My concern at this point is that we have several issues. Specifically
we have VXLAN-GPE trying to pass itself off as VXLAN when it clearly
is not, and I know we are going to end up with somebody eventually
trying to push this feature into the kernel. I know for a fact there
is hardware out there that already supports it. I'm trying to get
ahead of this and define what the interface is supposed to look like
myself so that we don't end up with somebody unfamiliar with all this
trying to push it. This way we can avoid having some hardware vendor
on a timeline trying to push it through quick as in the case of i40e,
or somebody trying to get around it by just hard coding it into their
driver like occurred with bnxt.
While I appreciate the opinion, outright refusing to enable the
existing offloads is counterproductive. There are customers out there
that already have this hardware. There are driver writers out there
who are going to have to enable these features one way or another. If
we want to be obstructionists then I am sure they can just work around
us and write up out-of-tree drivers and use something like module
parameters to enable offloads on a specific port. Most of these
implementations only seem to support one port anyway. I just thought
it might be better to have this figured out in the kernel so that we
didn't end up creating a bigger mess than needed with each vendor
going off and doing their own out-of-tree implementation.
- Alex
From: David Miller <davem@davemloft.net> Date: 2016-06-15 07:22:07
From: Alexander Duyck <redacted>
Date: Mon, 13 Jun 2016 19:50:02 -0700
I'm not going to speculate on what Dave's opinion on this is. I'll
wait to hear it from him.
My concern at this point is that we have several issues. Specifically
we have VXLAN-GPE trying to pass itself off as VXLAN when it clearly
is not, and I know we are going to end up with somebody eventually
trying to push this feature into the kernel. I know for a fact there
is hardware out there that already supports it. I'm trying to get
ahead of this and define what the interface is supposed to look like
myself so that we don't end up with somebody unfamiliar with all this
trying to push it. This way we can avoid having some hardware vendor
on a timeline trying to push it through quick as in the case of i40e,
or somebody trying to get around it by just hard coding it into their
driver like occurred with bnxt.
While I appreciate the opinion, outright refusing to enable the
existing offloads is counterproductive. There are customers out there
that already have this hardware. There are driver writers out there
who are going to have to enable these features one way or another. If
we want to be obstructionists then I am sure they can just work around
us and write up out-of-tree drivers and use something like module
parameters to enable offloads on a specific port. Most of these
implementations only seem to support one port anyway. I just thought
it might be better to have this figured out in the kernel so that we
didn't end up creating a bigger mess than needed with each vendor
going off and doing their own out-of-tree implementation.
My plan is to try and properly balance the two side of this situation.
Realistically, and Alex is right on this, we shoot ourselves in the
foot by not supporting offloads that exist in hardware now even if
they are not generic.
So I would encourage Alex to keep working on his patch set and to
keep working on the feedback he is given.
Thanks.
From: Tom Herbert <hidden> Date: 2016-06-15 16:12:58
On Wed, Jun 15, 2016 at 12:22 AM, David Miller [off-list ref] wrote:
From: Alexander Duyck <redacted>
Date: Mon, 13 Jun 2016 19:50:02 -0700
quoted
I'm not going to speculate on what Dave's opinion on this is. I'll
wait to hear it from him.
My concern at this point is that we have several issues. Specifically
we have VXLAN-GPE trying to pass itself off as VXLAN when it clearly
is not, and I know we are going to end up with somebody eventually
trying to push this feature into the kernel. I know for a fact there
is hardware out there that already supports it. I'm trying to get
ahead of this and define what the interface is supposed to look like
myself so that we don't end up with somebody unfamiliar with all this
trying to push it. This way we can avoid having some hardware vendor
on a timeline trying to push it through quick as in the case of i40e,
or somebody trying to get around it by just hard coding it into their
driver like occurred with bnxt.
While I appreciate the opinion, outright refusing to enable the
existing offloads is counterproductive. There are customers out there
that already have this hardware. There are driver writers out there
who are going to have to enable these features one way or another. If
we want to be obstructionists then I am sure they can just work around
us and write up out-of-tree drivers and use something like module
parameters to enable offloads on a specific port. Most of these
implementations only seem to support one port anyway. I just thought
it might be better to have this figured out in the kernel so that we
didn't end up creating a bigger mess than needed with each vendor
going off and doing their own out-of-tree implementation.
My plan is to try and properly balance the two side of this situation.
Realistically, and Alex is right on this, we shoot ourselves in the
foot by not supporting offloads that exist in hardware now even if
they are not generic.
It was the interface that was rejected not any particular hardware
offload. We pointed out that n-tuple filtering is a much better
interface anyway allowing address binding and implementing offload for
new protocols without needed to change common header files. Besides,
if it's really just about VXLAN-GPE and that is the last of the
protocols in the three year HW pipeline then we can add another ndo
function specific for that.
Personally, I think the question of protocol specific offloads is moot
anyway. In the past six months the world since this issue came up the
world has moved forward. We have a lot better support for generic
offloads (Alex's patches on that), GRO for UDP is based on socket
lookup instead alternate lookup destination port, LCO has been
integrated, real support for ipxip6, extension headers being developed
that are going to be deployed, ILA allows virtualization without
encapsulation (no HW support needed), more IPv6 deployment in general,
MPLS/UDP is now an Internet standard, GRE/UDP will go to WGLC in IETF
soon, even more encapsulation protocols like IP/UDP have been
proposed, QUIC is being deployed and probably going to be a WG, first
TOU patches will soon be upstream, FD.io and DPDK are still making a
big fuss to bypass the kernel-- XDP is proving the kernel is not
problem, we now have first instances of truly programmable NICs using
BPF which is the path to truly generic offloads. This is really quite
an impressive list for sure! I don't see that protocol specific
offloads figure into much of this.
Tom
So I would encourage Alex to keep working on his patch set and to
keep working on the feedback he is given.
Thanks.