aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_hw.c
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>2011-06-21 22:52:23 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-24 04:17:07 -0400
commit22c8c9343258feda9ea9ebb9e5f8cbb727b69454 (patch)
treefac14dcf287c032ff83c832a253178b90a2228b3 /drivers/net/qlcnic/qlcnic_hw.c
parent9d6a6440fe30132e4d1f1aadd099345ced9178fb (diff)
qlcnic: multi protocol internal loopback support added.
Driver will generate loopback traffic pattern and do the test. And returns result of the test to application. Updated driver version to 5.0.19. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_hw.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 81de563ee96c..0391a04695dd 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -533,6 +533,56 @@ void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter)
533 } 533 }
534} 534}
535 535
536int qlcnic_set_fw_loopback(struct qlcnic_adapter *adapter, u8 flag)
537{
538 struct qlcnic_nic_req req;
539 int rv;
540
541 memset(&req, 0, sizeof(struct qlcnic_nic_req));
542
543 req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
544 req.req_hdr = cpu_to_le64(QLCNIC_H2C_OPCODE_CONFIG_LOOPBACK |
545 ((u64) adapter->portnum << 16) | ((u64) 0x1 << 32));
546
547 req.words[0] = cpu_to_le64(flag);
548
549 rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
550 if (rv != 0)
551 dev_err(&adapter->pdev->dev, "%sting loopback mode failed\n",
552 flag ? "Set" : "Reset");
553 return rv;
554}
555
556int qlcnic_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
557{
558 if (qlcnic_set_fw_loopback(adapter, mode))
559 return -EIO;
560
561 if (qlcnic_nic_set_promisc(adapter, VPORT_MISS_MODE_ACCEPT_ALL)) {
562 qlcnic_set_fw_loopback(adapter, mode);
563 return -EIO;
564 }
565
566 msleep(1000);
567 return 0;
568}
569
570void qlcnic_clear_lb_mode(struct qlcnic_adapter *adapter)
571{
572 int mode = VPORT_MISS_MODE_DROP;
573 struct net_device *netdev = adapter->netdev;
574
575 qlcnic_set_fw_loopback(adapter, 0);
576
577 if (netdev->flags & IFF_PROMISC)
578 mode = VPORT_MISS_MODE_ACCEPT_ALL;
579 else if (netdev->flags & IFF_ALLMULTI)
580 mode = VPORT_MISS_MODE_ACCEPT_MULTI;
581
582 qlcnic_nic_set_promisc(adapter, mode);
583 msleep(1000);
584}
585
536/* 586/*
537 * Send the interrupt coalescing parameter set by ethtool to the card. 587 * Send the interrupt coalescing parameter set by ethtool to the card.
538 */ 588 */