diff mbox series

scsi: qedf: Add port_id getter

Message ID 20190923103738.67749-1-dwagner@suse.de (mailing list archive)
State Superseded
Headers show
Series scsi: qedf: Add port_id getter | expand

Commit Message

Daniel Wagner Sept. 23, 2019, 10:37 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>
---
 drivers/scsi/qedf/qedf_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Saurav Kashyap Sept. 24, 2019, 6:08 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: Monday, September 23, 2019 4:08 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] 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>
> ---
>  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; }

Minor stuff, the closing brace should be in next line. Please submit v2.

Thanks,
~Saurav
> +
>  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
Daniel Wagner Sept. 24, 2019, 7:11 a.m. UTC | #2
On Tue, Sep 24, 2019 at 06:08:09AM +0000, Saurav Kashyap wrote:
> > +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; }
> 
> Minor stuff, the closing brace should be in next line. Please submit v2.

Oops, sorry about that.

Thanks
Daniel
Daniel Wagner Sept. 24, 2019, 7:23 a.m. UTC | #3
Hi Saurav,

On Tue, Sep 24, 2019 at 09:11:38AM +0200, Daniel Wagner wrote:
> On Tue, Sep 24, 2019 at 06:08:09AM +0000, Saurav Kashyap wrote:
> > > +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; }
> > 
> > Minor stuff, the closing brace should be in next line. Please submit v2.
> 
> Oops, sorry about that.

The patch I sent out had the closing brace on a new
line:

https://lore.kernel.org/linux-scsi/20190923103738.67749-1-dwagner@suse.de/

Now I am a bit confused how I screwed it up. Anyway, I'll send it out
again after with hexdump there is not a special ASCII character
hidden :)

Thanks,
Daniel
Saurav Kashyap Sept. 24, 2019, 9:10 a.m. UTC | #4
Hi Daniel,

> -----Original Message-----
> From: Daniel Wagner <dwagner@suse.de>
> Sent: Tuesday, September 24, 2019 12:54 PM
> To: Saurav Kashyap <skashyap@marvell.com>
> Cc: QLogic-Storage-Upstream@cavium.com; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH] scsi: qedf: Add port_id getter
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi Saurav,
> 
> On Tue, Sep 24, 2019 at 09:11:38AM +0200, Daniel Wagner wrote:
> > On Tue, Sep 24, 2019 at 06:08:09AM +0000, Saurav Kashyap wrote:
> > > > +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; }
> > >
> > > Minor stuff, the closing brace should be in next line. Please submit v2.
> >
> > Oops, sorry about that.
> 
> The patch I sent out had the closing brace on a new
> line:
> 
> https://lore.kernel.org/linux-scsi/20190923103738.67749-1-dwagner@suse.de/
> 
> Now I am a bit confused how I screwed it up. Anyway, I'll send it out
> again after with hexdump there is not a special ASCII character
> hidden :)

Sorry about that, I changed my email client and it remove the extra lines.

Thanks,
~Saurav
> 
> Thanks,
> Daniel
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,