On 03/16/2018 03:40 PM, Felix Manlunas wrote:
> From: Intiyaz Basha <intiyaz.ba...@cavium.com>
> 
> 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 <intiyaz.ba...@cavium.com>
> Acked-by: Satanand Burla <satananda.bu...@cavium.com>
> Signed-off-by: Felix Manlunas <felix.manlu...@cavium.com>
> ---
>  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()


Reply via email to