qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH RFC] e1000: secrc support
Date: Mon, 12 Jul 2010 14:20:25 -0600	[thread overview]
Message-ID: <1278966025.20397.243.camel@x201> (raw)
In-Reply-To: <20100712174945.GA11440@redhat.com>

On Mon, 2010-07-12 at 20:49 +0300, Michael S. Tsirkin wrote:
> Add support for secrc field. Reportedly needed by old RHEL guests.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/e1000.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> Anthony, Alex, please review.

Acked-by: Alex Williamson <alex.williamson@redhat.com>

> diff --git a/hw/e1000.c b/hw/e1000.c
> index 70aba11..8d87492 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -344,6 +344,15 @@ is_vlan_txd(uint32_t txd_lower)
>      return ((txd_lower & E1000_TXD_CMD_VLE) != 0);
>  }
>  
> +/* FCS aka Ethernet CRC-32. We don't get it from backends and can't
> + * fill it in, just pad descriptor length by 4 bytes unless guest
> + * told us to trip it off the packet. */
> +static inline int
> +fcs_len(E1000State *s)
> +{
> +    return (s->mac_reg[RCTL] & E1000_RCTL_SECRC) ? 0 : 4;
> +}
> +
>  static void
>  xmit_seg(E1000State *s)
>  {
> @@ -662,7 +671,7 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
>          if (desc.buffer_addr) {
>              cpu_physical_memory_write(le64_to_cpu(desc.buffer_addr),
>                                        (void *)(buf + vlan_offset), size);
> -            desc.length = cpu_to_le16(size + 4 /* for FCS */);
> +            desc.length = cpu_to_le16(size + fcs_len(s));
>              desc.status |= E1000_RXD_STAT_EOP|E1000_RXD_STAT_IXSM;
>          } else // as per intel docs; skip descriptors with null buf addr
>              DBGOUT(RX, "Null RX descriptor!!\n");

      reply	other threads:[~2010-07-12 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 17:49 [Qemu-devel] [PATCH RFC] e1000: secrc support Michael S. Tsirkin
2010-07-12 20:20 ` Alex Williamson [this message]

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=1278966025.20397.243.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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).