All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Wei Xu <wexu@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [ RFC Patch v4 3/3] virtio-net rsc: support coalescing ipv6 tcp traffic
Date: Fri, 8 Apr 2016 15:27:50 +0800	[thread overview]
Message-ID: <57075D76.2000306@redhat.com> (raw)
In-Reply-To: <57075874.8060903@redhat.com>



On 04/08/2016 03:06 PM, Wei Xu wrote:
>
>
> On 2016年04月05日 10:50, Jason Wang wrote:
>>
>> On 04/04/2016 03:25 AM, wexu@redhat.com wrote:
>>> From: Wei Xu <wexu@redhat.com>
>>>
>>> Most things like ipv4 except there is a significant difference
>>> between ipv4
>>> and ipv6, the fragment lenght in ipv4 header includes itself, while
>>> it's not
>> typo
> Thanks.
>>
>>> included for ipv6, thus means ipv6 can carry a real '65535' payload.
>>>
>>> Signed-off-by: Wei Xu <wexu@redhat.com>
>>> ---
>>>   hw/net/virtio-net.c | 147
>>> +++++++++++++++++++++++++++++++++++++++++++++++++---
>>>   1 file changed, 141 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>>> index 81e8e71..2d09352 100644
>>> --- a/hw/net/virtio-net.c
>>> +++ b/hw/net/virtio-net.c
>>> @@ -50,6 +50,10 @@
>>>   /* header lenght value in ip header without option */
>>>   #define VIRTIO_NET_IP4_HEADER_LENGTH 5
>>>   +#define ETH_IP6_HDR_SZ (ETH_HDR_SZ + IP6_HDR_SZ)
>>> +#define VIRTIO_NET_IP6_ADDR_SIZE   32      /* ipv6 saddr + daddr */
>>> +#define VIRTIO_NET_MAX_IP6_PAYLOAD VIRTIO_NET_MAX_TCP_PAYLOAD
>>> +
>>>   /* Purge coalesced packets timer interval */
>>>   #define VIRTIO_NET_RSC_INTERVAL  300000
>>>   @@ -1725,6 +1729,25 @@ static void
>>> virtio_net_rsc_extract_unit4(NetRscChain *chain,
>>>       unit->payload = htons(*unit->ip_plen) - ip_hdrlen -
>>> unit->tcp_hdrlen;
>>>   }
>>>   +static void virtio_net_rsc_extract_unit6(NetRscChain *chain,
>>> +                                         const uint8_t *buf,
>>> NetRscUnit* unit)
>>> +{
>>> +    uint16_t hdr_len;
>>> +    struct ip6_header *ip6;
>>> +
>>> +    hdr_len = ((VirtIONet *)(chain->n))->guest_hdr_len;
>>> +    ip6 = (struct ip6_header *)(buf + hdr_len + sizeof(struct
>>> eth_header));
>>> +    unit->ip = ip6;
>>> +    unit->ip_plen = &(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen);
>>> +    unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip)\
>>> +                                        + sizeof(struct ip6_header));
>>> +    unit->tcp_hdrlen = (htons(unit->tcp->th_offset_flags) & 0xF000)
>>> >> 10;
>>> +
>>> +    /* There is a difference between payload lenght in ipv4 and v6,
>>> +       ip header is excluded in ipv6 */
>>> +    unit->payload = htons(*unit->ip_plen) - unit->tcp_hdrlen;
>>> +}
>>> +
>>>   static void virtio_net_rsc_ipv4_checksum(struct ip_header *ip)
>>>   {
>>>       uint32_t sum;
>>> @@ -1738,7 +1761,9 @@ static size_t
>>> virtio_net_rsc_drain_seg(NetRscChain *chain, NetRscSeg *seg)
>>>   {
>>>       int ret;
>>>   -    virtio_net_rsc_ipv4_checksum(seg->unit.ip);
>>> +    if ((chain->proto == ETH_P_IP) && seg->is_coalesced) {
>>> +        virtio_net_rsc_ipv4_checksum(seg->unit.ip);
>>> +    }
>> Why not introduce proto specific checksum function for chain?
> Since there are only 2 protocols to be supported, and very limited
> extension for this feature, mst suggest to use direct call in v2 patch
> to make things simple, and i took it.

Have you tried with my suggestion? I think it will actually simplify the
current code (at least several lines of codes).

  reply	other threads:[~2016-04-08  7:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-03 19:25 [Qemu-devel] [ RFC Patch v4 0/3] Support Receive-Segment-Offload(RSC) for WHQL wexu
2016-04-03 19:25 ` [Qemu-devel] [ RFC Patch v4 1/3] virtio-net rsc: add a new host offload(rsc) feature bit wexu
2016-04-05  2:05   ` Jason Wang
2016-04-05  8:17     ` Michael S. Tsirkin
2016-04-10 15:23       ` Wei Xu
2016-04-03 19:25 ` [Qemu-devel] [ RFC Patch v4 2/3] virtio-net rsc: support coalescing ipv4 tcp traffic wexu
2016-04-05  2:47   ` Jason Wang
2016-04-08  7:47     ` Wei Xu
2016-04-08  8:31       ` Jason Wang
2016-04-08  9:15         ` Wei Xu
2016-04-12  8:23   ` Michael S. Tsirkin
2016-04-03 19:25 ` [Qemu-devel] [ RFC Patch v4 3/3] virtio-net rsc: support coalescing ipv6 " wexu
2016-04-05  2:50   ` Jason Wang
2016-04-08  7:06     ` Wei Xu
2016-04-08  7:27       ` Jason Wang [this message]
2016-04-08  7:51         ` Wei Xu
2016-04-05  2:52 ` [Qemu-devel] [ RFC Patch v4 0/3] Support Receive-Segment-Offload(RSC) for WHQL 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=57075D76.2000306@redhat.com \
    --to=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wexu@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.