On 11/24/26 12:54 AM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] ibmveth: persistent pool deactivation in
ibmveth_alloc_queue_buffer_pools()
--
diff --git a/drivers/net/ethernet/ibm/ibmveth.c
b/drivers/net/ethernet/ibm/ibmveth.c
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -660,6 +660,100 @@ static void ibmveth_rxq_no_skb(struct ibmveth_adapter
*adapter,
schedule_work(&adapter->work);
}
+/**
+ * ibmveth_free_queue_buffer_pools - Free buffer pools for a single queue
+ * @adapter: ibmveth adapter structure
+ * @queue: queue index
+ *
+ * Frees every pool on @queue regardless of the active flag;
+ * ibmveth_free_buffer_pool() skips what was never allocated.
+ */
+static void ibmveth_free_queue_buffer_pools(struct ibmveth_adapter *adapter,
+ int queue)
+{
+ int i;
+
+ for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
+ ibmveth_free_buffer_pool(adapter,
+ &adapter->rx_buff_pool[queue][i]);
+}
+
+/**
+ * ibmveth_alloc_queue_buffer_pools - Allocate buffer pools for a single queue
+ * @adapter: ibmveth adapter structure
+ * @queue: queue index
+ *
+ * Allocates backing storage for each active pool on @queue.
+ *
+ * Return: 0 on success, -ENOMEM on failure
+ */
+static int ibmveth_alloc_queue_buffer_pools(struct ibmveth_adapter *adapter,
+ int queue)
+{
+ struct net_device *netdev = adapter->netdev;
+ int i;
+
+ for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
+ struct ibmveth_buff_pool *bpool =
+ &adapter->rx_buff_pool[queue][i];
+
+ if (!bpool->active)
+ continue;
+
+ if (ibmveth_alloc_buffer_pool(bpool)) {
+ netdev_err(netdev,
+ "queue %d pool %d alloc failed (size=%u
count=%u)\n",
+ queue, i,
+ bpool->buff_size,
+ bpool->size);
+ bpool->active = 0;
+ /* Undo the pools this queue already allocated; the
+ * failed one freed its own partial allocation.
+ */
+ ibmveth_free_queue_buffer_pools(adapter, queue);
+ return -ENOMEM;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * ibmveth_alloc_buffer_pools - Allocate buffer pools for all queues
+ * @adapter: ibmveth adapter structure
+ *
+ * Return: 0 on success, -ENOMEM on failure
+ */
+static int
+ibmveth_alloc_buffer_pools(struct ibmveth_adapter *adapter)
+{
+ int q, rc;
+
+ for (q = 0; q < adapter->num_rx_queues; q++) {
+ rc = ibmveth_alloc_queue_buffer_pools(adapter, q);
+ if (rc) {
+ while (--q >= 0)
+ ibmveth_free_queue_buffer_pools(adapter, q);
+ return rc;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * ibmveth_free_buffer_pools - Free buffer pools for all queues
+ * @adapter: ibmveth adapter structure
+ */
+static void
+ibmveth_free_buffer_pools(struct ibmveth_adapter *adapter)
+{
+ int q;
+
+ for (q = 0; q < adapter->num_rx_queues; q++)
+ ibmveth_free_queue_buffer_pools(adapter, q);
+}
+
/**
* ibmveth_remove_buffer_from_pool - remove a buffer from a pool
* @adapter: adapter instance
[Severity: Medium]
Now that ibmveth_free_queue_buffer_pools() frees every pool on the
queue regardless of the active flag, is there still a reason to clear
bpool->active here?
The active flag is the pool's persistent configuration. It comes from
pool_active[] at probe, is turned on by ibmveth_change_mtu() for large
MTUs and toggled through veth_pool_store(), and ibmveth_close() leaves
it alone so the same pools come back on the next open. Clearing it on
a transient ibmveth_alloc_buffer_pool() failure has two effects. A
later ibmveth_open() quietly skips that pool, and it can succeed
without a pool large enough for mtu + IBMVETH_BUFF_OH.
None of the callers of ibmveth_open() put the flag back.
veth_pool_store() only restores oldactive for the pool it is editing.
The ndo_open path, ibmveth_change_mtu(), ibmveth_set_csum_offload(),
ibmveth_set_tso() and ibmveth_reset() do not touch it at all.
The old single-queue loop did the same thing. With per-queue pools,
though, a failure on one queue also leaves rx_buff_pool[q][i].active
different between queues for the same pool index.
Can this line simply be dropped, since the unwind no longer depends on
it?
Yes — the clear is not needed for unwind. It is also not new here: it
dates back to 860f242eb534 ("[PATCH] ibmveth change buffer pools
dynamically"), and this patch keeps it so the refactor does not change
behaviour.
I am dropping it in the multi-queue series that follows, not in an s1
respin. With one RX queue (this series and base), the only effect is
that later opens skip that pool. Once there are several RX queues, the
same clear can leave queues with different active sets, or disable the
pool on every queue when queue 0's template is cleared. That is where
the footgun shows up, so the fix belongs with that series (first
patch: drop `bpool->active = 0`, retry the pool on the next open).
Until then this prep series just prepares the helpers and leaves the
pre-existing clear alone.
Thanks,
Mingming