Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

eth: fbnic: split fbnic_flush()

Factor out handling a single nv from fbnic_flush() to make
it reusable for queue ops.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250901211214.1027927-8-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jakub Kicinski and committed by
Paolo Abeni
be2be74a cbfc0474

+45 -42
+45 -42
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
··· 2297 2297 return err; 2298 2298 } 2299 2299 2300 + static void fbnic_nv_flush(struct fbnic_napi_vector *nv) 2301 + { 2302 + int j, t; 2303 + 2304 + /* Flush any processed Tx Queue Triads and drop the rest */ 2305 + for (t = 0; t < nv->txt_count; t++) { 2306 + struct fbnic_q_triad *qt = &nv->qt[t]; 2307 + struct netdev_queue *tx_queue; 2308 + 2309 + /* Clean the work queues of unprocessed work */ 2310 + fbnic_clean_twq0(nv, 0, &qt->sub0, true, qt->sub0.tail); 2311 + fbnic_clean_twq1(nv, false, &qt->sub1, true, 2312 + qt->sub1.tail); 2313 + 2314 + /* Reset completion queue descriptor ring */ 2315 + memset(qt->cmpl.desc, 0, qt->cmpl.size); 2316 + 2317 + /* Nothing else to do if Tx queue is disabled */ 2318 + if (qt->sub0.flags & FBNIC_RING_F_DISABLED) 2319 + continue; 2320 + 2321 + /* Reset BQL associated with Tx queue */ 2322 + tx_queue = netdev_get_tx_queue(nv->napi.dev, 2323 + qt->sub0.q_idx); 2324 + netdev_tx_reset_queue(tx_queue); 2325 + } 2326 + 2327 + /* Flush any processed Rx Queue Triads and drop the rest */ 2328 + for (j = 0; j < nv->rxt_count; j++, t++) { 2329 + struct fbnic_q_triad *qt = &nv->qt[t]; 2330 + 2331 + /* Clean the work queues of unprocessed work */ 2332 + fbnic_clean_bdq(&qt->sub0, qt->sub0.tail, 0); 2333 + fbnic_clean_bdq(&qt->sub1, qt->sub1.tail, 0); 2334 + 2335 + /* Reset completion queue descriptor ring */ 2336 + memset(qt->cmpl.desc, 0, qt->cmpl.size); 2337 + 2338 + fbnic_put_pkt_buff(qt, qt->cmpl.pkt, 0); 2339 + memset(qt->cmpl.pkt, 0, sizeof(struct fbnic_pkt_buff)); 2340 + } 2341 + } 2342 + 2300 2343 void fbnic_flush(struct fbnic_net *fbn) 2301 2344 { 2302 2345 int i; 2303 2346 2304 - for (i = 0; i < fbn->num_napi; i++) { 2305 - struct fbnic_napi_vector *nv = fbn->napi[i]; 2306 - int j, t; 2307 - 2308 - /* Flush any processed Tx Queue Triads and drop the rest */ 2309 - for (t = 0; t < nv->txt_count; t++) { 2310 - struct fbnic_q_triad *qt = &nv->qt[t]; 2311 - struct netdev_queue *tx_queue; 2312 - 2313 - /* Clean the work queues of unprocessed work */ 2314 - fbnic_clean_twq0(nv, 0, &qt->sub0, true, qt->sub0.tail); 2315 - fbnic_clean_twq1(nv, false, &qt->sub1, true, 2316 - qt->sub1.tail); 2317 - 2318 - /* Reset completion queue descriptor ring */ 2319 - memset(qt->cmpl.desc, 0, qt->cmpl.size); 2320 - 2321 - /* Nothing else to do if Tx queue is disabled */ 2322 - if (qt->sub0.flags & FBNIC_RING_F_DISABLED) 2323 - continue; 2324 - 2325 - /* Reset BQL associated with Tx queue */ 2326 - tx_queue = netdev_get_tx_queue(nv->napi.dev, 2327 - qt->sub0.q_idx); 2328 - netdev_tx_reset_queue(tx_queue); 2329 - } 2330 - 2331 - /* Flush any processed Rx Queue Triads and drop the rest */ 2332 - for (j = 0; j < nv->rxt_count; j++, t++) { 2333 - struct fbnic_q_triad *qt = &nv->qt[t]; 2334 - 2335 - /* Clean the work queues of unprocessed work */ 2336 - fbnic_clean_bdq(&qt->sub0, qt->sub0.tail, 0); 2337 - fbnic_clean_bdq(&qt->sub1, qt->sub1.tail, 0); 2338 - 2339 - /* Reset completion queue descriptor ring */ 2340 - memset(qt->cmpl.desc, 0, qt->cmpl.size); 2341 - 2342 - fbnic_put_pkt_buff(qt, qt->cmpl.pkt, 0); 2343 - memset(qt->cmpl.pkt, 0, sizeof(struct fbnic_pkt_buff)); 2344 - } 2345 - } 2347 + for (i = 0; i < fbn->num_napi; i++) 2348 + fbnic_nv_flush(fbn->napi[i]); 2346 2349 } 2347 2350 2348 2351 void fbnic_fill(struct fbnic_net *fbn)