[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080908112629.GA26488@2ka.mipt.ru>
Date: Mon, 8 Sep 2008 15:26:29 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: Johann Baudy <johaahn@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: Fwd: Packet mmap: TX RING and zero copy
Hi Johann.
On Mon, Sep 08, 2008 at 12:21:16PM +0200, Johann Baudy (johaahn@...il.com) wrote:
> I've made a test with below patch (with and without UDP fragmentation):
>
> without UDP fragmentation, packet size are almost always equal to
> PAGE_SIZE due to my mtu limit (2*PACKET_SIZE > mtu).
> with UDP fragmentation, kernel is sending multiple fragmented packets
> of 61448Kbytes.
>
> Unfortunately, in both case, bitrate is still 15-20 MB/s :(
> According to wireshark, kernel sends 60KB over 9 packets, nothing
> during ~5ms, 60KB and so on. strange ... kernel seems to spend its
> time during push(). Is there a blocking call somewhere ?
Are you sure that it is udp_push_pending_frames() and not some splice
waiting?
> Thanks in advance,
> Johann
>
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
>
> @@ -743,7 +743,28 @@ int udp_sendpage(struct sock *sk, struct page
> *page, int offset,
> size_t size, int flags)
> {
> struct udp_sock *up = udp_sk(sk);
> + struct inet_sock *inet = inet_sk(sk);
> int ret;
> + int mtu = inet->cork.fragsize;
> + int fragheaderlen;
> + struct ip_options *opt = NULL;
> +
> + if (inet->cork.flags & IPCORK_OPT)
> + opt = inet->cork.opt;
This has to be checked under socket lock.
> + fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0);
> +
> + // With UDP fragmentation
> + if (inet->cork.length + size >= 0xFFFF - fragheaderlen) {
> + // Without UDP fragmentation
> + // if( (inet->cork.length + size) > mtu) {
This also should be protected. Two threads can simultaneously check
inet->cork.length and both suceed.
> + lock_sock(sk);
> + ret = udp_push_pending_frames(sk);
> + release_sock(sk);
> + if (ret) {
> + return 0;
> + }
> + }
--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists