aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex
diff options
context:
space:
mode:
authorVasundhara Volam <vasundhara.volam@emulex.com>2013-04-21 19:28:17 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-22 15:36:06 -0400
commita05f99db86e6a57265890de1c9c7d748c3b25667 (patch)
tree1579d8df0d59ff459395e53e69d05296b15bd871 /drivers/net/ethernet/emulex
parent0ad3157e813a59e91dfbea2eff6a3d330215f5af (diff)
be2net: Use GET_PROFILE_CONFIG V1 cmd for BE3-R
Use GET_PROFILE_CONFIG_V1 cmd for BE3-R, to query the maximum number of TX rings available per function. On SH-R the same is queried via the GET_FUNCTION_CONFIG cmd. Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com> Signed-off-by: Sathya Perla <sathya.perla@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_cmds.c95
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h14
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c10
3 files changed, 93 insertions, 26 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index d60be6845ee6..d6291aba2524 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2946,7 +2946,8 @@ static struct be_nic_resource_desc *be_get_nic_desc(u8 *buf, u32 desc_count,
2946 break; 2946 break;
2947 } 2947 }
2948 2948
2949 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_ID) 2949 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 ||
2950 desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1)
2950 break; 2951 break;
2951 2952
2952 desc = (void *)desc + desc->desc_len; 2953 desc = (void *)desc + desc->desc_len;
@@ -3020,23 +3021,41 @@ err:
3020 return status; 3021 return status;
3021} 3022}
3022 3023
3023 /* Uses sync mcc */ 3024/* Uses mbox */
3024int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags, 3025int be_cmd_get_profile_config_mbox(struct be_adapter *adapter,
3025 u8 domain) 3026 u8 domain, struct be_dma_mem *cmd)
3026{ 3027{
3027 struct be_mcc_wrb *wrb; 3028 struct be_mcc_wrb *wrb;
3028 struct be_cmd_req_get_profile_config *req; 3029 struct be_cmd_req_get_profile_config *req;
3029 int status; 3030 int status;
3030 struct be_dma_mem cmd;
3031 3031
3032 memset(&cmd, 0, sizeof(struct be_dma_mem)); 3032 if (mutex_lock_interruptible(&adapter->mbox_lock))
3033 cmd.size = sizeof(struct be_cmd_resp_get_profile_config); 3033 return -1;
3034 cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, 3034 wrb = wrb_from_mbox(adapter);
3035 &cmd.dma); 3035
3036 if (!cmd.va) { 3036 req = cmd->va;
3037 dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); 3037 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3038 return -ENOMEM; 3038 OPCODE_COMMON_GET_PROFILE_CONFIG,
3039 } 3039 cmd->size, wrb, cmd);
3040
3041 req->type = ACTIVE_PROFILE_TYPE;
3042 req->hdr.domain = domain;
3043 if (!lancer_chip(adapter))
3044 req->hdr.version = 1;
3045
3046 status = be_mbox_notify_wait(adapter);
3047
3048 mutex_unlock(&adapter->mbox_lock);
3049 return status;
3050}
3051
3052/* Uses sync mcc */
3053int be_cmd_get_profile_config_mccq(struct be_adapter *adapter,
3054 u8 domain, struct be_dma_mem *cmd)
3055{
3056 struct be_mcc_wrb *wrb;
3057 struct be_cmd_req_get_profile_config *req;
3058 int status;
3040 3059
3041 spin_lock_bh(&adapter->mcc_lock); 3060 spin_lock_bh(&adapter->mcc_lock);
3042 3061
@@ -3046,16 +3065,47 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
3046 goto err; 3065 goto err;
3047 } 3066 }
3048 3067
3049 req = cmd.va; 3068 req = cmd->va;
3050
3051 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 3069 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3052 OPCODE_COMMON_GET_PROFILE_CONFIG, 3070 OPCODE_COMMON_GET_PROFILE_CONFIG,
3053 cmd.size, wrb, &cmd); 3071 cmd->size, wrb, cmd);
3054 3072
3055 req->type = ACTIVE_PROFILE_TYPE; 3073 req->type = ACTIVE_PROFILE_TYPE;
3056 req->hdr.domain = domain; 3074 req->hdr.domain = domain;
3075 if (!lancer_chip(adapter))
3076 req->hdr.version = 1;
3057 3077
3058 status = be_mcc_notify_wait(adapter); 3078 status = be_mcc_notify_wait(adapter);
3079
3080err:
3081 spin_unlock_bh(&adapter->mcc_lock);
3082 return status;
3083}
3084
3085/* Uses sync mcc, if MCCQ is already created otherwise mbox */
3086int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
3087 u16 *txq_count, u8 domain)
3088{
3089 struct be_queue_info *mccq = &adapter->mcc_obj.q;
3090 struct be_dma_mem cmd;
3091 int status;
3092
3093 memset(&cmd, 0, sizeof(struct be_dma_mem));
3094 if (!lancer_chip(adapter))
3095 cmd.size = sizeof(struct be_cmd_resp_get_profile_config_v1);
3096 else
3097 cmd.size = sizeof(struct be_cmd_resp_get_profile_config);
3098 cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size,
3099 &cmd.dma);
3100 if (!cmd.va) {
3101 dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
3102 return -ENOMEM;
3103 }
3104
3105 if (!mccq->created)
3106 status = be_cmd_get_profile_config_mbox(adapter, domain, &cmd);
3107 else
3108 status = be_cmd_get_profile_config_mccq(adapter, domain, &cmd);
3059 if (!status) { 3109 if (!status) {
3060 struct be_cmd_resp_get_profile_config *resp = cmd.va; 3110 struct be_cmd_resp_get_profile_config *resp = cmd.va;
3061 u32 desc_count = le32_to_cpu(resp->desc_count); 3111 u32 desc_count = le32_to_cpu(resp->desc_count);
@@ -3068,12 +3118,15 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
3068 status = -EINVAL; 3118 status = -EINVAL;
3069 goto err; 3119 goto err;
3070 } 3120 }
3071 *cap_flags = le32_to_cpu(desc->cap_flags); 3121 if (cap_flags)
3122 *cap_flags = le32_to_cpu(desc->cap_flags);
3123 if (txq_count)
3124 *txq_count = le32_to_cpu(desc->txq_count);
3072 } 3125 }
3073err: 3126err:
3074 spin_unlock_bh(&adapter->mcc_lock); 3127 if (cmd.va)
3075 pci_free_consistent(adapter->pdev, cmd.size, 3128 pci_free_consistent(adapter->pdev, cmd.size,
3076 cmd.va, cmd.dma); 3129 cmd.va, cmd.dma);
3077 return status; 3130 return status;
3078} 3131}
3079 3132
@@ -3102,7 +3155,7 @@ int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
3102 req->hdr.domain = domain; 3155 req->hdr.domain = domain;
3103 req->desc_count = cpu_to_le32(1); 3156 req->desc_count = cpu_to_le32(1);
3104 3157
3105 req->nic_desc.desc_type = NIC_RESOURCE_DESC_TYPE_ID; 3158 req->nic_desc.desc_type = NIC_RESOURCE_DESC_TYPE_V0;
3106 req->nic_desc.desc_len = RESOURCE_DESC_SIZE; 3159 req->nic_desc.desc_len = RESOURCE_DESC_SIZE;
3107 req->nic_desc.flags = (1 << QUN) | (1 << IMM) | (1 << NOSV); 3160 req->nic_desc.flags = (1 << QUN) | (1 << IMM) | (1 << NOSV);
3108 req->nic_desc.pf_num = adapter->pf_number; 3161 req->nic_desc.pf_num = adapter->pf_number;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index e9597852a404..460332021590 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1687,9 +1687,11 @@ struct be_cmd_req_set_ext_fat_caps {
1687 struct be_fat_conf_params set_params; 1687 struct be_fat_conf_params set_params;
1688}; 1688};
1689 1689
1690#define RESOURCE_DESC_SIZE 72 1690#define RESOURCE_DESC_SIZE 88
1691#define NIC_RESOURCE_DESC_TYPE_ID 0x41 1691#define NIC_RESOURCE_DESC_TYPE_V0 0x41
1692#define NIC_RESOURCE_DESC_TYPE_V1 0x51
1692#define MAX_RESOURCE_DESC 4 1693#define MAX_RESOURCE_DESC 4
1694#define MAX_RESOURCE_DESC_V1 32
1693 1695
1694/* QOS unit number */ 1696/* QOS unit number */
1695#define QUN 4 1697#define QUN 4
@@ -1755,6 +1757,12 @@ struct be_cmd_resp_get_profile_config {
1755 u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE]; 1757 u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE];
1756}; 1758};
1757 1759
1760struct be_cmd_resp_get_profile_config_v1 {
1761 struct be_cmd_req_hdr hdr;
1762 u32 desc_count;
1763 u8 func_param[MAX_RESOURCE_DESC_V1 * RESOURCE_DESC_SIZE];
1764};
1765
1758struct be_cmd_req_set_profile_config { 1766struct be_cmd_req_set_profile_config {
1759 struct be_cmd_req_hdr hdr; 1767 struct be_cmd_req_hdr hdr;
1760 u32 rsvd; 1768 u32 rsvd;
@@ -1917,7 +1925,7 @@ extern int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
1917extern int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); 1925extern int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
1918extern int be_cmd_get_func_config(struct be_adapter *adapter); 1926extern int be_cmd_get_func_config(struct be_adapter *adapter);
1919extern int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags, 1927extern int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
1920 u8 domain); 1928 u16 *txq_count, u8 domain);
1921 1929
1922extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, 1930extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
1923 u8 domain); 1931 u8 domain);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index c70b8fff8cff..e773fbaf8d02 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2719,7 +2719,8 @@ static int be_vfs_if_create(struct be_adapter *adapter)
2719 2719
2720 for_all_vfs(adapter, vf_cfg, vf) { 2720 for_all_vfs(adapter, vf_cfg, vf) {
2721 if (!BE3_chip(adapter)) 2721 if (!BE3_chip(adapter))
2722 be_cmd_get_profile_config(adapter, &cap_flags, vf + 1); 2722 be_cmd_get_profile_config(adapter, &cap_flags,
2723 NULL, vf + 1);
2723 2724
2724 /* If a FW profile exists, then cap_flags are updated */ 2725 /* If a FW profile exists, then cap_flags are updated */
2725 en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | 2726 en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |
@@ -2883,11 +2884,14 @@ static void be_get_resources(struct be_adapter *adapter)
2883 u16 dev_num_vfs; 2884 u16 dev_num_vfs;
2884 int pos, status; 2885 int pos, status;
2885 bool profile_present = false; 2886 bool profile_present = false;
2887 u16 txq_count = 0;
2886 2888
2887 if (!BEx_chip(adapter)) { 2889 if (!BEx_chip(adapter)) {
2888 status = be_cmd_get_func_config(adapter); 2890 status = be_cmd_get_func_config(adapter);
2889 if (!status) 2891 if (!status)
2890 profile_present = true; 2892 profile_present = true;
2893 } else if (BE3_chip(adapter) && be_physfn(adapter)) {
2894 be_cmd_get_profile_config(adapter, NULL, &txq_count, 0);
2891 } 2895 }
2892 2896
2893 if (profile_present) { 2897 if (profile_present) {
@@ -2925,7 +2929,9 @@ static void be_get_resources(struct be_adapter *adapter)
2925 adapter->max_vlans = BE_NUM_VLANS_SUPPORTED; 2929 adapter->max_vlans = BE_NUM_VLANS_SUPPORTED;
2926 2930
2927 adapter->max_mcast_mac = BE_MAX_MC; 2931 adapter->max_mcast_mac = BE_MAX_MC;
2928 adapter->max_tx_queues = MAX_TX_QS; 2932 adapter->max_tx_queues = txq_count ? txq_count : MAX_TX_QS;
2933 adapter->max_tx_queues = min_t(u16, adapter->max_tx_queues,
2934 MAX_TX_QS);
2929 adapter->max_rss_queues = (adapter->be3_native) ? 2935 adapter->max_rss_queues = (adapter->be3_native) ?
2930 BE3_MAX_RSS_QS : BE2_MAX_RSS_QS; 2936 BE3_MAX_RSS_QS : BE2_MAX_RSS_QS;
2931 adapter->max_event_queues = BE3_MAX_RSS_QS; 2937 adapter->max_event_queues = BE3_MAX_RSS_QS;