From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:35712 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbeCPWrW (ORCPT ); Fri, 16 Mar 2018 18:47:22 -0400 Received: by mail-pf0-f194.google.com with SMTP id y186so4722833pfb.2 for ; Fri, 16 Mar 2018 15:47:22 -0700 (PDT) Subject: Re: [PATCH net-next] liquidio: Added support for trusted VF To: Felix Manlunas , davem@davemloft.net Cc: netdev@vger.kernel.org, raghu.vatsavayi@cavium.com, derek.chickles@cavium.com, satananda.burla@cavium.com, intiyaz.basha@cavium.com References: <20180316224002.GA2507@felix-thinkpad.cavium.com> From: Eric Dumazet Message-ID: Date: Fri, 16 Mar 2018 15:47:20 -0700 MIME-Version: 1.0 In-Reply-To: <20180316224002.GA2507@felix-thinkpad.cavium.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 03/16/2018 03:40 PM, Felix Manlunas wrote: > From: Intiyaz Basha > > When a VF is trusted, all promiscuous traffic will only be sent to that VF. > In normal operation promiscuous traffic is sent to the PF. There can be > only one trusted VF per PF. > > Signed-off-by: Intiyaz Basha > Acked-by: Satanand Burla > Signed-off-by: Felix Manlunas > --- > drivers/net/ethernet/cavium/liquidio/lio_main.c | 125 +++++++++++++++++++++ > .../net/ethernet/cavium/liquidio/liquidio_common.h | 7 ++ > .../net/ethernet/cavium/liquidio/octeon_device.h | 2 + > 3 files changed, 134 insertions(+) > > diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c > index 140085b..c14b87a 100644 > --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c > +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c > @@ -91,6 +91,12 @@ static int octeon_console_debug_enabled(u32 console) > */ > #define LIO_SYNC_OCTEON_TIME_INTERVAL_MS 60000 > > +struct lio_trusted_vf_ctx { > + wait_queue_head_t wc; > + int cond; > + int status; > +}; > + > struct liquidio_rx_ctl_context { > int octeon_id; > > @@ -3265,10 +3271,128 @@ static int liquidio_get_vf_config(struct net_device *netdev, int vfidx, > ether_addr_copy(&ivi->mac[0], macaddr); > ivi->vlan = oct->sriov_info.vf_vlantci[vfidx] & VLAN_VID_MASK; > ivi->qos = oct->sriov_info.vf_vlantci[vfidx] >> VLAN_PRIO_SHIFT; > + if (oct->sriov_info.trusted_vf.active && > + oct->sriov_info.trusted_vf.id == vfidx) > + ivi->trusted = true; > + else > + ivi->trusted = false; > ivi->linkstate = oct->sriov_info.vf_linkstate[vfidx]; > return 0; > } > > +static void trusted_vf_callback(struct octeon_device *oct_dev, > + u32 status, void *ptr) > +{ > + struct octeon_soft_command *sc = (struct octeon_soft_command *)ptr; > + struct lio_trusted_vf_ctx *ctx; > + > + ctx = (struct lio_trusted_vf_ctx *)sc->ctxptr; > + ctx->status = status; > + WRITE_ONCE(ctx->cond, 1); > + > + /* This barrier is required to be sure that the response has > + * been written fully before waking up the handler > + */ > + wmb(); > + > + wake_up_interruptible(&ctx->wc); > +} Hmmm... it looks like you tried to reimplement completions, possibly dealing with barriers... Check complete(), init_completion(), wait_for_completion()