bnxt_en: Register devlink irrespective of firmware spec version
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Mon, 27 Jan 2020 09:56:21 +0000 (04:56 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jan 2020 10:33:28 +0000 (11:33 +0100)
This will allow to register for devlink port and use port features.
Also register params only if firmware spec version is at least 0x10600
which will support reading/setting numbered variables in NVRAM.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

index 9253eed60f55f085ea5b18e36fb4576a9eb38b7b..a8cdfbdd55983f02fa4b95fcc2146e931a266fca 100644 (file)
@@ -489,6 +489,9 @@ static int bnxt_dl_params_register(struct bnxt *bp)
 {
        int rc;
 
+       if (bp->hwrm_spec_code < 0x10600)
+               return 0;
+
        rc = devlink_params_register(bp->dl, bnxt_dl_params,
                                     ARRAY_SIZE(bnxt_dl_params));
        if (rc) {
@@ -511,6 +514,9 @@ static int bnxt_dl_params_register(struct bnxt *bp)
 
 static void bnxt_dl_params_unregister(struct bnxt *bp)
 {
+       if (bp->hwrm_spec_code < 0x10600)
+               return;
+
        devlink_params_unregister(bp->dl, bnxt_dl_params,
                                  ARRAY_SIZE(bnxt_dl_params));
        devlink_port_params_unregister(&bp->dl_port, bnxt_dl_port_params,
@@ -522,11 +528,6 @@ int bnxt_dl_register(struct bnxt *bp)
        struct devlink *dl;
        int rc;
 
-       if (bp->hwrm_spec_code < 0x10600) {
-               netdev_warn(bp->dev, "Firmware does not support NVM params");
-               return -ENOTSUPP;
-       }
-
        if (BNXT_PF(bp))
                dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
        else