On Thu, Dec 12, 2013 at 05:38:59PM +0900, Simon Horman wrote:
> If VLAN acceleration is used when the kernel receives a packet
> then the outer-most VLAN tag will not be present in the packet
> when it is received by netdev-linux. Rather, it will be present
> in auxdata.
> 
> This patch uses recvmsg() instead of recv() to read auxdata for
> each packet and if the vlan_tid is set then it is added to the packet.
> 
> Adding the vlan_tid makes use of headroom available
> in the buffer parameter of rx_recv.
> 
> Signed-off-by: Simon Horman <ho...@verge.net.au>


> @@ -803,7 +811,7 @@ netdev_linux_rx_construct(struct netdev_rx *rx_)
>          memset(&sll, 0, sizeof sll);
>          sll.sll_family = AF_PACKET;
>          sll.sll_ifindex = ifindex;
> -        sll.sll_protocol = (OVS_FORCE unsigned short int) htons(ETH_P_ALL);
> +        sll.sll_protocol = htons(ETH_P_ALL);

I was surprised that this didn't raise a sparse warning, but it doesn't.
Great.

In netdev_linux_rx_recv_sock(), I think we might want to
ofpbuf_reserve() VLAN_HEADER_LEN bytes at the beginning, to ensure that
there is headroom to insert a VLAN header.  On the other hand, that
would mean that we lose four bytes of tailroom that are important if the
VLAN header is actually embedded in the packet.  I think that means that
we should advise callers to supply 4 bytes of space beyond what they
think they need.

I don't think the cast here, or in netdev_linux_rx_recv(), is necessary:
> +    } else if ((size_t)retval > size) {
> +        errno = EMSGSIZE;
> +        return -1;
> +    }
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to