Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Adit Ranadive <aditr@vmware.com>
To: jgg@mellanox.com, dledford@redhat.com, linux-rdma@vger.kernel.org
Cc: Adit Ranadive <aditr@vmware.com>, pv-drivers@vmware.com
Subject: [PATCH for-rc] RDMA/vmw_pvrdma: Fix the active_speed and phys_state value
Date: Wed, 28 Oct 2020 23:19:45 +0000	[thread overview]
Message-ID: <20201028231945.6533-1-aditr@vmware.com> (raw)

The PVRDMA device still reports the active_speed in u8.
Lets use the ib_eth_get_speed to report the speed and
width. Unfortunately, phys_state gets stored as msb of
the new u16 active_speed.

Fixes: 376ceb31ff87 ("RDMA: Fix link active_speed size")
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Signed-off-by: Adit Ranadive <aditr@vmware.com>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma.h      | 18 ------------------
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.c    |  8 ++++----
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h    |  2 +-
 3 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
index c142f5e7f25f..17f20506575f 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
@@ -360,24 +360,6 @@ static inline enum pvrdma_port_width ib_port_width_to_pvrdma(
 	return (enum pvrdma_port_width)width;
 }
 
-static inline enum ib_port_width pvrdma_port_width_to_ib(
-					enum pvrdma_port_width width)
-{
-	return (enum ib_port_width)width;
-}
-
-static inline enum pvrdma_port_speed ib_port_speed_to_pvrdma(
-					enum ib_port_speed speed)
-{
-	return (enum pvrdma_port_speed)speed;
-}
-
-static inline enum ib_port_speed pvrdma_port_speed_to_ib(
-					enum pvrdma_port_speed speed)
-{
-	return (enum ib_port_speed)speed;
-}
-
 static inline int ib_qp_attr_mask_to_pvrdma(int attr_mask)
 {
 	return attr_mask & PVRDMA_MASK(PVRDMA_QP_ATTR_MASK_MAX);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
index fc412cbfd042..221705837d78 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
@@ -167,11 +167,11 @@ int pvrdma_query_port(struct ib_device *ibdev, u8 port,
 	props->sm_sl = resp->attrs.sm_sl;
 	props->subnet_timeout = resp->attrs.subnet_timeout;
 	props->init_type_reply = resp->attrs.init_type_reply;
-	props->active_width = pvrdma_port_width_to_ib(resp->attrs.active_width);
-	props->active_speed = pvrdma_port_speed_to_ib(resp->attrs.active_speed);
-	props->phys_state = resp->attrs.phys_state;
+	err = ib_get_eth_speed(ibdev, 1, &props->active_speed,
+			       &props->active_width);
+	props->phys_state = resp->attrs.active_speed >> 8;
 
-	return 0;
+	return err;
 }
 
 /**
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
index f0e5ffba2d51..715416902992 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
@@ -178,7 +178,7 @@ struct pvrdma_port_attr {
 	u8			active_width;
 	u16			active_speed;
 	u8			phys_state;
-	u8			reserved[2];
+	u8			reserved;
 };
 
 struct pvrdma_global_route {
-- 
2.18.1


             reply	other threads:[~2020-10-28 23:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 23:19 Adit Ranadive [this message]
2020-10-29 11:57 ` [PATCH for-rc] RDMA/vmw_pvrdma: Fix the active_speed and phys_state value Jason Gunthorpe
2020-10-29 16:16   ` [Suspected Spam] " Adit Ranadive
2020-11-02 17:55     ` Adit Ranadive
2020-11-02 18:02       ` Jason Gunthorpe
2020-11-02 18:21         ` Adit Ranadive
2020-11-02 18:27           ` Jason Gunthorpe
2020-11-02 18:38             ` [Suspected Spam] " Adit Ranadive
2020-11-02 18:46               ` Jason Gunthorpe
2020-11-03  6:56                 ` Leon Romanovsky
2020-11-03 22:41                   ` Adit Ranadive
2020-11-04  9:50                     ` Leon Romanovsky

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=20201028231945.6533-1-aditr@vmware.com \
    --to=aditr@vmware.com \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=pv-drivers@vmware.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