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.

octeon_ep_vf: introduce octep_vf_oq_next_idx() helper

Introduce octep_vf_oq_next_idx() to consolidate the repeated
ring index advance and wraparound pattern in __octep_vf_oq_process_rx().

No functional change intended.

Signed-off-by: David Carlier <devnexen@gmail.com>
Link: https://patch.msgid.link/20260409184009.930359-2-devnexen@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Carlier and committed by
Jakub Kicinski
4e5bc3ff 9ad24ba4

+8 -9
+8 -9
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c
··· 352 352 return new_pkts; 353 353 } 354 354 355 + static inline u32 octep_vf_oq_next_idx(struct octep_vf_oq *oq, u32 idx) 356 + { 357 + return (idx + 1 == oq->max_count) ? 0 : idx + 1; 358 + } 359 + 355 360 /** 356 361 * __octep_vf_oq_process_rx() - Process hardware Rx queue and push to stack. 357 362 * ··· 420 415 skb = napi_build_skb((void *)resp_hw, PAGE_SIZE); 421 416 skb_reserve(skb, data_offset); 422 417 skb_put(skb, buff_info->len); 423 - read_idx++; 424 418 desc_used++; 425 - if (read_idx == oq->max_count) 426 - read_idx = 0; 419 + read_idx = octep_vf_oq_next_idx(oq, read_idx); 427 420 } else { 428 421 struct skb_shared_info *shinfo; 429 422 u16 data_len; ··· 432 429 * subsequent fragments contains only data. 433 430 */ 434 431 skb_put(skb, oq->max_single_buffer_size); 435 - read_idx++; 436 432 desc_used++; 437 - if (read_idx == oq->max_count) 438 - read_idx = 0; 433 + read_idx = octep_vf_oq_next_idx(oq, read_idx); 439 434 440 435 shinfo = skb_shinfo(skb); 441 436 data_len = buff_info->len - oq->max_single_buffer_size; ··· 455 454 buff_info->len, 456 455 buff_info->len); 457 456 buff_info->page = NULL; 458 - read_idx++; 459 457 desc_used++; 460 - if (read_idx == oq->max_count) 461 - read_idx = 0; 458 + read_idx = octep_vf_oq_next_idx(oq, read_idx); 462 459 } 463 460 } 464 461