From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99366A0548; Tue, 22 Jun 2021 22:06:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24A044003F; Tue, 22 Jun 2021 22:06:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 162FD4003E for ; Tue, 22 Jun 2021 22:06:16 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15MK1S6l001976 for ; Tue, 22 Jun 2021 13:06:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=div95r1xZw8wQ7cE4seRgnaN0Bum2Q8NApqzYMLFqPw=; b=bAV8Z1krk++KNzj48phLqLgDys0ihCJUhP6ei1w2GR2ppSfxpJE3ZtAC+dTEoxJ8U0Du JFlB2D3k2qBjPsTfNVdkyDcH+e1Ao8qkp2bLpt6+ssWQXlgCeVxjmRCknrayERIIxnzm eV6xKu44fv1EJleds/9Exsq9X/dHQxB3mZAjTzNcZzElKEAe96ZGVAAgCp0eJl49JxD7 qeoOnFaSgOg/0f7yFHDIbEx2hCCnBtfuMSN6SZyo8qVzbN+jqr32gIIQ2FpYuUoxULmJ qIdTKjOXfZZ5WQMZbwbaODGd7qlDetYrAcpN/9dIdRwzCFEKkVKL3MjPtzSyvnQt1Cgz 5g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 39b91hbqd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 22 Jun 2021 13:06:15 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Jun 2021 13:06:14 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 22 Jun 2021 13:06:14 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id 372C65B6925; Tue, 22 Jun 2021 13:06:12 -0700 (PDT) From: Harman Kalra To: Jerin Jacob , Nithin Dabilpuram CC: , Harman Kalra Date: Wed, 23 Jun 2021 01:35:53 +0530 Message-ID: <20210622200554.1544-1-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: PGzNtFZJ2HEydMsnioLiOIPr3hRL0mG_ X-Proofpoint-GUID: PGzNtFZJ2HEydMsnioLiOIPr3hRL0mG_ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-22_13:2021-06-22, 2021-06-22 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] common/octeontx2: send link event to VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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