Message ID | 20211030005408.13932-2-decui@microsoft.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6c7ea69653e4e5f5faf800cbf51d2285de12e17f |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: mana: some misc patches | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Series has a cover letter |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 1 maintainers not CCed: sthemmin@microsoft.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | No Fixes tag |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | No static functions without inline keyword in header files |
> -----Original Message----- > From: Dexuan Cui <decui@microsoft.com> > Sent: Friday, October 29, 2021 8:54 PM > To: davem@davemloft.net; kuba@kernel.org; gustavoars@kernel.org; Haiyang > Zhang <haiyangz@microsoft.com>; netdev@vger.kernel.org > Cc: KY Srinivasan <kys@microsoft.com>; stephen@networkplumber.org; > wei.liu@kernel.org; linux-kernel@vger.kernel.org; linux- > hyperv@vger.kernel.org; Shachar Raindel <shacharr@microsoft.com>; Paul > Rosswurm <paulros@microsoft.com>; olaf@aepfle.de; vkuznets > <vkuznets@redhat.com>; Dexuan Cui <decui@microsoft.com> > 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 <decui@microsoft.com> > --- > 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 <haiyangz@microsoft.com>
On Fri, 29 Oct 2021 17:54:05 -0700 Dexuan Cui <decui@microsoft.com> 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 <stephen@networkplumber.org> > Sent: Saturday, October 30, 2021 1:07 PM > > On Fri, 29 Oct 2021 17:54:05 -0700 > Dexuan Cui <decui@microsoft.com> 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; }
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; }
Use the correct port index rather than 0. Signed-off-by: Dexuan Cui <decui@microsoft.com> --- drivers/net/ethernet/microsoft/mana/mana_en.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)