bnxt: call devlink_port_type_eth_set() before port register
authorJiri Pirko <jiri@mellanox.com>
Sun, 24 Mar 2019 10:14:28 +0000 (11:14 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Mar 2019 18:55:30 +0000 (14:55 -0400)
Call devlink_port_type_eth_set() before devlink_port_register(). Bnxt
instances won't change type during lifetime. This avoids one extra
userspace devlink notification.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

index ab6fd05c462bd975e0e0e38c5c7f0408d46eb277..a266bff559dc66f6038ee979cbca1d35b900e7ad 100644 (file)
@@ -229,6 +229,7 @@ int bnxt_dl_register(struct bnxt *bp)
                goto err_dl_unreg;
        }
 
+       devlink_port_type_eth_set(&bp->dl_port, bp->dev);
        devlink_port_attrs_set(&bp->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
                               bp->pf.port_id, false, 0);
        rc = devlink_port_register(dl, &bp->dl_port, bp->pf.port_id);
@@ -236,7 +237,6 @@ int bnxt_dl_register(struct bnxt *bp)
                netdev_err(bp->dev, "devlink_port_register failed");
                goto err_dl_param_unreg;
        }
-       devlink_port_type_eth_set(&bp->dl_port, bp->dev);
 
        rc = devlink_port_params_register(&bp->dl_port, bnxt_dl_port_params,
                                          ARRAY_SIZE(bnxt_dl_port_params));