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 2A5EEA0C45; Thu, 16 Sep 2021 16:32:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 14937407FF; Thu, 16 Sep 2021 16:32:06 +0200 (CEST) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by mails.dpdk.org (Postfix) with ESMTP id 30D5A4069E for ; Thu, 16 Sep 2021 16:32:05 +0200 (CEST) Received: by mail-il1-f181.google.com with SMTP id b15so6780947ils.10 for ; Thu, 16 Sep 2021 07:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qwl+kLMZHmILHHGx7F6CdJ7YZSmisi0nKTfsEANMSME=; b=qfUx3qGivgwPSi0F4w25sg8Yy3ERcB0w86VDOj9rmZjSCappOfmqIRRjoehdeiPvkE FDjXNj+fwdf5TnafU0qCokRyFOsxaokGyXm26P8E01t/2DsDIWXSl26n+WkxZiYnfhba Y7MXbRd/NyLzna9/WvuttzX6iwR2JLV0sGJiVsGh1jl65W5/11MJz/g3gdw7Ny7GYuZp jO+JVsmSlcgoGx8eY0GfHEuTD+zv7i9hp4H5bYe+DIxLUPfNCL6aLhf76YKzRgZVDpIG 430TgSvJ+Do3SPpt3qjk1OMl4w2QmQSaw6s/C1OdoQa8oGm0eql3a0CXPI9wTof0ka1U Lmvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qwl+kLMZHmILHHGx7F6CdJ7YZSmisi0nKTfsEANMSME=; b=TkvR25R0mTmDilikl3bfeFUaHXqMraz4SWbk44mXu6PrEVwVvISvuvoPAn5bD5+HVT YA3TCPrrKRYNZ1KoXUvjYUQtvxR+U0FJZlxCzsqpEFMggIjF6Io8cnBwQ3d8CcMPk+5C F5Y1QZaM6espmh3nHYkhAglF+f0v+gIfvxkfh4uRrzCH78bIOglTu2qXT3iarZrtEzZ6 238koSwDIzmPz6W4wca89s6kFNc0iy4AUA2oIQjCAU/Vpo8QtjHEkIOLlEP3eTgNh7qY +asNnY+SPwuIH9SnLel5wskXGTwovSAxypwPxvtNmBK3Bn7cHxZk4ejkuC2spgaVgupW q/EQ== X-Gm-Message-State: AOAM5313LHoYZSb1/RK1lO5lM1j+ht08Ry0nD1xhQJw9oTaWgGAhA5VF 6Nx782A1cjUAIJT/MtLvH2zaWr4FRe7lhulH9tWql94KOqvFeA== X-Google-Smtp-Source: ABdhPJx8xKEw/0y9IwFDw8B71H4j/UHBNlXU9MtSnZAzNhoAKynE+dYAGakjrZHMABm0Ob6DqSqoVQOdiSKoAZRvBmU= X-Received: by 2002:a92:6e12:: with SMTP id j18mr4184695ilc.243.1631802724515; Thu, 16 Sep 2021 07:32:04 -0700 (PDT) MIME-Version: 1.0 References: <20210730160829.13597-1-hkalra@marvell.com> In-Reply-To: <20210730160829.13597-1-hkalra@marvell.com> From: Jerin Jacob Date: Thu, 16 Sep 2021 20:01:37 +0530 Message-ID: To: Harman Kalra Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/2] common/cnxk: 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" On Fri, Jul 30, 2021 at 9:38 PM Harman Kalra wrote: > > 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 Series Acked-by: Jerin Jacob > --- > drivers/common/cnxk/roc_dev.c | 33 ++++++++++++++++++++++++++++++ > drivers/common/cnxk/roc_dev_priv.h | 5 +++++ > drivers/common/cnxk/roc_nix.h | 7 +++++++ > drivers/common/cnxk/roc_nix_mac.c | 23 +++++++++++++++++++++ > drivers/common/cnxk/version.map | 2 ++ > 5 files changed, 70 insertions(+) > > diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c > index c14f189f9b..4e204373dc 100644 > --- a/drivers/common/cnxk/roc_dev.c > +++ b/drivers/common/cnxk/roc_dev.c > @@ -163,6 +163,39 @@ af_pf_wait_msg(struct 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; > + size_t sz; > + > + /* Get the link status */ > + memset(&linfo, 0, sizeof(struct cgx_link_user_info)); > + if (dev->ops && dev->ops->link_status_get) > + dev->ops->link_status_get(dev->roc_nix, &linfo); > + > + sz = PLT_ALIGN(mbox_id2size(MBOX_MSG_CGX_LINK_EVENT), > + MBOX_MSG_ALIGN); > + /* Prepare the message to be sent */ > + vf_msg = mbox_alloc_msg(&dev->mbox_vfpf_up, vf, sz); > + if (vf_msg) { > + 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 */ > + mbox_msg_send(&dev->mbox_vfpf_up, vf); > + } > + } > + > offset = mbox->rx_start + msg->next_msgoff; > } > plt_spinlock_unlock(&mdev->mbox_lock); > diff --git a/drivers/common/cnxk/roc_dev_priv.h b/drivers/common/cnxk/roc_dev_priv.h > index 9488db3c41..302dc0feb0 100644 > --- a/drivers/common/cnxk/roc_dev_priv.h > +++ b/drivers/common/cnxk/roc_dev_priv.h > @@ -30,9 +30,14 @@ typedef void (*link_info_t)(void *roc_nix, > /* PTP info callback */ > typedef int (*ptp_info_t)(void *roc_nix, bool enable); > > +/* Link status get callback */ > +typedef void (*link_status_get_t)(void *roc_nix, > + struct cgx_link_user_info *link); > + > struct dev_ops { > link_info_t link_status_update; > ptp_info_t ptp_info_update; > + link_status_get_t link_status_get; > }; > > #define dev_is_vf(dev) ((dev)->hwcap & DEV_HWCAP_F_VF) > diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h > index bb69027956..d7ab3c674e 100644 > --- a/drivers/common/cnxk/roc_nix.h > +++ b/drivers/common/cnxk/roc_nix.h > @@ -243,6 +243,10 @@ typedef void (*link_status_t)(struct roc_nix *roc_nix, > /* PTP info update callback */ > typedef int (*ptp_info_update_t)(struct roc_nix *roc_nix, bool enable); > > +/* Link status get callback */ > +typedef void (*link_info_get_t)(struct roc_nix *roc_nix, > + struct roc_nix_link_info *link); > + > struct roc_nix { > /* Input parameters */ > struct plt_pci_device *pci_dev; > @@ -487,6 +491,9 @@ int __roc_api roc_nix_mac_max_rx_len_set(struct roc_nix *roc_nix, > int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, > link_status_t link_update); > void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix); > +int __roc_api roc_nix_mac_link_info_get_cb_register( > + struct roc_nix *roc_nix, link_info_get_t link_info_get); > +void __roc_api roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix); > > /* Ops */ > int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix, > diff --git a/drivers/common/cnxk/roc_nix_mac.c b/drivers/common/cnxk/roc_nix_mac.c > index 682d5a7295..36259941c9 100644 > --- a/drivers/common/cnxk/roc_nix_mac.c > +++ b/drivers/common/cnxk/roc_nix_mac.c > @@ -296,3 +296,26 @@ roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix) > > dev->ops->link_status_update = NULL; > } > + > +int > +roc_nix_mac_link_info_get_cb_register(struct roc_nix *roc_nix, > + link_info_get_t link_info_get) > +{ > + struct nix *nix = roc_nix_to_nix_priv(roc_nix); > + struct dev *dev = &nix->dev; > + > + if (link_info_get == NULL) > + return NIX_ERR_PARAM; > + > + dev->ops->link_status_get = (link_info_t)link_info_get; > + return 0; > +} > + > +void > +roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix) > +{ > + struct nix *nix = roc_nix_to_nix_priv(roc_nix); > + struct dev *dev = &nix->dev; > + > + dev->ops->link_status_get = NULL; > +} > diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map > index e3af48c02e..4cc2c9652c 100644 > --- a/drivers/common/cnxk/version.map > +++ b/drivers/common/cnxk/version.map > @@ -105,6 +105,8 @@ INTERNAL { > roc_nix_mac_addr_set; > roc_nix_mac_link_cb_register; > roc_nix_mac_link_cb_unregister; > + roc_nix_mac_link_info_get_cb_register; > + roc_nix_mac_link_info_get_cb_unregister; > roc_nix_mac_link_event_start_stop; > roc_nix_mac_link_info_get; > roc_nix_mac_link_info_set; > -- > 2.18.0 >