* [PATCH net-next 0/2] Implement udp tunnel port for txgbe
@ 2025-04-10 7:44 Jiawen Wu
2025-04-10 7:44 ` [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port Jiawen Wu
2025-04-10 7:44 ` [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets Jiawen Wu
0 siblings, 2 replies; 6+ messages in thread
From: Jiawen Wu @ 2025-04-10 7:44 UTC (permalink / raw)
To: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
dlemoal, jdamato, saikrishnag, vadim.fedorenko,
przemyslaw.kitszel, ecree.xilinx, rmk+kernel
Cc: mengyuanlou, Jiawen Wu
Setting UDP tunnel port is supported on TXGBE devices, to implement
hardware offload for various tunnel packets.
Jiawen Wu (2):
net: txgbe: Support to set UDP tunnel port
net: wangxun: restrict feature flags for tunnel packets
drivers/net/ethernet/wangxun/libwx/wx_lib.c | 27 +++++
drivers/net/ethernet/wangxun/libwx/wx_lib.h | 3 +
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 1 +
.../net/ethernet/wangxun/txgbe/txgbe_main.c | 114 ++++++++++++++++++
.../net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++
5 files changed, 153 insertions(+)
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port
2025-04-10 7:44 [PATCH net-next 0/2] Implement udp tunnel port for txgbe Jiawen Wu
@ 2025-04-10 7:44 ` Jiawen Wu
2025-04-11 13:49 ` Michal Kubiak
2025-04-11 23:22 ` Jakub Kicinski
2025-04-10 7:44 ` [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets Jiawen Wu
1 sibling, 2 replies; 6+ messages in thread
From: Jiawen Wu @ 2025-04-10 7:44 UTC (permalink / raw)
To: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
dlemoal, jdamato, saikrishnag, vadim.fedorenko,
przemyslaw.kitszel, ecree.xilinx, rmk+kernel
Cc: mengyuanlou, Jiawen Wu
Tunnel types VXLAN/VXLAN_GPE/GENEVE are supported for txgbe devices. The
hardware supports to set only one port for each tunnel type.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
.../net/ethernet/wangxun/txgbe/txgbe_main.c | 113 ++++++++++++++++++
.../net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++
2 files changed, 121 insertions(+)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index 6d9134a3ce4d..c984745504b4 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -8,6 +8,7 @@
#include <linux/string.h>
#include <linux/etherdevice.h>
#include <linux/phylink.h>
+#include <net/udp_tunnel.h>
#include <net/ip.h>
#include <linux/if_vlan.h>
@@ -392,6 +393,8 @@ static int txgbe_open(struct net_device *netdev)
txgbe_up_complete(wx);
+ udp_tunnel_nic_reset_ntf(netdev);
+
return 0;
err_free_irq:
@@ -537,6 +540,114 @@ void txgbe_do_reset(struct net_device *netdev)
txgbe_reset(wx);
}
+static int txgbe_udp_tunnel_set(struct net_device *dev, unsigned int table,
+ unsigned int entry, struct udp_tunnel_info *ti)
+{
+ struct wx *wx = netdev_priv(dev);
+ struct txgbe *txgbe = wx->priv;
+
+ switch (ti->type) {
+ case UDP_TUNNEL_TYPE_VXLAN:
+ if (txgbe->vxlan_port == ti->port)
+ break;
+
+ if (txgbe->vxlan_port) {
+ wx_err(wx, "VXLAN port %d set, not adding port %d\n",
+ txgbe->vxlan_port, ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->vxlan_port = ti->port;
+ wr32(wx, TXGBE_CFG_VXLAN, ntohs(ti->port));
+ break;
+ case UDP_TUNNEL_TYPE_VXLAN_GPE:
+ if (txgbe->vxlan_gpe_port == ti->port)
+ break;
+
+ if (txgbe->vxlan_gpe_port) {
+ wx_err(wx, "VXLAN-GPE port %d set, not adding port %d\n",
+ txgbe->vxlan_gpe_port, ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->vxlan_gpe_port = ti->port;
+ wr32(wx, TXGBE_CFG_VXLAN_GPE, ntohs(ti->port));
+ break;
+ case UDP_TUNNEL_TYPE_GENEVE:
+ if (txgbe->geneve_port == ti->port)
+ break;
+
+ if (txgbe->geneve_port) {
+ wx_err(wx, "GENEVE port %d set, not adding port %d\n",
+ txgbe->geneve_port, ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->geneve_port = ti->port;
+ wr32(wx, TXGBE_CFG_GENEVE, ntohs(ti->port));
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int txgbe_udp_tunnel_unset(struct net_device *dev,
+ unsigned int table, unsigned int entry,
+ struct udp_tunnel_info *ti)
+{
+ struct wx *wx = netdev_priv(dev);
+ struct txgbe *txgbe = wx->priv;
+
+ if (ti->type != UDP_TUNNEL_TYPE_VXLAN &&
+ ti->type != UDP_TUNNEL_TYPE_VXLAN_GPE &&
+ ti->type != UDP_TUNNEL_TYPE_GENEVE)
+ return -EINVAL;
+
+ switch (ti->type) {
+ case UDP_TUNNEL_TYPE_VXLAN:
+ if (txgbe->vxlan_port != ti->port) {
+ wx_err(wx, "VXLAN port %d not found\n", ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->vxlan_port = 0;
+ break;
+ case UDP_TUNNEL_TYPE_VXLAN_GPE:
+ if (txgbe->vxlan_gpe_port != ti->port) {
+ wx_err(wx, "VXLAN-GPE port %d not found\n", ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->vxlan_gpe_port = 0;
+ break;
+ case UDP_TUNNEL_TYPE_GENEVE:
+ if (txgbe->geneve_port != ti->port) {
+ wx_err(wx, "GENEVE port %d not found\n", ti->port);
+ return -EINVAL;
+ }
+
+ txgbe->geneve_port = 0;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static const struct udp_tunnel_nic_info txgbe_udp_tunnels = {
+ .set_port = txgbe_udp_tunnel_set,
+ .unset_port = txgbe_udp_tunnel_unset,
+ .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
+ .tables = {
+ { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
+ { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN_GPE, },
+ { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
+ },
+};
+
static const struct net_device_ops txgbe_netdev_ops = {
.ndo_open = txgbe_open,
.ndo_stop = txgbe_close,
@@ -632,6 +743,7 @@ static int txgbe_probe(struct pci_dev *pdev,
wx->driver_name = txgbe_driver_name;
txgbe_set_ethtool_ops(netdev);
netdev->netdev_ops = &txgbe_netdev_ops;
+ netdev->udp_tunnel_nic_info = &txgbe_udp_tunnels;
/* setup the private structure */
err = txgbe_sw_init(wx);
@@ -677,6 +789,7 @@ static int txgbe_probe(struct pci_dev *pdev,
netdev->features |= NETIF_F_HIGHDMA;
netdev->hw_features |= NETIF_F_GRO;
netdev->features |= NETIF_F_GRO;
+ netdev->features |= NETIF_F_RX_UDP_TUNNEL_PORT;
netdev->priv_flags |= IFF_UNICAST_FLT;
netdev->priv_flags |= IFF_SUPP_NOFCS;
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
index 5937cbc6bd05..67ea81dfe786 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
@@ -88,6 +88,9 @@
/* Port cfg registers */
#define TXGBE_CFG_PORT_ST 0x14404
#define TXGBE_CFG_PORT_ST_LINK_UP BIT(0)
+#define TXGBE_CFG_VXLAN 0x14410
+#define TXGBE_CFG_VXLAN_GPE 0x14414
+#define TXGBE_CFG_GENEVE 0x14418
/* I2C registers */
#define TXGBE_I2C_BASE 0x14900
@@ -359,6 +362,11 @@ struct txgbe {
union txgbe_atr_input fdir_mask;
int fdir_filter_count;
spinlock_t fdir_perfect_lock; /* spinlock for FDIR */
+
+ /* tunnel port */
+ __be16 vxlan_port;
+ __be16 geneve_port;
+ __be16 vxlan_gpe_port;
};
#endif /* _TXGBE_TYPE_H_ */
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets
2025-04-10 7:44 [PATCH net-next 0/2] Implement udp tunnel port for txgbe Jiawen Wu
2025-04-10 7:44 ` [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port Jiawen Wu
@ 2025-04-10 7:44 ` Jiawen Wu
2025-04-11 13:52 ` Michal Kubiak
1 sibling, 1 reply; 6+ messages in thread
From: Jiawen Wu @ 2025-04-10 7:44 UTC (permalink / raw)
To: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
dlemoal, jdamato, saikrishnag, vadim.fedorenko,
przemyslaw.kitszel, ecree.xilinx, rmk+kernel
Cc: mengyuanlou, Jiawen Wu
Implement ndo_features_check to restrict Tx checksum offload flags, since
there are some inner layer length and protocols unsupported.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/ethernet/wangxun/libwx/wx_lib.c | 27 +++++++++++++++++++
drivers/net/ethernet/wangxun/libwx/wx_lib.h | 3 +++
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 1 +
.../net/ethernet/wangxun/txgbe/txgbe_main.c | 1 +
4 files changed, 32 insertions(+)
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
index 59d904f23764..a1f9d2287fdc 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
@@ -2998,6 +2998,33 @@ netdev_features_t wx_fix_features(struct net_device *netdev,
}
EXPORT_SYMBOL(wx_fix_features);
+#define WX_MAX_TUNNEL_HDR_LEN 80
+netdev_features_t wx_features_check(struct sk_buff *skb,
+ struct net_device *netdev,
+ netdev_features_t features)
+{
+ struct wx *wx = netdev_priv(netdev);
+
+ if (!skb->encapsulation)
+ return features;
+
+ if (wx->mac.type == wx_mac_em)
+ return features & ~NETIF_F_CSUM_MASK;
+
+ if (unlikely(skb_inner_mac_header(skb) - skb_transport_header(skb) >
+ WX_MAX_TUNNEL_HDR_LEN))
+ return features & ~NETIF_F_CSUM_MASK;
+
+ if (skb->inner_protocol_type == ENCAP_TYPE_ETHER &&
+ skb->inner_protocol != htons(ETH_P_IP) &&
+ skb->inner_protocol != htons(ETH_P_IPV6) &&
+ skb->inner_protocol != htons(ETH_P_TEB))
+ return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+
+ return features;
+}
+EXPORT_SYMBOL(wx_features_check);
+
void wx_set_ring(struct wx *wx, u32 new_tx_count,
u32 new_rx_count, struct wx_ring *temp_ring)
{
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.h b/drivers/net/ethernet/wangxun/libwx/wx_lib.h
index fdeb0c315b75..919f49999308 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.h
+++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.h
@@ -33,6 +33,9 @@ void wx_get_stats64(struct net_device *netdev,
int wx_set_features(struct net_device *netdev, netdev_features_t features);
netdev_features_t wx_fix_features(struct net_device *netdev,
netdev_features_t features);
+netdev_features_t wx_features_check(struct sk_buff *skb,
+ struct net_device *netdev,
+ netdev_features_t features);
void wx_set_ring(struct wx *wx, u32 new_tx_count,
u32 new_rx_count, struct wx_ring *temp_ring);
diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index fd102078f5c9..82e27b9cfc9c 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -587,6 +587,7 @@ static const struct net_device_ops ngbe_netdev_ops = {
.ndo_set_rx_mode = wx_set_rx_mode,
.ndo_set_features = wx_set_features,
.ndo_fix_features = wx_fix_features,
+ .ndo_features_check = wx_features_check,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = wx_set_mac,
.ndo_get_stats64 = wx_get_stats64,
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index c984745504b4..0c5d0914e830 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -656,6 +656,7 @@ static const struct net_device_ops txgbe_netdev_ops = {
.ndo_set_rx_mode = wx_set_rx_mode,
.ndo_set_features = wx_set_features,
.ndo_fix_features = wx_fix_features,
+ .ndo_features_check = wx_features_check,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = wx_set_mac,
.ndo_get_stats64 = wx_get_stats64,
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port
2025-04-10 7:44 ` [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port Jiawen Wu
@ 2025-04-11 13:49 ` Michal Kubiak
2025-04-11 23:22 ` Jakub Kicinski
1 sibling, 0 replies; 6+ messages in thread
From: Michal Kubiak @ 2025-04-11 13:49 UTC (permalink / raw)
To: Jiawen Wu
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
dlemoal, jdamato, saikrishnag, vadim.fedorenko,
przemyslaw.kitszel, ecree.xilinx, rmk+kernel, mengyuanlou
On Thu, Apr 10, 2025 at 03:44:55PM +0800, Jiawen Wu wrote:
> Tunnel types VXLAN/VXLAN_GPE/GENEVE are supported for txgbe devices. The
> hardware supports to set only one port for each tunnel type.
>
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
> .../net/ethernet/wangxun/txgbe/txgbe_main.c | 113 ++++++++++++++++++
> .../net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++
> 2 files changed, 121 insertions(+)
>
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
[...]
> index 5937cbc6bd05..67ea81dfe786 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
> @@ -88,6 +88,9 @@
> /* Port cfg registers */
> #define TXGBE_CFG_PORT_ST 0x14404
> #define TXGBE_CFG_PORT_ST_LINK_UP BIT(0)
> +#define TXGBE_CFG_VXLAN 0x14410
> +#define TXGBE_CFG_VXLAN_GPE 0x14414
> +#define TXGBE_CFG_GENEVE 0x14418
>
> /* I2C registers */
> #define TXGBE_I2C_BASE 0x14900
> @@ -359,6 +362,11 @@ struct txgbe {
> union txgbe_atr_input fdir_mask;
> int fdir_filter_count;
> spinlock_t fdir_perfect_lock; /* spinlock for FDIR */
> +
> + /* tunnel port */
> + __be16 vxlan_port;
> + __be16 geneve_port;
> + __be16 vxlan_gpe_port;
nitpick: Can these definitions be reordered to keep the consistent order in
newly added code?
(In all other places you have the order: VXLAN, GPE, GENEVE).
Thanks,
Michal
[...]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets
2025-04-10 7:44 ` [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets Jiawen Wu
@ 2025-04-11 13:52 ` Michal Kubiak
0 siblings, 0 replies; 6+ messages in thread
From: Michal Kubiak @ 2025-04-11 13:52 UTC (permalink / raw)
To: Jiawen Wu
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
dlemoal, jdamato, saikrishnag, vadim.fedorenko,
przemyslaw.kitszel, ecree.xilinx, rmk+kernel, mengyuanlou
On Thu, Apr 10, 2025 at 03:44:56PM +0800, Jiawen Wu wrote:
> Implement ndo_features_check to restrict Tx checksum offload flags, since
> there are some inner layer length and protocols unsupported.
>
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
> drivers/net/ethernet/wangxun/libwx/wx_lib.c | 27 +++++++++++++++++++
> drivers/net/ethernet/wangxun/libwx/wx_lib.h | 3 +++
> drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 1 +
> .../net/ethernet/wangxun/txgbe/txgbe_main.c | 1 +
> 4 files changed, 32 insertions(+)
>
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> index 59d904f23764..a1f9d2287fdc 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> @@ -2998,6 +2998,33 @@ netdev_features_t wx_fix_features(struct net_device *netdev,
> }
> EXPORT_SYMBOL(wx_fix_features);
>
> +#define WX_MAX_TUNNEL_HDR_LEN 80
> +netdev_features_t wx_features_check(struct sk_buff *skb,
> + struct net_device *netdev,
> + netdev_features_t features)
> +{
> + struct wx *wx = netdev_priv(netdev);
> +
> + if (!skb->encapsulation)
> + return features;
> +
> + if (wx->mac.type == wx_mac_em)
> + return features & ~NETIF_F_CSUM_MASK;
> +
> + if (unlikely(skb_inner_mac_header(skb) - skb_transport_header(skb) >
> + WX_MAX_TUNNEL_HDR_LEN))
> + return features & ~NETIF_F_CSUM_MASK;
> +
> + if (skb->inner_protocol_type == ENCAP_TYPE_ETHER &&
> + skb->inner_protocol != htons(ETH_P_IP) &&
> + skb->inner_protocol != htons(ETH_P_IPV6) &&
> + skb->inner_protocol != htons(ETH_P_TEB))
> + return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
> +
> + return features;
> +}
> +EXPORT_SYMBOL(wx_features_check);
> +
> void wx_set_ring(struct wx *wx, u32 new_tx_count,
> u32 new_rx_count, struct wx_ring *temp_ring)
> {
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.h b/drivers/net/ethernet/wangxun/libwx/wx_lib.h
> index fdeb0c315b75..919f49999308 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.h
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.h
> @@ -33,6 +33,9 @@ void wx_get_stats64(struct net_device *netdev,
> int wx_set_features(struct net_device *netdev, netdev_features_t features);
> netdev_features_t wx_fix_features(struct net_device *netdev,
> netdev_features_t features);
> +netdev_features_t wx_features_check(struct sk_buff *skb,
> + struct net_device *netdev,
> + netdev_features_t features);
> void wx_set_ring(struct wx *wx, u32 new_tx_count,
> u32 new_rx_count, struct wx_ring *temp_ring);
>
> diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> index fd102078f5c9..82e27b9cfc9c 100644
> --- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> +++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> @@ -587,6 +587,7 @@ static const struct net_device_ops ngbe_netdev_ops = {
> .ndo_set_rx_mode = wx_set_rx_mode,
> .ndo_set_features = wx_set_features,
> .ndo_fix_features = wx_fix_features,
> + .ndo_features_check = wx_features_check,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_set_mac_address = wx_set_mac,
> .ndo_get_stats64 = wx_get_stats64,
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index c984745504b4..0c5d0914e830 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> @@ -656,6 +656,7 @@ static const struct net_device_ops txgbe_netdev_ops = {
> .ndo_set_rx_mode = wx_set_rx_mode,
> .ndo_set_features = wx_set_features,
> .ndo_fix_features = wx_fix_features,
> + .ndo_features_check = wx_features_check,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_set_mac_address = wx_set_mac,
> .ndo_get_stats64 = wx_get_stats64,
> --
> 2.27.0
>
>
Thanks,
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port
2025-04-10 7:44 ` [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port Jiawen Wu
2025-04-11 13:49 ` Michal Kubiak
@ 2025-04-11 23:22 ` Jakub Kicinski
1 sibling, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-04-11 23:22 UTC (permalink / raw)
To: Jiawen Wu
Cc: netdev, andrew+netdev, davem, edumazet, pabeni, horms, dlemoal,
jdamato, saikrishnag, vadim.fedorenko, przemyslaw.kitszel,
ecree.xilinx, rmk+kernel, mengyuanlou
On Thu, 10 Apr 2025 15:44:55 +0800 Jiawen Wu wrote:
> + if (ti->type != UDP_TUNNEL_TYPE_VXLAN &&
> + ti->type != UDP_TUNNEL_TYPE_VXLAN_GPE &&
> + ti->type != UDP_TUNNEL_TYPE_GENEVE)
> + return -EINVAL;
Why are you doing this validation?
> + switch (ti->type) {
> + case UDP_TUNNEL_TYPE_VXLAN:
> + if (txgbe->vxlan_port != ti->port) {
> + wx_err(wx, "VXLAN port %d not found\n", ti->port);
> + return -EINVAL;
> + }
And what is this check for? Is the core code calling your driver with
incorrect info? Please don't do this sort of defensive programming.
This patch is >50% pointless checks :(
> + txgbe->vxlan_port = 0;
> + break;
> + case UDP_TUNNEL_TYPE_VXLAN_GPE:
> + if (txgbe->vxlan_gpe_port != ti->port) {
> + wx_err(wx, "VXLAN-GPE port %d not found\n", ti->port);
> + return -EINVAL;
> + }
> +
> + txgbe->vxlan_gpe_port = 0;
> + break;
> + case UDP_TUNNEL_TYPE_GENEVE:
> + if (txgbe->geneve_port != ti->port) {
> + wx_err(wx, "GENEVE port %d not found\n", ti->port);
> + return -EINVAL;
> + }
> +
> + txgbe->geneve_port = 0;
> + break;
> + default:
> + return -EINVAL;
Also pointless. Unless you can show me in the core how it could
possibly call your driver with a table type that you didn't declare as
supported.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-11 23:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 7:44 [PATCH net-next 0/2] Implement udp tunnel port for txgbe Jiawen Wu
2025-04-10 7:44 ` [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port Jiawen Wu
2025-04-11 13:49 ` Michal Kubiak
2025-04-11 23:22 ` Jakub Kicinski
2025-04-10 7:44 ` [PATCH net-next 2/2] net: wangxun: restrict feature flags for tunnel packets Jiawen Wu
2025-04-11 13:52 ` Michal Kubiak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).