aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex
diff options
context:
space:
mode:
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>2012-10-20 02:01:53 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-21 22:15:35 -0400
commitd5c184731fad8018084f5d8c4850f0b9cb5336e5 (patch)
treea383b1ed8338a1788fc5ce111eaf9a5eea7e2c76 /drivers/net/ethernet/emulex
parentabb9395123f6529de46f58900867ec07dc032a78 (diff)
be2net: Fix setting QoS for VF for Lancer
Use Lancer specific command to set QoS for VF. Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c58
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h23
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c5
4 files changed, 86 insertions, 1 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index dc6ec6b7fbff..3b8ef4b8b025 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -444,6 +444,7 @@ struct be_adapter {
444 u16 max_vlans; 444 u16 max_vlans;
445 u16 max_event_queues; 445 u16 max_event_queues;
446 u32 if_cap_flags; 446 u32 if_cap_flags;
447 u8 pf_number;
447}; 448};
448 449
449#define be_physfn(adapter) (!adapter->virtfn) 450#define be_physfn(adapter) (!adapter->virtfn)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 094b5f322050..3980b5815d8d 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2862,6 +2862,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter)
2862 goto err; 2862 goto err;
2863 } 2863 }
2864 2864
2865 adapter->pf_number = desc->pf_num;
2865 adapter->max_pmac_cnt = le16_to_cpu(desc->unicast_mac_count); 2866 adapter->max_pmac_cnt = le16_to_cpu(desc->unicast_mac_count);
2866 adapter->max_vlans = le16_to_cpu(desc->vlan_count); 2867 adapter->max_vlans = le16_to_cpu(desc->vlan_count);
2867 adapter->max_mcast_mac = le16_to_cpu(desc->mcast_mac_count); 2868 adapter->max_mcast_mac = le16_to_cpu(desc->mcast_mac_count);
@@ -2936,6 +2937,63 @@ err:
2936 return status; 2937 return status;
2937} 2938}
2938 2939
2940/* Uses sync mcc */
2941int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
2942 u8 domain)
2943{
2944 struct be_mcc_wrb *wrb;
2945 struct be_cmd_req_set_profile_config *req;
2946 int status;
2947
2948 spin_lock_bh(&adapter->mcc_lock);
2949
2950 wrb = wrb_from_mccq(adapter);
2951 if (!wrb) {
2952 status = -EBUSY;
2953 goto err;
2954 }
2955
2956 req = embedded_payload(wrb);
2957
2958 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
2959 OPCODE_COMMON_SET_PROFILE_CONFIG, sizeof(*req),
2960 wrb, NULL);
2961
2962 req->hdr.domain = domain;
2963 req->desc_count = cpu_to_le32(1);
2964
2965 req->nic_desc.desc_type = NIC_RESOURCE_DESC_TYPE_ID;
2966 req->nic_desc.desc_len = RESOURCE_DESC_SIZE;
2967 req->nic_desc.flags = (1 << QUN) | (1 << IMM) | (1 << NOSV);
2968 req->nic_desc.pf_num = adapter->pf_number;
2969 req->nic_desc.vf_num = domain;
2970
2971 /* Mark fields invalid */
2972 req->nic_desc.unicast_mac_count = 0xFFFF;
2973 req->nic_desc.mcc_count = 0xFFFF;
2974 req->nic_desc.vlan_count = 0xFFFF;
2975 req->nic_desc.mcast_mac_count = 0xFFFF;
2976 req->nic_desc.txq_count = 0xFFFF;
2977 req->nic_desc.rq_count = 0xFFFF;
2978 req->nic_desc.rssq_count = 0xFFFF;
2979 req->nic_desc.lro_count = 0xFFFF;
2980 req->nic_desc.cq_count = 0xFFFF;
2981 req->nic_desc.toe_conn_count = 0xFFFF;
2982 req->nic_desc.eq_count = 0xFFFF;
2983 req->nic_desc.link_param = 0xFF;
2984 req->nic_desc.bw_min = 0xFFFFFFFF;
2985 req->nic_desc.acpi_params = 0xFF;
2986 req->nic_desc.wol_param = 0x0F;
2987
2988 /* Change BW */
2989 req->nic_desc.bw_min = cpu_to_le32(bps);
2990 req->nic_desc.bw_max = cpu_to_le32(bps);
2991 status = be_mcc_notify_wait(adapter);
2992err:
2993 spin_unlock_bh(&adapter->mcc_lock);
2994 return status;
2995}
2996
2939int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, 2997int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
2940 int wrb_payload_size, u16 *cmd_status, u16 *ext_status) 2998 int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
2941{ 2999{
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index c2bf4dfdb690..ad16d31b86d7 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -198,6 +198,7 @@ struct be_mcc_mailbox {
198#define OPCODE_COMMON_GET_HSW_CONFIG 152 198#define OPCODE_COMMON_GET_HSW_CONFIG 152
199#define OPCODE_COMMON_GET_FUNC_CONFIG 160 199#define OPCODE_COMMON_GET_FUNC_CONFIG 160
200#define OPCODE_COMMON_GET_PROFILE_CONFIG 164 200#define OPCODE_COMMON_GET_PROFILE_CONFIG 164
201#define OPCODE_COMMON_SET_PROFILE_CONFIG 165
201#define OPCODE_COMMON_SET_HSW_CONFIG 153 202#define OPCODE_COMMON_SET_HSW_CONFIG 153
202#define OPCODE_COMMON_READ_OBJECT 171 203#define OPCODE_COMMON_READ_OBJECT 171
203#define OPCODE_COMMON_WRITE_OBJECT 172 204#define OPCODE_COMMON_WRITE_OBJECT 172
@@ -1689,6 +1690,14 @@ struct be_cmd_req_set_ext_fat_caps {
1689#define RESOURCE_DESC_SIZE 72 1690#define RESOURCE_DESC_SIZE 72
1690#define NIC_RESOURCE_DESC_TYPE_ID 0x41 1691#define NIC_RESOURCE_DESC_TYPE_ID 0x41
1691#define MAX_RESOURCE_DESC 4 1692#define MAX_RESOURCE_DESC 4
1693
1694/* QOS unit number */
1695#define QUN 4
1696/* Immediate */
1697#define IMM 6
1698/* No save */
1699#define NOSV 7
1700
1692struct be_nic_resource_desc { 1701struct be_nic_resource_desc {
1693 u8 desc_type; 1702 u8 desc_type;
1694 u8 desc_len; 1703 u8 desc_len;
@@ -1746,6 +1755,17 @@ struct be_cmd_resp_get_profile_config {
1746 u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE]; 1755 u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE];
1747}; 1756};
1748 1757
1758struct be_cmd_req_set_profile_config {
1759 struct be_cmd_req_hdr hdr;
1760 u32 rsvd;
1761 u32 desc_count;
1762 struct be_nic_resource_desc nic_desc;
1763};
1764
1765struct be_cmd_resp_set_profile_config {
1766 struct be_cmd_req_hdr hdr;
1767};
1768
1749extern int be_pci_fnum_get(struct be_adapter *adapter); 1769extern int be_pci_fnum_get(struct be_adapter *adapter);
1750extern int be_fw_wait_ready(struct be_adapter *adapter); 1770extern int be_fw_wait_ready(struct be_adapter *adapter);
1751extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, 1771extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
@@ -1863,3 +1883,6 @@ extern int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
1863extern int be_cmd_get_func_config(struct be_adapter *adapter); 1883extern int be_cmd_get_func_config(struct be_adapter *adapter);
1864extern int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags, 1884extern int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
1865 u8 domain); 1885 u8 domain);
1886
1887extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
1888 u8 domain);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9b734a0f8efa..0b49201b8b45 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1062,7 +1062,10 @@ static int be_set_vf_tx_rate(struct net_device *netdev,
1062 return -EINVAL; 1062 return -EINVAL;
1063 } 1063 }
1064 1064
1065 status = be_cmd_set_qos(adapter, rate / 10, vf + 1); 1065 if (lancer_chip(adapter))
1066 status = be_cmd_set_profile_config(adapter, rate / 10, vf + 1);
1067 else
1068 status = be_cmd_set_qos(adapter, rate / 10, vf + 1);
1066 1069
1067 if (status) 1070 if (status)
1068 dev_err(&adapter->pdev->dev, 1071 dev_err(&adapter->pdev->dev,