]> Pileus Git - ~andy/linux/commitdiff
openvswitch: Unify vport error stats handling.
authorPravin B Shelar <pshelar@nicira.com>
Mon, 13 May 2013 15:22:34 +0000 (08:22 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 14 Jun 2013 22:09:10 +0000 (15:09 -0700)
Following patch changes vport->send return type so that vport
layer can do error accounting.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
net/openvswitch/vport-netdev.c
net/openvswitch/vport.c
net/openvswitch/vport.h

index 4f01c6d2ffa40dcdb92856d6b35782a43679ad66..43712217a372f405ec0fd0047674cabf42b6164f 100644 (file)
@@ -170,7 +170,7 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
                net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n",
                                     netdev_vport->dev->name,
                                     packet_length(skb), mtu);
-               goto error;
+               goto drop;
        }
 
        skb->dev = netdev_vport->dev;
@@ -179,9 +179,8 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
 
        return len;
 
-error:
+drop:
        kfree_skb(skb);
-       ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
        return 0;
 }
 
index 720623190eaa82d9ad4a2fcf460a0270cf57a03b..7f20f6d1be9480ed722143cca2f4d10197669ef5 100644 (file)
@@ -351,7 +351,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
 {
        int sent = vport->ops->send(vport, skb);
 
-       if (likely(sent)) {
+       if (likely(sent > 0)) {
                struct pcpu_tstats *stats;
 
                stats = this_cpu_ptr(vport->percpu_stats);
@@ -360,7 +360,12 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
                stats->tx_packets++;
                stats->tx_bytes += sent;
                u64_stats_update_end(&stats->syncp);
-       }
+       } else if (sent < 0) {
+               ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
+               kfree_skb(skb);
+       } else
+               ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
+
        return sent;
 }
 
index 26c594b1a47037aa2aefa191aca2cce76779335c..1cef5cd3be47681f0a2cc2950d47bf75cd8ffaf2 100644 (file)
@@ -123,7 +123,8 @@ struct vport_parms {
  * existing vport to a &struct sk_buff.  May be %NULL for a vport that does not
  * have any configuration.
  * @get_name: Get the device's name.
- * @send: Send a packet on the device.  Returns the length of the packet sent.
+ * @send: Send a packet on the device.  Returns the length of the packet sent,
+ * zero for dropped packets or negative for error.
  */
 struct vport_ops {
        enum ovs_vport_type type;