Skip to content

Commit

Permalink
be2net: Log the profile-id used by FW during driver initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vasundhara Volam authored and David S. Miller committed Jan 15, 2014
1 parent 2c07c1d commit 542963b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
34 changes: 34 additions & 0 deletions drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
13 changes: 13 additions & 0 deletions drivers/net/ethernet/emulex/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 542963b

Please sign in to comment.