diff mbox series

[v2] scsi: qedf: Add port_id getter

Message ID 20190924072906.23737-1-dwagner@suse.de (mailing list archive)
State Mainlined
Commit c3dde2f3fe6aa48ed4650e103d23aac8f9620ddd
Headers show
Series [v2] scsi: qedf: Add port_id getter | expand

Commit Message

Daniel Wagner Sept. 24, 2019, 7:29 a.m. UTC
Add qedf_get_host_port_id() to the transport template.

The fc_transport_template initializes the port_id member to the
default value of -1. The new getter ensures that the sysfs entry shows
the current value and not the default one, e.g by using 'lsscsi -H -t'

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---

changes v2:
  - place closing brace on new line, fix whitespace damage

 drivers/scsi/qedf/qedf_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Saurav Kashyap Sept. 24, 2019, 9:06 a.m. UTC | #1
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org <linux-scsi-owner@vger.kernel.org> On
> Behalf Of Daniel Wagner
> Sent: Tuesday, September 24, 2019 12:59 PM
> To: QLogic-Storage-Upstream@cavium.com
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; Daniel Wagner
> <dwagner@suse.de>
> Subject: [PATCH v2] scsi: qedf: Add port_id getter
> 
> Add qedf_get_host_port_id() to the transport template.
> 
> The fc_transport_template initializes the port_id member to the
> default value of -1. The new getter ensures that the sysfs entry shows
> the current value and not the default one, e.g by using 'lsscsi -H -t'
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
> 
> changes v2:
>   - place closing brace on new line, fix whitespace damage
> 
>  drivers/scsi/qedf/qedf_main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 9c24f3834d70..8fe8c3fdde1b 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -1926,6 +1926,13 @@ static int qedf_fcoe_reset(struct Scsi_Host *shost)
>  	return 0;
>  }
> 
> +static void qedf_get_host_port_id(struct Scsi_Host *shost)
> +{
> +	struct fc_lport *lport = shost_priv(shost);
> +
> +	fc_host_port_id(shost) = lport->port_id;
> +}
> +
>  static struct fc_host_statistics *qedf_fc_get_host_stats(struct Scsi_Host
>  	*shost)
>  {
> @@ -1996,6 +2003,7 @@ static struct fc_function_template
> qedf_fc_transport_fn = {
>  	.show_host_active_fc4s = 1,
>  	.show_host_maxframe_size = 1,
> 
> +	.get_host_port_id = qedf_get_host_port_id,
>  	.show_host_port_id = 1,
>  	.show_host_supported_speeds = 1,
>  	.get_host_speed = fc_get_host_speed,
> --
> 2.16.4

Thanks for the patch.

Acked-by: Saurav Kashyap <skashyap@marvell.com>
Hannes Reinecke Sept. 24, 2019, 12:03 p.m. UTC | #2
On 9/24/19 9:29 AM, Daniel Wagner wrote:
> Add qedf_get_host_port_id() to the transport template.
> 
> The fc_transport_template initializes the port_id member to the
> default value of -1. The new getter ensures that the sysfs entry shows
> the current value and not the default one, e.g by using 'lsscsi -H -t'
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
> 
> changes v2:
>   - place closing brace on new line, fix whitespace damage
> 
>  drivers/scsi/qedf/qedf_main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 9c24f3834d70..8fe8c3fdde1b 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -1926,6 +1926,13 @@ static int qedf_fcoe_reset(struct Scsi_Host *shost)
>  	return 0;
>  }
>  
> +static void qedf_get_host_port_id(struct Scsi_Host *shost)
> +{
> +	struct fc_lport *lport = shost_priv(shost);
> +
> +	fc_host_port_id(shost) = lport->port_id;
> +}
> +
>  static struct fc_host_statistics *qedf_fc_get_host_stats(struct Scsi_Host
>  	*shost)
>  {
> @@ -1996,6 +2003,7 @@ static struct fc_function_template qedf_fc_transport_fn = {
>  	.show_host_active_fc4s = 1,
>  	.show_host_maxframe_size = 1,
>  
> +	.get_host_port_id = qedf_get_host_port_id,
>  	.show_host_port_id = 1,
>  	.show_host_supported_speeds = 1,
>  	.get_host_speed = fc_get_host_speed,
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Martin K. Petersen Oct. 1, 2019, 3:05 a.m. UTC | #3
Daniel,

> Add qedf_get_host_port_id() to the transport template.
>
> The fc_transport_template initializes the port_id member to the
> default value of -1. The new getter ensures that the sysfs entry shows
> the current value and not the default one, e.g by using 'lsscsi -H -t'

Applied to 5.5/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 9c24f3834d70..8fe8c3fdde1b 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1926,6 +1926,13 @@  static int qedf_fcoe_reset(struct Scsi_Host *shost)
 	return 0;
 }
 
+static void qedf_get_host_port_id(struct Scsi_Host *shost)
+{
+	struct fc_lport *lport = shost_priv(shost);
+
+	fc_host_port_id(shost) = lport->port_id;
+}
+
 static struct fc_host_statistics *qedf_fc_get_host_stats(struct Scsi_Host
 	*shost)
 {
@@ -1996,6 +2003,7 @@  static struct fc_function_template qedf_fc_transport_fn = {
 	.show_host_active_fc4s = 1,
 	.show_host_maxframe_size = 1,
 
+	.get_host_port_id = qedf_get_host_port_id,
 	.show_host_port_id = 1,
 	.show_host_supported_speeds = 1,
 	.get_host_speed = fc_get_host_speed,