be2net: Log the profile-id used by FW during driver initialization
authorVasundhara Volam <vasundhara.volam@emulex.com>
Wed, 15 Jan 2014 07:53:33 +0000 (13:23 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jan 2014 23:52:02 +0000 (15:52 -0800)
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>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h
drivers/net/ethernet/emulex/benet/be_main.c

index d9bdeba79aa4669a5cc384bfdcdf5821044e428a..1c626e1c384768fd0cf6e6e1ad335ed06c40fcff 100644 (file)
@@ -3608,6 +3608,40 @@ int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable)
        return status;
 }
 
+/* Uses MBOX */
+int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile_id)
+{
+       struct be_cmd_req_get_active_profile *req;
+       struct be_mcc_wrb *wrb;
+       int status;
+
+       if (mutex_lock_interruptible(&adapter->mbox_lock))
+               return -1;
+
+       wrb = wrb_from_mbox(adapter);
+       if (!wrb) {
+               status = -EBUSY;
+               goto err;
+       }
+
+       req = embedded_payload(wrb);
+
+       be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+                              OPCODE_COMMON_GET_ACTIVE_PROFILE, sizeof(*req),
+                              wrb, NULL);
+
+       status = be_mbox_notify_wait(adapter);
+       if (!status) {
+               struct be_cmd_resp_get_active_profile *resp =
+                                                       embedded_payload(wrb);
+               *profile_id = le16_to_cpu(resp->active_profile_id);
+       }
+
+err:
+       mutex_unlock(&adapter->mbox_lock);
+       return status;
+}
+
 int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
                        int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
 {
index ed1daedd896d7e53c6caba7c514ba7488b452d6a..8054b84d9bf3d6753e803a449708084423867368 100644 (file)
@@ -216,6 +216,7 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_GET_FUNC_CONFIG                  160
 #define OPCODE_COMMON_GET_PROFILE_CONFIG               164
 #define OPCODE_COMMON_SET_PROFILE_CONFIG               165
+#define OPCODE_COMMON_GET_ACTIVE_PROFILE               167
 #define OPCODE_COMMON_SET_HSW_CONFIG                   153
 #define OPCODE_COMMON_GET_FN_PRIVILEGES                        170
 #define OPCODE_COMMON_READ_OBJECT                      171
@@ -1917,6 +1918,17 @@ struct be_cmd_resp_set_profile_config {
        struct be_cmd_resp_hdr hdr;
 };
 
+struct be_cmd_req_get_active_profile {
+       struct be_cmd_req_hdr hdr;
+       u32 rsvd;
+} __packed;
+
+struct be_cmd_resp_get_active_profile {
+       struct be_cmd_resp_hdr hdr;
+       u16 active_profile_id;
+       u16 next_profile_id;
+} __packed;
+
 struct be_cmd_enable_disable_vf {
        struct be_cmd_req_hdr hdr;
        u8 enable;
@@ -2063,6 +2075,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter,
 int be_cmd_get_profile_config(struct be_adapter *adapter,
                              struct be_resources *res, u8 domain);
 int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, u8 domain);
+int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile);
 int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg,
                     int vf_num);
 int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
index 3acf137b57840556ec66b08971028c76d05bd394..1f670d3f77e5bb976abf7dc205fa32dcb2b131df 100644 (file)
@@ -3233,6 +3233,7 @@ static int be_get_resources(struct be_adapter *adapter)
 /* Routine to query per function resource limits */
 static int be_get_config(struct be_adapter *adapter)
 {
+       u16 profile_id;
        int status;
 
        status = be_cmd_query_fw_cfg(adapter, &adapter->port_num,
@@ -3242,6 +3243,13 @@ static int be_get_config(struct be_adapter *adapter)
        if (status)
                return status;
 
+        if (be_physfn(adapter)) {
+               status = be_cmd_get_active_profile(adapter, &profile_id);
+               if (!status)
+                       dev_info(&adapter->pdev->dev,
+                                "Using profile 0x%x\n", profile_id);
+       }
+
        status = be_get_resources(adapter);
        if (status)
                return status;