2022-05-17 17:39:52

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH 03/12] net: mana: Handle vport sharing between devices

On Tue, 17 May 2022 02:04:27 -0700
[email protected] wrote:

> diff --git a/drivers/net/ethernet/microsoft/mana/mana.h b/drivers/net/ethernet/microsoft/mana/mana.h
> index 51bff91b63ee..26f14fcb6a61 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana.h
> +++ b/drivers/net/ethernet/microsoft/mana/mana.h
> @@ -375,6 +375,7 @@ struct mana_port_context {
> unsigned int num_queues;
>
> mana_handle_t port_handle;
> + atomic_t port_use_count;

Could this be a refcount_t instead?
The refcount_t has protections against under/overflow.


2022-05-18 04:46:46

by Long Li

[permalink] [raw]
Subject: RE: [PATCH 03/12] net: mana: Handle vport sharing between devices

> Subject: Re: [PATCH 03/12] net: mana: Handle vport sharing between devices
>
> On Tue, 17 May 2022 02:04:27 -0700
> [email protected] wrote:
>
> > diff --git a/drivers/net/ethernet/microsoft/mana/mana.h
> b/drivers/net/ethernet/microsoft/mana/mana.h
> > index 51bff91b63ee..26f14fcb6a61 100644
> > --- a/drivers/net/ethernet/microsoft/mana/mana.h
> > +++ b/drivers/net/ethernet/microsoft/mana/mana.h
> > @@ -375,6 +375,7 @@ struct mana_port_context {
> > unsigned int num_queues;
> >
> > mana_handle_t port_handle;
> > + atomic_t port_use_count;
>
> Could this be a refcount_t instead?
> The refcount_t has protections against under/overflow.

Thanks for pointing this out. I will use refcount_t for v2.

Long