Thread (52 messages) flat view 52 messages, 7 authors, 2023-01-24

RE: [PATCH net-next 3/7] sfc: add mport lookup based on driver's mport data

From: "Keller, Jacob E" <jacob.e.keller@intel.com>
Date: 2023-01-20 18:36:44

-----Original Message-----
From: Lucero Palau, Alejandro <redacted>
Sent: Friday, January 20, 2023 1:35 AM
To: Keller, Jacob E <jacob.e.keller@intel.com>; Lucero Palau, Alejandro
[off-list ref]; netdev@vger.kernel.org; linux-net-drivers
(AMD-Xilinx) [off-list ref]
Cc: davem@davemloft.net; kuba@kernel.org; pabeni@redhat.com;
edumazet@google.com; habetsm@gmail.com; ecree.xilinx@gmail.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:
quoted
On 1/19/2023 3:31 AM, alejandro.lucero-palau@amd.com wrote:
quoted
+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
&&
quoted
quoted
+		    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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help