From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
edumazet@google.com, leon@kernel.org, saeedm@nvidia.com,
moshe@nvidia.com, jesse.brandeburg@intel.com,
anthony.l.nguyen@intel.com, tariqt@nvidia.com, idosch@nvidia.com,
petrm@nvidia.com, simon.horman@corigine.com,
ecree.xilinx@gmail.com, habetsm.xilinx@gmail.com,
michal.wilczynski@intel.com, jacob.e.keller@intel.com
Subject: Re: [patch net-next v2 14/15] devlink: move port_del() to devlink_port_ops
Date: Tue, 30 May 2023 10:34:00 -0700 [thread overview]
Message-ID: <20230530103400.3d0be965@kernel.org> (raw)
In-Reply-To: <ZHWep0dU9gCGJW0d@nanopsycho>
On Tue, 30 May 2023 08:58:47 +0200 Jiri Pirko wrote:
> >> .port_fn_hw_addr_get = mlx5_devlink_port_fn_hw_addr_get,
> >> .port_fn_hw_addr_set = mlx5_devlink_port_fn_hw_addr_set,
> >> .port_fn_roce_get = mlx5_devlink_port_fn_roce_get,
> >
> >Is it okay if we deferred the port_del() patch until there's some
> >clear benefit?
>
> Well actually, there is a clear benefit even in this patchset:
>
> We have 2 flavours of ports each with different ops in mlx5:
> VF:
> static const struct devlink_port_ops mlx5_esw_dl_port_ops = {
> .port_fn_hw_addr_get = mlx5_devlink_port_fn_hw_addr_get,
> .port_fn_hw_addr_set = mlx5_devlink_port_fn_hw_addr_set,
> .port_fn_roce_get = mlx5_devlink_port_fn_roce_get,
> .port_fn_roce_set = mlx5_devlink_port_fn_roce_set,
> .port_fn_migratable_get = mlx5_devlink_port_fn_migratable_get,
> .port_fn_migratable_set = mlx5_devlink_port_fn_migratable_set,
> };
>
> SF:
> static const struct devlink_port_ops mlx5_esw_dl_sf_port_ops = {
> .port_del = mlx5_devlink_sf_port_del,
> .port_fn_hw_addr_get = mlx5_devlink_port_fn_hw_addr_get,
> .port_fn_hw_addr_set = mlx5_devlink_port_fn_hw_addr_set,
> .port_fn_roce_get = mlx5_devlink_port_fn_roce_get,
> .port_fn_roce_set = mlx5_devlink_port_fn_roce_set,
> .port_fn_state_get = mlx5_devlink_sf_port_fn_state_get,
> .port_fn_state_set = mlx5_devlink_sf_port_fn_state_set,
> };
>
> You can see that the port_del() op is supported only on the SF flavour.
> VF does not support it and therefore port_del() is not defined on it.
This is what I started thinking as well yesterday. Is there any reason
to delete a port which isn't an SF? Similarly - is there any reason to
delete a port which wasn't allocated via port_new?
> Without this patch, I would have to have a helper
> mlx5_devlink_port_del() that would check if the port is SF and call
> mlx5_devlink_sf_port_del() in that case. This patch reduces the
> boilerplate.
... Because if port_del can only happen on port_new'd ports, we should
try to move that check into the core. It'd prevent misuse of the API.
> Btw if you look at the cmd line api, it also aligns:
> $ devlink port add pci/0000:08:00.0 flavour pcisf pfnum 0 sfnum 101
> pci/0000:08:00.0/32768: type eth netdev eth4 flavour pcisf controller 0 pfnum 0 sfnum 101 splittable false
> function:
> hw_addr 00:00:00:00:00:00 state inactive opstate detached
> $ devlink port del pci/0000:08:00.0/32768
>
> You use pci/0000:08:00.0/32768 as a delete handle.
>
> port_del() is basically an object destructor. Would it perhaps help to
> rename is to .port_destructor()? That would somehow ease the asymmetry
> :) IDK. I would leave the name as it is a and move to port_ops.
Meh.
next prev parent reply other threads:[~2023-05-30 17:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 10:28 [patch net-next v2 00/15] devlink: move port ops into separate structure Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 01/15] devlink: introduce port ops placeholder Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 02/15] ice: register devlink port for PF with ops Jiri Pirko
2023-05-26 10:52 ` Wilczynski, Michal
2023-05-26 11:35 ` Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 03/15] mlxsw_core: register devlink port " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 04/15] nfp: devlink: " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 05/15] devlink: move port_split/unsplit() ops into devlink_port_ops Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 06/15] mlx4: register devlink port with ops Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 07/15] devlink: move port_type_set() op into devlink_port_ops Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 08/15] sfc: register devlink port with ops Jiri Pirko
2023-05-30 8:02 ` Martin Habets
2023-05-26 10:28 ` [patch net-next v2 09/15] mlx5: register devlink ports " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 10/15] devlink: move port_fn_hw_addr_get/set() to devlink_port_ops Jiri Pirko
2023-05-30 8:03 ` Martin Habets
2023-05-26 10:28 ` [patch net-next v2 11/15] devlink: move port_fn_roce_get/set() " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 12/15] devlink: move port_fn_migratable_get/set() " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 13/15] devlink: move port_fn_state_get/set() " Jiri Pirko
2023-05-26 10:28 ` [patch net-next v2 14/15] devlink: move port_del() " Jiri Pirko
2023-05-27 4:10 ` Jakub Kicinski
2023-05-27 7:42 ` Jiri Pirko
2023-05-29 6:33 ` Jakub Kicinski
2023-05-29 8:31 ` Jiri Pirko
2023-05-30 1:41 ` Jakub Kicinski
2023-05-30 6:33 ` Jiri Pirko
2023-05-30 6:58 ` Jiri Pirko
2023-05-30 17:34 ` Jakub Kicinski [this message]
2023-05-31 6:33 ` Jiri Pirko
2023-06-01 22:16 ` Jacob Keller
2023-05-26 10:28 ` [patch net-next v2 15/15] devlink: save devlink_port_ops into a variable in devlink_port_function_validate() Jiri Pirko
2023-05-30 18:00 ` [patch net-next v2 00/15] devlink: move port ops into separate structure patchwork-bot+netdevbpf
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=20230530103400.3d0be965@kernel.org \
--to=kuba@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=habetsm.xilinx@gmail.com \
--cc=idosch@nvidia.com \
--cc=jacob.e.keller@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=jiri@resnulli.us \
--cc=leon@kernel.org \
--cc=michal.wilczynski@intel.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=simon.horman@corigine.com \
--cc=tariqt@nvidia.com \
/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).