@@ -714,7 +714,7 @@ int bnxt_dl_register(struct bnxt *bp)
return 0;
devlink_port_attrs_set(&bp->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
- bp->pf.port_id, false, 0, bp->dsn,
+ bp->pf.port_id, false, 0, 0, bp->dsn,
sizeof(bp->dsn));
rc = devlink_port_register(dl, &bp->dl_port, bp->pf.port_id);
if (rc) {
@@ -297,7 +297,7 @@ int ice_devlink_create_port(struct ice_pf *pf)
}
devlink_port_attrs_set(&pf->devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
- pf->hw.pf_id, false, 0, NULL, 0);
+ pf->hw.pf_id, false, 0, 0, NULL, 0);
err = devlink_port_register(devlink, &pf->devlink_port, pf->hw.pf_id);
if (err) {
dev_err(dev, "devlink_port_register failed: %d\n", err);
@@ -11,12 +11,12 @@ int mlx5e_devlink_port_register(struct mlx5e_priv *priv)
devlink_port_attrs_set(&priv->dl_port,
DEVLINK_PORT_FLAVOUR_PHYSICAL,
PCI_FUNC(priv->mdev->pdev->devfn),
- false, 0,
+ false, 0, 0,
NULL, 0);
else
devlink_port_attrs_set(&priv->dl_port,
DEVLINK_PORT_FLAVOUR_VIRTUAL,
- 0, false, 0, NULL, 0);
+ 0, false, 0, 0, NULL, 0);
return devlink_port_register(devlink, &priv->dl_port, 1);
}
@@ -2050,7 +2050,7 @@ static int register_devlink_port(struct mlx5_core_dev *dev,
if (rep->vport == MLX5_VPORT_UPLINK)
devlink_port_attrs_set(&rpriv->dl_port,
DEVLINK_PORT_FLAVOUR_PHYSICAL,
- pfnum, false, 0,
+ pfnum, false, 0, 0,
&ppid.id[0], ppid.id_len);
else if (rep->vport == MLX5_VPORT_PF)
devlink_port_attrs_pci_pf_set(&rpriv->dl_port,
@@ -2134,7 +2134,7 @@ static int __mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
mlxsw_core_port->local_port = local_port;
devlink_port_attrs_set(devlink_port, flavour, port_number,
- split, split_port_subnumber,
+ split, split_port_subnumber, width,
switch_id, switch_id_len);
err = devlink_port_register(devlink, devlink_port, local_port);
if (err)
@@ -368,7 +368,7 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
serial_len = nfp_cpp_serial(port->app->cpp, &serial);
devlink_port_attrs_set(&port->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
eth_port.label_port, eth_port.is_split,
- eth_port.label_subport, serial, serial_len);
+ eth_port.label_subport, 0, serial, serial_len);
devlink = priv_to_devlink(app->pf);
@@ -82,7 +82,7 @@ int ionic_devlink_register(struct ionic *ionic)
return 0;
devlink_port_attrs_set(&ionic->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
- 0, false, 0, NULL, 0);
+ 0, false, 0, 0, NULL, 0);
err = devlink_port_register(dl, &ionic->dl_port, 0);
if (err)
dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
@@ -893,7 +893,7 @@ static int __nsim_dev_port_add(struct nsim_dev *nsim_dev,
devlink_port = &nsim_dev_port->devlink_port;
devlink_port_attrs_set(devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
- port_index + 1, 0, 0,
+ port_index + 1, 0, 0, 0,
nsim_dev->switch_id.id,
nsim_dev->switch_id.id_len);
err = devlink_port_register(priv_to_devlink(nsim_dev), devlink_port,
@@ -68,6 +68,7 @@ struct devlink_port_attrs {
u8 set:1,
split:1,
switch_port:1;
+ u32 width;
enum devlink_port_flavour flavour;
struct netdev_phys_item_id switch_id;
union {
@@ -972,6 +973,7 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
enum devlink_port_flavour flavour,
u32 port_number, bool split,
u32 split_subport_number,
+ u32 width,
const unsigned char *switch_id,
unsigned char switch_id_len);
void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port,
@@ -442,6 +442,8 @@ enum devlink_attr {
DEVLINK_ATTR_TRAP_POLICER_RATE, /* u64 */
DEVLINK_ATTR_TRAP_POLICER_BURST, /* u64 */
+ DEVLINK_ATTR_PORT_WIDTH, /* u32 */
+
/* add new attributes above here, update the policy in devlink.c */
__DEVLINK_ATTR_MAX,
@@ -526,6 +526,10 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
if (!attrs->set)
return 0;
+ if (attrs->width) {
+ if (nla_put_u32(msg, DEVLINK_ATTR_PORT_WIDTH, attrs->width))
+ return -EMSGSIZE;
+ }
if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour))
return -EMSGSIZE;
switch (devlink_port->attrs.flavour) {
@@ -7408,6 +7412,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port,
* @split: indicates if this is split port
* @split_subport_number: if the port is split, this is the number
* of subport.
+ * @width: width of the port. 0 value is not passed to netlink.
* @switch_id: if the port is part of switch, this is buffer with ID,
* otwerwise this is NULL
* @switch_id_len: length of the switch_id buffer
@@ -7416,6 +7421,7 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
enum devlink_port_flavour flavour,
u32 port_number, bool split,
u32 split_subport_number,
+ u32 width,
const unsigned char *switch_id,
unsigned char switch_id_len)
{
@@ -7427,6 +7433,7 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
if (ret)
return;
attrs->split = split;
+ attrs->width = width;
attrs->phys.port_number = port_number;
attrs->phys.split_subport_number = split_subport_number;
}
@@ -275,7 +275,7 @@ static int dsa_port_setup(struct dsa_port *dp)
case DSA_PORT_TYPE_CPU:
memset(dlp, 0, sizeof(*dlp));
devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_CPU,
- dp->index, false, 0, id, len);
+ dp->index, false, 0, 0, id, len);
err = devlink_port_register(dl, dlp, dp->index);
if (err)
break;
@@ -295,7 +295,7 @@ static int dsa_port_setup(struct dsa_port *dp)
case DSA_PORT_TYPE_DSA:
memset(dlp, 0, sizeof(*dlp));
devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_DSA,
- dp->index, false, 0, id, len);
+ dp->index, false, 0, 0, id, len);
err = devlink_port_register(dl, dlp, dp->index);
if (err)
break;
@@ -315,7 +315,7 @@ static int dsa_port_setup(struct dsa_port *dp)
case DSA_PORT_TYPE_USER:
memset(dlp, 0, sizeof(*dlp));
devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_PHYSICAL,
- dp->index, false, 0, id, len);
+ dp->index, false, 0, 0, id, len);
err = devlink_port_register(dl, dlp, dp->index);
if (err)
break;