On Mon, Apr 8, 2019 at 4:18 AM Paolo Abeni <pab...@redhat.com> wrote: > > After commit a297569fe00a ("net/udp: do not touch skb->peeked unless > really needed") the 'peeked' argument of __skb_try_recv_datagram() > and friends is always equal to !!'flags & MSG_PEEK'. > > Since such argument is really a boolean info, and the callers have > already 'flags & MSG_PEEK' handy, we can remove it and clean-up the > code a bit. > > Signed-off-by: Paolo Abeni <pab...@redhat.com>
Acked-by: Willem de Bruijn <will...@google.com> More for my own understanding: I had a quick look why this approach existed. It does seem that at some point *peeked used to be derived from skb->peeked, so that MIB indatagrams would be incremented only on the first read or peek (at a59322be07c9). This calculation was changed and the update to skb->peeked on every peek avoided as of a297569fe00. So threading this state then is no longer needed. Good catch! Now skb_recv_datagram could also subsume __skb_recv_datagram, as it is the only (trivial) caller.