[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200701115126.4ba0915a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 1 Jul 2020 11:51:26 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Ido Schimmel <idosch@...sch.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
michael.chan@...adcom.com, jeffrey.t.kirsher@...el.com,
saeedm@...lanox.com, leon@...nel.org, jiri@...lanox.com,
snelson@...sando.io, andrew@...n.ch, vivien.didelot@...il.com,
f.fainelli@...il.com, danieller@...lanox.com, mlxsw@...lanox.com,
Ido Schimmel <idosch@...lanox.com>
Subject: Re: [PATCH net-next v2 3/9] devlink: Replace devlink_port_attrs_set
parameters with a struct
On Wed, 1 Jul 2020 17:32:45 +0300 Ido Schimmel wrote:
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> index 2bd610fafc58..3af4e7397263 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> @@ -691,6 +691,9 @@ static void bnxt_dl_params_unregister(struct bnxt *bp)
>
> int bnxt_dl_register(struct bnxt *bp)
> {
> + struct devlink_port_attrs attrs = {};
> + const unsigned char *switch_id;
> + unsigned char switch_id_len;
> struct devlink *dl;
> int rc;
>
> @@ -719,9 +722,13 @@ int bnxt_dl_register(struct bnxt *bp)
> if (!BNXT_PF(bp))
> return 0;
>
> - devlink_port_attrs_set(&bp->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
> - bp->pf.port_id, false, 0, bp->dsn,
> - sizeof(bp->dsn));
> + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
> + attrs.phys.port_number = bp->pf.port_id;
> + switch_id = bp->dsn;
> + switch_id_len = sizeof(bp->dsn);
Why do you create those local variables everywhere?
> + memcpy(attrs.switch_id.id, switch_id, switch_id_len);
> + attrs.switch_id.id_len = switch_id_len;
> + devlink_port_attrs_set(&bp->dl_port, &attrs);
> rc = devlink_port_register(dl, &bp->dl_port, bp->pf.port_id);
> if (rc) {
> netdev_err(bp->dev, "devlink_port_register failed\n");
Powered by blists - more mailing lists