From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v1 net-next 07/14] udp: Remove pcslen, pcrlen, and pcflag in struct udp_sock.
Date: Mon, 29 May 2023 18:03:41 -0700 [thread overview]
Message-ID: <20230530010348.21425-8-kuniyu@amazon.com> (raw)
In-Reply-To: <20230530010348.21425-1-kuniyu@amazon.com>
We removed partial checksum coverage support in the previous commit;
thus, udp_sk(sk)->{pcslen,pcrlen,pcflag} are always zero. We can safely
remove the related code guarded by pcflag.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
After removing these members, the layout of udp_sock changes as follows.
We may want to move encap/gro functions on the last cache line to save
one cache line ?
Before:
struct udp_sock {
struct inet_sock inet __attribute__((__aligned__(8))); /* 0 976 */
/* XXX last struct has 4 bytes of padding */
/* --- cacheline 15 boundary (960 bytes) was 16 bytes ago --- */
...
unsigned char accept_udp_fraglist:1; /* 985: 5 1 */
/* XXX 2 bits hole, try to pack */
__u16 len; /* 986 2 */
__u16 gso_size; /* 988 2 */
__u16 pcslen; /* 990 2 */
__u16 pcrlen; /* 992 2 */
__u8 pcflag; /* 994 1 */
__u8 unused[3]; /* 995 3 */
/* XXX 2 bytes hole, try to pack */
int (*encap_rcv)(struct sock *, struct sk_buff *); /* 1000 8 */
void (*encap_err_rcv)(struct sock *, struct sk_buff *, int, __be16, u32, u8 *); /* 1008 8 */
int (*encap_err_lookup)(struct sock *, struct sk_buff *); /* 1016 8 */
/* --- cacheline 16 boundary (1024 bytes) --- */
void (*encap_destroy)(struct sock *); /* 1024 8 */
struct sk_buff * (*gro_receive)(struct sock *, struct list_head *, struct sk_buff *); /* 1032 8 */
int (*gro_complete)(struct sock *, struct sk_buff *, int); /* 1040 8 */
/* XXX 40 bytes hole, try to pack */
/* --- cacheline 17 boundary (1088 bytes) --- */
struct sk_buff_head reader_queue __attribute__((__aligned__(64))); /* 1088 24 */
int forward_deficit; /* 1112 4 */
int forward_threshold; /* 1116 4 */
/* size: 1152, cachelines: 18, members: 25 */
/* sum members: 1077, holes: 2, sum holes: 42 */
/* sum bitfield members: 6 bits, bit holes: 1, sum bit holes: 2 bits */
/* padding: 32 */
/* paddings: 1, sum paddings: 4 */
/* forced alignments: 2, forced holes: 1, sum forced holes: 40 */
} __attribute__((__aligned__(64)));
After:
struct udp_sock {
struct inet_sock inet __attribute__((__aligned__(8))); /* 0 976 */
/* XXX last struct has 4 bytes of padding */
/* --- cacheline 15 boundary (960 bytes) was 16 bytes ago --- */
...
unsigned char accept_udp_fraglist:1; /* 985: 5 1 */
/* XXX 2 bits hole, try to pack */
__u16 len; /* 986 2 */
__u16 gso_size; /* 988 2 */
/* XXX 2 bytes hole, try to pack */
int (*encap_rcv)(struct sock *, struct sk_buff *); /* 992 8 */
void (*encap_err_rcv)(struct sock *, struct sk_buff *, int, __be16, u32, u8 *); /* 1000 8 */
int (*encap_err_lookup)(struct sock *, struct sk_buff *); /* 1008 8 */
void (*encap_destroy)(struct sock *); /* 1016 8 */
/* --- cacheline 16 boundary (1024 bytes) --- */
struct sk_buff * (*gro_receive)(struct sock *, struct list_head *, struct sk_buff *); /* 1024 8 */
int (*gro_complete)(struct sock *, struct sk_buff *, int); /* 1032 8 */
/* XXX 48 bytes hole, try to pack */
/* --- cacheline 17 boundary (1088 bytes) --- */
struct sk_buff_head reader_queue __attribute__((__aligned__(64))); /* 1088 24 */
int forward_deficit; /* 1112 4 */
int forward_threshold; /* 1116 4 */
/* size: 1152, cachelines: 18, members: 21 */
/* sum members: 1069, holes: 2, sum holes: 50 */
/* sum bitfield members: 6 bits, bit holes: 1, sum bit holes: 2 bits */
/* padding: 32 */
/* paddings: 1, sum paddings: 4 */
/* forced alignments: 2, forced holes: 1, sum forced holes: 48 */
} __attribute__((__aligned__(64)));
---
include/linux/udp.h | 12 +-----------
include/net/udplite.h | 6 ------
net/ipv4/udp.c | 34 ----------------------------------
net/ipv6/udp.c | 17 -----------------
4 files changed, 1 insertion(+), 68 deletions(-)
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 43c1fb2d2c21..f2f44ad62ea0 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -57,17 +57,7 @@ struct udp_sock {
*/
__u16 len; /* total length of pending frames */
__u16 gso_size;
- /*
- * Fields specific to UDP-Lite.
- */
- __u16 pcslen;
- __u16 pcrlen;
-/* indicator bits used by pcflag: */
-#define UDPLITE_BIT 0x1 /* set by udplite proto init function */
-#define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */
-#define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */
- __u8 pcflag; /* marks socket as UDP-Lite if > 0 */
- __u8 unused[3];
+
/*
* For encapsulation sockets.
*/
diff --git a/include/net/udplite.h b/include/net/udplite.h
index f4c513cff753..1bc9393f2890 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -59,15 +59,9 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
/* Fast-path computation of checksum. Socket may not be locked. */
static inline __wsum udplite_csum(struct sk_buff *skb)
{
- const struct udp_sock *up = udp_sk(skb->sk);
const int off = skb_transport_offset(skb);
int len = skb->len - off;
- if ((up->pcflag & UDPLITE_SEND_CC) && up->pcslen < len) {
- if (0 < up->pcslen)
- len = up->pcslen;
- udp_hdr(skb)->len = htons(up->pcslen);
- }
skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
return skb_checksum(skb, off, len, 0);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index dc416db001c8..345a6364a969 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2129,40 +2129,6 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb)
/* FALLTHROUGH -- it's a UDP Packet */
}
- /*
- * UDP-Lite specific tests, ignored on UDP sockets
- */
- if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
-
- /*
- * MIB statistics other than incrementing the error count are
- * disabled for the following two types of errors: these depend
- * on the application settings, not on the functioning of the
- * protocol stack as such.
- *
- * RFC 3828 here recommends (sec 3.3): "There should also be a
- * way ... to ... at least let the receiving application block
- * delivery of packets with coverage values less than a value
- * provided by the application."
- */
- if (up->pcrlen == 0) { /* full coverage was set */
- net_dbg_ratelimited("UDPLite: partial coverage %d while full coverage %d requested\n",
- UDP_SKB_CB(skb)->cscov, skb->len);
- goto drop;
- }
- /* The next case involves violating the min. coverage requested
- * by the receiver. This is subtle: if receiver wants x and x is
- * greater than the buffersize/MTU then receiver will complain
- * that it wants x while sender emits packets of smaller size y.
- * Therefore the above ...()->partial_cov statement is essential.
- */
- if (UDP_SKB_CB(skb)->cscov < up->pcrlen) {
- net_dbg_ratelimited("UDPLite: coverage %d too small, need min %d\n",
- UDP_SKB_CB(skb)->cscov, up->pcrlen);
- goto drop;
- }
- }
-
prefetch(&sk->sk_rmem_alloc);
if (rcu_access_pointer(sk->sk_filter) &&
udp_lib_checksum_complete(skb))
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index ecd304bbecb4..5c4b0e662ff5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -738,23 +738,6 @@ static int udpv6_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb)
/* FALLTHROUGH -- it's a UDP Packet */
}
- /*
- * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c).
- */
- if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
-
- if (up->pcrlen == 0) { /* full coverage was set */
- net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
- UDP_SKB_CB(skb)->cscov, skb->len);
- goto drop;
- }
- if (UDP_SKB_CB(skb)->cscov < up->pcrlen) {
- net_dbg_ratelimited("UDPLITE6: coverage %d too small, need min %d\n",
- UDP_SKB_CB(skb)->cscov, up->pcrlen);
- goto drop;
- }
- }
-
prefetch(&sk->sk_rmem_alloc);
if (rcu_access_pointer(sk->sk_filter) &&
udp_lib_checksum_complete(skb))
--
2.30.2
next prev parent reply other threads:[~2023-05-30 1:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 1:03 [PATCH v1 net-next 00/14] udp: Farewell to UDP-Lite Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 01/14] udp: Random clenaup Kuniyuki Iwashima
2023-05-30 12:56 ` Simon Horman
2023-05-30 1:03 ` [PATCH v1 net-next 02/14] udplite: Retire UDP-Lite for IPv6 Kuniyuki Iwashima
2023-05-30 13:01 ` Simon Horman
2023-05-30 17:49 ` Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 03/14] ipv6: Remove IPV6_ADDRFORM support for IPPROTO_UDPLITE Kuniyuki Iwashima
2023-05-30 14:22 ` Simon Horman
2023-05-30 1:03 ` [PATCH v1 net-next 04/14] udplite: Retire UDP-Lite for IPv4 Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 05/14] udp: Remove UDP-Lite SNMP stats Kuniyuki Iwashima
2023-05-30 14:24 ` Simon Horman
2023-05-30 1:03 ` [PATCH v1 net-next 06/14] udp: Remove UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV Kuniyuki Iwashima
2023-05-30 1:03 ` Kuniyuki Iwashima [this message]
2023-05-30 1:03 ` [PATCH v1 net-next 08/14] udp: Remove csum branch for UDP-Lite Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 09/14] udp: Don't pass proto to udp[46]_csum_init() Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 10/14] udp: Don't pass proto to __udp[46]_lib_rcv() Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 11/14] udp: Optimise ulen tests in __udp[46]_lib_rcv() Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 12/14] udp: Remove udp_table in struct proto Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 13/14] udp: Remove udp_table in struct udp_seq_afinfo Kuniyuki Iwashima
2023-05-30 1:03 ` [PATCH v1 net-next 14/14] udp: Don't pass udp_table to __udp[46]_lib_lookup() Kuniyuki Iwashima
2023-05-30 2:15 ` [PATCH v1 net-next 00/14] udp: Farewell to UDP-Lite Willem de Bruijn
2023-05-30 17:34 ` Kuniyuki Iwashima
2023-05-30 20:16 ` Willem de Bruijn
2023-05-30 22:14 ` Jakub Kicinski
2023-05-31 1:01 ` Kuniyuki Iwashima
2023-05-31 4:25 ` Eric Dumazet
2023-05-31 5:10 ` Jakub Kicinski
2023-05-31 6:24 ` Paolo Abeni
2023-05-31 6:44 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230530010348.21425-8-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.