Use the correct port index rather than 0.
Signed-off-by: Dexuan Cui <[email protected]>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 1417d1e72b7b..4ff5a1fc506f 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1599,7 +1599,8 @@ static int mana_init_port(struct net_device *ndev)
err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
&num_indirect_entries);
if (err) {
- netdev_err(ndev, "Failed to query info for vPort 0\n");
+ netdev_err(ndev, "Failed to query info for vPort %d\n",
+ port_idx);
goto reset_apc;
}
--
2.17.1
> -----Original Message-----
> From: Dexuan Cui <[email protected]>
> Sent: Friday, October 29, 2021 8:54 PM
> To: [email protected]; [email protected]; [email protected]; Haiyang
> Zhang <[email protected]>; [email protected]
> Cc: KY Srinivasan <[email protected]>; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; Shachar Raindel <[email protected]>; Paul
> Rosswurm <[email protected]>; [email protected]; vkuznets
> <[email protected]>; Dexuan Cui <[email protected]>
> Subject: [PATCH net-next 1/4] net: mana: Fix the netdev_err()'s vPort
> argument in mana_init_port()
>
> Use the correct port index rather than 0.
>
> Signed-off-by: Dexuan Cui <[email protected]>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c
> b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 1417d1e72b7b..4ff5a1fc506f 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -1599,7 +1599,8 @@ static int mana_init_port(struct net_device *ndev)
> err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
> &num_indirect_entries);
> if (err) {
> - netdev_err(ndev, "Failed to query info for vPort 0\n");
> + netdev_err(ndev, "Failed to query info for vPort %d\n",
> + port_idx);
Reviewed-by: Haiyang Zhang <[email protected]>
On Fri, 29 Oct 2021 17:54:05 -0700
Dexuan Cui <[email protected]> wrote:
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 1417d1e72b7b..4ff5a1fc506f 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -1599,7 +1599,8 @@ static int mana_init_port(struct net_device *ndev)
> err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
> &num_indirect_entries);
> if (err) {
> - netdev_err(ndev, "Failed to query info for vPort 0\n");
> + netdev_err(ndev, "Failed to query info for vPort %d\n",
> + port_idx);
Shouldn't port_idx have been unsigned or u16?
It is u16 in mana_port_context.
> From: Stephen Hemminger <[email protected]>
> Sent: Saturday, October 30, 2021 1:07 PM
>
> On Fri, 29 Oct 2021 17:54:05 -0700
> Dexuan Cui <[email protected]> wrote:
>
> > diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c
> b/drivers/net/ethernet/microsoft/mana/mana_en.c
> > index 1417d1e72b7b..4ff5a1fc506f 100644
> > --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> > +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> > @@ -1599,7 +1599,8 @@ static int mana_init_port(struct net_device *ndev)
> > err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
> > &num_indirect_entries);
> > if (err) {
> > - netdev_err(ndev, "Failed to query info for vPort 0\n");
> > + netdev_err(ndev, "Failed to query info for vPort %d\n",
> > + port_idx);
>
> Shouldn't port_idx have been unsigned or u16?
> It is u16 in mana_port_context.
Thanks! I'll use "u32" and "%u" here.
I'll post v2 like the below. Please let me know if any further change is needed.
diff --git a/drivers/net/ethernet/microsoft/mana/mana.h b/drivers/net/ethernet/microsoft/mana/mana.h
index fc98a5ba5ed0..0a4246646447 100644
--- a/drivers/net/ethernet/microsoft/mana/mana.h
+++ b/drivers/net/ethernet/microsoft/mana/mana.h
@@ -359,6 +359,9 @@ struct mana_port_context {
mana_handle_t port_handle;
+ /* This doesn't have to be u32, because the max_num_vports is u16:
+ * see mana_query_device_cfg().
+ */
u16 port_idx;
bool port_is_up;
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 1417d1e72b7b..b495e9a20324 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -479,6 +479,9 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
return 0;
}
+/* The range of the 'vport_index' parameter is actually only u16, but since
+ * the PF driver defines req.vport_index as u32, we also use u32 here.
+ */
static int mana_query_vport_cfg(struct mana_port_context *apc, u32 vport_index,
u32 *max_sq, u32 *max_rq, u32 *num_indir_entry)
{
@@ -1588,7 +1591,7 @@ static int mana_init_port(struct net_device *ndev)
{
struct mana_port_context *apc = netdev_priv(ndev);
u32 max_txq, max_rxq, max_queues;
- int port_idx = apc->port_idx;
+ u32 port_idx = apc->port_idx;
u32 num_indirect_entries;
int err;
@@ -1599,7 +1602,8 @@ static int mana_init_port(struct net_device *ndev)
err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
&num_indirect_entries);
if (err) {
- netdev_err(ndev, "Failed to query info for vPort 0\n");
+ netdev_err(ndev, "Failed to query info for vPort %u\n",
+ port_idx);
goto reset_apc;
}