DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harman Kalra <hkalra@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>
Cc: <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>
Subject: [dpdk-dev] [PATCH 1/2] common/octeontx2: send link event to VF
Date: Wed, 23 Jun 2021 01:35:53 +0530	[thread overview]
Message-ID: <20210622200554.1544-1-hkalra@marvell.com> (raw)

Currently link event is only sent to the PF by AF as soon as it comes
up, or in case of any physical change in link. PF will broadcast
these link events to all its VFs as soon as it receives it.
But no event is sent when a new VF comes up, hence it will not have
the link status.
Adding support for sending link status to the VF once it comes up
successfully.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/common/octeontx2/otx2_dev.c | 26 ++++++++++++++++++++++++++
 drivers/common/octeontx2/otx2_dev.h | 10 +++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
index 6a84df2344..1485e2b357 100644
--- a/drivers/common/octeontx2/otx2_dev.c
+++ b/drivers/common/octeontx2/otx2_dev.c
@@ -163,6 +163,32 @@ af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
 		rsp->rc = msg->rc;
 		rsp->pcifunc = msg->pcifunc;
 
+		/* Whenever a PF comes up, AF sends the link status to it but
+		 * when VF comes up no such event is sent to respective VF.
+		 * Using MBOX_MSG_NIX_LF_START_RX response from AF for the
+		 * purpose and send the link status of PF to VF.
+		 */
+		if (msg->id == MBOX_MSG_NIX_LF_START_RX) {
+			/* Send link status to VF */
+			struct cgx_link_user_info linfo;
+			struct mbox_msghdr *vf_msg;
+
+			/* Get the link status */
+			if (dev->ops && dev->ops->link_status_get)
+				dev->ops->link_status_get(dev, &linfo);
+
+			/* Prepare the message to be sent */
+			vf_msg = otx2_mbox_alloc_msg(&dev->mbox_vfpf_up, vf,
+						     size);
+			otx2_mbox_req_init(MBOX_MSG_CGX_LINK_EVENT, vf_msg);
+			memcpy((uint8_t *)vf_msg + sizeof(struct mbox_msghdr),
+			       &linfo, sizeof(struct cgx_link_user_info));
+
+			vf_msg->rc = msg->rc;
+			vf_msg->pcifunc = msg->pcifunc;
+			/* Send to VF */
+			otx2_mbox_msg_send(&dev->mbox_vfpf_up, vf);
+		}
 		offset = mbox->rx_start + msg->next_msgoff;
 	}
 	rte_spinlock_unlock(&mdev->mbox_lock);
diff --git a/drivers/common/octeontx2/otx2_dev.h b/drivers/common/octeontx2/otx2_dev.h
index cd4fe517db..be0faacc6a 100644
--- a/drivers/common/octeontx2/otx2_dev.h
+++ b/drivers/common/octeontx2/otx2_dev.h
@@ -57,15 +57,19 @@
 
 struct otx2_dev;
 
-/* Link status callback */
-typedef void (*otx2_link_status_t)(struct otx2_dev *dev,
+/* Link status update callback */
+typedef void (*otx2_link_status_update_t)(struct otx2_dev *dev,
 				   struct cgx_link_user_info *link);
 /* PTP info callback */
 typedef int (*otx2_ptp_info_t)(struct otx2_dev *dev, bool ptp_en);
+/* Link status get callback */
+typedef void (*otx2_link_status_get_t)(struct otx2_dev *dev,
+				   struct cgx_link_user_info *link);
 
 struct otx2_dev_ops {
-	otx2_link_status_t link_status_update;
+	otx2_link_status_update_t link_status_update;
 	otx2_ptp_info_t ptp_info_update;
+	otx2_link_status_get_t link_status_get;
 };
 
 #define OTX2_DEV					\
-- 
2.18.0


             reply	other threads:[~2021-06-22 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 20:05 Harman Kalra [this message]
2021-06-22 20:05 ` [dpdk-dev] [PATCH 2/2] net/octeontx2: callback for getting link status Harman Kalra
2021-06-29 14:12   ` Jerin Jacob

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=20210622200554.1544-1-hkalra@marvell.com \
    --to=hkalra@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=ndabilpuram@marvell.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).