[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB50896ED5BCA48756B04B2458D6C59@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Fri, 20 Jan 2023 18:36:36 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: "Lucero Palau, Alejandro" <alejandro.lucero-palau@....com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-net-drivers (AMD-Xilinx)" <linux-net-drivers@....com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"habetsm@...il.com" <habetsm@...il.com>,
"ecree.xilinx@...il.com" <ecree.xilinx@...il.com>
Subject: RE: [PATCH net-next 3/7] sfc: add mport lookup based on driver's
mport data
> -----Original Message-----
> From: Lucero Palau, Alejandro <alejandro.lucero-palau@....com>
> Sent: Friday, January 20, 2023 1:35 AM
> To: Keller, Jacob E <jacob.e.keller@...el.com>; Lucero Palau, Alejandro
> <alejandro.lucero-palau@....com>; netdev@...r.kernel.org; linux-net-drivers
> (AMD-Xilinx) <linux-net-drivers@....com>
> Cc: davem@...emloft.net; kuba@...nel.org; pabeni@...hat.com;
> edumazet@...gle.com; habetsm@...il.com; ecree.xilinx@...il.com
> Subject: Re: [PATCH net-next 3/7] sfc: add mport lookup based on driver's mport
> data
>
>
> On 1/19/23 23:57, Jacob Keller wrote:
> >
> > On 1/19/2023 3:31 AM, alejandro.lucero-palau@....com wrote:
> >> +int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf_idx, u32 *id)
> >> +{
> >> + struct ef100_nic_data *nic_data = efx->nic_data;
> >> + struct efx_mae *mae = efx->mae;
> >> + struct rhashtable_iter walk;
> >> + struct mae_mport_desc *m;
> >> + int rc = -ENOENT;
> >> +
> >> + rhashtable_walk_enter(&mae->mports_ht, &walk);
> >> + rhashtable_walk_start(&walk);
> >> + while ((m = rhashtable_walk_next(&walk)) != NULL) {
> >> + if (m->mport_type == MAE_MPORT_DESC_MPORT_TYPE_VNIC
> &&
> >> + m->interface_idx == nic_data->local_mae_intf &&
> >> + m->pf_idx == 0 &&
> >> + m->vf_idx == vf_idx) {
> >> + *id = m->mport_id;
> >> + rc = 0;
> >> + break;
> >> + }
> >> + }
> >> + rhashtable_walk_stop(&walk);
> >> + rhashtable_walk_exit(&walk);
> > Curious if you have any reasoning for why you chose rhashtable vs
> > another structure (such as a simpler hash table of linked lists or xarray).
>
>
> The mports can appear and disappear (although it is not supported by the
> code yet nor by current firmware/hardware) so something resizable was
> needed for supporting this in the near future.
>
>
Right. Xarray feels like it would fit the bill too. I don't know what the advantage/disadvantage would be compared to rhashtable.
Powered by blists - more mailing lists