[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520091605.x25ak23noxpcahnl@skbuf>
Date: Fri, 20 May 2022 09:16:06 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"jhs@...atatu.com" <jhs@...atatu.com>,
"xiyou.wangcong@...il.com" <xiyou.wangcong@...il.com>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"davem@...emloft.net" <davem@...emloft.net>,
Po Liu <po.liu@....com>,
"boon.leong.ong@...el.com" <boon.leong.ong@...el.com>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
Subject: Re: [PATCH net-next v5 02/11] ethtool: Add support for Frame
Preemption verification
On Thu, May 19, 2022 at 06:15:29PM -0700, Vinicius Costa Gomes wrote:
> Expose the ethtool parameters to the PREEMPT_SET/_GET commands
> necessary to support the verification procedure as defined by IEEE
> 802.3-2018.
>
> These include the 'verified' bit to indicate that the verification
> dialog has concluded successfully with the link partner and frame
> preemption is supported. There's also the 'disable_verify' config to
> disable initiating the verification dialog.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>
> ---
> Documentation/networking/ethtool-netlink.rst | 3 +++
> include/linux/ethtool.h | 3 +++
> include/uapi/linux/ethtool_netlink.h | 2 ++
> net/ethtool/netlink.h | 2 +-
> net/ethtool/preempt.c | 11 +++++++++++
> 5 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
> index 15d7c025cc4e..1731e7ad9ee7 100644
> --- a/Documentation/networking/ethtool-netlink.rst
> +++ b/Documentation/networking/ethtool-netlink.rst
> @@ -1646,6 +1646,8 @@ Kernel response contents:
> ``ETHTOOL_A_PREEMPT_ENABLED`` bool frame preemption enabled
> ``ETHTOOL_A_PREEMPT_PREEMPTIBLE_MASK`` bitset preemptible queue mask
> ``ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE`` u32 Min additional frag size
> + ``ETHTOOL_A_PREEMPT_DISABLE_VERIFY`` u32 disable verification
> + ``ETHTOOL_A_PREEMPT_VERIFIED`` u32 verification procedure
> ====================================== ====== ==========================
>
> ``ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE`` configures the minimum non-final
> @@ -1667,6 +1669,7 @@ Request contents:
> ``ETHTOOL_A_PREEMPT_ENABLED`` bool frame preemption enabled
> ``ETHTOOL_A_PREEMPT_PREEMPTIBLE_MASK`` bitset preemptible queue mask
> ``ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE`` u32 Min additional frag size
> + ``ETHTOOL_A_PREEMPT_DISABLE_VERIFY`` bool disable verification
> ====================================== ====== ==========================
>
> ``ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE`` configures the minimum non-final
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 42570ec8ee44..5600a7610fa1 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -13,6 +13,7 @@
> #ifndef _LINUX_ETHTOOL_H
> #define _LINUX_ETHTOOL_H
>
> +#include "asm-generic/int-ll64.h"
Why this header, and why now?
> #include <linux/bitmap.h>
> #include <linux/compat.h>
> #include <linux/netlink.h>
> @@ -464,6 +465,8 @@ struct ethtool_module_power_mode_params {
> struct ethtool_fp {
> u32 enabled;
> u32 preemptible_mask;
> + u32 disable_verify;
> + u32 verified;
> u32 add_frag_size;
> };
>
> diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h
> index 651c7af76776..27c9bc5bfa51 100644
> --- a/include/uapi/linux/ethtool_netlink.h
> +++ b/include/uapi/linux/ethtool_netlink.h
> @@ -709,6 +709,8 @@ enum {
> ETHTOOL_A_PREEMPT_ENABLED, /* u8 */
> ETHTOOL_A_PREEMPT_PREEMPTIBLE_MASK, /* bitset */
> ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE, /* u32 */
> + ETHTOOL_A_PREEMPT_DISABLE_VERIFY, /* u8 */
> + ETHTOOL_A_PREEMPT_VERIFIED, /* u8 */
Clause 30.14.1.2 aMACMergeStatusVerify talks about a state machine with
more than 2 states (verified and not verified):
An ENUMERATED VALUE that has one of the following entries:
unknown: verification status is unknown
initial: the Verify State diagram (Figure 99-8) is in the state INIT_VERIFICATION
verifying: the Verify State diagram is in the state VERIFICATION_IDLE, SEND_VERIFY or WAIT_FOR_RESPONSE
succeeded: indicates that the Verify State diagram is in the state VERIFIED
failed: the Verify State diagram is in the state VERIFY_FAIL
disabled: verification of preemption operation is disabled
BEHAVIOUR DEFINED AS:
This attribute indicates (when accessed via a GET operation) the status of the MAC Merge
sublayer verification on the given device. The SET operation shall have no effect on a device.
Could we have an enum here with all the states?
>
> /* add new constants above here */
> __ETHTOOL_A_PREEMPT_CNT,
> diff --git a/net/ethtool/netlink.h b/net/ethtool/netlink.h
> index 444799f3e91a..dfdef5b8fe5b 100644
> --- a/net/ethtool/netlink.h
> +++ b/net/ethtool/netlink.h
> @@ -381,7 +381,7 @@ extern const struct nla_policy ethnl_fec_get_policy[ETHTOOL_A_FEC_HEADER + 1];
> extern const struct nla_policy ethnl_fec_set_policy[ETHTOOL_A_FEC_AUTO + 1];
> extern const struct nla_policy ethnl_module_eeprom_get_policy[ETHTOOL_A_MODULE_EEPROM_I2C_ADDRESS + 1];
> extern const struct nla_policy ethnl_preempt_get_policy[ETHTOOL_A_PREEMPT_HEADER + 1];
> -extern const struct nla_policy ethnl_preempt_set_policy[ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE + 1];
> +extern const struct nla_policy ethnl_preempt_set_policy[ETHTOOL_A_PREEMPT_VERIFIED + 1];
> extern const struct nla_policy ethnl_stats_get_policy[ETHTOOL_A_STATS_GROUPS + 1];
> extern const struct nla_policy ethnl_phc_vclocks_get_policy[ETHTOOL_A_PHC_VCLOCKS_HEADER + 1];
> extern const struct nla_policy ethnl_module_get_policy[ETHTOOL_A_MODULE_HEADER + 1];
> diff --git a/net/ethtool/preempt.c b/net/ethtool/preempt.c
> index 0000ba8cb90c..7566ffb948b2 100644
> --- a/net/ethtool/preempt.c
> +++ b/net/ethtool/preempt.c
> @@ -63,6 +63,8 @@ static int preempt_reply_size(const struct ethnl_req_info *req_base,
>
> len += nla_total_size(sizeof(u8)); /* _PREEMPT_ENABLED */
> len += nla_total_size(sizeof(u32)); /* _PREEMPT_ADD_FRAG_SIZE */
> + len += nla_total_size(sizeof(u8)); /* _PREEMPT_DISABLE_VERIFY */
> + len += nla_total_size(sizeof(u8)); /* _PREEMPT_VERIFIED */
>
> return len;
> }
> @@ -89,6 +91,12 @@ static int preempt_fill_reply(struct sk_buff *skb,
> if (ret < 0)
> return ret;
>
> + if (nla_put_u32(skb, ETHTOOL_A_PREEMPT_DISABLE_VERIFY, preempt->disable_verify))
> + return -EMSGSIZE;
> +
> + if (nla_put_u32(skb, ETHTOOL_A_PREEMPT_VERIFIED, preempt->verified))
> + return -EMSGSIZE;
> +
> return 0;
> }
>
> @@ -110,6 +118,7 @@ ethnl_preempt_set_policy[ETHTOOL_A_PREEMPT_MAX + 1] = {
> [ETHTOOL_A_PREEMPT_ENABLED] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
> [ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE] = { .type = NLA_U32 },
> [ETHTOOL_A_PREEMPT_PREEMPTIBLE_MASK] = { .type = NLA_NESTED },
> + [ETHTOOL_A_PREEMPT_DISABLE_VERIFY] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
> };
>
> int ethnl_set_preempt(struct sk_buff *skb, struct genl_info *info)
> @@ -155,6 +164,8 @@ int ethnl_set_preempt(struct sk_buff *skb, struct genl_info *info)
> tb[ETHTOOL_A_PREEMPT_ENABLED], &mod);
> ethnl_update_u32(&preempt.add_frag_size,
> tb[ETHTOOL_A_PREEMPT_ADD_FRAG_SIZE], &mod);
> + ethnl_update_bool32(&preempt.disable_verify,
> + tb[ETHTOOL_A_PREEMPT_DISABLE_VERIFY], &mod);
> ret = 0;
> if (!mod)
> goto out_ops;
> --
> 2.35.3
>
Powered by blists - more mailing lists