diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-06-21 23:33:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-21 23:33:34 -0400 |
commit | 56f8a75c17abb854b5907f4a815dc4c3f186ba11 (patch) | |
tree | 6ba333b7668ce7dd04cddecf4f15a0a48b335991 /net/sched | |
parent | f470e5ae34d68880a38aa79ee5c102ebc2a1aef6 (diff) |
ip: introduce ip_is_fragment helper inline function
There are enough instances of this:
iph->frag_off & htons(IP_MF | IP_OFFSET)
that a helper function is probably warranted.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/cls_flow.c | 4 | ||||
-rw-r--r-- | net/sched/cls_rsvp.h | 2 | ||||
-rw-r--r-- | net/sched/sch_choke.c | 2 | ||||
-rw-r--r-- | net/sched/sch_sfq.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 8ec01391d988..34533a5d1b3a 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -121,7 +121,7 @@ static u32 flow_get_proto_src(struct sk_buff *skb) | |||
121 | if (!pskb_network_may_pull(skb, sizeof(*iph))) | 121 | if (!pskb_network_may_pull(skb, sizeof(*iph))) |
122 | break; | 122 | break; |
123 | iph = ip_hdr(skb); | 123 | iph = ip_hdr(skb); |
124 | if (iph->frag_off & htons(IP_MF | IP_OFFSET)) | 124 | if (ip_is_fragment(iph)) |
125 | break; | 125 | break; |
126 | poff = proto_ports_offset(iph->protocol); | 126 | poff = proto_ports_offset(iph->protocol); |
127 | if (poff >= 0 && | 127 | if (poff >= 0 && |
@@ -163,7 +163,7 @@ static u32 flow_get_proto_dst(struct sk_buff *skb) | |||
163 | if (!pskb_network_may_pull(skb, sizeof(*iph))) | 163 | if (!pskb_network_may_pull(skb, sizeof(*iph))) |
164 | break; | 164 | break; |
165 | iph = ip_hdr(skb); | 165 | iph = ip_hdr(skb); |
166 | if (iph->frag_off & htons(IP_MF | IP_OFFSET)) | 166 | if (ip_is_fragment(iph)) |
167 | break; | 167 | break; |
168 | poff = proto_ports_offset(iph->protocol); | 168 | poff = proto_ports_offset(iph->protocol); |
169 | if (poff >= 0 && | 169 | if (poff >= 0 && |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 402c44b241a3..ed691b148384 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -167,7 +167,7 @@ restart: | |||
167 | dst = &nhptr->daddr; | 167 | dst = &nhptr->daddr; |
168 | protocol = nhptr->protocol; | 168 | protocol = nhptr->protocol; |
169 | xprt = ((u8 *)nhptr) + (nhptr->ihl<<2); | 169 | xprt = ((u8 *)nhptr) + (nhptr->ihl<<2); |
170 | if (nhptr->frag_off & htons(IP_MF | IP_OFFSET)) | 170 | if (ip_is_fragment(nhptr)) |
171 | return -1; | 171 | return -1; |
172 | #endif | 172 | #endif |
173 | 173 | ||
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index 06afbaeb4c88..3422b25df9e4 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -181,7 +181,7 @@ static bool choke_match_flow(struct sk_buff *skb1, | |||
181 | ip1->saddr != ip2->saddr || ip1->daddr != ip2->daddr) | 181 | ip1->saddr != ip2->saddr || ip1->daddr != ip2->daddr) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | if ((ip1->frag_off | ip2->frag_off) & htons(IP_MF | IP_OFFSET)) | 184 | if (ip_is_fragment(ip1) | ip_is_fragment(ip2)) |
185 | ip_proto = 0; | 185 | ip_proto = 0; |
186 | off1 += ip1->ihl * 4; | 186 | off1 += ip1->ihl * 4; |
187 | off2 += ip2->ihl * 4; | 187 | off2 += ip2->ihl * 4; |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index b6ea6afa55b0..4536ee64383e 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -157,7 +157,7 @@ static unsigned int sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
157 | iph = ip_hdr(skb); | 157 | iph = ip_hdr(skb); |
158 | h = (__force u32)iph->daddr; | 158 | h = (__force u32)iph->daddr; |
159 | h2 = (__force u32)iph->saddr ^ iph->protocol; | 159 | h2 = (__force u32)iph->saddr ^ iph->protocol; |
160 | if (iph->frag_off & htons(IP_MF | IP_OFFSET)) | 160 | if (ip_is_fragment(iph)) |
161 | break; | 161 | break; |
162 | poff = proto_ports_offset(iph->protocol); | 162 | poff = proto_ports_offset(iph->protocol); |
163 | if (poff >= 0 && | 163 | if (poff >= 0 && |