On 2021/5/27 8:00, Jakub Kicinski wrote:
On Wed, 26 May 2021 17:27:40 +0800 Huazhong Tan wrote:
Currently, there many drivers who support CQE mode configuration,
some configure it as a fixed when initialized, some provide an
interface to change it by ethtool private flags. In order make it
more generic, add 'ETHTOOL_A_COALESCE_USE_CQE_TX' and
'ETHTOOL_A_COALESCE_USE_CQE_RX' attribute and expand struct
kernel_ethtool_coalesce with use_cqe_mode_tx and use_cqe_mode_rx,
then these parameters can be accessed by ethtool netlink coalesce
uAPI.
Signed-off-by: Huazhong Tan <tanhuazhong@xxxxxxxxxx>
diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
index 25131df..975394e 100644
--- a/Documentation/networking/ethtool-netlink.rst
+++ b/Documentation/networking/ethtool-netlink.rst
@@ -937,6 +937,8 @@ Kernel response contents:
``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx
``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx
``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
+ ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool Tx CQE mode
+ ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool Rx CQE mode
=========================================== ====== =======================
Attributes are only included in reply if their value is not zero or the
@@ -975,6 +977,8 @@ Request contents:
``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx
``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx
``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
+ ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool Tx CQE mode
+ ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool Rx CQE mode
=========================================== ====== =======================
Request is rejected if it attributes declared as unsupported by driver (i.e.
You need to thoroughly document the semantics. Can you point us to
which drivers/devices implement similar modes of operation (if they
exist we need to make sure semantics match)?
Ok, will complement the semantics.
Currently, only mlx5 provides a interface to update
this mode through ethtool priv-flag. other drivers like
broadcom and ice just use a fixed EQE and do not have
update interface.
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 1030540..9d0a386 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -179,6 +179,8 @@ __ethtool_get_link_ksettings(struct net_device *dev,
struct kernel_ethtool_coalesce {
struct ethtool_coalesce base;
+ __u32 use_cqe_mode_tx;
+ __u32 use_cqe_mode_rx;
No __ in front, this is not a user space structure.
Why not bool or a bitfield?
bool is enough, __u32 is used here to be consistent with
fields in struct ethtool_coalesce.
This seems unnecessary?
};
/**
@@ -216,6 +223,8 @@ const struct nla_policy ethnl_coalesce_set_policy[] = {
[ETHTOOL_A_COALESCE_TX_USECS_HIGH] = { .type = NLA_U32 },
[ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH] = { .type = NLA_U32 },
[ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL] = { .type = NLA_U32 },
+ [ETHTOOL_A_COALESCE_USE_CQE_MODE_TX] = { .type = NLA_U8 },
+ [ETHTOOL_A_COALESCE_USE_CQE_MODE_RX] = { .type = NLA_U8 },
This needs a policy to make sure values are <= 1.
.