diff mbox series

i40e: add a fault tolerance judgment

Message ID 20221020033425.11471-1-xiaolinkui@126.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series i40e: add a fault tolerance judgment | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

xiaolinkui Oct. 20, 2022, 3:34 a.m. UTC
From: Linkui Xiao <xiaolinkui@kylinos.cn>

Avoid requesting memory when system memory resources are insufficient.
Reference function i40e_setup_tx_descriptors, adding fault tolerance
handling.

Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jacob Keller Oct. 20, 2022, 9:38 p.m. UTC | #1
On 10/19/2022 8:34 PM, xiaolinkui wrote:
> From: Linkui Xiao <xiaolinkui@kylinos.cn>
> 
> Avoid requesting memory when system memory resources are insufficient.
> Reference function i40e_setup_tx_descriptors, adding fault tolerance
> handling.
> 
> Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index d4226161a3ef..673f2f0d078f 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> @@ -1565,6 +1565,9 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
>  	struct device *dev = rx_ring->dev;
>  	int err;
>  
> +	if (!dev)
> +		return -ENOMEM;
> +

What is this trying to protect against? When does a ring not have a dev
pointer? This seems more like patching over a buggy setup where we
failed to assign a device pointer.

How does this protect against use of system memory resources? It also
doesn't seem like it would significantly improve fault tolerance since
its possible to have a non-NULL but invalid dev pointer...

Thanks,
Jake

>  	u64_stats_init(&rx_ring->syncp);
>  
>  	/* Round up to nearest 4K */
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index d4226161a3ef..673f2f0d078f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1565,6 +1565,9 @@  int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
 	struct device *dev = rx_ring->dev;
 	int err;
 
+	if (!dev)
+		return -ENOMEM;
+
 	u64_stats_init(&rx_ring->syncp);
 
 	/* Round up to nearest 4K */