Merge branch 'net-use-ip_outnoroutes-drop-reason'

Eric Dumazet says:

====================
net: use IP_OUTNOROUTES drop reason

First patch changes sk_skb_reason_drop() sock to be const.

Second and last patch add SKB_DROP_REASON_IP_OUTNOROUTES
to both tcp_v6_send_response() and inet6_csk_xmit().
====================

Link: https://patch.msgid.link/20260511072310.1094859-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-05-12 18:33:12 -07:00
commit 34c78dff59
6 changed files with 13 additions and 10 deletions

View File

@ -1313,7 +1313,8 @@ static inline bool skb_data_unref(const struct sk_buff *skb,
return true;
}
void __fix_address sk_skb_reason_drop(struct sock *sk, struct sk_buff *skb,
void __fix_address sk_skb_reason_drop(const struct sock *sk,
struct sk_buff *skb,
enum skb_drop_reason reason);
static inline void

View File

@ -24,14 +24,14 @@ DEFINE_DROP_REASON(FN, FN)
TRACE_EVENT(kfree_skb,
TP_PROTO(struct sk_buff *skb, void *location,
enum skb_drop_reason reason, struct sock *rx_sk),
enum skb_drop_reason reason, const struct sock *rx_sk),
TP_ARGS(skb, location, reason, rx_sk),
TP_STRUCT__entry(
__field(void *, skbaddr)
__field(void *, location)
__field(void *, rx_sk)
__field(const void *, rx_sk)
__field(unsigned short, protocol)
__field(enum skb_drop_reason, reason)
),

View File

@ -110,7 +110,7 @@ struct net_dm_alert_ops {
void (*kfree_skb_probe)(void *ignore, struct sk_buff *skb,
void *location,
enum skb_drop_reason reason,
struct sock *rx_sk);
const struct sock *rx_sk);
void (*napi_poll_probe)(void *ignore, struct napi_struct *napi,
int work, int budget);
void (*work_item_func)(struct work_struct *work);
@ -266,7 +266,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location)
static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb,
void *location,
enum skb_drop_reason reason,
struct sock *rx_sk)
const struct sock *rx_sk)
{
trace_drop_common(skb, location);
}
@ -493,7 +493,7 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore,
struct sk_buff *skb,
void *location,
enum skb_drop_reason reason,
struct sock *rx_sk)
const struct sock *rx_sk)
{
ktime_t tstamp = ktime_get_real();
struct per_cpu_dm_data *data;

View File

@ -1206,7 +1206,7 @@ void __kfree_skb(struct sk_buff *skb)
EXPORT_SYMBOL(__kfree_skb);
static __always_inline
bool __sk_skb_reason_drop(struct sock *sk, struct sk_buff *skb,
bool __sk_skb_reason_drop(const struct sock *sk, struct sk_buff *skb,
enum skb_drop_reason reason)
{
if (unlikely(!skb_unref(skb)))
@ -1235,7 +1235,8 @@ bool __sk_skb_reason_drop(struct sock *sk, struct sk_buff *skb,
* 'kfree_skb' tracepoint.
*/
void __fix_address
sk_skb_reason_drop(struct sock *sk, struct sk_buff *skb, enum skb_drop_reason reason)
sk_skb_reason_drop(const struct sock *sk, struct sk_buff *skb,
enum skb_drop_reason reason)
{
if (__sk_skb_reason_drop(sk, skb, reason))
__kfree_skb(skb);

View File

@ -102,7 +102,8 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused
if (IS_ERR(dst)) {
WRITE_ONCE(sk->sk_err_soft, -PTR_ERR(dst));
sk->sk_route_caps = 0;
kfree_skb(skb);
sk_skb_reason_drop(sk, skb,
SKB_DROP_REASON_IP_OUTNOROUTES);
return PTR_ERR(dst);
}
/* Restore final destination back after routing done */

View File

@ -982,7 +982,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
return;
}
kfree_skb(buff);
sk_skb_reason_drop(sk, buff, SKB_DROP_REASON_IP_OUTNOROUTES);
}
static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb,