patch "staging: octeon: Drop on uncorrectable alignment or FCS error" added to staging-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
staging: octeon: Drop on uncorrectable alignment or FCS error
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 49d28ebdf1e30d806410eefc7de0a7a1ca5d747c Mon Sep 17 00:00:00 2001
From: Alexander Sverdlin <[email protected]>
Date: Fri, 16 Oct 2020 16:56:30 +0200
Subject: staging: octeon: Drop on uncorrectable alignment or FCS error
Currently in case of alignment or FCS error if the packet cannot be corrected it's still not dropped. Report the error properly and drop the packet while making the code around a little bit more readable.
--- drivers/staging/octeon/ethernet-rx.c | 34 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-)
drivers/staging/octeon/ethernet-rx.c +19 -15
@@ -69,15 +69,17 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)else port = work->word1.cn38xx.ipprt; -if ((work->word2.snoip.err_code ==10 ) && (work->word1.len <=64 )) { +if ((work->word2.snoip.err_code ==10 ) && (work->word1.len <=64 ))/* * Ignore length errors on min size packets. Some * equipment incorrectly pads packets to 64+4FCS * instead of 60+4FCS. Note these packets still get * counted as frame errors. */ - }else if (work->word2.snoip.err_code ==5 || - work->word2.snoip.err_code ==7 ) { +return 0 ; + +if (work->word2.snoip.err_code ==5 || + work->word2.snoip.err_code ==7 ) {/* * We received a packet with either an alignment error * or a FCS error. This may be signalling that we are
@@ -108,7 +110,10 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)/* Port received 0xd5 preamble */ work->packet_ptr.s.addr += i +1 ; work->word1.len -= i +5 ; - }else if ((*ptr &0xf ) ==0xd ) { +return 0 ; + } + +if ((*ptr &0xf ) ==0xd ) {/* Port received 0xd preamble */ work->packet_ptr.s.addr += i; work->word1.len -= i +4 ;
@@ -118,21 +123,20 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work) ((*(ptr +1 ) &0xf ) <<4 ); ptr++; } - }else { -printk_ratelimited ("Port %d unknown preamble, packet dropped\n" , - port); -cvm_oct_free_work (work); -return 1 ; +return 0 ; } + +printk_ratelimited ("Port %d unknown preamble, packet dropped\n" , + port); +cvm_oct_free_work (work); +return 1 ; } - }else { -printk_ratelimited ("Port %d receive error code %d, packet dropped\n" , - port, work->word2.snoip.err_code); -cvm_oct_free_work (work); -return 1 ; } -return 0 ; +printk_ratelimited ("Port %d receive error code %d, packet dropped\n" , + port, work->word2.snoip.err_code); +cvm_oct_free_work (work); +return 1 ; }static void copy_segments_to_skb (struct cvmx_wqe *work,struct sk_buff *skb)
Signature · 1 line
2.29.1