Merge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'
[sliver-openvswitch.git] / datapath / vport.c
index 6f2b2f6..03b775d 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/if.h>
 #include <linux/if_vlan.h>
 #include <linux/jhash.h>
+#include <linux/kconfig.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
 static const struct vport_ops *vport_ops_list[] = {
        &ovs_netdev_vport_ops,
        &ovs_internal_vport_ops,
+#if IS_ENABLED(CONFIG_NET_IPGRE_DEMUX)
        &ovs_gre_vport_ops,
        &ovs_gre64_vport_ops,
+#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
        &ovs_vxlan_vport_ops,
        &ovs_lisp_vport_ops,
@@ -354,7 +357,8 @@ int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
  * skb->data should point to the Ethernet header.  The caller must have already
  * called compute_ip_summed() to initialize the checksumming fields.
  */
-void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
+void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
+                      struct ovs_key_ipv4_tunnel *tun_key)
 {
        struct pcpu_tstats *stats;
 
@@ -364,9 +368,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
        stats->rx_bytes += skb->len;
        u64_stats_update_end(&stats->syncp);
 
-       if (!(vport->ops->flags & VPORT_F_TUN_ID))
-               OVS_CB(skb)->tun_key = NULL;
-
+       OVS_CB(skb)->tun_key = tun_key;
        ovs_dp_process_received_packet(vport, skb);
 }
 
@@ -383,7 +385,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);
@@ -408,7 +410,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
  * @err_type: one of enum vport_err_type types to indicate the error type
  *
  * If using the vport generic stats layer indicate that an error of the given
- * type has occured.
+ * type has occurred.
  */
 void ovs_vport_record_error(struct vport *vport, enum vport_err_type err_type)
 {