From: Jakub Kicinski <kuba@kernel.org>
To: Shay Drory <shayd@nvidia.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<danielj@nvidia.com>, <yishaih@nvidia.com>, <jiri@nvidia.com>,
<saeedm@nvidia.com>, <parav@nvidia.com>
Subject: Re: [PATCH net-next V2 4/8] devlink: Expose port function commands to control RoCE
Date: Fri, 2 Dec 2022 10:56:28 -0800 [thread overview]
Message-ID: <20221202105628.3a16029a@kernel.org> (raw)
In-Reply-To: <20221202082622.57765-5-shayd@nvidia.com>
On Fri, 2 Dec 2022 10:26:18 +0200 Shay Drory wrote:
> Expose port function commands to enable / disable RoCE, this is used to
> control the port RoCE device capabilities.
> @@ -122,6 +122,9 @@ A user may set the hardware address of the function using
> 'devlink port function set hw_addr' command. For Ethernet port function
> this means a MAC address.
>
> +Users may also set the RoCE capability of the function using
> +'devlink port function set roce' command.
nit: use backticks (`) for better highlight?
> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
> index 70191d96af89..830f8ffd69d1 100644
> --- a/include/uapi/linux/devlink.h
> +++ b/include/uapi/linux/devlink.h
> @@ -658,11 +658,23 @@ enum devlink_resource_unit {
> DEVLINK_RESOURCE_UNIT_ENTRY,
> };
>
> +enum devlink_port_fn_attr_cap {
> + DEVLINK_PORT_FN_ATTR_CAP_ROCE,
> +
> + /* Add new caps above */
> + __DEVLINK_PORT_FN_ATTR_CAPS_MAX,
> + DEVLINK_PORT_FN_ATTR_CAPS_MAX = __DEVLINK_PORT_FN_ATTR_CAPS_MAX - 1
Is DEVLINK_PORT_FN_ATTR_CAPS_MAX actually needed?
This is a bit list, not an attribute list, don't copy the format
of netlink attribute definition without a reason.
> +};
> +
> +#define DEVLINK_PORT_FN_ATTR_CAPS_VALID_MASK \
> + (_BITUL(__DEVLINK_PORT_FN_ATTR_CAPS_MAX) - 1)
This does not belong in the uAPI. User space has to discover the mask
at runtime via a policy dump, anyway.
> + [DEVLINK_PORT_FN_ATTR_CAPS] =
> + NLA_POLICY_BITFIELD32(DEVLINK_PORT_FN_ATTR_CAPS_VALID_MASK),
Why is there _ATTR in the name of the CAPS mask?
> };
>
> static const struct nla_policy devlink_selftest_nl_policy[DEVLINK_ATTR_SELFTEST_ID_MAX + 1] = {
> @@ -692,6 +694,64 @@ devlink_sb_tc_index_get_from_attrs(struct devlink_sb *devlink_sb,
> return 0;
> }
>
> +#define DEVLINK_PORT_FN_CAP(_name) \
> + BIT(DEVLINK_PORT_FN_ATTR_CAP_##_name)
No, just work harder to make the name concise :/
Not being able to grep or ctag uses of a value is a huge PITA during
code reviews.
> +#define DEVLINK_PORT_FN_SET_CAP(caps, cap, enable) \
> + do { \
> + typeof(cap) cap_ = (cap); \
> + typeof(caps) caps_ = (caps); \
> + (caps_)->selector |= cap_; \
> + if (enable) \
> + (caps_)->value |= cap_; \
> + } while (0)
I think you can code this up as a function instead of a macro.
next prev parent reply other threads:[~2022-12-02 18:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 8:26 [PATCH net-next V2 0/8] devlink: Add port function attribute to enable/disable Roce and migratable Shay Drory
2022-12-02 8:26 ` [PATCH net-next V2 1/8] net/mlx5: Introduce IFC bits for migratable Shay Drory
2022-12-02 8:26 ` [PATCH net-next V2 2/8] devlink: Validate port function request Shay Drory
2022-12-02 18:42 ` Jakub Kicinski
2022-12-02 8:26 ` [PATCH net-next V2 3/8] devlink: Move devlink port function hw_addr attr documentation Shay Drory
2022-12-02 8:26 ` [PATCH net-next V2 4/8] devlink: Expose port function commands to control RoCE Shay Drory
2022-12-02 18:56 ` Jakub Kicinski [this message]
2022-12-02 8:26 ` [PATCH net-next V2 5/8] net/mlx5: Add generic getters for other functions caps Shay Drory
2022-12-02 8:26 ` [PATCH net-next V2 6/8] net/mlx5: E-Switch, Implement devlink port function cmds to control RoCE Shay Drory
2022-12-02 8:26 ` [PATCH net-next V2 7/8] devlink: Expose port function commands to control migratable Shay Drory
2022-12-02 9:02 ` Jiri Pirko
2022-12-02 18:39 ` Jakub Kicinski
2022-12-04 9:31 ` Shay Drory
2022-12-02 17:26 ` kernel test robot
2022-12-02 18:58 ` Jakub Kicinski
2022-12-02 8:26 ` [PATCH net-next V2 8/8] net/mlx5: E-Switch, Implement devlink port function cmds " Shay Drory
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=20221202105628.3a16029a@kernel.org \
--to=kuba@kernel.org \
--cc=danielj@nvidia.com \
--cc=davem@davemloft.net \
--cc=jiri@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=parav@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.com \
--cc=yishaih@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.