diff options
author | Sarveshwar Bandi <sarveshwarb@serverengines.com> | 2009-12-23 05:41:44 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-24 05:58:14 +0100 |
commit | fced9999ed7f6975fbb2350a73048918ba60a773 (patch) | |
tree | ec62516793df52ef31d7a0f1ddeeddec5aa1b3df /drivers/net/benet/be_cmds.c | |
parent | be2net: Bug fix to avoid soft lockup in loopback test. (diff) | |
download | linux-fced9999ed7f6975fbb2350a73048918ba60a773.tar.xz linux-fced9999ed7f6975fbb2350a73048918ba60a773.zip |
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>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index a27fdb35eebf..102ade134165 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -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) { |