提交 b45386ef 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: rename IP_INC_STATS_BH()

Rename IP_INC_STATS_BH() to __IP_INC_STATS(), to
better express this is used in non preemptible context.
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 08e3baef
...@@ -187,7 +187,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, ...@@ -187,7 +187,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
unsigned int len); unsigned int len);
#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) #define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field) #define __IP_INC_STATS(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val) #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val) #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)
#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val) #define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
......
...@@ -217,13 +217,13 @@ static int br_validate_ipv4(struct net *net, struct sk_buff *skb) ...@@ -217,13 +217,13 @@ static int br_validate_ipv4(struct net *net, struct sk_buff *skb)
len = ntohs(iph->tot_len); len = ntohs(iph->tot_len);
if (skb->len < len) { if (skb->len < len) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INTRUNCATEDPKTS); __IP_INC_STATS(net, IPSTATS_MIB_INTRUNCATEDPKTS);
goto drop; goto drop;
} else if (len < (iph->ihl*4)) } else if (len < (iph->ihl*4))
goto inhdr_error; goto inhdr_error;
if (pskb_trim_rcsum(skb, len)) { if (pskb_trim_rcsum(skb, len)) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INDISCARDS); __IP_INC_STATS(net, IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
...@@ -236,7 +236,7 @@ static int br_validate_ipv4(struct net *net, struct sk_buff *skb) ...@@ -236,7 +236,7 @@ static int br_validate_ipv4(struct net *net, struct sk_buff *skb)
return 0; return 0;
inhdr_error: inhdr_error:
IP_INC_STATS_BH(net, IPSTATS_MIB_INHDRERRORS); __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS);
drop: drop:
return -1; return -1;
} }
......
...@@ -462,7 +462,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, ...@@ -462,7 +462,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); security_skb_classify_flow(skb, flowi4_to_flowi(&fl4));
rt = ip_route_output_flow(net, &fl4, sk); rt = ip_route_output_flow(net, &fl4, sk);
if (IS_ERR(rt)) { if (IS_ERR(rt)) {
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
return NULL; return NULL;
} }
......
...@@ -427,7 +427,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, ...@@ -427,7 +427,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk,
route_err: route_err:
ip_rt_put(rt); ip_rt_put(rt);
no_route: no_route:
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(inet_csk_route_req); EXPORT_SYMBOL_GPL(inet_csk_route_req);
...@@ -466,7 +466,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, ...@@ -466,7 +466,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
ip_rt_put(rt); ip_rt_put(rt);
no_route: no_route:
rcu_read_unlock(); rcu_read_unlock();
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(inet_csk_route_child_sock); EXPORT_SYMBOL_GPL(inet_csk_route_child_sock);
......
...@@ -65,7 +65,7 @@ static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *s ...@@ -65,7 +65,7 @@ static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *s
{ {
struct ip_options *opt = &(IPCB(skb)->opt); struct ip_options *opt = &(IPCB(skb)->opt);
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTFORWDATAGRAMS); __IP_INC_STATS(net, IPSTATS_MIB_OUTFORWDATAGRAMS);
IP_ADD_STATS_BH(net, IPSTATS_MIB_OUTOCTETS, skb->len); IP_ADD_STATS_BH(net, IPSTATS_MIB_OUTOCTETS, skb->len);
if (unlikely(opt->optlen)) if (unlikely(opt->optlen))
...@@ -157,7 +157,7 @@ int ip_forward(struct sk_buff *skb) ...@@ -157,7 +157,7 @@ int ip_forward(struct sk_buff *skb)
too_many_hops: too_many_hops:
/* Tell the sender its packet died... */ /* Tell the sender its packet died... */
IP_INC_STATS_BH(net, IPSTATS_MIB_INHDRERRORS); __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS);
icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
......
...@@ -204,14 +204,14 @@ static void ip_expire(unsigned long arg) ...@@ -204,14 +204,14 @@ static void ip_expire(unsigned long arg)
goto out; goto out;
ipq_kill(qp); ipq_kill(qp);
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
if (!inet_frag_evicting(&qp->q)) { if (!inet_frag_evicting(&qp->q)) {
struct sk_buff *head = qp->q.fragments; struct sk_buff *head = qp->q.fragments;
const struct iphdr *iph; const struct iphdr *iph;
int err; int err;
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT); __IP_INC_STATS(net, IPSTATS_MIB_REASMTIMEOUT);
if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments) if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments)
goto out; goto out;
...@@ -291,7 +291,7 @@ static int ip_frag_too_far(struct ipq *qp) ...@@ -291,7 +291,7 @@ static int ip_frag_too_far(struct ipq *qp)
struct net *net; struct net *net;
net = container_of(qp->q.net, struct net, ipv4.frags); net = container_of(qp->q.net, struct net, ipv4.frags);
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
} }
return rc; return rc;
...@@ -635,7 +635,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, ...@@ -635,7 +635,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
ip_send_check(iph); ip_send_check(iph);
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS); __IP_INC_STATS(net, IPSTATS_MIB_REASMOKS);
qp->q.fragments = NULL; qp->q.fragments = NULL;
qp->q.fragments_tail = NULL; qp->q.fragments_tail = NULL;
return 0; return 0;
...@@ -647,7 +647,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, ...@@ -647,7 +647,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
out_oversize: out_oversize:
net_info_ratelimited("Oversized IP packet from %pI4\n", &qp->saddr); net_info_ratelimited("Oversized IP packet from %pI4\n", &qp->saddr);
out_fail: out_fail:
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
return err; return err;
} }
...@@ -658,7 +658,7 @@ int ip_defrag(struct net *net, struct sk_buff *skb, u32 user) ...@@ -658,7 +658,7 @@ int ip_defrag(struct net *net, struct sk_buff *skb, u32 user)
int vif = l3mdev_master_ifindex_rcu(dev); int vif = l3mdev_master_ifindex_rcu(dev);
struct ipq *qp; struct ipq *qp;
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMREQDS); __IP_INC_STATS(net, IPSTATS_MIB_REASMREQDS);
skb_orphan(skb); skb_orphan(skb);
/* Lookup (or create) queue header */ /* Lookup (or create) queue header */
...@@ -675,7 +675,7 @@ int ip_defrag(struct net *net, struct sk_buff *skb, u32 user) ...@@ -675,7 +675,7 @@ int ip_defrag(struct net *net, struct sk_buff *skb, u32 user)
return ret; return ret;
} }
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
kfree_skb(skb); kfree_skb(skb);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -218,17 +218,17 @@ static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_b ...@@ -218,17 +218,17 @@ static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_b
protocol = -ret; protocol = -ret;
goto resubmit; goto resubmit;
} }
IP_INC_STATS_BH(net, IPSTATS_MIB_INDELIVERS); __IP_INC_STATS(net, IPSTATS_MIB_INDELIVERS);
} else { } else {
if (!raw) { if (!raw) {
if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INUNKNOWNPROTOS); __IP_INC_STATS(net, IPSTATS_MIB_INUNKNOWNPROTOS);
icmp_send(skb, ICMP_DEST_UNREACH, icmp_send(skb, ICMP_DEST_UNREACH,
ICMP_PROT_UNREACH, 0); ICMP_PROT_UNREACH, 0);
} }
kfree_skb(skb); kfree_skb(skb);
} else { } else {
IP_INC_STATS_BH(net, IPSTATS_MIB_INDELIVERS); __IP_INC_STATS(net, IPSTATS_MIB_INDELIVERS);
consume_skb(skb); consume_skb(skb);
} }
} }
...@@ -273,7 +273,7 @@ static inline bool ip_rcv_options(struct sk_buff *skb) ...@@ -273,7 +273,7 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
--ANK (980813) --ANK (980813)
*/ */
if (skb_cow(skb, skb_headroom(skb))) { if (skb_cow(skb, skb_headroom(skb))) {
IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INDISCARDS); __IP_INC_STATS(dev_net(dev), IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
...@@ -282,7 +282,7 @@ static inline bool ip_rcv_options(struct sk_buff *skb) ...@@ -282,7 +282,7 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
opt->optlen = iph->ihl*4 - sizeof(struct iphdr); opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
if (ip_options_compile(dev_net(dev), opt, skb)) { if (ip_options_compile(dev_net(dev), opt, skb)) {
IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INHDRERRORS); __IP_INC_STATS(dev_net(dev), IPSTATS_MIB_INHDRERRORS);
goto drop; goto drop;
} }
...@@ -413,7 +413,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -413,7 +413,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
skb = skb_share_check(skb, GFP_ATOMIC); skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb) { if (!skb) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INDISCARDS); __IP_INC_STATS(net, IPSTATS_MIB_INDISCARDS);
goto out; goto out;
} }
...@@ -453,7 +453,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -453,7 +453,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
len = ntohs(iph->tot_len); len = ntohs(iph->tot_len);
if (skb->len < len) { if (skb->len < len) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INTRUNCATEDPKTS); __IP_INC_STATS(net, IPSTATS_MIB_INTRUNCATEDPKTS);
goto drop; goto drop;
} else if (len < (iph->ihl*4)) } else if (len < (iph->ihl*4))
goto inhdr_error; goto inhdr_error;
...@@ -463,7 +463,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -463,7 +463,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
* Note this now means skb->len holds ntohs(iph->tot_len). * Note this now means skb->len holds ntohs(iph->tot_len).
*/ */
if (pskb_trim_rcsum(skb, len)) { if (pskb_trim_rcsum(skb, len)) {
IP_INC_STATS_BH(net, IPSTATS_MIB_INDISCARDS); __IP_INC_STATS(net, IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
...@@ -480,9 +480,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -480,9 +480,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
ip_rcv_finish); ip_rcv_finish);
csum_error: csum_error:
IP_INC_STATS_BH(net, IPSTATS_MIB_CSUMERRORS); __IP_INC_STATS(net, IPSTATS_MIB_CSUMERRORS);
inhdr_error: inhdr_error:
IP_INC_STATS_BH(net, IPSTATS_MIB_INHDRERRORS); __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
out: out:
......
...@@ -915,11 +915,11 @@ static int ip_error(struct sk_buff *skb) ...@@ -915,11 +915,11 @@ static int ip_error(struct sk_buff *skb)
if (!IN_DEV_FORWARD(in_dev)) { if (!IN_DEV_FORWARD(in_dev)) {
switch (rt->dst.error) { switch (rt->dst.error) {
case EHOSTUNREACH: case EHOSTUNREACH:
IP_INC_STATS_BH(net, IPSTATS_MIB_INADDRERRORS); __IP_INC_STATS(net, IPSTATS_MIB_INADDRERRORS);
break; break;
case ENETUNREACH: case ENETUNREACH:
IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES); __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES);
break; break;
} }
goto out; goto out;
...@@ -934,7 +934,7 @@ static int ip_error(struct sk_buff *skb) ...@@ -934,7 +934,7 @@ static int ip_error(struct sk_buff *skb)
break; break;
case ENETUNREACH: case ENETUNREACH:
code = ICMP_NET_UNREACH; code = ICMP_NET_UNREACH;
IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES); __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES);
break; break;
case EACCES: case EACCES:
code = ICMP_PKT_FILTERED; code = ICMP_PKT_FILTERED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册