Message ID | 164103678041.26263.8354809911405746465.stgit@palantir17.mph.net (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] sfc: The RX page_ring is optional | expand |
Hi Martin, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] url: https://github.com/0day-ci/linux/commits/Martin-Habets/sfc-The-RX-page_ring-is-optional/20220101-194123 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git e63a02348958cd7cc8c8401c94de57ad97b5d06c config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220102/202201021335.SbR7I6ht-lkp@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c054402170cd8466683a20385befc0523aba3359) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/162a8e2305bbbba8cd81966114ecce08790c431d git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Martin-Habets/sfc-The-RX-page_ring-is-optional/20220101-194123 git checkout 162a8e2305bbbba8cd81966114ecce08790c431d # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/net/ethernet/sfc/rx_common.c:120:3: error: void function 'efx_recycle_rx_pages' should not return a value [-Wreturn-type] return NULL; ^ ~~~~ 1 error generated. -- >> drivers/net/ethernet/sfc/falcon/rx.c:299:3: error: void function 'ef4_recycle_rx_pages' should not return a value [-Wreturn-type] return NULL; ^ ~~~~ 1 error generated. vim +/efx_recycle_rx_pages +120 drivers/net/ethernet/sfc/rx_common.c 111 112 /* Recycle the pages that are used by buffers that have just been received. */ 113 void efx_recycle_rx_pages(struct efx_channel *channel, 114 struct efx_rx_buffer *rx_buf, 115 unsigned int n_frags) 116 { 117 struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); 118 119 if (unlikely(!rx_queue->page_ring)) > 120 return NULL; 121 122 do { 123 efx_recycle_rx_page(channel, rx_buf); 124 rx_buf = efx_rx_buf_next(rx_queue, rx_buf); 125 } while (--n_frags); 126 } 127 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c index 11a6aee852e9..57874adfb1b2 100644 --- a/drivers/net/ethernet/sfc/falcon/rx.c +++ b/drivers/net/ethernet/sfc/falcon/rx.c @@ -110,6 +110,8 @@ static struct page *ef4_reuse_page(struct ef4_rx_queue *rx_queue) struct ef4_rx_page_state *state; unsigned index; + if (unlikely(!rx_queue->page_ring)) + return NULL; index = rx_queue->page_remove & rx_queue->page_ptr_mask; page = rx_queue->page_ring[index]; if (page == NULL) @@ -293,6 +295,9 @@ static void ef4_recycle_rx_pages(struct ef4_channel *channel, { struct ef4_rx_queue *rx_queue = ef4_channel_get_rx_queue(channel); + if (unlikely(!rx_queue->page_ring)) + return NULL; + do { ef4_recycle_rx_page(channel, rx_buf); rx_buf = ef4_rx_buf_next(rx_queue, rx_buf); diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index 0983abc0cc5f..9ea50617dd04 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -45,6 +45,8 @@ static struct page *efx_reuse_page(struct efx_rx_queue *rx_queue) unsigned int index; struct page *page; + if (unlikely(!rx_queue->page_ring)) + return NULL; index = rx_queue->page_remove & rx_queue->page_ptr_mask; page = rx_queue->page_ring[index]; if (page == NULL) @@ -114,6 +116,9 @@ void efx_recycle_rx_pages(struct efx_channel *channel, { struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); + if (unlikely(!rx_queue->page_ring)) + return NULL; + do { efx_recycle_rx_page(channel, rx_buf); rx_buf = efx_rx_buf_next(rx_queue, rx_buf);
The RX page_ring is an optional feature that improves performance. When allocation fails the driver can still function, but possibly with a lower bandwidth. Guard against dereferencing a NULL page_ring. Fixes: 2768935a4660 ("sfc: reuse pages to avoid DMA mapping/unmapping costs") Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com> Reported-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> --- drivers/net/ethernet/sfc/falcon/rx.c | 5 +++++ drivers/net/ethernet/sfc/rx_common.c | 5 +++++ 2 files changed, 10 insertions(+)