On Fri, Mar 27, 2020 at 7:26 AM Jamal Hadi Salim <jhs@xxxxxxxxxxxx> wrote: > > On 2020-03-27 12:25 a.m., Joe Stringer wrote: > > BPF_CALL_1(bpf_sk_release, struct sock *, sk) > > { > > - /* Only full sockets have sk->sk_flags. */ > > - if (!sk_fullsock(sk) || !sock_flag(sk, SOCK_RCU_FREE)) > > + if (sk_is_refcounted(sk)) > > sock_gen_put(sk); > > return 0; > > } > > > Would it make sense to have both the bpf_sk_release and bpf_sk_assign() > centralized so we dont replicate the functionality in tc? Reduces > maintainance overhead. I think sock_pfree() steps in that direction, we would just need the corresponding refactoring for sk_assign bits. Sounds like a good idea. This shouldn't functionally affect this series, I'm happy to either spin this into next revision of this series (if there's other feedback), or send a followup refactor for this, or defer this to your TC follow-up series that would consume the refactored functions.