be2net: Bug fix to config NIC appropriately before loopback test
NIC controller has to be set to an appropriate mode before doing a loopback test. Test will fail otherwise. Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d7b9014182
commit
fced9999ed
@@ -1479,6 +1479,41 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
|
||||
u8 loopback_type, u8 enable)
|
||||
{
|
||||
struct be_mcc_wrb *wrb;
|
||||
struct be_cmd_req_set_lmode *req;
|
||||
int status;
|
||||
|
||||
spin_lock_bh(&adapter->mcc_lock);
|
||||
|
||||
wrb = wrb_from_mccq(adapter);
|
||||
if (!wrb) {
|
||||
status = -EBUSY;
|
||||
goto err;
|
||||
}
|
||||
|
||||
req = embedded_payload(wrb);
|
||||
|
||||
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
|
||||
OPCODE_LOWLEVEL_SET_LOOPBACK_MODE);
|
||||
|
||||
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
|
||||
OPCODE_LOWLEVEL_SET_LOOPBACK_MODE,
|
||||
sizeof(*req));
|
||||
|
||||
req->src_port = port_num;
|
||||
req->dest_port = port_num;
|
||||
req->loopback_type = loopback_type;
|
||||
req->loopback_state = enable;
|
||||
|
||||
status = be_mcc_notify_wait(adapter);
|
||||
err:
|
||||
spin_unlock_bh(&adapter->mcc_lock);
|
||||
return status;
|
||||
}
|
||||
|
||||
int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
|
||||
u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern)
|
||||
{
|
||||
|
Reference in New Issue
Block a user