* [PATCH net-next] sfc: The RX page_ring is optional
@ 2022-01-01 11:33 Martin Habets
2022-01-02 5:23 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: Martin Habets @ 2022-01-01 11:33 UTC (permalink / raw)
To: kuba, jiasheng, davem; +Cc: ecree.xilinx, netdev
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(+)
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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] sfc: The RX page_ring is optional
2022-01-01 11:33 [PATCH net-next] sfc: The RX page_ring is optional Martin Habets
@ 2022-01-02 5:23 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-02 5:23 UTC (permalink / raw)
To: Martin Habets, kuba, jiasheng, davem
Cc: llvm, kbuild-all, ecree.xilinx, netdev
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] sfc: The RX page_ring is optional
@ 2022-01-02 5:23 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-02 5:23 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2642 bytes --]
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(a)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(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-02 5:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 11:33 [PATCH net-next] sfc: The RX page_ring is optional Martin Habets
2022-01-02 5:23 ` kernel test robot
2022-01-02 5:23 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.