gve: Replace zero-length array with flexible-array member
[linux-2.6-microblaze.git] / drivers / net / veth.c
index a475f48..8c73766 100644 (file)
@@ -234,14 +234,14 @@ static bool veth_is_xdp_frame(void *ptr)
        return (unsigned long)ptr & VETH_XDP_FLAG;
 }
 
-static void *veth_ptr_to_xdp(void *ptr)
+static struct xdp_frame *veth_ptr_to_xdp(void *ptr)
 {
        return (void *)((unsigned long)ptr & ~VETH_XDP_FLAG);
 }
 
-static void *veth_xdp_to_ptr(void *ptr)
+static void *veth_xdp_to_ptr(struct xdp_frame *xdp)
 {
-       return (void *)((unsigned long)ptr | VETH_XDP_FLAG);
+       return (void *)((unsigned long)xdp | VETH_XDP_FLAG);
 }
 
 static void veth_ptr_free(void *ptr)
@@ -420,6 +420,14 @@ static int veth_select_rxq(struct net_device *dev)
        return smp_processor_id() % dev->real_num_rx_queues;
 }
 
+static struct net_device *veth_peer_dev(struct net_device *dev)
+{
+       struct veth_priv *priv = netdev_priv(dev);
+
+       /* Callers must be under RCU read side. */
+       return rcu_dereference(priv->peer);
+}
+
 static int veth_xdp_xmit(struct net_device *dev, int n,
                         struct xdp_frame **frames,
                         u32 flags, bool ndo_xmit)
@@ -897,14 +905,13 @@ static void veth_napi_del(struct net_device *dev)
                struct veth_rq *rq = &priv->rq[i];
 
                napi_disable(&rq->xdp_napi);
-               napi_hash_del(&rq->xdp_napi);
+               __netif_napi_del(&rq->xdp_napi);
        }
        synchronize_net();
 
        for (i = 0; i < dev->real_num_rx_queues; i++) {
                struct veth_rq *rq = &priv->rq[i];
 
-               netif_napi_del(&rq->xdp_napi);
                rq->rx_notify_masked = false;
                ptr_ring_cleanup(&rq->xdp_ring, veth_ptr_free);
        }
@@ -1225,6 +1232,7 @@ static const struct net_device_ops veth_netdev_ops = {
        .ndo_set_rx_headroom    = veth_set_rx_headroom,
        .ndo_bpf                = veth_xdp,
        .ndo_xdp_xmit           = veth_ndo_xdp_xmit,
+       .ndo_get_peer_dev       = veth_peer_dev,
 };
 
 #define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | \