提交 91b7514c 编写于 作者: P Pravin B Shelar 提交者: Jesse Gross

openvswitch: Unify vport error stats handling.

Following patch changes vport->send return type so that vport
layer can do error accounting.
Signed-off-by: NPravin B Shelar <pshelar@nicira.com>
Signed-off-by: NJesse Gross <jesse@nicira.com>
上级 cbd531be
...@@ -170,7 +170,7 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb) ...@@ -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", net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n",
netdev_vport->dev->name, netdev_vport->dev->name,
packet_length(skb), mtu); packet_length(skb), mtu);
goto error; goto drop;
} }
skb->dev = netdev_vport->dev; skb->dev = netdev_vport->dev;
...@@ -179,9 +179,8 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb) ...@@ -179,9 +179,8 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
return len; return len;
error: drop:
kfree_skb(skb); kfree_skb(skb);
ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
return 0; return 0;
} }
......
...@@ -351,7 +351,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb) ...@@ -351,7 +351,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
{ {
int sent = vport->ops->send(vport, skb); int sent = vport->ops->send(vport, skb);
if (likely(sent)) { if (likely(sent > 0)) {
struct pcpu_tstats *stats; struct pcpu_tstats *stats;
stats = this_cpu_ptr(vport->percpu_stats); stats = this_cpu_ptr(vport->percpu_stats);
...@@ -360,7 +360,12 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb) ...@@ -360,7 +360,12 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
stats->tx_packets++; stats->tx_packets++;
stats->tx_bytes += sent; stats->tx_bytes += sent;
u64_stats_update_end(&stats->syncp); 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; return sent;
} }
......
...@@ -123,7 +123,8 @@ struct vport_parms { ...@@ -123,7 +123,8 @@ struct vport_parms {
* existing vport to a &struct sk_buff. May be %NULL for a vport that does not * existing vport to a &struct sk_buff. May be %NULL for a vport that does not
* have any configuration. * have any configuration.
* @get_name: Get the device's name. * @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 { struct vport_ops {
enum ovs_vport_type type; enum ovs_vport_type type;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册