]> git.karo-electronics.de Git - linux-beck.git/commitdiff
{pktgen, xfrm} Add statistics counting when transforming
authorFan Du <fan.du@windriver.com>
Fri, 3 Jan 2014 03:18:28 +0000 (11:18 +0800)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 3 Jan 2014 06:29:11 +0000 (07:29 +0100)
so /proc/net/xfrm_stat could give user clue about what's
wrong in this process.

Signed-off-by: Fan Du <fan.du@windriver.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/core/pktgen.c

index b0075865d29bb7a5a11dbdcea61093c3d19a8f39..156d57b616ac6bcf4a8b6be718d1a35dc834ebd6 100644 (file)
@@ -2479,6 +2479,7 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
 {
        struct xfrm_state *x = pkt_dev->flows[pkt_dev->curfl].x;
        int err = 0;
+       struct net *net = dev_net(pkt_dev->odev);
 
        if (!x)
                return 0;
@@ -2488,12 +2489,15 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
                return 0;
 
        err = x->outer_mode->output(x, skb);
-       if (err)
+       if (err) {
+               XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATEMODEERROR);
                goto error;
+       }
        err = x->type->output(x, skb);
-       if (err)
+       if (err) {
+               XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATEPROTOERROR);
                goto error;
-
+       }
        spin_lock_bh(&x->lock);
        x->curlft.bytes += skb->len;
        x->curlft.packets++;