* [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks
@ 2023-12-06 15:12 Louis Peens
2023-12-06 15:12 ` [PATCH net-next 1/2] nfp: ethtool: add extended ack report messages Louis Peens
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Louis Peens @ 2023-12-06 15:12 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni; +Cc: Ryno Swart, netdev, oss-drivers
This is a mostly cosmetic series to add error messages to devlink and
ethtool callbacks which supports them but did not have them added in the
nfp driver yet.
Ryno Swart (2):
nfp: ethtool: add extended ack report messages
nfp: devlink: add extended ack report messages
.../net/ethernet/netronome/nfp/nfp_devlink.c | 8 ++-
drivers/net/ethernet/netronome/nfp/nfp_net.h | 4 +-
.../ethernet/netronome/nfp/nfp_net_common.c | 6 ++-
.../ethernet/netronome/nfp/nfp_net_ethtool.c | 53 ++++++++++++++-----
4 files changed, 51 insertions(+), 20 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] nfp: ethtool: add extended ack report messages
2023-12-06 15:12 [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks Louis Peens
@ 2023-12-06 15:12 ` Louis Peens
2023-12-06 15:12 ` [PATCH net-next 2/2] nfp: devlink: " Louis Peens
2023-12-08 3:00 ` [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Louis Peens @ 2023-12-06 15:12 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni; +Cc: Ryno Swart, netdev, oss-drivers
From: Ryno Swart <ryno.swart@corigine.com>
Add descriptive error messages to common ethtool failures to be more
user friendly.
Update `nfp_net_coalesce_para_check` to only check one argument, which
facilitates unique error messages.
Additionally, three error codes are updated to `EOPNOTSUPP` to reflect
that these operations are not supported.
Signed-off-by: Ryno Swart <ryno.swart@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net.h | 4 +-
.../ethernet/netronome/nfp/nfp_net_common.c | 6 ++-
.../ethernet/netronome/nfp/nfp_net_ethtool.c | 53 ++++++++++++++-----
3 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h
index bd0e26524417..46764aeccb37 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h
@@ -966,9 +966,9 @@ static inline bool nfp_netdev_is_nfp_net(struct net_device *netdev)
netdev->netdev_ops == &nfp_nfdk_netdev_ops;
}
-static inline int nfp_net_coalesce_para_check(u32 usecs, u32 pkts)
+static inline int nfp_net_coalesce_para_check(u32 param)
{
- if ((usecs >= ((1 << 16) - 1)) || (pkts >= ((1 << 16) - 1)))
+ if (param >= ((1 << 16) - 1))
return -EINVAL;
return 0;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index ac1f4514b1d0..dcd27ba2a74c 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -1176,7 +1176,8 @@ static void nfp_net_rx_dim_work(struct work_struct *work)
* count.
*/
factor = nn->tlv_caps.me_freq_mhz / 16;
- if (nfp_net_coalesce_para_check(factor * moder.usec, moder.pkts))
+ if (nfp_net_coalesce_para_check(factor * moder.usec) ||
+ nfp_net_coalesce_para_check(moder.pkts))
return;
/* copy RX interrupt coalesce parameters */
@@ -1205,7 +1206,8 @@ static void nfp_net_tx_dim_work(struct work_struct *work)
* count.
*/
factor = nn->tlv_caps.me_freq_mhz / 16;
- if (nfp_net_coalesce_para_check(factor * moder.usec, moder.pkts))
+ if (nfp_net_coalesce_para_check(factor * moder.usec) ||
+ nfp_net_coalesce_para_check(moder.pkts))
return;
/* copy TX interrupt coalesce parameters */
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index 200b3588363c..f4f6153cae0f 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -633,7 +633,8 @@ static void nfp_net_get_ringparam(struct net_device *netdev,
ring->tx_pending = nn->dp.txd_cnt;
}
-static int nfp_net_set_ring_size(struct nfp_net *nn, u32 rxd_cnt, u32 txd_cnt)
+static int nfp_net_set_ring_size(struct nfp_net *nn, u32 rxd_cnt, u32 txd_cnt,
+ struct netlink_ext_ack *extack)
{
struct nfp_net_dp *dp;
@@ -644,7 +645,7 @@ static int nfp_net_set_ring_size(struct nfp_net *nn, u32 rxd_cnt, u32 txd_cnt)
dp->rxd_cnt = rxd_cnt;
dp->txd_cnt = txd_cnt;
- return nfp_net_ring_reconfig(nn, dp, NULL);
+ return nfp_net_ring_reconfig(nn, dp, extack);
}
static int nfp_net_set_ringparam(struct net_device *netdev,
@@ -657,7 +658,7 @@ static int nfp_net_set_ringparam(struct net_device *netdev,
/* We don't have separate queues/rings for small/large frames. */
if (ring->rx_mini_pending || ring->rx_jumbo_pending)
- return -EINVAL;
+ return -EOPNOTSUPP;
qc_min = nn->dev_info->min_qc_size;
qc_max = nn->dev_info->max_qc_size;
@@ -666,9 +667,15 @@ static int nfp_net_set_ringparam(struct net_device *netdev,
rxd_cnt = roundup_pow_of_two(ring->rx_pending);
txd_cnt = roundup_pow_of_two(ring->tx_pending);
- if (rxd_cnt < qc_min || rxd_cnt > qc_max ||
- txd_cnt < qc_min / tx_dpp || txd_cnt > qc_max / tx_dpp)
+ if (rxd_cnt < qc_min || rxd_cnt > qc_max) {
+ NL_SET_ERR_MSG_MOD(extack, "rx parameter out of bounds");
return -EINVAL;
+ }
+
+ if (txd_cnt < qc_min / tx_dpp || txd_cnt > qc_max / tx_dpp) {
+ NL_SET_ERR_MSG_MOD(extack, "tx parameter out of bounds");
+ return -EINVAL;
+ }
if (nn->dp.rxd_cnt == rxd_cnt && nn->dp.txd_cnt == txd_cnt)
return 0;
@@ -676,7 +683,7 @@ static int nfp_net_set_ringparam(struct net_device *netdev,
nn_dbg(nn, "Change ring size: RxQ %u->%u, TxQ %u->%u\n",
nn->dp.rxd_cnt, rxd_cnt, nn->dp.txd_cnt, txd_cnt);
- return nfp_net_set_ring_size(nn, rxd_cnt, txd_cnt);
+ return nfp_net_set_ring_size(nn, rxd_cnt, txd_cnt, extack);
}
static int nfp_test_link(struct net_device *netdev)
@@ -1866,7 +1873,7 @@ static int nfp_net_get_coalesce(struct net_device *netdev,
struct nfp_net *nn = netdev_priv(netdev);
if (!(nn->cap & NFP_NET_CFG_CTRL_IRQMOD))
- return -EINVAL;
+ return -EOPNOTSUPP;
ec->use_adaptive_rx_coalesce = nn->rx_coalesce_adapt_on;
ec->use_adaptive_tx_coalesce = nn->tx_coalesce_adapt_on;
@@ -2145,22 +2152,40 @@ static int nfp_net_set_coalesce(struct net_device *netdev,
*/
if (!(nn->cap & NFP_NET_CFG_CTRL_IRQMOD))
- return -EINVAL;
+ return -EOPNOTSUPP;
/* ensure valid configuration */
- if (!ec->rx_coalesce_usecs && !ec->rx_max_coalesced_frames)
+ if (!ec->rx_coalesce_usecs && !ec->rx_max_coalesced_frames) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "rx-usecs and rx-frames cannot both be zero");
return -EINVAL;
+ }
- if (!ec->tx_coalesce_usecs && !ec->tx_max_coalesced_frames)
+ if (!ec->tx_coalesce_usecs && !ec->tx_max_coalesced_frames) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "tx-usecs and tx-frames cannot both be zero");
return -EINVAL;
+ }
- if (nfp_net_coalesce_para_check(ec->rx_coalesce_usecs * factor,
- ec->rx_max_coalesced_frames))
+ if (nfp_net_coalesce_para_check(ec->rx_coalesce_usecs * factor)) {
+ NL_SET_ERR_MSG_MOD(extack, "rx-usecs too large");
return -EINVAL;
+ }
- if (nfp_net_coalesce_para_check(ec->tx_coalesce_usecs * factor,
- ec->tx_max_coalesced_frames))
+ if (nfp_net_coalesce_para_check(ec->rx_max_coalesced_frames)) {
+ NL_SET_ERR_MSG_MOD(extack, "rx-frames too large");
return -EINVAL;
+ }
+
+ if (nfp_net_coalesce_para_check(ec->tx_coalesce_usecs * factor)) {
+ NL_SET_ERR_MSG_MOD(extack, "tx-usecs too large");
+ return -EINVAL;
+ }
+
+ if (nfp_net_coalesce_para_check(ec->tx_max_coalesced_frames)) {
+ NL_SET_ERR_MSG_MOD(extack, "tx-frames too large");
+ return -EINVAL;
+ }
/* configuration is valid */
nn->rx_coalesce_adapt_on = !!ec->use_adaptive_rx_coalesce;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] nfp: devlink: add extended ack report messages
2023-12-06 15:12 [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks Louis Peens
2023-12-06 15:12 ` [PATCH net-next 1/2] nfp: ethtool: add extended ack report messages Louis Peens
@ 2023-12-06 15:12 ` Louis Peens
2023-12-08 3:00 ` [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Louis Peens @ 2023-12-06 15:12 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni; +Cc: Ryno Swart, netdev, oss-drivers
From: Ryno Swart <ryno.swart@corigine.com>
Add descriptive error messages to common devlink failures to
be more user friendly.
Signed-off-by: Ryno Swart <ryno.swart@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
---
drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
index 8c6954c58a88..635d33c0d6d3 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -75,8 +75,10 @@ nfp_devlink_port_split(struct devlink *devlink, struct devlink_port *port,
if (ret)
return ret;
- if (eth_port.port_lanes % count)
+ if (eth_port.port_lanes % count) {
+ NL_SET_ERR_MSG_MOD(extack, "invalid count");
return -EINVAL;
+ }
/* Special case the 100G CXP -> 2x40G split */
lanes = eth_port.port_lanes / count;
@@ -101,8 +103,10 @@ nfp_devlink_port_unsplit(struct devlink *devlink, struct devlink_port *port,
if (ret)
return ret;
- if (!eth_port.is_split)
+ if (!eth_port.is_split) {
+ NL_SET_ERR_MSG_MOD(extack, "port is not split");
return -EINVAL;
+ }
/* Special case the 100G CXP -> 2x40G unsplit */
lanes = eth_port.port_lanes;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks
2023-12-06 15:12 [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks Louis Peens
2023-12-06 15:12 ` [PATCH net-next 1/2] nfp: ethtool: add extended ack report messages Louis Peens
2023-12-06 15:12 ` [PATCH net-next 2/2] nfp: devlink: " Louis Peens
@ 2023-12-08 3:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-08 3:00 UTC (permalink / raw)
To: Louis Peens; +Cc: davem, kuba, pabeni, ryno.swart, netdev, oss-drivers
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 6 Dec 2023 17:12:07 +0200 you wrote:
> This is a mostly cosmetic series to add error messages to devlink and
> ethtool callbacks which supports them but did not have them added in the
> nfp driver yet.
>
> Ryno Swart (2):
> nfp: ethtool: add extended ack report messages
> nfp: devlink: add extended ack report messages
>
> [...]
Here is the summary with links:
- [net-next,1/2] nfp: ethtool: add extended ack report messages
https://git.kernel.org/netdev/net-next/c/b0318e285493
- [net-next,2/2] nfp: devlink: add extended ack report messages
https://git.kernel.org/netdev/net-next/c/2f076ea86674
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-08 3:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 15:12 [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks Louis Peens
2023-12-06 15:12 ` [PATCH net-next 1/2] nfp: ethtool: add extended ack report messages Louis Peens
2023-12-06 15:12 ` [PATCH net-next 2/2] nfp: devlink: " Louis Peens
2023-12-08 3:00 ` [PATCH net-next 0/2] nfp: add ext_ack messages to supported callbacks patchwork-bot+netdevbpf
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).