lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 29 Apr 2015 16:59:49 -0700 From: Alexei Starovoitov <ast@...mgrid.com> To: Eric Dumazet <eric.dumazet@...il.com> CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Daniel Borkmann <daniel@...earbox.net>, Thomas Graf <tgraf@...g.ch>, Jamal Hadi Salim <jhs@...atatu.com>, John Fastabend <john.r.fastabend@...el.com>, netdev@...r.kernel.org Subject: Re: [PATCH RFC net-next] pktgen: introduce 'rx' mode On 4/29/15 4:39 PM, Eric Dumazet wrote: > > Zap the 'burst/clone' thing, this is not going to work for RX. > TX was okay, not RX. > > You could for instance do : > > atomic_inc(&skb->users); > netif_receive_skb(skb); > if (atomic_read(skb->users) != 1) { > /* This is too bad, I can not recycle this skb because it is still used */ > consume_skb(skb); > /* allocate a fresh new skb */ > skb = ... > } else { > /* Yeah ! Lets celebrate, cost of reusing this skb was one atomic op */ > } ahh, great! I think I'm starting to understand. then the following should be ok as well? atomic_add(burst, &skb->users); do { netif_receive_skb(skb); if (atomic_read(skb->users) != burst) { /* too bad, can not recycle */ atomic_sub(burst - 1, &skb->users); consume_skb(skb); /* allocate a fresh new skb */ skb = ... /* and get out of this loop */ } else { /* Yeah ! the cost of reusing this skb was one atomic op amortized over 'burst' iterations */ } } while (--burst > 0); -- 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