be2net: Don't run ethtool self-tests for VFs
The CMD_SUBSYSTEM_LOWLEVEL cmds need DEV_CFG Privilege to run which VFs don't have by default. Self-tests need to be issued only for PFs. Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ee9ad28024
commit
2e365b1b80
|
@ -65,7 +65,22 @@ static struct be_cmd_priv_map cmd_priv_map[] = {
|
|||
CMD_SUBSYSTEM_COMMON,
|
||||
BE_PRIV_LNKMGMT | BE_PRIV_VHADM |
|
||||
BE_PRIV_DEVCFG | BE_PRIV_DEVSEC
|
||||
}
|
||||
},
|
||||
{
|
||||
OPCODE_LOWLEVEL_HOST_DDR_DMA,
|
||||
CMD_SUBSYSTEM_LOWLEVEL,
|
||||
BE_PRIV_DEVCFG | BE_PRIV_DEVSEC
|
||||
},
|
||||
{
|
||||
OPCODE_LOWLEVEL_LOOPBACK_TEST,
|
||||
CMD_SUBSYSTEM_LOWLEVEL,
|
||||
BE_PRIV_DEVCFG | BE_PRIV_DEVSEC
|
||||
},
|
||||
{
|
||||
OPCODE_LOWLEVEL_SET_LOOPBACK_MODE,
|
||||
CMD_SUBSYSTEM_LOWLEVEL,
|
||||
BE_PRIV_DEVCFG | BE_PRIV_DEVSEC
|
||||
},
|
||||
};
|
||||
|
||||
static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, u8 subsystem)
|
||||
|
@ -3169,6 +3184,10 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
|
|||
struct be_cmd_req_set_lmode *req;
|
||||
int status;
|
||||
|
||||
if (!be_cmd_allowed(adapter, OPCODE_LOWLEVEL_SET_LOOPBACK_MODE,
|
||||
CMD_SUBSYSTEM_LOWLEVEL))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_bh(&adapter->mcc_lock);
|
||||
|
||||
wrb = wrb_from_mccq(adapter);
|
||||
|
@ -3214,6 +3233,10 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
|
|||
struct be_cmd_resp_loopback_test *resp;
|
||||
int status;
|
||||
|
||||
if (!be_cmd_allowed(adapter, OPCODE_LOWLEVEL_LOOPBACK_TEST,
|
||||
CMD_SUBSYSTEM_LOWLEVEL))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_bh(&adapter->mcc_lock);
|
||||
|
||||
wrb = wrb_from_mccq(adapter);
|
||||
|
@ -3260,6 +3283,10 @@ int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
|
|||
int status;
|
||||
int i, j = 0;
|
||||
|
||||
if (!be_cmd_allowed(adapter, OPCODE_LOWLEVEL_HOST_DDR_DMA,
|
||||
CMD_SUBSYSTEM_LOWLEVEL))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_bh(&adapter->mcc_lock);
|
||||
|
||||
wrb = wrb_from_mccq(adapter);
|
||||
|
|
Loading…
Reference in New Issue