Skip to content

Commit bef55ae

Browse files
committed
decnet: Convert to use flowidn where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1958b85 commit bef55ae

10 files changed

Lines changed: 196 additions & 185 deletions

File tree

‎include/net/dn.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
192192
ethaddr[5] = (__u8)(a >> 8);
193193
}
194194

195-
static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
195+
static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
196196
{
197-
fl->u.dn.uli.ports.sport = scp->addrloc;
198-
fl->u.dn.uli.ports.dport = scp->addrrem;
197+
fld->fld_sport = scp->addrloc;
198+
fld->fld_dport = scp->addrrem;
199199
}
200200

201201
extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);

‎include/net/dn_fib.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct dn_fib_table {
9898
int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
9999
struct dn_kern_rta *rta, struct nlmsghdr *n,
100100
struct netlink_skb_parms *req);
101-
int (*lookup)(struct dn_fib_table *t, const struct flowi *fl,
101+
int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,
102102
struct dn_fib_res *res);
103103
int (*flush)(struct dn_fib_table *t);
104104
int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb);
@@ -119,12 +119,12 @@ extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
119119
struct dn_kern_rta *rta,
120120
const struct nlmsghdr *nlh, int *errp);
121121
extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
122-
const struct flowi *fl,
122+
const struct flowidn *fld,
123123
struct dn_fib_res *res);
124124
extern void dn_fib_release_info(struct dn_fib_info *fi);
125125
extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
126126
extern void dn_fib_flush(void);
127-
extern void dn_fib_select_multipath(const struct flowi *fl,
127+
extern void dn_fib_select_multipath(const struct flowidn *fld,
128128
struct dn_fib_res *res);
129129

130130
/*
@@ -141,7 +141,7 @@ extern void dn_fib_table_cleanup(void);
141141
extern void dn_fib_rules_init(void);
142142
extern void dn_fib_rules_cleanup(void);
143143
extern unsigned dnet_addr_type(__le16 addr);
144-
extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
144+
extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
145145

146146
extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
147147

‎include/net/dn_route.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*******************************************************************************/
1717

1818
extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19-
extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
19+
extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags);
2020
extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
2121
extern void dn_rt_cache_flush(int delay);
2222

@@ -67,7 +67,7 @@ extern void dn_rt_cache_flush(int delay);
6767
struct dn_route {
6868
struct dst_entry dst;
6969

70-
struct flowi fl;
70+
struct flowidn fld;
7171

7272
__le16 rt_saddr;
7373
__le16 rt_daddr;
@@ -82,12 +82,12 @@ struct dn_route {
8282

8383
static inline bool dn_is_input_route(struct dn_route *rt)
8484
{
85-
return rt->fl.flowi_iif != 0;
85+
return rt->fld.flowidn_iif != 0;
8686
}
8787

8888
static inline bool dn_is_output_route(struct dn_route *rt)
8989
{
90-
return rt->fl.flowi_iif == 0;
90+
return rt->fld.flowidn_iif == 0;
9191
}
9292

9393
extern void dn_route_init(void);

‎include/net/flow.h‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,17 @@ struct flowi6 {
9595

9696
struct flowidn {
9797
struct flowi_common __fl_common;
98+
#define flowidn_oif __fl_common.flowic_oif
99+
#define flowidn_iif __fl_common.flowic_iif
100+
#define flowidn_mark __fl_common.flowic_mark
101+
#define flowidn_scope __fl_common.flowic_scope
102+
#define flowidn_proto __fl_common.flowic_proto
103+
#define flowidn_flags __fl_common.flowic_flags
98104
__le16 daddr;
99105
__le16 saddr;
100106
union flowi_uli uli;
107+
#define fld_sport uli.ports.sport
108+
#define fld_dport uli.ports.dport
101109
};
102110

103111
struct flowi {
@@ -115,10 +123,6 @@ struct flowi {
115123
#define flowi_proto u.__fl_common.flowic_proto
116124
#define flowi_flags u.__fl_common.flowic_flags
117125
#define flowi_secid u.__fl_common.flowic_secid
118-
#define fld_scope flowi_scope
119-
120-
#define fld_dst u.dn.daddr
121-
#define fld_src u.dn.saddr
122126
} __attribute__((__aligned__(BITS_PER_LONG/8)));
123127

124128
static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)

‎net/decnet/af_decnet.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
908908
struct socket *sock = sk->sk_socket;
909909
struct dn_scp *scp = DN_SK(sk);
910910
int err = -EISCONN;
911-
struct flowi fl;
911+
struct flowidn fld;
912912

913913
if (sock->state == SS_CONNECTED)
914914
goto out;
@@ -947,13 +947,13 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
947947
memcpy(&scp->peer, addr, sizeof(struct sockaddr_dn));
948948

949949
err = -EHOSTUNREACH;
950-
memset(&fl, 0, sizeof(fl));
951-
fl.flowi_oif = sk->sk_bound_dev_if;
952-
fl.fld_dst = dn_saddr2dn(&scp->peer);
953-
fl.fld_src = dn_saddr2dn(&scp->addr);
954-
dn_sk_ports_copy(&fl, scp);
955-
fl.flowi_proto = DNPROTO_NSP;
956-
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, flags) < 0)
950+
memset(&fld, 0, sizeof(fld));
951+
fld.flowidn_oif = sk->sk_bound_dev_if;
952+
fld.daddr = dn_saddr2dn(&scp->peer);
953+
fld.saddr = dn_saddr2dn(&scp->addr);
954+
dn_sk_ports_copy(&fld, scp);
955+
fld.flowidn_proto = DNPROTO_NSP;
956+
if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0)
957957
goto out;
958958
sk->sk_route_caps = sk->sk_dst_cache->dev->features;
959959
sock->state = SS_CONNECTING;

‎net/decnet/dn_fib.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
201201
int err;
202202

203203
if (nh->nh_gw) {
204-
struct flowi fl;
204+
struct flowidn fld;
205205
struct dn_fib_res res;
206206

207207
if (nh->nh_flags&RTNH_F_ONLINK) {
@@ -221,15 +221,15 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
221221
return 0;
222222
}
223223

224-
memset(&fl, 0, sizeof(fl));
225-
fl.fld_dst = nh->nh_gw;
226-
fl.flowi_oif = nh->nh_oif;
227-
fl.fld_scope = r->rtm_scope + 1;
224+
memset(&fld, 0, sizeof(fld));
225+
fld.daddr = nh->nh_gw;
226+
fld.flowidn_oif = nh->nh_oif;
227+
fld.flowidn_scope = r->rtm_scope + 1;
228228

229-
if (fl.fld_scope < RT_SCOPE_LINK)
230-
fl.fld_scope = RT_SCOPE_LINK;
229+
if (fld.flowidn_scope < RT_SCOPE_LINK)
230+
fld.flowidn_scope = RT_SCOPE_LINK;
231231

232-
if ((err = dn_fib_lookup(&fl, &res)) != 0)
232+
if ((err = dn_fib_lookup(&fld, &res)) != 0)
233233
return err;
234234

235235
err = -EINVAL;
@@ -404,7 +404,7 @@ struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, struct dn_kern_rta
404404
return NULL;
405405
}
406406

407-
int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *fl, struct dn_fib_res *res)
407+
int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowidn *fld, struct dn_fib_res *res)
408408
{
409409
int err = dn_fib_props[type].error;
410410

@@ -424,7 +424,8 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *
424424
for_nexthops(fi) {
425425
if (nh->nh_flags & RTNH_F_DEAD)
426426
continue;
427-
if (!fl->flowi_oif || fl->flowi_oif == nh->nh_oif)
427+
if (!fld->flowidn_oif ||
428+
fld->flowidn_oif == nh->nh_oif)
428429
break;
429430
}
430431
if (nhsel < fi->fib_nhs) {
@@ -445,7 +446,7 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *
445446
return err;
446447
}
447448

448-
void dn_fib_select_multipath(const struct flowi *fl, struct dn_fib_res *res)
449+
void dn_fib_select_multipath(const struct flowidn *fld, struct dn_fib_res *res)
449450
{
450451
struct dn_fib_info *fi = res->fi;
451452
int w;

‎net/decnet/dn_nsp_out.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void dn_nsp_send(struct sk_buff *skb)
7878
struct sock *sk = skb->sk;
7979
struct dn_scp *scp = DN_SK(sk);
8080
struct dst_entry *dst;
81-
struct flowi fl;
81+
struct flowidn fld;
8282

8383
skb_reset_transport_header(skb);
8484
scp->stamp = jiffies;
@@ -91,13 +91,13 @@ static void dn_nsp_send(struct sk_buff *skb)
9191
return;
9292
}
9393

94-
memset(&fl, 0, sizeof(fl));
95-
fl.flowi_oif = sk->sk_bound_dev_if;
96-
fl.fld_src = dn_saddr2dn(&scp->addr);
97-
fl.fld_dst = dn_saddr2dn(&scp->peer);
98-
dn_sk_ports_copy(&fl, scp);
99-
fl.flowi_proto = DNPROTO_NSP;
100-
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, 0) == 0) {
94+
memset(&fld, 0, sizeof(fld));
95+
fld.flowidn_oif = sk->sk_bound_dev_if;
96+
fld.saddr = dn_saddr2dn(&scp->addr);
97+
fld.daddr = dn_saddr2dn(&scp->peer);
98+
dn_sk_ports_copy(&fld, scp);
99+
fld.flowidn_proto = DNPROTO_NSP;
100+
if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, 0) == 0) {
101101
dst = sk_dst_get(sk);
102102
sk->sk_route_caps = dst->dev->features;
103103
goto try_again;

0 commit comments

Comments
 (0)