@@ -116,7 +116,7 @@ static struct vport_ops ovs_geneve_vport_ops = {
.create = geneve_create,
.destroy = ovs_netdev_tunnel_destroy,
.get_options = geneve_get_options,
- .send = ovs_netdev_send_tap,
+ .send = ovs_netdev_send,
};
static int __init ovs_geneve_tnl_init(void)
@@ -87,7 +87,7 @@ static struct vport *gre_create(const struct vport_parms *parms)
static struct vport_ops ovs_gre_vport_ops = {
.type = OVS_VPORT_TYPE_GRE,
.create = gre_create,
- .send = ovs_netdev_send_raw_tun,
+ .send = ovs_netdev_send,
.destroy = ovs_netdev_tunnel_destroy,
};
@@ -197,25 +197,20 @@ void ovs_netdev_tunnel_destroy(struct vport *vport)
}
EXPORT_SYMBOL_GPL(ovs_netdev_tunnel_destroy);
-int ovs_netdev_send_tap(struct sk_buff *skb)
+int ovs_netdev_send(struct sk_buff *skb)
{
- /* Only send L2 packets */
- if (skb->mac_len)
- return dev_queue_xmit(skb);
+ struct net_device *dev = skb->dev;
- kfree_skb(skb);
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ovs_netdev_send_tap);
-
-int ovs_netdev_send_raw_tun(struct sk_buff *skb)
-{
- if (skb->mac_len)
- skb->protocol = ntohs(ETH_P_TEB);
+ if (dev->type != ARPHRD_ETHER && skb->mac_len) {
+ skb->protocol = htons(ETH_P_TEB);
+ } else if (dev->type == ARPHRD_ETHER && !skb->mac_len) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
return dev_queue_xmit(skb);
}
-EXPORT_SYMBOL_GPL(ovs_netdev_send_raw_tun);
+EXPORT_SYMBOL_GPL(ovs_netdev_send);
/* Returns null if this device is not attached to a datapath. */
struct vport *ovs_netdev_get_vport(struct net_device *dev)
@@ -231,7 +226,7 @@ static struct vport_ops ovs_netdev_vport_ops = {
.type = OVS_VPORT_TYPE_NETDEV,
.create = netdev_create,
.destroy = netdev_destroy,
- .send = ovs_netdev_send_tap,
+ .send = ovs_netdev_send,
};
int __init ovs_netdev_init(void)
@@ -34,6 +34,5 @@ void ovs_netdev_exit(void);
void ovs_netdev_tunnel_destroy(struct vport *vport);
-int ovs_netdev_send_tap(struct sk_buff *skb);
-int ovs_netdev_send_raw_tun(struct sk_buff *skb);
+int ovs_netdev_send(struct sk_buff *skb);
#endif /* vport_netdev.h */
@@ -153,7 +153,7 @@ static struct vport_ops ovs_vxlan_netdev_vport_ops = {
.create = vxlan_create,
.destroy = ovs_netdev_tunnel_destroy,
.get_options = vxlan_get_options,
- .send = ovs_netdev_send_tap,
+ .send = ovs_netdev_send,
};
static int __init ovs_vxlan_tnl_init(void)