Re: [PATCH 0/8] Cleanup/fix the sk_alloc() call

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Pavel Emelyanov <xemul@...>
Cc: Arnaldo Carvalho de Melo <acme@...>, David Miller <davem@...>, Linux Netdev List <netdev@...>, <devel@...>
Date: Wednesday, October 31, 2007 - 10:14 am

Em Wed, Oct 31, 2007 at 05:32:20PM +0300, Pavel Emelyanov escreveu:

Start here:

const struct proto_ops inet_stream_ops = {
        .family            = PF_INET,
        .owner             = THIS_MODULE,
        .release           = inet_release,
        .bind              = inet_bind,
        .connect           = inet_stream_connect,
        .socketpair        = sock_no_socketpair,
        .accept            = inet_accept,
        .getname           = inet_getname,
        .poll              = tcp_poll,
        .ioctl             = inet_ioctl,
        .listen            = inet_listen,
        .shutdown          = inet_shutdown,
        .setsockopt        = sock_common_setsockopt,
        .getsockopt        = sock_common_getsockopt,
        .sendmsg           = tcp_sendmsg,
        .recvmsg           = sock_common_recvmsg,
        .mmap              = sock_no_mmap,
        .sendpage          = tcp_sendpage,
#ifdef CONFIG_COMPAT
        .compat_setsockopt = compat_sock_common_setsockopt,
        .compat_getsockopt = compat_sock_common_getsockopt,
#endif
};

Now look at all the "*_common_*" stuff, for instance:

int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
                        struct msghdr *msg, size_t size, int flags)
{
        struct sock *sk = sock->sk;
        int addr_len = 0;
        int err;

        err = sk->sk_prot->recvmsg(iocb, sk, msg, size, flags & MSG_DONTWAIT,
                                   flags & ~MSG_DONTWAIT, &addr_len);
        if (err >= 0)
                msg->msg_namelen = addr_len;
        return err;
}

So if we made all protocols implement sk->sk_prot_recvmsg... got it?

And then look at the inet_* routines above, at least for LLC I was using
several unmodified.

Over the years the quality work is done on the mainstream protocols,
with the legacy ones lagging behind, so the more we share...

Anyway, look at my paper about it:

http://www.linuxsymposium.org/proceedings/reprints/Reprint-Melo-OLS2004.pdf

The DCCP paper also talks about this:

http://www.linuxinsight.com/files/ols2005/melo-reprint.pdf

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/8] Cleanup/fix the sk_alloc() call, Pavel Emelyanov, (Wed Oct 31, 9:40 am)
Re: [PATCH 0/8] Cleanup/fix the sk_alloc() call, Arnaldo Carvalho de Melo, (Wed Oct 31, 9:15 am)
Re: [PATCH 0/8] Cleanup/fix the sk_alloc() call, Pavel Emelyanov, (Wed Oct 31, 10:32 am)
Re: [PATCH 0/8] Cleanup/fix the sk_alloc() call, Arnaldo Carvalho de Melo, (Wed Oct 31, 10:14 am)
[PATCH 8/8] Forget the zero_it argument of sk_alloc(), Pavel Emelyanov, (Wed Oct 31, 9:59 am)
[PATCH 7/8] Remove bogus zero_it argument from sk_alloc, Pavel Emelyanov, (Wed Oct 31, 9:56 am)
[PATCH 6/8] Make the sk_clone() lighter, Pavel Emelyanov, (Wed Oct 31, 9:54 am)
Re: [PATCH 6/8] Make the sk_clone() lighter, David Miller, (Thu Nov 1, 3:38 am)
Re: [PATCH 6/8] Make the sk_clone() lighter, David Miller, (Thu Nov 1, 3:26 am)
Re: [PATCH 6/8] Make the sk_clone() lighter, Pavel Emelyanov, (Thu Nov 1, 4:46 am)
[PATCH 5/8] Move some core sock setup into sk_prot_alloc, Pavel Emelyanov, (Wed Oct 31, 9:51 am)
[PATCH 4/8] Auto-zero the allocated sock object, Pavel Emelyanov, (Wed Oct 31, 9:48 am)
Re: [PATCH 4/8] Auto-zero the allocated sock object, David Miller, (Thu Nov 1, 3:35 am)
[PATCH 2/8] Move the get_net() from sock_copy(), Pavel Emelyanov, (Wed Oct 31, 9:44 am)
Re: [PATCH 2/8] Move the get_net() from sock_copy(), David Miller, (Thu Nov 1, 3:32 am)
[PATCH 1/8] Move the sock_copy() from the header, Pavel Emelyanov, (Wed Oct 31, 9:42 am)
Re: [PATCH 1/8] Move the sock_copy() from the header, David Miller, (Thu Nov 1, 3:30 am)