From: Hannes Reinecke <hare@suse.de>
To: Jitendra Bhivare <jitendra.bhivare@avagotech.com>,
linux-scsi@vger.kernel.org, michaelc@cs.wisc.edu
Subject: Re: [PATCH 7/9] be2iscsi: Fix to process 25G link speed info from FW
Date: Mon, 14 Dec 2015 16:26:19 +0100 [thread overview]
Message-ID: <566EDF9B.4060908@suse.de> (raw)
In-Reply-To: <1450073466-21077-8-git-send-email-jitendra.bhivare@avagotech.com>
On 12/14/2015 07:11 AM, Jitendra Bhivare wrote:
> From: Jitendra <jitendra.bhivare@avagotech.com>
>
> Async link event provides port_speed info. Use the same to report in
> ISCSI_HOST_PARAM_PORT_SPEED query. Removed link status query IOCTL used
> to do the same.
>
> 25G and 40G are defined in kernel enum iscsi_port_speed.
>
> Fixed get_nic_conf structure definition. Removed rsvd[23] field in
> be_cmd_get_nic_conf_resp.
>
> Signed-off-by: Jitendra <jitendra.bhivare@avagotech.com>
> ---
> drivers/scsi/be2iscsi/be_cmds.c | 52 +++++++++++++---------------
> drivers/scsi/be2iscsi/be_cmds.h | 65 ++++++++++------------------------
> drivers/scsi/be2iscsi/be_iscsi.c | 49 +++++++-------------------
> drivers/scsi/be2iscsi/be_main.h | 1 +
> drivers/scsi/be2iscsi/be_mgmt.c | 28 ---------------
> drivers/scsi/scsi_transport_iscsi.c | 2 +
> include/scsi/iscsi_if.h | 2 +
> 7 files changed, 62 insertions(+), 137 deletions(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 37d1008..498eba2 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -402,31 +402,31 @@ void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
> iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
> }
>
> -static void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
> - struct be_async_event_link_state *evt)
> +static void beiscsi_process_async_link(struct beiscsi_hba *phba,
> + struct be_mcc_compl *compl)
> {
> - if ((evt->port_link_status == ASYNC_EVENT_LINK_DOWN) ||
> - ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
> - (evt->port_fault != BEISCSI_PHY_LINK_FAULT_NONE))) {
> - phba->state = BE_ADAPTER_LINK_DOWN;
> + struct be_async_event_link_state *evt;
>
> - beiscsi_log(phba, KERN_ERR,
> - BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
> - "BC_%d : Link Down on Port %d\n",
> - evt->physical_port);
> + evt = (struct be_async_event_link_state *)compl;
>
> - iscsi_host_for_each_session(phba->shost,
> - beiscsi_fail_session);
> - } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
> - ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
> - (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
> + phba->port_speed = evt->port_speed;
> + /**
> + * Check logical link status in ASYNC event.
> + * This has been newly introduced in SKH-R Firmware 10.0.338.45.
> + **/
> + if (evt->port_link_status & BE_ASYNC_LINK_UP_MASK) {
> phba->state = BE_ADAPTER_LINK_UP | BE_ADAPTER_CHECK_BOOT;
> phba->get_boot = BE_GET_BOOT_RETRIES;
> -
> - beiscsi_log(phba, KERN_ERR,
> - BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
> - "BC_%d : Link UP on Port %d\n",
> - evt->physical_port);
> + __beiscsi_log(phba, KERN_ERR,
> + "BC_%d : Link Up on Port %d tag 0x%x\n",
> + evt->physical_port, evt->event_tag);
> + } else {
> + phba->state = BE_ADAPTER_LINK_DOWN;
> + __beiscsi_log(phba, KERN_ERR,
> + "BC_%d : Link Down on Port %d tag 0x%x\n",
> + evt->physical_port, evt->event_tag);
> + iscsi_host_for_each_session(phba->shost,
> + beiscsi_fail_session);
> }
> }
>
> @@ -438,9 +438,6 @@ static char *beiscsi_port_misconf_event_msg[] = {
> "Unqualified optics - Replace with Avago optics for Warranty and Technical Support.",
> "Uncertified optics - Replace with Avago Certified optics to enable link operation."
> };
> -#define BEISCSI_PORT_MISCONF_EVENT_MAX \
> - (sizeof(beiscsi_port_misconf_event_msg) / \
> - sizeof(beiscsi_port_misconf_event_msg[0]))
>
> static void beiscsi_process_async_sli(struct beiscsi_hba *phba,
> struct be_mcc_compl *compl)
> @@ -466,7 +463,7 @@ static void beiscsi_process_async_sli(struct beiscsi_hba *phba,
> old_state = phba->optic_state;
> phba->optic_state = state;
>
> - if (state >= BEISCSI_PORT_MISCONF_EVENT_MAX) {
> + if (state >= ARRAY_SIZE(beiscsi_port_misconf_event_msg)) {
> /* fw is reporting a state we don't know, log and return */
> __beiscsi_log(phba, KERN_ERR,
> "BC_%d : Port %c: Unrecognized optic state 0x%x\n",
> @@ -506,8 +503,7 @@ void beiscsi_process_async_event(struct beiscsi_hba *phba,
> evt_code &= ASYNC_TRAILER_EVENT_CODE_MASK;
> switch (evt_code) {
> case ASYNC_EVENT_CODE_LINK_STATE:
> - beiscsi_async_link_state_process(phba,
> - (struct be_async_event_link_state *)compl);
> + beiscsi_process_async_link(phba, compl);
> break;
> case ASYNC_EVENT_CODE_ISCSI:
> phba->state |= BE_ADAPTER_CHECK_BOOT;
> @@ -523,8 +519,8 @@ void beiscsi_process_async_event(struct beiscsi_hba *phba,
> }
>
> beiscsi_log(phba, sev, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> - "BC_%d : ASYNC Event: status 0x%08x flags 0x%08x\n",
> - compl->status, compl->flags);
> + "BC_%d : ASYNC Event %x: status 0x%08x flags 0x%08x\n",
> + evt_code, compl->status, compl->flags);
> }
>
> int beiscsi_process_mcc(struct beiscsi_hba *phba)
> diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
> index 6411f7b..3b9bc2e 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.h
> +++ b/drivers/scsi/be2iscsi/be_cmds.h
> @@ -142,7 +142,6 @@ struct be_async_event_trailer {
> enum {
> ASYNC_EVENT_LINK_DOWN = 0x0,
> ASYNC_EVENT_LINK_UP = 0x1,
> - ASYNC_EVENT_LOGICAL = 0x2
> };
>
> /**
> @@ -152,13 +151,26 @@ enum {
> struct be_async_event_link_state {
> u8 physical_port;
> u8 port_link_status;
> +/**
> + * ASYNC_EVENT_LINK_DOWN 0x0
> + * ASYNC_EVENT_LINK_UP 0x1
> + * ASYNC_EVENT_LINK_LOGICAL_DOWN 0x2
> + * ASYNC_EVENT_LINK_LOGICAL_UP 0x3
> + */
> +#define BE_ASYNC_LINK_UP_MASK 0x01
> u8 port_duplex;
> u8 port_speed;
> -#define BEISCSI_PHY_LINK_FAULT_NONE 0x00
> -#define BEISCSI_PHY_LINK_FAULT_LOCAL 0x01
> -#define BEISCSI_PHY_LINK_FAULT_REMOTE 0x02
> +/* BE2ISCSI_LINK_SPEED_ZERO 0x00 - no link */
> +#define BE2ISCSI_LINK_SPEED_10MBPS 0x01
> +#define BE2ISCSI_LINK_SPEED_100MBPS 0x02
> +#define BE2ISCSI_LINK_SPEED_1GBPS 0x03
> +#define BE2ISCSI_LINK_SPEED_10GBPS 0x04
> +#define BE2ISCSI_LINK_SPEED_25GBPS 0x06
> +#define BE2ISCSI_LINK_SPEED_40GBPS 0x07
> u8 port_fault;
> - u8 rsvd0[7];
> + u8 event_reason;
> + u16 qos_link_speed;
> + u32 event_tag;
> struct be_async_event_trailer trailer;
> } __packed;
>
> @@ -675,20 +687,6 @@ struct be_cmd_req_modify_eq_delay {
>
> /******************** Get MAC ADDR *******************/
>
> -#define ETH_ALEN 6
> -
> -struct be_cmd_get_nic_conf_req {
> - struct be_cmd_req_hdr hdr;
> - u32 nic_port_count;
> - u32 speed;
> - u32 max_speed;
> - u32 link_state;
> - u32 max_frame_size;
> - u16 size_of_structure;
> - u8 mac_address[ETH_ALEN];
> - u32 rsvd[23];
> -};
> -
> struct be_cmd_get_nic_conf_resp {
> struct be_cmd_resp_hdr hdr;
> u32 nic_port_count;
> @@ -697,9 +695,8 @@ struct be_cmd_get_nic_conf_resp {
> u32 link_state;
> u32 max_frame_size;
> u16 size_of_structure;
> - u8 mac_address[6];
> - u32 rsvd[23];
> -};
> + u8 mac_address[ETH_ALEN];
> +} __packed;
>
> #define BEISCSI_ALIAS_LEN 32
>
> @@ -711,29 +708,6 @@ struct be_cmd_hba_name {
> u8 initiator_alias[BEISCSI_ALIAS_LEN];
> } __packed;
>
> -struct be_cmd_ntwk_link_status_req {
> - struct be_cmd_req_hdr hdr;
> - u32 rsvd0;
> -} __packed;
> -
> -/*** Port Speed Values ***/
> -#define BE2ISCSI_LINK_SPEED_ZERO 0x00
> -#define BE2ISCSI_LINK_SPEED_10MBPS 0x01
> -#define BE2ISCSI_LINK_SPEED_100MBPS 0x02
> -#define BE2ISCSI_LINK_SPEED_1GBPS 0x03
> -#define BE2ISCSI_LINK_SPEED_10GBPS 0x04
> -struct be_cmd_ntwk_link_status_resp {
> - struct be_cmd_resp_hdr hdr;
> - u8 phys_port;
> - u8 mac_duplex;
> - u8 mac_speed;
> - u8 mac_fault;
> - u8 mgmt_mac_duplex;
> - u8 mgmt_mac_speed;
> - u16 qos_link_speed;
> - u32 logical_link_speed;
> -} __packed;
> -
> int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
> struct be_queue_info *eq, int eq_delay);
>
> @@ -752,7 +726,6 @@ int be_poll_mcc(struct be_ctrl_info *ctrl);
> int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
> struct beiscsi_hba *phba);
> unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
> -unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
>
> void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
>
> diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
> index 3545721..eca72b9 100644
> --- a/drivers/scsi/be2iscsi/be_iscsi.c
> +++ b/drivers/scsi/be2iscsi/be_iscsi.c
> @@ -749,51 +749,30 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
> }
>
> /**
> - * beiscsi_get_port_state - Get the Port State
> + * beiscsi_set_port_state - Set port_state in iscsi_cls_host
> * @shost : pointer to scsi_host structure
> *
> */
> -static void beiscsi_get_port_state(struct Scsi_Host *shost)
> +static void beiscsi_set_port_state(struct Scsi_Host *shost)
> {
> struct beiscsi_hba *phba = iscsi_host_priv(shost);
> struct iscsi_cls_host *ihost = shost->shost_data;
>
> - ihost->port_state = (phba->state == BE_ADAPTER_LINK_UP) ?
> + ihost->port_state = (phba->state & BE_ADAPTER_LINK_UP) ?
> ISCSI_PORT_STATE_UP : ISCSI_PORT_STATE_DOWN;
> }
>
> /**
> - * beiscsi_get_port_speed - Get the Port Speed from Adapter
> + * beiscsi_set_port_speed - Set port_speed in iscsi_cls_host
> * @shost : pointer to scsi_host structure
> *
> - * returns Success/Failure
> */
> -static int beiscsi_get_port_speed(struct Scsi_Host *shost)
> +static void beiscsi_set_port_speed(struct Scsi_Host *shost)
> {
> - int rc;
> - unsigned int tag;
> - struct be_mcc_wrb *wrb;
> - struct be_cmd_ntwk_link_status_resp *resp;
> struct beiscsi_hba *phba = iscsi_host_priv(shost);
> struct iscsi_cls_host *ihost = shost->shost_data;
>
> - tag = be_cmd_get_port_speed(phba);
> - if (!tag) {
> - beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> - "BS_%d : Getting Port Speed Failed\n");
> -
> - return -EBUSY;
> - }
> - rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
> - if (rc) {
> - beiscsi_log(phba, KERN_ERR,
> - BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> - "BS_%d : Port Speed MBX Failed\n");
> - return rc;
> - }
> - resp = embedded_payload(wrb);
> -
> - switch (resp->mac_speed) {
> + switch (phba->port_speed) {
> case BE2ISCSI_LINK_SPEED_10MBPS:
> ihost->port_speed = ISCSI_PORT_SPEED_10MBPS;
> break;
> @@ -806,10 +785,15 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
> case BE2ISCSI_LINK_SPEED_10GBPS:
> ihost->port_speed = ISCSI_PORT_SPEED_10GBPS;
> break;
> + case BE2ISCSI_LINK_SPEED_25GBPS:
> + ihost->port_speed = ISCSI_PORT_SPEED_25GBPS;
> + break;
> + case BE2ISCSI_LINK_SPEED_40GBPS:
> + ihost->port_speed = ISCSI_PORT_SPEED_40GBPS;
> + break;
> default:
> ihost->port_speed = ISCSI_PORT_SPEED_UNKNOWN;
> }
> - return 0;
> }
>
> /**
> @@ -855,16 +839,11 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
> }
> break;
> case ISCSI_HOST_PARAM_PORT_STATE:
> - beiscsi_get_port_state(shost);
> + beiscsi_set_port_state(shost);
> status = sprintf(buf, "%s\n", iscsi_get_port_state_name(shost));
> break;
> case ISCSI_HOST_PARAM_PORT_SPEED:
> - status = beiscsi_get_port_speed(shost);
> - if (status) {
> - beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> - "BS_%d : Retreiving Port Speed Failed\n");
> - return status;
> - }
> + beiscsi_set_port_speed(shost);
> status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
> break;
> default:
Why did you rename the functions?
The new names are utterly confusing. Please keep the old names.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-12-14 15:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 6:10 [PATCH 0/9] be2iscsi driver update to 11.0.0.0 Jitendra Bhivare
2015-12-14 6:10 ` [PATCH 1/9] be2iscsi: Fix soft lockup in mgmt_get_all_if_id path using bmbx Jitendra Bhivare
2015-12-14 15:04 ` Hannes Reinecke
2015-12-15 4:03 ` Jitendra Bhivare
2015-12-14 6:10 ` [PATCH 2/9] be2iscsi: Fix mbox synchronization replacing spinlock with mutex Jitendra Bhivare
2015-12-14 15:09 ` Hannes Reinecke
2015-12-14 6:11 ` [PATCH 3/9] be2iscsi: Fix to remove shutdown entry point Jitendra Bhivare
2015-12-14 15:11 ` Hannes Reinecke
2015-12-14 6:11 ` [PATCH 4/9] be2iscsi: Fix VLAN support for IPv6 network Jitendra Bhivare
2015-12-14 15:11 ` Hannes Reinecke
2015-12-14 6:11 ` [PATCH 5/9] be2iscsi: Fix to handle misconfigured optics events Jitendra Bhivare
2015-12-14 15:18 ` Hannes Reinecke
2015-12-15 13:17 ` Jitendra Bhivare
2015-12-14 6:11 ` [PATCH 6/9] be2iscsi: Fix IOPOLL implementation Jitendra Bhivare
2015-12-14 15:23 ` Hannes Reinecke
2015-12-15 4:50 ` Jitendra Bhivare
2015-12-14 6:11 ` [PATCH 7/9] be2iscsi: Fix to process 25G link speed info from FW Jitendra Bhivare
2015-12-14 15:26 ` Hannes Reinecke [this message]
2015-12-14 6:11 ` [PATCH 8/9] be2iscsi: Fix WRB leak in login/logout path Jitendra Bhivare
2015-12-14 15:27 ` Hannes Reinecke
2015-12-14 6:11 ` [PATCH 9/9] be2iscsi: Update the driver version Jitendra Bhivare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=566EDF9B.4060908@suse.de \
--to=hare@suse.de \
--cc=jitendra.bhivare@avagotech.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).