Message ID | 20220216035426.2233808-2-imagedong@tencent.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: add skb drop reasons to TCP packet receive | expand |
On Wed, 16 Feb 2022 11:54:18 +0800 menglong8.dong@gmail.com wrote: > +static inline void tcp_drop(struct sock *sk, struct sk_buff *skb) > +{ > + tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED); > } Please make this non-inline. The compiler will inline it anyway, and if it's a static inline compiler will not warn us that it should be removed once all callers are gone.
On Wed, 16 Feb 2022 07:58:21 -0800 Jakub Kicinski <kuba@kernel.org> wrote: > On Wed, 16 Feb 2022 11:54:18 +0800 menglong8.dong@gmail.com wrote: > > +static inline void tcp_drop(struct sock *sk, struct sk_buff *skb) > > +{ > > + tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED); > > } > > Please make this non-inline. The compiler will inline it anyway, and > if it's a static inline compiler will not warn us that it should be > removed once all callers are gone. I guess that's no longer true for C files. https://lore.kernel.org/all/202202132037.4aN017dU-lkp@intel.com/ -- Steve
On Thu, Feb 17, 2022 at 12:50 AM Steven Rostedt <rostedt@goodmis.org> wrote: > > On Wed, 16 Feb 2022 07:58:21 -0800 > Jakub Kicinski <kuba@kernel.org> wrote: > > > On Wed, 16 Feb 2022 11:54:18 +0800 menglong8.dong@gmail.com wrote: > > > +static inline void tcp_drop(struct sock *sk, struct sk_buff *skb) > > > +{ > > > + tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED); > > > } > > > > Please make this non-inline. The compiler will inline it anyway, and > > if it's a static inline compiler will not warn us that it should be > > removed once all callers are gone. > > I guess that's no longer true for C files. > > https://lore.kernel.org/all/202202132037.4aN017dU-lkp@intel.com/ > Ok, seems we can keep this inline still. > -- Steve
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index af94a6d22a9d..0a2740add404 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4684,10 +4684,16 @@ static bool tcp_ooo_try_coalesce(struct sock *sk, return res; } -static void tcp_drop(struct sock *sk, struct sk_buff *skb) +static void tcp_drop_reason(struct sock *sk, struct sk_buff *skb, + enum skb_drop_reason reason) { sk_drops_add(sk, skb); - __kfree_skb(skb); + kfree_skb_reason(skb, reason); +} + +static inline void tcp_drop(struct sock *sk, struct sk_buff *skb) +{ + tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED); } /* This one checks to see if we can put data from the