aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_cmds.c
diff options
context:
space:
mode:
authorSarveshwar Bandi <sarveshwarb@serverengines.com>2009-12-22 23:41:44 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-23 23:58:14 -0500
commitfced9999ed7f6975fbb2350a73048918ba60a773 (patch)
treeec62516793df52ef31d7a0f1ddeeddec5aa1b3df /drivers/net/benet/be_cmds.c
parentd7b901418250f00eaaa18f9135d09ba61b72a5bc (diff)
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.c35
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:
1479 return status; 1479 return status;
1480} 1480}
1481 1481
1482int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
1483 u8 loopback_type, u8 enable)
1484{
1485 struct be_mcc_wrb *wrb;
1486 struct be_cmd_req_set_lmode *req;
1487 int status;
1488
1489 spin_lock_bh(&adapter->mcc_lock);
1490
1491 wrb = wrb_from_mccq(adapter);
1492 if (!wrb) {
1493 status = -EBUSY;
1494 goto err;
1495 }
1496
1497 req = embedded_payload(wrb);
1498
1499 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
1500 OPCODE_LOWLEVEL_SET_LOOPBACK_MODE);
1501
1502 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
1503 OPCODE_LOWLEVEL_SET_LOOPBACK_MODE,
1504 sizeof(*req));
1505
1506 req->src_port = port_num;
1507 req->dest_port = port_num;
1508 req->loopback_type = loopback_type;
1509 req->loopback_state = enable;
1510
1511 status = be_mcc_notify_wait(adapter);
1512err:
1513 spin_unlock_bh(&adapter->mcc_lock);
1514 return status;
1515}
1516
1482int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, 1517int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
1483 u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) 1518 u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern)
1484{ 1519{