From: Vladimir Oltean <olteanv@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Eric Dumazet <edumazet@google.com>,
George McCollister <george.mccollister@gmail.com>,
Oleksij Rempel <o.rempel@pengutronix.de>,
Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
Arnd Bergmann <arnd@arndb.de>, Taehee Yoo <ap420073@gmail.com>,
Jiri Pirko <jiri@mellanox.com>, Florian Westphal <fw@strlen.de>
Subject: [PATCH v4 net-next 10/18] scsi: fcoe: propagate errors from dev_get_stats
Date: Fri, 8 Jan 2021 02:19:57 +0200 [thread overview]
Message-ID: <20210108002005.3429956-11-olteanv@gmail.com> (raw)
In-Reply-To: <20210108002005.3429956-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
The FCoE callback for the Link Error Status Block retrieves the FCS
error count using dev_get_stats. This function can now return errors.
Propagate these all the way to the sysfs device attributes.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v4:
Patch is new (Eric's suggestion).
drivers/scsi/fcoe/fcoe_sysfs.c | 9 +++++++--
drivers/scsi/fcoe/fcoe_transport.c | 24 +++++++++++++++---------
drivers/scsi/libfc/fc_rport.c | 5 ++++-
include/scsi/fcoe_sysfs.h | 12 ++++++------
include/scsi/libfc.h | 2 +-
include/scsi/libfcoe.h | 8 ++++----
6 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index af658aa38fed..a197e66ffa8a 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -139,8 +139,13 @@ static ssize_t show_fcoe_ctlr_device_##field(struct device *dev, \
char *buf) \
{ \
struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); \
- if (ctlr->f->get_fcoe_ctlr_##field) \
- ctlr->f->get_fcoe_ctlr_##field(ctlr); \
+ int err; \
+ \
+ if (ctlr->f->get_fcoe_ctlr_##field) { \
+ err = ctlr->f->get_fcoe_ctlr_##field(ctlr); \
+ if (err) \
+ return err; \
+ } \
return snprintf(buf, sz, format_string, \
cast fcoe_ctlr_##field(ctlr)); \
}
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 213ee9efb044..5d19650e9bc1 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -166,15 +166,16 @@ EXPORT_SYMBOL_GPL(fcoe_link_speed_update);
* Note, the Link Error Status Block (LESB) for FCoE is defined in FC-BB-6
* Clause 7.11 in v1.04.
*/
-void __fcoe_get_lesb(struct fc_lport *lport,
- struct fc_els_lesb *fc_lesb,
- struct net_device *netdev)
+int __fcoe_get_lesb(struct fc_lport *lport,
+ struct fc_els_lesb *fc_lesb,
+ struct net_device *netdev)
{
struct rtnl_link_stats64 dev_stats;
unsigned int cpu;
u32 lfc, vlfc, mdac;
struct fc_stats *stats;
struct fcoe_fc_els_lesb *lesb;
+ int err;
lfc = 0;
vlfc = 0;
@@ -190,8 +191,14 @@ void __fcoe_get_lesb(struct fc_lport *lport,
lesb->lesb_link_fail = htonl(lfc);
lesb->lesb_vlink_fail = htonl(vlfc);
lesb->lesb_miss_fka = htonl(mdac);
- dev_get_stats(netdev, &dev_stats);
+
+ err = dev_get_stats(netdev, &dev_stats);
+ if (err)
+ return err;
+
lesb->lesb_fcs_error = htonl(dev_stats.rx_crc_errors);
+
+ return 0;
}
EXPORT_SYMBOL_GPL(__fcoe_get_lesb);
@@ -200,12 +207,11 @@ EXPORT_SYMBOL_GPL(__fcoe_get_lesb);
* @lport: the local port
* @fc_lesb: the link error status block
*/
-void fcoe_get_lesb(struct fc_lport *lport,
- struct fc_els_lesb *fc_lesb)
+int fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb)
{
struct net_device *netdev = fcoe_get_netdev(lport);
- __fcoe_get_lesb(lport, fc_lesb, netdev);
+ return __fcoe_get_lesb(lport, fc_lesb, netdev);
}
EXPORT_SYMBOL_GPL(fcoe_get_lesb);
@@ -215,14 +221,14 @@ EXPORT_SYMBOL_GPL(fcoe_get_lesb);
* @ctlr_dev: The given fcoe controller device
*
*/
-void fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev)
+int fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev)
{
struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr_dev);
struct net_device *netdev = fcoe_get_netdev(fip->lp);
struct fc_els_lesb *fc_lesb;
fc_lesb = (struct fc_els_lesb *)(&ctlr_dev->lesb);
- __fcoe_get_lesb(fip->lp, fc_lesb, netdev);
+ return __fcoe_get_lesb(fip->lp, fc_lesb, netdev);
}
EXPORT_SYMBOL_GPL(fcoe_ctlr_get_lesb);
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 56003208d2e7..cb299fef7a78 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -1633,6 +1633,7 @@ static void fc_rport_recv_rls_req(struct fc_rport_priv *rdata,
struct fc_els_lesb *lesb;
struct fc_seq_els_data rjt_data;
struct fc_host_statistics *hst;
+ int err;
lockdep_assert_held(&rdata->rp_mutex);
@@ -1659,7 +1660,9 @@ static void fc_rport_recv_rls_req(struct fc_rport_priv *rdata,
lesb = &rsp->rls_lesb;
if (lport->tt.get_lesb) {
/* get LESB from LLD if it supports it */
- lport->tt.get_lesb(lport, lesb);
+ err = lport->tt.get_lesb(lport, lesb);
+ if (err)
+ goto out_rjt;
} else {
fc_get_host_stats(lport->host);
hst = &lport->host_stats;
diff --git a/include/scsi/fcoe_sysfs.h b/include/scsi/fcoe_sysfs.h
index 4b1216de3f22..076b593f2625 100644
--- a/include/scsi/fcoe_sysfs.h
+++ b/include/scsi/fcoe_sysfs.h
@@ -16,12 +16,12 @@ struct fcoe_ctlr_device;
struct fcoe_fcf_device;
struct fcoe_sysfs_function_template {
- void (*get_fcoe_ctlr_link_fail)(struct fcoe_ctlr_device *);
- void (*get_fcoe_ctlr_vlink_fail)(struct fcoe_ctlr_device *);
- void (*get_fcoe_ctlr_miss_fka)(struct fcoe_ctlr_device *);
- void (*get_fcoe_ctlr_symb_err)(struct fcoe_ctlr_device *);
- void (*get_fcoe_ctlr_err_block)(struct fcoe_ctlr_device *);
- void (*get_fcoe_ctlr_fcs_error)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_link_fail)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_vlink_fail)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_miss_fka)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_symb_err)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_err_block)(struct fcoe_ctlr_device *);
+ int (*get_fcoe_ctlr_fcs_error)(struct fcoe_ctlr_device *);
void (*set_fcoe_ctlr_mode)(struct fcoe_ctlr_device *);
int (*set_fcoe_ctlr_enabled)(struct fcoe_ctlr_device *);
void (*get_fcoe_fcf_selected)(struct fcoe_fcf_device *);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 9b87e1a1c646..510654796db5 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -501,7 +501,7 @@ struct libfc_function_template {
*
* STATUS: OPTIONAL
*/
- void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb);
+ int (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb);
/*
* Reset an exchange manager, completing all sequences and exchanges.
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 2568cb0627ec..a42cbe847ce6 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -255,13 +255,13 @@ int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
u32 fcoe_fc_crc(struct fc_frame *fp);
int fcoe_start_io(struct sk_buff *skb);
int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
-void __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb,
- struct net_device *netdev);
+int __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb,
+ struct net_device *netdev);
void fcoe_wwn_to_str(u64 wwn, char *buf, int len);
int fcoe_validate_vport_create(struct fc_vport *vport);
int fcoe_link_speed_update(struct fc_lport *);
-void fcoe_get_lesb(struct fc_lport *, struct fc_els_lesb *);
-void fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev);
+int fcoe_get_lesb(struct fc_lport *, struct fc_els_lesb *);
+int fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev);
/**
* is_fip_mode() - returns true if FIP mode selected.
--
2.25.1
next prev parent reply other threads:[~2021-01-08 0:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 0:19 [PATCH v4 net-next 00/18] Make .ndo_get_stats64 sleepable Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 01/18] net: mark dev_base_lock for deprecation Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 02/18] net: introduce a mutex for the netns interface lists Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 03/18] net: procfs: hold netif_lists_lock when retrieving device statistics Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 04/18] net: sysfs: don't hold dev_base_lock while " Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 05/18] s390/appldata_net_sum: hold the netdev lists lock when " Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 06/18] parisc/led: reindent the code that gathers " Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 07/18] parisc/led: hold the netdev lists lock when retrieving " Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 08/18] net: make dev_get_stats return void Vladimir Oltean
2021-01-08 10:14 ` Eric Dumazet
2021-01-08 10:31 ` Vladimir Oltean
2021-01-08 10:38 ` Eric Dumazet
2021-01-08 0:19 ` [PATCH v4 net-next 09/18] net: allow ndo_get_stats64 to return an int error code Vladimir Oltean
2021-01-08 0:19 ` Vladimir Oltean [this message]
2021-01-08 0:19 ` [PATCH v4 net-next 11/18] net: openvswitch: propagate errors from dev_get_stats Vladimir Oltean
2021-01-08 0:19 ` [PATCH v4 net-next 12/18] net: " Vladimir Oltean
2021-01-08 0:20 ` [PATCH v4 net-next 13/18] net: terminate " Vladimir Oltean
2021-01-08 0:20 ` [PATCH v4 net-next 14/18] net: openvswitch: ensure dev_get_stats can sleep Vladimir Oltean
2021-01-08 0:20 ` [PATCH v4 net-next 15/18] net: net_failover: ensure .ndo_get_stats64 " Vladimir Oltean
2021-01-08 0:20 ` [PATCH v4 net-next 16/18] net: bonding: " Vladimir Oltean
2021-01-08 9:58 ` Nikolay Aleksandrov
2021-01-08 0:20 ` [PATCH v4 net-next 17/18] net: mark ndo_get_stats64 as being able to sleep Vladimir Oltean
2021-01-08 0:20 ` [PATCH v4 net-next 18/18] net: remove obsolete comments about ndo_get_stats64 context from eth drivers Vladimir Oltean
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=20210108002005.3429956-11-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=andy@greyhouse.net \
--cc=ap420073@gmail.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=fw@strlen.de \
--cc=george.mccollister@gmail.com \
--cc=j.vosburgh@gmail.com \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=o.rempel@pengutronix.de \
--cc=stephen@networkplumber.org \
--cc=vfalico@gmail.com \
--cc=xiyou.wangcong@gmail.com \
/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).