Skip to content

Commit f289c02

Browse files
q2vendavem330
authored andcommitted
raw: Use helpers for the hlist_nulls variant.
hlist_nulls_add_head_rcu() and hlist_nulls_for_each_entry() have dedicated macros for sk. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5da39e3 commit f289c02

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

net/ipv4/raw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int raw_hash_sk(struct sock *sk)
9696
hlist = &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)];
9797

9898
write_lock_bh(&h->lock);
99-
hlist_nulls_add_head_rcu(&sk->sk_nulls_node, hlist);
99+
__sk_nulls_add_node_rcu(sk, hlist);
100100
sock_set_flag(sk, SOCK_RCU_FREE);
101101
write_unlock_bh(&h->lock);
102102
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
@@ -172,7 +172,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
172172

173173
hlist = &raw_v4_hashinfo.ht[hash];
174174
rcu_read_lock();
175-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
175+
sk_nulls_for_each(sk, hnode, hlist) {
176176
if (!raw_v4_match(net, sk, iph->protocol,
177177
iph->saddr, iph->daddr, dif, sdif))
178178
continue;
@@ -275,7 +275,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
275275
hlist = &raw_v4_hashinfo.ht[hash];
276276

277277
rcu_read_lock();
278-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
278+
sk_nulls_for_each(sk, hnode, hlist) {
279279
iph = (const struct iphdr *)skb->data;
280280
if (!raw_v4_match(net, sk, iph->protocol,
281281
iph->saddr, iph->daddr, dif, sdif))
@@ -954,7 +954,7 @@ static struct sock *raw_get_first(struct seq_file *seq, int bucket)
954954
for (state->bucket = bucket; state->bucket < RAW_HTABLE_SIZE;
955955
++state->bucket) {
956956
hlist = &h->ht[state->bucket];
957-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
957+
sk_nulls_for_each(sk, hnode, hlist) {
958958
if (sock_net(sk) == seq_file_net(seq))
959959
return sk;
960960
}

net/ipv4/raw_diag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static struct sock *raw_sock_get(struct net *net, const struct inet_diag_req_v2
6868
rcu_read_lock();
6969
for (slot = 0; slot < RAW_HTABLE_SIZE; slot++) {
7070
hlist = &hashinfo->ht[slot];
71-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
71+
sk_nulls_for_each(sk, hnode, hlist) {
7272
if (raw_lookup(net, sk, r)) {
7373
/*
7474
* Grab it and keep until we fill
@@ -161,7 +161,7 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
161161
num = 0;
162162

163163
hlist = &hashinfo->ht[slot];
164-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
164+
sk_nulls_for_each(sk, hnode, hlist) {
165165
struct inet_sock *inet = inet_sk(sk);
166166

167167
if (!net_eq(sock_net(sk), net))

net/ipv6/raw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
155155
hash = nexthdr & (RAW_HTABLE_SIZE - 1);
156156
hlist = &raw_v6_hashinfo.ht[hash];
157157
rcu_read_lock();
158-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
158+
sk_nulls_for_each(sk, hnode, hlist) {
159159
int filtered;
160160

161161
if (!raw_v6_match(net, sk, nexthdr, daddr, saddr,
@@ -342,7 +342,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
342342
hash = nexthdr & (RAW_HTABLE_SIZE - 1);
343343
hlist = &raw_v6_hashinfo.ht[hash];
344344
rcu_read_lock();
345-
hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
345+
sk_nulls_for_each(sk, hnode, hlist) {
346346
/* Note: ipv6_hdr(skb) != skb->data */
347347
const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
348348
saddr = &ip6h->saddr;

0 commit comments

Comments
 (0)