vfio: fix FreeBSD build
[dpdk.git] / lib / librte_eal / linuxapp / kni / kni_net.c
index d447d3a..07d6fdb 100644 (file)
@@ -1,25 +1,6 @@
-/*-
- * GPL LICENSE SUMMARY
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of version 2 of the GNU General Public License as
- *   published by the Free Software Foundation.
- *
- *   This program is distributed in the hope that it will be useful, but
- *   WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *   General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *   The full GNU General Public License is included in this distribution
- *   in the file called LICENSE.GPL.
- *
- *   Contact Information:
- *   Intel Corporation
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright(c) 2010-2014 Intel Corporation.
  */
 
 /*
@@ -100,7 +81,7 @@ kni_net_process_request(struct kni_dev *kni, struct rte_kni_request *req)
 {
        int ret = -1;
        void *resp_va;
-       unsigned int num;
+       uint32_t num;
        int ret_val;
 
        if (!kni || !req) {
@@ -198,23 +179,11 @@ kni_net_config(struct net_device *dev, struct ifmap *map)
 /*
  * Transmit a packet (called by the kernel)
  */
-#ifdef RTE_KNI_VHOST
-static int
-kni_net_tx(struct sk_buff *skb, struct net_device *dev)
-{
-       struct kni_dev *kni = netdev_priv(dev);
-
-       dev_kfree_skb(skb);
-       kni->stats.tx_dropped++;
-
-       return NETDEV_TX_OK;
-}
-#else
 static int
 kni_net_tx(struct sk_buff *skb, struct net_device *dev)
 {
        int len = 0;
-       unsigned int ret;
+       uint32_t ret;
        struct kni_dev *kni = netdev_priv(dev);
        struct rte_kni_mbuf *pkt_kva = NULL;
        void *pkt_pa = NULL;
@@ -289,7 +258,6 @@ drop:
 
        return NETDEV_TX_OK;
 }
-#endif
 
 /*
  * RX: normal working mode
@@ -297,9 +265,9 @@ drop:
 static void
 kni_net_rx_normal(struct kni_dev *kni)
 {
-       unsigned int ret;
+       uint32_t ret;
        uint32_t len;
-       unsigned int i, num_rx, num_fq;
+       uint32_t i, num_rx, num_fq;
        struct rte_kni_mbuf *kva;
        void *data_kva;
        struct sk_buff *skb;
@@ -313,7 +281,7 @@ kni_net_rx_normal(struct kni_dev *kni)
        }
 
        /* Calculate the number of entries to dequeue from rx_q */
-       num_rx = min_t(unsigned int, num_fq, MBUF_BURST_SZ);
+       num_rx = min_t(uint32_t, num_fq, MBUF_BURST_SZ);
 
        /* Burst dequeue from rx_q */
        num_rx = kni_fifo_get(kni->rx_q, kni->pa, num_rx);
@@ -380,9 +348,9 @@ kni_net_rx_normal(struct kni_dev *kni)
 static void
 kni_net_rx_lo_fifo(struct kni_dev *kni)
 {
-       unsigned int ret;
+       uint32_t ret;
        uint32_t len;
-       unsigned int i, num, num_rq, num_tq, num_aq, num_fq;
+       uint32_t i, num, num_rq, num_tq, num_aq, num_fq;
        struct rte_kni_mbuf *kva;
        void *data_kva;
        struct rte_kni_mbuf *alloc_kva;
@@ -404,7 +372,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
        num = min(num_rq, num_tq);
        num = min(num, num_aq);
        num = min(num, num_fq);
-       num = min_t(unsigned int, num, MBUF_BURST_SZ);
+       num = min_t(uint32_t, num, MBUF_BURST_SZ);
 
        /* Return if no entry to dequeue from rx_q */
        if (num == 0)
@@ -465,9 +433,9 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
 static void
 kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
 {
-       unsigned int ret;
+       uint32_t ret;
        uint32_t len;
-       unsigned int i, num_rq, num_fq, num;
+       uint32_t i, num_rq, num_fq, num;
        struct rte_kni_mbuf *kva;
        void *data_kva;
        struct sk_buff *skb;
@@ -481,7 +449,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
 
        /* Calculate the number of entries to dequeue from rx_q */
        num = min(num_rq, num_fq);
-       num = min_t(unsigned int, num, MBUF_BURST_SZ);
+       num = min_t(uint32_t, num, MBUF_BURST_SZ);
 
        /* Return if no entry to dequeue from rx_q */
        if (num == 0)
@@ -573,7 +541,7 @@ kni_net_tx_timeout(struct net_device *dev)
 {
        struct kni_dev *kni = netdev_priv(dev);
 
-       KNI_DBG("Transmit timeout at %ld, latency %ld\n", jiffies,
+       pr_debug("Transmit timeout at %ld, latency %ld\n", jiffies,
                        jiffies - dev_trans_start(dev));
 
        kni->stats.tx_errors++;
@@ -586,8 +554,8 @@ kni_net_tx_timeout(struct net_device *dev)
 static int
 kni_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-       KNI_DBG("kni_net_ioctl %d\n",
-               ((struct kni_dev *)netdev_priv(dev))->group_id);
+       pr_debug("kni_net_ioctl group:%d cmd:%d\n",
+               ((struct kni_dev *)netdev_priv(dev))->group_id, cmd);
 
        return 0;
 }
@@ -604,7 +572,7 @@ kni_net_change_mtu(struct net_device *dev, int new_mtu)
        struct rte_kni_request req;
        struct kni_dev *kni = netdev_priv(dev);
 
-       KNI_DBG("kni_net_change_mtu new mtu %d to be set\n", new_mtu);
+       pr_debug("kni_net_change_mtu new mtu %d to be set\n", new_mtu);
 
        memset(&req, 0, sizeof(req));
        req.req_id = RTE_KNI_REQ_CHANGE_MTU;
@@ -643,7 +611,7 @@ kni_net_stats(struct net_device *dev)
 static int
 kni_net_header(struct sk_buff *skb, struct net_device *dev,
                unsigned short type, const void *daddr,
-               const void *saddr, unsigned int len)
+               const void *saddr, uint32_t len)
 {
        struct ethhdr *eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
 
@@ -730,8 +698,6 @@ kni_net_init(struct net_device *dev)
 {
        struct kni_dev *kni = netdev_priv(dev);
 
-       KNI_DBG("kni_net_init\n");
-
        init_waitqueue_head(&kni->wq);
        mutex_init(&kni->sync_lock);