From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, jasowang@redhat.com, sw@weilnetz.de
Subject: Re: [Qemu-devel] [PATCHv3 06/13] sungem: fix multicast filter CRC calculation
Date: Fri, 15 Dec 2017 16:46:17 -0300 [thread overview]
Message-ID: <88252cc8-2afa-db11-0a06-1a86c9c93ff0@amsat.org> (raw)
In-Reply-To: <20171215184155.2543-7-mark.cave-ayland@ilande.co.uk>
On 12/15/2017 03:41 PM, Mark Cave-Ayland wrote:
> From the Linux sungem driver, we know that the multicast filter CRC is
> implemented using ether_crc_le() which isn't the same as calling zlib's
> crc32() function (the zlib implementation requires a complemented initial value
> and also returns the complemented result).
>
> Fix the multicast filter by simply using the new net_crc32_le() function.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/net/sungem.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/net/sungem.c b/hw/net/sungem.c
> index 6aa8d1117b..60f1e479f3 100644
> --- a/hw/net/sungem.c
> +++ b/hw/net/sungem.c
> @@ -11,12 +11,11 @@
> #include "hw/pci/pci.h"
> #include "qemu/log.h"
> #include "net/net.h"
> +#include "net/eth.h"
> #include "net/checksum.h"
> #include "hw/net/mii.h"
> #include "sysemu/sysemu.h"
> #include "trace.h"
> -/* For crc32 */
> -#include <zlib.h>
>
> #define TYPE_SUNGEM "sungem"
>
> @@ -595,7 +594,7 @@ static ssize_t sungem_receive(NetClientState *nc, const uint8_t *buf,
> }
>
> /* Get MAC crc */
> - mac_crc = crc32(~0, buf, 6);
> + mac_crc = net_crc32_le(buf, ETH_ALEN);
>
> /* Packet isn't for me ? */
> rx_cond = sungem_check_rx_mac(s, buf, mac_crc);
>
next prev parent reply other threads:[~2017-12-15 19:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-15 18:41 [Qemu-devel] [PATCHv3 00/13] net: introduce common net_crc32() and net_crc32_le() functions Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 01/13] net: move CRC32 calculation from compute_mcast_idx() into its own net_crc32() function Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 02/13] net: introduce net_crc32_le() function Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 03/13] pcnet: switch pcnet over to use net_crc32_le() Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 04/13] eepro100: switch eepro100 e100_compute_mcast_idx() over to use net_crc32() Mark Cave-Ayland
2017-12-15 19:45 ` Philippe Mathieu-Daudé
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 05/13] sunhme: switch sunhme over to use net_crc32_le() Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 06/13] sungem: fix multicast filter CRC calculation Mark Cave-Ayland
2017-12-15 19:46 ` Philippe Mathieu-Daudé [this message]
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 07/13] eepro100: use inline net_crc32() and bitshift instead of compute_mcast_idx() Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 08/13] opencores_eth: " Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 09/13] lan9118: " Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 10/13] ftgmac100: " Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 11/13] ne2000: " Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 12/13] rtl8139: " Mark Cave-Ayland
2017-12-15 18:41 ` [Qemu-devel] [PATCHv3 13/13] net: remove unused compute_mcast_idx() function Mark Cave-Ayland
2017-12-20 8:35 ` [Qemu-devel] [PATCHv3 00/13] net: introduce common net_crc32() and net_crc32_le() functions Jason Wang
2017-12-20 8:58 ` Mark Cave-Ayland
2017-12-22 2:07 ` Jason Wang
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=88252cc8-2afa-db11-0a06-1a86c9c93ff0@amsat.org \
--to=f4bug@amsat.org \
--cc=jasowang@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).