public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] net: stmmac: fix oops when split header is enabled
@ 2026-02-06 19:56 Jie Zhang
  2026-02-06 20:30 ` Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jie Zhang @ 2026-02-06 19:56 UTC (permalink / raw)
  To: netdev
  Cc: jzhang918, jie.zhang, horms, Jacob Keller, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Russell King (Oracle),
	Maxime Chevallier, Vladimir Oltean, Jose Abreu, linux-stm32,
	linux-arm-kernel, linux-kernel

For GMAC4, when split header is enabled, in some rare cases, the
hardware does not fill buf2 of the first descriptor with payload.
Thus we cannot assume buf2 is always fully filled if it is not
the last descriptor. Otherwise, the length of buf2 of the second
descriptor will be calculated wrong and cause an oops:

Unable to handle kernel paging request at virtual address ffff00019246bfc0
...
x2 : 0000000000000040 x1 : ffff00019246bfc0 x0 : ffff00009246c000
Call trace:
 dcache_inval_poc+0x28/0x58 (P)
 dma_direct_sync_single_for_cpu+0x38/0x6c
 __dma_sync_single_for_cpu+0x34/0x6c
 stmmac_napi_poll_rx+0x8f0/0xb60
 __napi_poll.constprop.0+0x30/0x144
 net_rx_action+0x160/0x274
 handle_softirqs+0x1b8/0x1fc
...

To fix this, the PL bit-field in RDES3 register is used for all
descriptors, whether it is the last descriptor or not.

Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
---
v2:
1. Update for the latest net HEAD
2. Reduce crash dump message in commit message
3. Add Fixes tag
v1 link: https://lore.kernel.org/all/20251202025421.4560-1-jie.zhang@analog.com/
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a379221b96a3..8adc02003517 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5023,13 +5023,27 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
 	if (!priv->sph_active)
 		return 0;
 
-	/* Not last descriptor */
-	if (status & rx_not_ls)
+	/* For GMAC4, when split header is enabled, in some rare cases, the
+	 * hardware does not fill buf2 of the first descriptor with payload.
+	 * Thus we cannot assume buf2 is always fully filled if it is not
+	 * the last descriptor. Otherwise, the length of buf2 of the second
+	 * descriptor will be calculated wrong and cause an oops.
+	 *
+	 * If this is the last descriptor, 'plen' is the length of the
+	 * received packet that was transferred to system memory.
+	 * Otherwise, it is the accumulated number of bytes that have been
+	 * transferred for the current packet.
+	 *
+	 * Thus 'plen - len' always gives the correct length of buf2.
+	 */
+
+	/* Not GMAC4 and not last descriptor */
+	if (!priv->plat->has_gmac4 && (status & rx_not_ls))
 		return priv->dma_conf.dma_buf_sz;
 
+	/* GMAC4 or last descriptor */
 	plen = stmmac_get_rx_frame_len(priv, p, coe);
 
-	/* Last descriptor */
 	return plen - len;
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-06 19:56 [PATCH net v2] net: stmmac: fix oops when split header is enabled Jie Zhang
@ 2026-02-06 20:30 ` Russell King (Oracle)
  2026-02-09  3:41   ` Jie Zhang
  2026-02-07  1:15 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Russell King (Oracle) @ 2026-02-06 20:30 UTC (permalink / raw)
  To: Jie Zhang
  Cc: netdev, jie.zhang, horms, Jacob Keller, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Maxime Chevallier,
	Vladimir Oltean, Jose Abreu, linux-stm32, linux-arm-kernel,
	linux-kernel

On Fri, Feb 06, 2026 at 02:56:38PM -0500, Jie Zhang wrote:
> For GMAC4, when split header is enabled, in some rare cases, the
> hardware does not fill buf2 of the first descriptor with payload.
> Thus we cannot assume buf2 is always fully filled if it is not
> the last descriptor. Otherwise, the length of buf2 of the second
> descriptor will be calculated wrong and cause an oops:
> 
> Unable to handle kernel paging request at virtual address ffff00019246bfc0
> ...
> x2 : 0000000000000040 x1 : ffff00019246bfc0 x0 : ffff00009246c000
> Call trace:
>  dcache_inval_poc+0x28/0x58 (P)
>  dma_direct_sync_single_for_cpu+0x38/0x6c
>  __dma_sync_single_for_cpu+0x34/0x6c
>  stmmac_napi_poll_rx+0x8f0/0xb60
>  __napi_poll.constprop.0+0x30/0x144
>  net_rx_action+0x160/0x274
>  handle_softirqs+0x1b8/0x1fc
> ...
> 
> To fix this, the PL bit-field in RDES3 register is used for all
> descriptors, whether it is the last descriptor or not.
> 
> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Jie Zhang <jie.zhang@analog.com>
> ---
> v2:
> 1. Update for the latest net HEAD
> 2. Reduce crash dump message in commit message
> 3. Add Fixes tag
> v1 link: https://lore.kernel.org/all/20251202025421.4560-1-jie.zhang@analog.com/

I was trying to work out whether this was a re-post of a patch that had
already been merged and it was the result of someone inappropriately
re-posting old patches, or whether it was something to take seriously.

That is because of this in the patch:

> +	/* Not GMAC4 and not last descriptor */
> +	if (!priv->plat->has_gmac4 && (status & rx_not_ls))

Commit 26ab9830beab ("net: stmmac: replace has_xxxx with core_type"):

diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 99022620457a..151c81c560c8 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
...
+       enum dwmac_core_type core_type;
...
-       int has_gmac4;

So, has_gmac4 no longer exists, and hasn't done since October last
year.

Thus, it seems your patch has been generated against an old kernel.
As you are submitting for netdev, it is a good idea to ensure that
patches apply to the net-next tree and/or net tree depending on
which one you are targetting, and have been tested against that
tree.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-06 19:56 [PATCH net v2] net: stmmac: fix oops when split header is enabled Jie Zhang
  2026-02-06 20:30 ` Russell King (Oracle)
@ 2026-02-07  1:15 ` kernel test robot
  2026-02-07  1:46 ` kernel test robot
  2026-02-09 13:55 ` kernel test robot
  3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-02-07  1:15 UTC (permalink / raw)
  To: Jie Zhang, netdev
  Cc: oe-kbuild-all, jzhang918, jie.zhang, horms, Jacob Keller,
	Andrew Lunn, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Russell King (Oracle),
	Maxime Chevallier, Vladimir Oltean, Jose Abreu, linux-stm32,
	linux-arm-kernel, linux-kernel

Hi Jie,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jie-Zhang/net-stmmac-fix-oops-when-split-header-is-enabled/20260207-035916
base:   net/main
patch link:    https://lore.kernel.org/r/20260206195643.11333-1-jie.zhang%40analog.com
patch subject: [PATCH net v2] net: stmmac: fix oops when split header is enabled
config: arc-hsdk_defconfig (https://download.01.org/0day-ci/archive/20260207/202602070917.7RxMgQNe-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260207/202602070917.7RxMgQNe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602070917.7RxMgQNe-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_rx_buf2_len':
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5041:24: error: 'struct plat_stmmacenet_data' has no member named 'has_gmac4'
    5041 |         if (!priv->plat->has_gmac4 && (status & rx_not_ls))
         |                        ^~


vim +5041 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

  5014	
  5015	static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
  5016					       struct dma_desc *p,
  5017					       int status, unsigned int len)
  5018	{
  5019		int coe = priv->hw->rx_csum;
  5020		unsigned int plen = 0;
  5021	
  5022		/* Not split header, buffer is not available */
  5023		if (!priv->sph_active)
  5024			return 0;
  5025	
  5026		/* For GMAC4, when split header is enabled, in some rare cases, the
  5027		 * hardware does not fill buf2 of the first descriptor with payload.
  5028		 * Thus we cannot assume buf2 is always fully filled if it is not
  5029		 * the last descriptor. Otherwise, the length of buf2 of the second
  5030		 * descriptor will be calculated wrong and cause an oops.
  5031		 *
  5032		 * If this is the last descriptor, 'plen' is the length of the
  5033		 * received packet that was transferred to system memory.
  5034		 * Otherwise, it is the accumulated number of bytes that have been
  5035		 * transferred for the current packet.
  5036		 *
  5037		 * Thus 'plen - len' always gives the correct length of buf2.
  5038		 */
  5039	
  5040		/* Not GMAC4 and not last descriptor */
> 5041		if (!priv->plat->has_gmac4 && (status & rx_not_ls))
  5042			return priv->dma_conf.dma_buf_sz;
  5043	
  5044		/* GMAC4 or last descriptor */
  5045		plen = stmmac_get_rx_frame_len(priv, p, coe);
  5046	
  5047		return plen - len;
  5048	}
  5049	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-06 19:56 [PATCH net v2] net: stmmac: fix oops when split header is enabled Jie Zhang
  2026-02-06 20:30 ` Russell King (Oracle)
  2026-02-07  1:15 ` kernel test robot
@ 2026-02-07  1:46 ` kernel test robot
  2026-02-09 13:55 ` kernel test robot
  3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-02-07  1:46 UTC (permalink / raw)
  To: Jie Zhang, netdev
  Cc: llvm, oe-kbuild-all, jzhang918, jie.zhang, horms, Jacob Keller,
	Andrew Lunn, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Russell King (Oracle),
	Maxime Chevallier, Vladimir Oltean, Jose Abreu, linux-stm32,
	linux-arm-kernel, linux-kernel

Hi Jie,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jie-Zhang/net-stmmac-fix-oops-when-split-header-is-enabled/20260207-035916
base:   net/main
patch link:    https://lore.kernel.org/r/20260206195643.11333-1-jie.zhang%40analog.com
patch subject: [PATCH net v2] net: stmmac: fix oops when split header is enabled
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260207/202602070944.47xACYer-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260207/202602070944.47xACYer-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602070944.47xACYer-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5041:19: error: no member named 'has_gmac4' in 'struct plat_stmmacenet_data'
    5041 |         if (!priv->plat->has_gmac4 && (status & rx_not_ls))
         |              ~~~~~~~~~~  ^
   1 error generated.


vim +5041 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

  5014	
  5015	static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
  5016					       struct dma_desc *p,
  5017					       int status, unsigned int len)
  5018	{
  5019		int coe = priv->hw->rx_csum;
  5020		unsigned int plen = 0;
  5021	
  5022		/* Not split header, buffer is not available */
  5023		if (!priv->sph_active)
  5024			return 0;
  5025	
  5026		/* For GMAC4, when split header is enabled, in some rare cases, the
  5027		 * hardware does not fill buf2 of the first descriptor with payload.
  5028		 * Thus we cannot assume buf2 is always fully filled if it is not
  5029		 * the last descriptor. Otherwise, the length of buf2 of the second
  5030		 * descriptor will be calculated wrong and cause an oops.
  5031		 *
  5032		 * If this is the last descriptor, 'plen' is the length of the
  5033		 * received packet that was transferred to system memory.
  5034		 * Otherwise, it is the accumulated number of bytes that have been
  5035		 * transferred for the current packet.
  5036		 *
  5037		 * Thus 'plen - len' always gives the correct length of buf2.
  5038		 */
  5039	
  5040		/* Not GMAC4 and not last descriptor */
> 5041		if (!priv->plat->has_gmac4 && (status & rx_not_ls))
  5042			return priv->dma_conf.dma_buf_sz;
  5043	
  5044		/* GMAC4 or last descriptor */
  5045		plen = stmmac_get_rx_frame_len(priv, p, coe);
  5046	
  5047		return plen - len;
  5048	}
  5049	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-06 20:30 ` Russell King (Oracle)
@ 2026-02-09  3:41   ` Jie Zhang
  2026-02-09  8:52     ` Russell King (Oracle)
  0 siblings, 1 reply; 7+ messages in thread
From: Jie Zhang @ 2026-02-09  3:41 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: netdev, jie.zhang, horms, Jacob Keller, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Maxime Chevallier,
	Vladimir Oltean, Jose Abreu, linux-stm32, linux-arm-kernel,
	linux-kernel

On Fri, Feb 06, 2026 at 08:30:11PM +0000, Russell King (Oracle) wrote:
> On Fri, Feb 06, 2026 at 02:56:38PM -0500, Jie Zhang wrote:
> > For GMAC4, when split header is enabled, in some rare cases, the
> > hardware does not fill buf2 of the first descriptor with payload.
> > Thus we cannot assume buf2 is always fully filled if it is not
> > the last descriptor. Otherwise, the length of buf2 of the second
> > descriptor will be calculated wrong and cause an oops:
> > 
> > Unable to handle kernel paging request at virtual address ffff00019246bfc0
> > ...
> > x2 : 0000000000000040 x1 : ffff00019246bfc0 x0 : ffff00009246c000
> > Call trace:
> >  dcache_inval_poc+0x28/0x58 (P)
> >  dma_direct_sync_single_for_cpu+0x38/0x6c
> >  __dma_sync_single_for_cpu+0x34/0x6c
> >  stmmac_napi_poll_rx+0x8f0/0xb60
> >  __napi_poll.constprop.0+0x30/0x144
> >  net_rx_action+0x160/0x274
> >  handle_softirqs+0x1b8/0x1fc
> > ...
> > 
> > To fix this, the PL bit-field in RDES3 register is used for all
> > descriptors, whether it is the last descriptor or not.
> > 
> > Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
> > Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> > Signed-off-by: Jie Zhang <jie.zhang@analog.com>
> > ---
> > v2:
> > 1. Update for the latest net HEAD
> > 2. Reduce crash dump message in commit message
> > 3. Add Fixes tag
> > v1 link: https://lore.kernel.org/all/20251202025421.4560-1-jie.zhang@analog.com/
> 
> I was trying to work out whether this was a re-post of a patch that had
> already been merged and it was the result of someone inappropriately
> re-posting old patches, or whether it was something to take seriously.
> 
> That is because of this in the patch:
> 
> > +	/* Not GMAC4 and not last descriptor */
> > +	if (!priv->plat->has_gmac4 && (status & rx_not_ls))
> 
> Commit 26ab9830beab ("net: stmmac: replace has_xxxx with core_type"):
> 
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 99022620457a..151c81c560c8 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> ...
> +       enum dwmac_core_type core_type;
> ...
> -       int has_gmac4;
> 
> So, has_gmac4 no longer exists, and hasn't done since October last
> year.
> 
> Thus, it seems your patch has been generated against an old kernel.
> As you are submitting for netdev, it is a good idea to ensure that
> patches apply to the net-next tree and/or net tree depending on
> which one you are targetting, and have been tested against that
> tree.
> 
Thanks. This is a new version of the patch I sent last year. I tested
the original version again the net tree. But I forgot to test the new
version again. I just test it now on the latest net tree with other
patches for our board. But Ethernet stops working. I'm trying to figure
out what causes this new issue. After that I will send out a new version
of this patch.

Jie

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-09  3:41   ` Jie Zhang
@ 2026-02-09  8:52     ` Russell King (Oracle)
  0 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2026-02-09  8:52 UTC (permalink / raw)
  To: Jie Zhang
  Cc: netdev, jie.zhang, horms, Jacob Keller, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Maxime Chevallier,
	Vladimir Oltean, Jose Abreu, linux-stm32, linux-arm-kernel,
	linux-kernel

On Sun, Feb 08, 2026 at 10:41:08PM -0500, Jie Zhang wrote:
> Thanks. This is a new version of the patch I sent last year. I tested
> the original version again the net tree. But I forgot to test the new
> version again. I just test it now on the latest net tree with other
> patches for our board. But Ethernet stops working. I'm trying to figure
> out what causes this new issue. After that I will send out a new version
> of this patch.

You're not listed in MAINTAINERS, so you wouldn't have been Cc'd on the
various patches I've submitted for stmmac, and so wouldn't have had the
opportunity to test them and highlight any issues.

Please consider adding a MAINTAINERS entry so you can be aware of
patches as they are posted.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v2] net: stmmac: fix oops when split header is enabled
  2026-02-06 19:56 [PATCH net v2] net: stmmac: fix oops when split header is enabled Jie Zhang
                   ` (2 preceding siblings ...)
  2026-02-07  1:46 ` kernel test robot
@ 2026-02-09 13:55 ` kernel test robot
  3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-02-09 13:55 UTC (permalink / raw)
  To: Jie Zhang, netdev
  Cc: oe-kbuild-all, jzhang918, jie.zhang, horms, Jacob Keller,
	Andrew Lunn, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Alexandre Torgue, Russell King (Oracle),
	Maxime Chevallier, Vladimir Oltean, Jose Abreu, linux-stm32,
	linux-arm-kernel, linux-kernel

Hi Jie,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jie-Zhang/net-stmmac-fix-oops-when-split-header-is-enabled/20260207-035916
base:   net/main
patch link:    https://lore.kernel.org/r/20260206195643.11333-1-jie.zhang%40analog.com
patch subject: [PATCH net v2] net: stmmac: fix oops when split header is enabled
config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20260209/202602091406.tg5t31a5-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260209/202602091406.tg5t31a5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602091406.tg5t31a5-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_rx_buf2_len':
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5041:24: error: 'struct plat_stmmacenet_data' has no member named 'has_gmac4'
    5041 |         if (!priv->plat->has_gmac4 && (status & rx_not_ls))
         |                        ^~


vim +5041 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

  5014	
  5015	static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
  5016					       struct dma_desc *p,
  5017					       int status, unsigned int len)
  5018	{
  5019		int coe = priv->hw->rx_csum;
  5020		unsigned int plen = 0;
  5021	
  5022		/* Not split header, buffer is not available */
  5023		if (!priv->sph_active)
  5024			return 0;
  5025	
  5026		/* For GMAC4, when split header is enabled, in some rare cases, the
  5027		 * hardware does not fill buf2 of the first descriptor with payload.
  5028		 * Thus we cannot assume buf2 is always fully filled if it is not
  5029		 * the last descriptor. Otherwise, the length of buf2 of the second
  5030		 * descriptor will be calculated wrong and cause an oops.
  5031		 *
  5032		 * If this is the last descriptor, 'plen' is the length of the
  5033		 * received packet that was transferred to system memory.
  5034		 * Otherwise, it is the accumulated number of bytes that have been
  5035		 * transferred for the current packet.
  5036		 *
  5037		 * Thus 'plen - len' always gives the correct length of buf2.
  5038		 */
  5039	
  5040		/* Not GMAC4 and not last descriptor */
> 5041		if (!priv->plat->has_gmac4 && (status & rx_not_ls))
  5042			return priv->dma_conf.dma_buf_sz;
  5043	
  5044		/* GMAC4 or last descriptor */
  5045		plen = stmmac_get_rx_frame_len(priv, p, coe);
  5046	
  5047		return plen - len;
  5048	}
  5049	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-09 13:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 19:56 [PATCH net v2] net: stmmac: fix oops when split header is enabled Jie Zhang
2026-02-06 20:30 ` Russell King (Oracle)
2026-02-09  3:41   ` Jie Zhang
2026-02-09  8:52     ` Russell King (Oracle)
2026-02-07  1:15 ` kernel test robot
2026-02-07  1:46 ` kernel test robot
2026-02-09 13:55 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox