aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>2011-05-10 01:13:26 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-11 19:10:03 -0400
commitecd0bf0f7b280bac3ac7419ed3aac84cd92878e9 (patch)
treec4f6f4a61e4e5d744dccd7503bfdc0f856080c9c /drivers
parent18a91e6002207c8212e0960854f88ab924ea22f9 (diff)
be2net: Use NTWK_RX_FILTER command for promiscous mode
Use OPCODE_COMMON_NTWK_RX_FILTER command for promiscous mode as OPCODE_ETH_PROMISCUOUS command is getting deprecated. Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/benet/be_cmds.c46
-rw-r--r--drivers/net/benet/be_cmds.h24
-rw-r--r--drivers/net/benet/be_main.c4
3 files changed, 48 insertions, 26 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index bdd6c5402adf..0dbb4cbc07b6 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1404,12 +1404,24 @@ err:
1404/* Uses MCC for this command as it may be called in BH context 1404/* Uses MCC for this command as it may be called in BH context
1405 * Uses synchronous mcc 1405 * Uses synchronous mcc
1406 */ 1406 */
1407int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en) 1407int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en)
1408{ 1408{
1409 struct be_mcc_wrb *wrb; 1409 struct be_mcc_wrb *wrb;
1410 struct be_cmd_req_promiscuous_config *req; 1410 struct be_cmd_req_rx_filter *req;
1411 struct be_dma_mem promiscous_cmd;
1412 struct be_sge *sge;
1411 int status; 1413 int status;
1412 1414
1415 memset(&promiscous_cmd, 0, sizeof(struct be_dma_mem));
1416 promiscous_cmd.size = sizeof(struct be_cmd_req_rx_filter);
1417 promiscous_cmd.va = pci_alloc_consistent(adapter->pdev,
1418 promiscous_cmd.size, &promiscous_cmd.dma);
1419 if (!promiscous_cmd.va) {
1420 dev_err(&adapter->pdev->dev,
1421 "Memory allocation failure\n");
1422 return -ENOMEM;
1423 }
1424
1413 spin_lock_bh(&adapter->mcc_lock); 1425 spin_lock_bh(&adapter->mcc_lock);
1414 1426
1415 wrb = wrb_from_mccq(adapter); 1427 wrb = wrb_from_mccq(adapter);
@@ -1417,26 +1429,30 @@ int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en)
1417 status = -EBUSY; 1429 status = -EBUSY;
1418 goto err; 1430 goto err;
1419 } 1431 }
1420 req = embedded_payload(wrb);
1421 1432
1422 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, OPCODE_ETH_PROMISCUOUS); 1433 req = promiscous_cmd.va;
1434 sge = nonembedded_sgl(wrb);
1423 1435
1424 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, 1436 be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
1425 OPCODE_ETH_PROMISCUOUS, sizeof(*req)); 1437 OPCODE_COMMON_NTWK_RX_FILTER);
1426 1438 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1427 /* In FW versions X.102.149/X.101.487 and later, 1439 OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req));
1428 * the port setting associated only with the 1440
1429 * issuing pci function will take effect 1441 req->if_id = cpu_to_le32(adapter->if_handle);
1430 */ 1442 req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);
1431 if (port_num) 1443 if (en)
1432 req->port1_promiscuous = en; 1444 req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);
1433 else 1445
1434 req->port0_promiscuous = en; 1446 sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma));
1447 sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF);
1448 sge->len = cpu_to_le32(promiscous_cmd.size);
1435 1449
1436 status = be_mcc_notify_wait(adapter); 1450 status = be_mcc_notify_wait(adapter);
1437 1451
1438err: 1452err:
1439 spin_unlock_bh(&adapter->mcc_lock); 1453 spin_unlock_bh(&adapter->mcc_lock);
1454 pci_free_consistent(adapter->pdev, promiscous_cmd.size,
1455 promiscous_cmd.va, promiscous_cmd.dma);
1440 return status; 1456 return status;
1441} 1457}
1442 1458
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index af4bbff5feba..78256b65cb03 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -714,13 +714,6 @@ struct be_cmd_req_vlan_config {
714 u16 normal_vlan[64]; 714 u16 normal_vlan[64];
715} __packed; 715} __packed;
716 716
717struct be_cmd_req_promiscuous_config {
718 struct be_cmd_req_hdr hdr;
719 u8 port0_promiscuous;
720 u8 port1_promiscuous;
721 u16 rsvd0;
722} __packed;
723
724/******************** Multicast MAC Config *******************/ 717/******************** Multicast MAC Config *******************/
725#define BE_MAX_MC 64 /* set mcast promisc if > 64 */ 718#define BE_MAX_MC 64 /* set mcast promisc if > 64 */
726struct macaddr { 719struct macaddr {
@@ -741,6 +734,20 @@ hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd)
741 return &cmd->hw_stats; 734 return &cmd->hw_stats;
742} 735}
743 736
737
738/******************* RX FILTER ******************************/
739struct be_cmd_req_rx_filter {
740 struct be_cmd_req_hdr hdr;
741 u32 global_flags_mask;
742 u32 global_flags;
743 u32 if_flags_mask;
744 u32 if_flags;
745 u32 if_id;
746 u32 multicast_num;
747 struct macaddr mac[BE_MAX_MC];
748};
749
750
744/******************** Link Status Query *******************/ 751/******************** Link Status Query *******************/
745struct be_cmd_req_link_status { 752struct be_cmd_req_link_status {
746 struct be_cmd_req_hdr hdr; 753 struct be_cmd_req_hdr hdr;
@@ -1122,8 +1129,7 @@ extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
1122extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, 1129extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
1123 u16 *vtag_array, u32 num, bool untagged, 1130 u16 *vtag_array, u32 num, bool untagged,
1124 bool promiscuous); 1131 bool promiscuous);
1125extern int be_cmd_promiscuous_config(struct be_adapter *adapter, 1132extern int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en);
1126 u8 port_num, bool en);
1127extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, 1133extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
1128 struct net_device *netdev, struct be_dma_mem *mem); 1134 struct net_device *netdev, struct be_dma_mem *mem);
1129extern int be_cmd_set_flow_control(struct be_adapter *adapter, 1135extern int be_cmd_set_flow_control(struct be_adapter *adapter,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 3202f67d8785..babe53af7e86 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -698,7 +698,7 @@ static void be_set_multicast_list(struct net_device *netdev)
698 struct be_adapter *adapter = netdev_priv(netdev); 698 struct be_adapter *adapter = netdev_priv(netdev);
699 699
700 if (netdev->flags & IFF_PROMISC) { 700 if (netdev->flags & IFF_PROMISC) {
701 be_cmd_promiscuous_config(adapter, adapter->port_num, 1); 701 be_cmd_promiscuous_config(adapter, true);
702 adapter->promiscuous = true; 702 adapter->promiscuous = true;
703 goto done; 703 goto done;
704 } 704 }
@@ -706,7 +706,7 @@ static void be_set_multicast_list(struct net_device *netdev)
706 /* BE was previously in promiscuous mode; disable it */ 706 /* BE was previously in promiscuous mode; disable it */
707 if (adapter->promiscuous) { 707 if (adapter->promiscuous) {
708 adapter->promiscuous = false; 708 adapter->promiscuous = false;
709 be_cmd_promiscuous_config(adapter, adapter->port_num, 0); 709 be_cmd_promiscuous_config(adapter, false);
710 } 710 }
711 711
712 /* Enable multicast promisc if num configured exceeds what we support */ 712 /* Enable multicast promisc if num configured exceeds what we support */