#include "vport-internal_dev.h"
#include "vport-netdev.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
+#define HAVE_NET_DEVICE_OPS
+#endif
+
struct internal_dev {
struct vport *vport;
struct net_device_stats stats;
return netdev_priv(netdev);
}
-/* This function is only called by the kernel network layer. It is not a vport
- * get_stats() function. If a vport get_stats() function is defined that
- * results in this being called it will cause infinite recursion. */
+/* This function is only called by the kernel network layer.*/
static struct net_device_stats *internal_dev_sys_stats(struct net_device *netdev)
{
struct vport *vport = internal_dev_get_vport(netdev);
struct net_device_stats *stats = &internal_dev_priv(netdev)->stats;
if (vport) {
- struct rtnl_link_stats64 vport_stats;
+ struct ovs_vport_stats vport_stats;
vport_get_stats(vport, &vport_stats);
stats->tx_errors = vport_stats.rx_errors;
stats->rx_dropped = vport_stats.tx_dropped;
stats->tx_dropped = vport_stats.rx_dropped;
- stats->collisions = vport_stats.collisions;
}
return stats;
return 0;
}
-/* Called with rcu_read_lock and bottom-halves disabled. */
+/* Called with rcu_read_lock_bh. */
static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
{
if (unlikely(compute_ip_summed(skb, true))) {
vlan_copy_skb_tci(skb);
OVS_CB(skb)->flow = NULL;
+ rcu_read_lock();
vport_receive(internal_dev_priv(netdev)->vport, skb);
+ rcu_read_unlock();
return 0;
}
netdev->change_mtu = internal_dev_change_mtu;
#endif
+ netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
netdev->destructor = internal_dev_destructor;
SET_ETHTOOL_OPS(netdev, &internal_dev_ethtool_ops);
netdev->tx_queue_len = 0;
skb->protocol = eth_type_trans(skb, netdev);
forward_ip_summed(skb, false);
- if (in_interrupt())
- netif_rx(skb);
- else
- netif_rx_ni(skb);
+ netif_rx(skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
netdev->last_rx = jiffies;
const struct vport_ops internal_vport_ops = {
.type = OVS_VPORT_TYPE_INTERNAL,
- .flags = VPORT_F_REQUIRED | VPORT_F_GEN_STATS | VPORT_F_FLOW,
+ .flags = VPORT_F_REQUIRED | VPORT_F_FLOW,
.create = internal_dev_create,
.destroy = internal_dev_destroy,
.set_addr = netdev_set_addr,