aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2013-05-13 11:22:34 -0400
committerJesse Gross <jesse@nicira.com>2013-06-14 18:09:10 -0400
commit91b7514cdff406ad8f63d09b74f664c37bed2e01 (patch)
treee74b566546cfb0ec1b48baa9cc39acd647256bd9 /net/openvswitch
parentcbd531bebb02bc6c0fc3619a2cfc32f7d8843b18 (diff)
openvswitch: Unify vport error stats handling.
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>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/vport-netdev.c5
-rw-r--r--net/openvswitch/vport.c9
-rw-r--r--net/openvswitch/vport.h3
3 files changed, 11 insertions, 6 deletions
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 4f01c6d2ffa4..43712217a372 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -170,7 +170,7 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
170 net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n", 170 net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n",
171 netdev_vport->dev->name, 171 netdev_vport->dev->name,
172 packet_length(skb), mtu); 172 packet_length(skb), mtu);
173 goto error; 173 goto drop;
174 } 174 }
175 175
176 skb->dev = netdev_vport->dev; 176 skb->dev = netdev_vport->dev;
@@ -179,9 +179,8 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
179 179
180 return len; 180 return len;
181 181
182error: 182drop:
183 kfree_skb(skb); 183 kfree_skb(skb);
184 ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
185 return 0; 184 return 0;
186} 185}
187 186
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 720623190eaa..7f20f6d1be94 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -351,7 +351,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
351{ 351{
352 int sent = vport->ops->send(vport, skb); 352 int sent = vport->ops->send(vport, skb);
353 353
354 if (likely(sent)) { 354 if (likely(sent > 0)) {
355 struct pcpu_tstats *stats; 355 struct pcpu_tstats *stats;
356 356
357 stats = this_cpu_ptr(vport->percpu_stats); 357 stats = this_cpu_ptr(vport->percpu_stats);
@@ -360,7 +360,12 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
360 stats->tx_packets++; 360 stats->tx_packets++;
361 stats->tx_bytes += sent; 361 stats->tx_bytes += sent;
362 u64_stats_update_end(&stats->syncp); 362 u64_stats_update_end(&stats->syncp);
363 } 363 } else if (sent < 0) {
364 ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
365 kfree_skb(skb);
366 } else
367 ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
368
364 return sent; 369 return sent;
365} 370}
366 371
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 26c594b1a470..1cef5cd3be47 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -123,7 +123,8 @@ struct vport_parms {
123 * existing vport to a &struct sk_buff. May be %NULL for a vport that does not 123 * existing vport to a &struct sk_buff. May be %NULL for a vport that does not
124 * have any configuration. 124 * have any configuration.
125 * @get_name: Get the device's name. 125 * @get_name: Get the device's name.
126 * @send: Send a packet on the device. Returns the length of the packet sent. 126 * @send: Send a packet on the device. Returns the length of the packet sent,
127 * zero for dropped packets or negative for error.
127 */ 128 */
128struct vport_ops { 129struct vport_ops {
129 enum ovs_vport_type type; 130 enum ovs_vport_type type;