From: Andrew Lunn <andrew@lunn.ch>
To: Alexander A Sverdlin <alexander.sverdlin@nokia.com>
Cc: devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Aaro Koskinen <aaro.koskinen@iki.fi>,
Ralf Baechle <ralf@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH v2 net] staging: octeon: Drop on uncorrectable alignment or FCS error
Date: Sat, 17 Oct 2020 23:02:35 +0200 [thread overview]
Message-ID: <20201017210235.GU456889@lunn.ch> (raw)
In-Reply-To: <20201016101858.11374-2-alexander.sverdlin@nokia.com>
> diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
> index 2c16230..9ebd665 100644
> --- a/drivers/staging/octeon/ethernet-rx.c
> +++ b/drivers/staging/octeon/ethernet-rx.c
> @@ -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))
It would be nice to replace all these err_code magic numbers with #defines.
You should also replace 64 with ETH_ZLEN + ETH_FCS_LEN. I also wonder
if <= should be just < ?
> /*
> * 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) {
The comments are not so clear what is going on here. Can this
incorrectly match a destination MAC address of xD:XX:XX:XX:XX:XX.
> /* Port received 0xd preamble */
> work->packet_ptr.s.addr += i;
> work->word1.len -= i + 4;
Andrew
next prev parent reply other threads:[~2020-10-17 21:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 10:18 [PATCH v2 net] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
2020-10-16 10:18 ` [PATCH v2 net] staging: octeon: Drop on uncorrectable alignment or FCS error Alexander A Sverdlin
2020-10-16 11:17 ` Greg Kroah-Hartman
2020-10-16 13:14 ` Greg Kroah-Hartman
2020-10-17 21:02 ` Andrew Lunn [this message]
2020-10-19 9:11 ` Alexander Sverdlin
2020-10-25 9:22 ` Greg Kroah-Hartman
2020-10-17 20:45 ` [PATCH v2 net] staging: octeon: repair "fixed-link" support Andrew Lunn
2020-10-17 20:48 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201017210235.GU456889@lunn.ch \
--to=andrew@lunn.ch \
--cc=aaro.koskinen@iki.fi \
--cc=alexander.sverdlin@nokia.com \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).