Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_dev.h     | 11 +++---
 lib/librte_eal/linuxapp/kni/kni_ethtool.c | 39 +++++++++++++++-----
 lib/librte_eal/linuxapp/kni/kni_fifo.h    |  2 +-
 lib/librte_eal/linuxapp/kni/kni_misc.c    | 18 +++++-----
 lib/librte_eal/linuxapp/kni/kni_net.c     | 17 +++++----
 lib/librte_eal/linuxapp/kni/kni_vhost.c   | 60 ++++++++++++++++---------------
 6 files changed, 88 insertions(+), 59 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h 
b/lib/librte_eal/linuxapp/kni/kni_dev.h
index 48e4562..059defc 100644
--- a/lib/librte_eal/linuxapp/kni/kni_dev.h
+++ b/lib/librte_eal/linuxapp/kni/kni_dev.h
@@ -84,7 +84,7 @@ struct kni_dev {
        /* response queue */
        void *resp_q;

-       void * sync_kva;
+       void *sync_kva;
        void *sync_va;

        void *mbuf_kva;
@@ -97,12 +97,13 @@ struct kni_dev {
        unsigned long synchro;

 #ifdef RTE_KNI_VHOST
-       struct kni_vhost_queue* vhost_queue;
+       struct kni_vhost_queue *vhost_queue;
+
        volatile enum {
                BE_STOP = 0x1,
                BE_START = 0x2,
                BE_FINISH = 0x4,
-       }vq_status;
+       } vq_status;
 #endif
 };

@@ -128,8 +129,8 @@ struct kni_vhost_queue {
        struct kni_dev *kni;
        int sockfd;
        unsigned int flags;
-       struct sk_buff* cache;
-       struct rte_kni_fifo* fifo;
+       struct sk_buff *cache;
+       struct rte_kni_fifo *fifo;
 };

 #endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_ethtool.c 
b/lib/librte_eal/linuxapp/kni/kni_ethtool.c
index 06b6d46..0c88589 100644
--- a/lib/librte_eal/linuxapp/kni/kni_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/kni_ethtool.c
@@ -31,6 +31,7 @@ static int
 kni_check_if_running(struct net_device *dev)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        if (priv->lad_dev)
                return 0;
        else
@@ -41,6 +42,7 @@ static void
 kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info);
 }

@@ -48,6 +50,7 @@ static int
 kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd);
 }

@@ -55,6 +58,7 @@ static int
 kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd);
 }

@@ -62,6 +66,7 @@ static void
 kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_wol(priv->lad_dev, wol);
 }

@@ -69,6 +74,7 @@ static int
 kni_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->set_wol(priv->lad_dev, wol);
 }

@@ -76,6 +82,7 @@ static int
 kni_nway_reset(struct net_device *dev)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->nway_reset(priv->lad_dev);
 }

@@ -83,6 +90,7 @@ static int
 kni_get_eeprom_len(struct net_device *dev)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_eeprom_len(priv->lad_dev);
 }

@@ -91,6 +99,7 @@ kni_get_eeprom(struct net_device *dev, struct ethtool_eeprom 
*eeprom,
                                                        u8 *bytes)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_eeprom(priv->lad_dev, eeprom,
                                                                bytes);
 }
@@ -100,6 +109,7 @@ kni_set_eeprom(struct net_device *dev, struct 
ethtool_eeprom *eeprom,
                                                        u8 *bytes)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->set_eeprom(priv->lad_dev, eeprom,
                                                                bytes);
 }
@@ -108,6 +118,7 @@ static void
 kni_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_ringparam(priv->lad_dev, ring);
 }

@@ -115,6 +126,7 @@ static int
 kni_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->set_ringparam(priv->lad_dev, ring);
 }

@@ -122,6 +134,7 @@ static void
 kni_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_pauseparam(priv->lad_dev, pause);
 }

@@ -129,6 +142,7 @@ static int
 kni_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->set_pauseparam(priv->lad_dev,
                                                                pause);
 }
@@ -137,6 +151,7 @@ static u32
 kni_get_msglevel(struct net_device *dev)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_msglevel(priv->lad_dev);
 }

@@ -144,6 +159,7 @@ static void
 kni_set_msglevel(struct net_device *dev, u32 data)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->set_msglevel(priv->lad_dev, data);
 }

@@ -151,6 +167,7 @@ static int
 kni_get_regs_len(struct net_device *dev)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_regs_len(priv->lad_dev);
 }

@@ -158,6 +175,7 @@ static void
 kni_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_regs(priv->lad_dev, regs, p);
 }

@@ -165,6 +183,7 @@ static void
 kni_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_strings(priv->lad_dev, stringset,
                                                                data);
 }
@@ -173,6 +192,7 @@ static int
 kni_get_sset_count(struct net_device *dev, int sset)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        return priv->lad_dev->ethtool_ops->get_sset_count(priv->lad_dev, sset);
 }

@@ -181,24 +201,25 @@ kni_get_ethtool_stats(struct net_device *dev, struct 
ethtool_stats *stats,
                                                                u64 *data)
 {
        struct kni_dev *priv = netdev_priv(dev);
+
        priv->lad_dev->ethtool_ops->get_ethtool_stats(priv->lad_dev, stats,
                                                                data);
 }

 struct ethtool_ops kni_ethtool_ops = {
-       .begin                          = kni_check_if_running,
+       .begin                  = kni_check_if_running,
        .get_drvinfo            = kni_get_drvinfo,
        .get_settings           = kni_get_settings,
        .set_settings           = kni_set_settings,
        .get_regs_len           = kni_get_regs_len,
-       .get_regs                       = kni_get_regs,
-       .get_wol                        = kni_get_wol,
-       .set_wol                        = kni_set_wol,
-       .nway_reset                     = kni_nway_reset,
-       .get_link                       = ethtool_op_get_link,
+       .get_regs               = kni_get_regs,
+       .get_wol                = kni_get_wol,
+       .set_wol                = kni_set_wol,
+       .nway_reset             = kni_nway_reset,
+       .get_link               = ethtool_op_get_link,
        .get_eeprom_len         = kni_get_eeprom_len,
-       .get_eeprom                     = kni_get_eeprom,
-       .set_eeprom                     = kni_set_eeprom,
+       .get_eeprom             = kni_get_eeprom,
+       .set_eeprom             = kni_set_eeprom,
        .get_ringparam          = kni_get_ringparam,
        .set_ringparam          = kni_set_ringparam,
        .get_pauseparam         = kni_get_pauseparam,
@@ -207,7 +228,7 @@ struct ethtool_ops kni_ethtool_ops = {
        .set_msglevel           = kni_set_msglevel,
        .get_strings            = kni_get_strings,
        .get_sset_count         = kni_get_sset_count,
-       .get_ethtool_stats  = kni_get_ethtool_stats,
+       .get_ethtool_stats      = kni_get_ethtool_stats,
 };

 void
diff --git a/lib/librte_eal/linuxapp/kni/kni_fifo.h 
b/lib/librte_eal/linuxapp/kni/kni_fifo.h
index 3ea750e..4006b1f 100644
--- a/lib/librte_eal/linuxapp/kni/kni_fifo.h
+++ b/lib/librte_eal/linuxapp/kni/kni_fifo.h
@@ -79,7 +79,7 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned 
num)
 static inline unsigned
 kni_fifo_count(struct rte_kni_fifo *fifo)
 {
-       return (fifo->len + fifo->write - fifo->read) & ( fifo->len - 1);
+       return (fifo->len + fifo->write - fifo->read) & (fifo->len - 1);
 }

 /**
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 551e7de..0cbc499 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -94,7 +94,8 @@ struct kni_net {
        struct list_head kni_list_head;
 };

-static int __net_init kni_init_net(struct net *net)
+static int __net_init
+kni_init_net(struct net *net)
 {
 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
        struct kni_net *knet = net_generic(net, kni_net_id);
@@ -126,7 +127,8 @@ static int __net_init kni_init_net(struct net *net)
 #endif
 }

-static void __net_exit kni_exit_net(struct net *net)
+static void __net_exit
+kni_exit_net(struct net *net)
 {
 #ifndef HAVE_SIMPLIFIED_PERNET_OPERATIONS
        struct kni_net *knet = net_generic(net, kni_net_id);
@@ -304,8 +306,8 @@ kni_thread_single(void *data)
                up_read(&knet->kni_list_lock);
 #ifdef RTE_KNI_PREEMPT_DEFAULT
                /* reschedule out for a while */
-               schedule_timeout_interruptible(usecs_to_jiffies( \
-                               KNI_KTHREAD_RESCHEDULE_INTERVAL));
+               schedule_timeout_interruptible(
+                       usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL));
 #endif
        }

@@ -328,8 +330,8 @@ kni_thread_multiple(void *param)
                        kni_net_poll_resp(dev);
                }
 #ifdef RTE_KNI_PREEMPT_DEFAULT
-               schedule_timeout_interruptible(usecs_to_jiffies( \
-                               KNI_KTHREAD_RESCHEDULE_INTERVAL));
+               schedule_timeout_interruptible(
+                       usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL));
 #endif
        }

@@ -484,7 +486,7 @@ kni_ioctl_create(struct net *net,

        /* Support Ethtool */
        while (pci) {
-               KNI_PRINT("pci_bus: %02x:%02x:%02x \n",
+               KNI_PRINT("pci_bus: %02x:%02x:%02x\n",
                                        pci->bus->number,
                                        PCI_SLOT(pci->devfn),
                                        PCI_FUNC(pci->devfn));
@@ -576,7 +578,7 @@ kni_ioctl_release(struct net *net,
        struct rte_kni_device_info dev_info;

        if (_IOC_SIZE(ioctl_num) > sizeof(dev_info))
-                       return -EINVAL;
+               return -EINVAL;

        ret = copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info));
        if (ret) {
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c 
b/lib/librte_eal/linuxapp/kni/kni_net.c
index fc82193..aa17f2c 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -126,7 +126,7 @@ kni_net_rx_normal(struct kni_dev *kni)
        unsigned i, num_rx, num_fq;
        struct rte_kni_mbuf *kva;
        struct rte_kni_mbuf *va[MBUF_BURST_SZ];
-       void * data_kva;
+       void *data_kva;

        struct sk_buff *skb;
        struct net_device *dev = kni->net_dev;
@@ -214,7 +214,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
        unsigned i, num, num_rq, num_tq, num_aq, num_fq;
        struct rte_kni_mbuf *kva;
        struct rte_kni_mbuf *va[MBUF_BURST_SZ];
-       void * data_kva;
+       void *data_kva;

        struct rte_kni_mbuf *alloc_kva;
        struct rte_kni_mbuf *alloc_va[MBUF_BURST_SZ];
@@ -303,7 +303,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
        unsigned i, num_rq, num_fq, num;
        struct rte_kni_mbuf *kva;
        struct rte_kni_mbuf *va[MBUF_BURST_SZ];
-       void * data_kva;
+       void *data_kva;

        struct sk_buff *skb;
        struct net_device *dev = kni->net_dev;
@@ -503,7 +503,7 @@ drop:
  * Deal with a transmit timeout.
  */
 static void
-kni_net_tx_timeout (struct net_device *dev)
+kni_net_tx_timeout(struct net_device *dev)
 {
        struct kni_dev *kni = netdev_priv(dev);

@@ -617,6 +617,7 @@ static struct net_device_stats *
 kni_net_stats(struct net_device *dev)
 {
        struct kni_dev *kni = netdev_priv(dev);
+
        return &kni->stats;
 }

@@ -637,7 +638,6 @@ kni_net_header(struct sk_buff *skb, struct net_device *dev,
        return dev->hard_header_len;
 }

-
 /*
  * Re-fill the eth header
  */
@@ -662,9 +662,11 @@ kni_net_rebuild_header(struct sk_buff *skb)
  *
  * Returns 0 on success, negative on failure
  **/
-static int kni_net_set_mac(struct net_device *netdev, void *p)
+static int
+kni_net_set_mac(struct net_device *netdev, void *p)
 {
        struct sockaddr *addr = p;
+
        if (!is_valid_ether_addr((unsigned char *)(addr->sa_data)))
                return -EADDRNOTAVAIL;
        memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
@@ -672,7 +674,8 @@ static int kni_net_set_mac(struct net_device *netdev, void 
*p)
 }

 #ifdef HAVE_CHANGE_CARRIER_CB
-static int kni_net_change_carrier(struct net_device *dev, bool new_carrier)
+static int
+kni_net_change_carrier(struct net_device *dev, bool new_carrier)
 {
        if (new_carrier)
                netif_carrier_on(dev);
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c 
b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 7aed96e..b4d91ca 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -40,11 +40,12 @@

 #define RX_BURST_SZ 4

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
 static int kni_sock_map_fd(struct socket *sock)
 {
        struct file *file;
        int fd = get_unused_fd_flags(0);
+
        if (fd < 0)
                return fd;

@@ -101,7 +102,7 @@ kni_vhost_net_tx(struct kni_dev *kni, struct msghdr *m,

                pkt_kva = (void *)pkt_va - kni->mbuf_va + kni->mbuf_kva;
                data_kva = pkt_kva->buf_addr + pkt_kva->data_off
-                          - kni->mbuf_va + kni->mbuf_kva;
+                       - kni->mbuf_va + kni->mbuf_kva;

 #ifdef HAVE_IOV_ITER_MSGHDR
                copy_from_iter(data_kva, len, &m->msg_iter);
@@ -149,7 +150,7 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
        uint32_t pkt_len;
        struct rte_kni_mbuf *kva;
        struct rte_kni_mbuf *va;
-       void * data_kva;
+       void *data_kva;
        struct sk_buff *skb;
        struct kni_vhost_queue *q = kni->vhost_queue;

@@ -164,7 +165,7 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
        if (unlikely(skb == NULL))
                return 0;

-       kva = (struct rte_kni_mbuf*)skb->data;
+       kva = (struct rte_kni_mbuf *)skb->data;

        /* free skb to cache */
        skb->data = NULL;
@@ -213,7 +214,7 @@ drop:
 }

 static unsigned int
-kni_sock_poll(struct file *file, struct socket *sock, poll_table * wait)
+kni_sock_poll(struct file *file, struct socket *sock, poll_table *wait)
 {
        struct kni_vhost_queue *q =
                container_of(sock->sk, struct kni_vhost_queue, sk);
@@ -224,7 +225,7 @@ kni_sock_poll(struct file *file, struct socket *sock, 
poll_table * wait)
                return POLLERR;

        kni = q->kni;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
        KNI_DBG("start kni_poll on group %d, wq 0x%16llx\n",
                  kni->group_id, (uint64_t)sock->wq);
 #else
@@ -232,7 +233,7 @@ kni_sock_poll(struct file *file, struct socket *sock, 
poll_table * wait)
                  kni->group_id, (uint64_t)&sock->wait);
 #endif

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
        poll_wait(file, &sock->wq->wait, wait);
 #else
        poll_wait(file, &sock->wait, wait);
@@ -260,7 +261,7 @@ kni_vhost_enqueue(struct kni_dev *kni, struct 
kni_vhost_queue *q,
        struct rte_kni_mbuf *kva;

        kva = (void *)(va) - kni->mbuf_va + kni->mbuf_kva;
-       (skb)->data = (unsigned char*)kva;
+       (skb)->data = (unsigned char *)kva;
        (skb)->len = kva->data_len;
        skb_queue_tail(&q->sk.sk_receive_queue, skb);
 }
@@ -270,6 +271,7 @@ kni_vhost_enqueue_burst(struct kni_dev *kni, struct 
kni_vhost_queue *q,
          struct sk_buff **skb, struct rte_kni_mbuf **va)
 {
        int i;
+
        for (i = 0; i < RX_BURST_SZ; skb++, va++, i++)
                kni_vhost_enqueue(kni, q, *skb, *va);
 }
@@ -341,7 +343,7 @@ kni_chk_vhost_rx(struct kni_dev *kni)

 except:
        /* Failing should not happen */
-       KNI_ERR("Fail to enqueue fifo, it shouldn't happen \n");
+       KNI_ERR("Fail to enqueue fifo, it shouldn't happen\n");
        BUG_ON(1);

        return 0;
@@ -482,8 +484,8 @@ kni_sock_ioctl(struct socket *sock, unsigned int cmd,
                        return -ENOLINK;

                ret = 0;
-               if (copy_to_user(&ifr->ifr_name, kni->net_dev->name, IFNAMSIZ) 
||
-                   put_user(q->flags, &ifr->ifr_flags))
+               if (copy_to_user(&ifr->ifr_name, kni->net_dev->name, IFNAMSIZ)
+                               || put_user(q->flags, &ifr->ifr_flags))
                        ret = -EFAULT;
                dev_put(kni->net_dev);
                return ret;
@@ -552,10 +554,10 @@ kni_sock_compat_ioctl(struct socket *sock, unsigned int 
cmd,
 }

 #define KNI_VHOST_WAIT_WQ_SAFE()                        \
-do {                                                   \
+do {                                                   \
        while ((BE_FINISH | BE_STOP) == kni->vq_status) \
-               msleep(1);                              \
-}while(0)                                               \
+               msleep(1);                              \
+} while (0)                                            \


 static int
@@ -589,12 +591,11 @@ kni_sock_release(struct socket *sock)
 }

 int
-kni_sock_getname (struct socket *sock,
-                 struct sockaddr *addr,
-                 int *sockaddr_len, int peer)
+kni_sock_getname(struct socket *sock, struct sockaddr *addr,
+               int *sockaddr_len, int peer)
 {
        KNI_DBG("dummy sock getname\n");
-       ((struct sockaddr_ll*)addr)->sll_family = AF_PACKET;
+       ((struct sockaddr_ll *)addr)->sll_family = AF_PACKET;
        return 0;
 }

@@ -637,7 +638,7 @@ kni_sk_destruct(struct sock *sk)

        /* make sure there's no packet in buffer */
        while (skb_dequeue(&sk->sk_receive_queue) != NULL)
-              ;
+               ;

        mb();

@@ -685,8 +686,9 @@ kni_vhost_backend_init(struct kni_dev *kni)
        }

        /* cache init */
-       q->cache = kzalloc(RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(struct 
sk_buff),
-                          GFP_KERNEL);
+       q->cache = kzalloc(
+               RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(struct sk_buff),
+               GFP_KERNEL);
        if (!q->cache)
                goto free_fd;

@@ -699,7 +701,7 @@ kni_vhost_backend_init(struct kni_dev *kni)

        for (i = 0; i < RTE_KNI_VHOST_MAX_CACHE_SIZE; i++) {
                elem = &q->cache[i];
-               kni_fifo_put(fifo, (void**)&elem, 1);
+               kni_fifo_put(fifo, (void **)&elem, 1);
        }
        q->fifo = fifo;

@@ -729,14 +731,12 @@ kni_vhost_backend_init(struct kni_dev *kni)

        kni->vq_status = BE_START;

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
-       KNI_DBG("backend init sockfd=%d, sock->wq=0x%16llx,"
-                 "sk->sk_wq=0x%16llx",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+       KNI_DBG("backend init sockfd=%d, sock->wq=0x%16llx,sk->sk_wq=0x%16llx",
                  q->sockfd, (uint64_t)q->sock->wq,
                  (uint64_t)q->sk.sk_wq);
 #else
-       KNI_DBG("backend init sockfd=%d, sock->wait at 0x%16llx,"
-                 "sk->sk_sleep=0x%16llx",
+       KNI_DBG("backend init sockfd=%d, sock->wait at 
0x%16llx,sk->sk_sleep=0x%16llx",
                  q->sockfd, (uint64_t)&q->sock->wait,
                  (uint64_t)q->sk.sk_sleep);
 #endif
@@ -759,7 +759,7 @@ free_sock:
        q->sock = NULL;

 free_sk:
-       sk_free((struct sock*)q);
+       sk_free((struct sock *)q);

        return err;
 }
@@ -772,6 +772,7 @@ show_sock_fd(struct device *dev, struct device_attribute 
*attr,
        struct net_device *net_dev = container_of(dev, struct net_device, dev);
        struct kni_dev *kni = netdev_priv(net_dev);
        int sockfd = -1;
+
        if (kni->vhost_queue != NULL)
                sockfd = kni->vhost_queue->sockfd;
        return snprintf(buf, 10, "%d\n", sockfd);
@@ -783,6 +784,7 @@ show_sock_en(struct device *dev, struct device_attribute 
*attr,
 {
        struct net_device *net_dev = container_of(dev, struct net_device, dev);
        struct kni_dev *kni = netdev_priv(net_dev);
+
        return snprintf(buf, 10, "%u\n", (kni->vhost_queue == NULL ? 0 : 1));
 }

@@ -809,7 +811,7 @@ static DEVICE_ATTR(sock_en, S_IRUGO | S_IWUSR, 
show_sock_en, set_sock_en);
 static struct attribute *dev_attrs[] = {
        &dev_attr_sock_fd.attr,
        &dev_attr_sock_en.attr,
-        NULL,
+       NULL,
 };

 static const struct attribute_group dev_attr_grp = {
-- 
2.7.4

Reply via email to