From: Jakub Kicinski <kuba@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
horms@kernel.org, dlemoal@kernel.org, jdamato@fastly.com,
saikrishnag@marvell.com, vadim.fedorenko@linux.dev,
przemyslaw.kitszel@intel.com, ecree.xilinx@gmail.com,
rmk+kernel@armlinux.org.uk, mengyuanlou@net-swift.com
Subject: Re: [PATCH net-next 1/2] net: txgbe: Support to set UDP tunnel port
Date: Fri, 11 Apr 2025 16:22:19 -0700 [thread overview]
Message-ID: <20250411162219.13a0ed22@kernel.org> (raw)
In-Reply-To: <20250410074456.321847-2-jiawenwu@trustnetic.com>
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
next prev parent reply other threads:[~2025-04-11 23:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250411162219.13a0ed22@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dlemoal@kernel.org \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=jiawenwu@trustnetic.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=saikrishnag@marvell.com \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).