kni: fix spacing and line lenghts
[dpdk.git] / lib / librte_eal / linuxapp / kni / kni_misc.c
1 /*-
2  * GPL LICENSE SUMMARY
3  *
4  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  *
6  *   This program is free software; you can redistribute it and/or modify
7  *   it under the terms of version 2 of the GNU General Public License as
8  *   published by the Free Software Foundation.
9  *
10  *   This program is distributed in the hope that it will be useful, but
11  *   WITHOUT ANY WARRANTY; without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *   General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program; if not, write to the Free Software
17  *   Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18  *   The full GNU General Public License is included in this distribution
19  *   in the file called LICENSE.GPL.
20  *
21  *   Contact Information:
22  *   Intel Corporation
23  */
24
25 #include <linux/version.h>
26 #include <linux/module.h>
27 #include <linux/miscdevice.h>
28 #include <linux/netdevice.h>
29 #include <linux/etherdevice.h>
30 #include <linux/pci.h>
31 #include <linux/kthread.h>
32 #include <linux/rwsem.h>
33 #include <linux/mutex.h>
34 #include <linux/nsproxy.h>
35 #include <net/net_namespace.h>
36 #include <net/netns/generic.h>
37
38 #include <exec-env/rte_kni_common.h>
39
40 #include "compat.h"
41 #include "kni_dev.h"
42
43 MODULE_LICENSE("Dual BSD/GPL");
44 MODULE_AUTHOR("Intel Corporation");
45 MODULE_DESCRIPTION("Kernel Module for managing kni devices");
46
47 #define KNI_RX_LOOP_NUM 1000
48
49 #define KNI_MAX_DEVICES 32
50
51 extern const struct pci_device_id ixgbe_pci_tbl[];
52 extern const struct pci_device_id igb_pci_tbl[];
53
54 static int kni_open(struct inode *inode, struct file *file);
55 static int kni_release(struct inode *inode, struct file *file);
56 static int kni_ioctl(struct inode *inode, unsigned int ioctl_num,
57                                         unsigned long ioctl_param);
58 static int kni_compat_ioctl(struct inode *inode, unsigned int ioctl_num,
59                                                 unsigned long ioctl_param);
60 static int kni_dev_remove(struct kni_dev *dev);
61
62 static int __init kni_parse_kthread_mode(void);
63
64 /* KNI processing for single kernel thread mode */
65 static int kni_thread_single(void *unused);
66 /* KNI processing for multiple kernel thread mode */
67 static int kni_thread_multiple(void *param);
68
69 static const struct file_operations kni_fops = {
70         .owner = THIS_MODULE,
71         .open = kni_open,
72         .release = kni_release,
73         .unlocked_ioctl = (void *)kni_ioctl,
74         .compat_ioctl = (void *)kni_compat_ioctl,
75 };
76
77 static struct miscdevice kni_misc = {
78         .minor = MISC_DYNAMIC_MINOR,
79         .name = KNI_DEVICE,
80         .fops = &kni_fops,
81 };
82
83 /* loopback mode */
84 static char *lo_mode;
85
86 /* Kernel thread mode */
87 static char *kthread_mode;
88 static unsigned int multiple_kthread_on;
89
90 #define KNI_DEV_IN_USE_BIT_NUM 0 /* Bit number for device in use */
91
92 static int kni_net_id;
93
94 struct kni_net {
95         unsigned long device_in_use; /* device in use flag */
96         struct mutex kni_kthread_lock;
97         struct task_struct *kni_kthread;
98         struct rw_semaphore kni_list_lock;
99         struct list_head kni_list_head;
100 };
101
102 static int __net_init
103 kni_init_net(struct net *net)
104 {
105 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
106         struct kni_net *knet = net_generic(net, kni_net_id);
107
108         memset(knet, 0, sizeof(*knet));
109 #else
110         struct kni_net *knet;
111         int ret;
112
113         knet = kzalloc(sizeof(struct kni_net), GFP_KERNEL);
114         if (!knet) {
115                 ret = -ENOMEM;
116                 return ret;
117         }
118 #endif
119
120         /* Clear the bit of device in use */
121         clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use);
122
123         mutex_init(&knet->kni_kthread_lock);
124
125         init_rwsem(&knet->kni_list_lock);
126         INIT_LIST_HEAD(&knet->kni_list_head);
127
128 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
129         return 0;
130 #else
131         ret = net_assign_generic(net, kni_net_id, knet);
132         if (ret < 0)
133                 kfree(knet);
134
135         return ret;
136 #endif
137 }
138
139 static void __net_exit
140 kni_exit_net(struct net *net)
141 {
142         struct kni_net *knet = net_generic(net, kni_net_id);
143
144         mutex_destroy(&knet->kni_kthread_lock);
145 #ifndef HAVE_SIMPLIFIED_PERNET_OPERATIONS
146         kfree(knet);
147 #endif
148 }
149
150 static struct pernet_operations kni_net_ops = {
151         .init = kni_init_net,
152         .exit = kni_exit_net,
153 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
154         .id   = &kni_net_id,
155         .size = sizeof(struct kni_net),
156 #endif
157 };
158
159 static int __init
160 kni_init(void)
161 {
162         int rc;
163
164         KNI_PRINT("######## DPDK kni module loading ########\n");
165
166         if (kni_parse_kthread_mode() < 0) {
167                 KNI_ERR("Invalid parameter for kthread_mode\n");
168                 return -EINVAL;
169         }
170
171         if (multiple_kthread_on == 0)
172                 KNI_PRINT("Single kernel thread for all KNI devices\n");
173         else
174                 KNI_PRINT("Multiple kernel thread mode enabled\n");
175
176 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
177         rc = register_pernet_subsys(&kni_net_ops);
178 #else
179         rc = register_pernet_gen_subsys(&kni_net_id, &kni_net_ops);
180 #endif
181         if (rc)
182                 return -EPERM;
183
184         rc = misc_register(&kni_misc);
185         if (rc != 0) {
186                 KNI_ERR("Misc registration failed\n");
187                 goto out;
188         }
189
190         /* Configure the lo mode according to the input parameter */
191         kni_net_config_lo_mode(lo_mode);
192
193         KNI_PRINT("######## DPDK kni module loaded  ########\n");
194
195         return 0;
196
197 out:
198 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
199         unregister_pernet_subsys(&kni_net_ops);
200 #else
201         unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops);
202 #endif
203         return rc;
204 }
205
206 static void __exit
207 kni_exit(void)
208 {
209         misc_deregister(&kni_misc);
210 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
211         unregister_pernet_subsys(&kni_net_ops);
212 #else
213         unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops);
214 #endif
215         KNI_PRINT("####### DPDK kni module unloaded  #######\n");
216 }
217
218 static int __init
219 kni_parse_kthread_mode(void)
220 {
221         if (!kthread_mode)
222                 return 0;
223
224         if (strcmp(kthread_mode, "single") == 0)
225                 return 0;
226         else if (strcmp(kthread_mode, "multiple") == 0)
227                 multiple_kthread_on = 1;
228         else
229                 return -1;
230
231         return 0;
232 }
233
234 static int
235 kni_open(struct inode *inode, struct file *file)
236 {
237         struct net *net = current->nsproxy->net_ns;
238         struct kni_net *knet = net_generic(net, kni_net_id);
239
240         /* kni device can be opened by one user only per netns */
241         if (test_and_set_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use))
242                 return -EBUSY;
243
244         file->private_data = get_net(net);
245         KNI_PRINT("/dev/kni opened\n");
246
247         return 0;
248 }
249
250 static int
251 kni_release(struct inode *inode, struct file *file)
252 {
253         struct net *net = file->private_data;
254         struct kni_net *knet = net_generic(net, kni_net_id);
255         struct kni_dev *dev, *n;
256
257         /* Stop kernel thread for single mode */
258         if (multiple_kthread_on == 0) {
259                 mutex_lock(&knet->kni_kthread_lock);
260                 /* Stop kernel thread */
261                 if (knet->kni_kthread != NULL) {
262                         kthread_stop(knet->kni_kthread);
263                         knet->kni_kthread = NULL;
264                 }
265                 mutex_unlock(&knet->kni_kthread_lock);
266         }
267
268         down_write(&knet->kni_list_lock);
269         list_for_each_entry_safe(dev, n, &knet->kni_list_head, list) {
270                 /* Stop kernel thread for multiple mode */
271                 if (multiple_kthread_on && dev->pthread != NULL) {
272                         kthread_stop(dev->pthread);
273                         dev->pthread = NULL;
274                 }
275
276 #ifdef RTE_KNI_VHOST
277                 kni_vhost_backend_release(dev);
278 #endif
279                 kni_dev_remove(dev);
280                 list_del(&dev->list);
281         }
282         up_write(&knet->kni_list_lock);
283
284         /* Clear the bit of device in use */
285         clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use);
286
287         put_net(net);
288         KNI_PRINT("/dev/kni closed\n");
289
290         return 0;
291 }
292
293 static int
294 kni_thread_single(void *data)
295 {
296         struct kni_net *knet = data;
297         int j;
298         struct kni_dev *dev;
299
300         while (!kthread_should_stop()) {
301                 down_read(&knet->kni_list_lock);
302                 for (j = 0; j < KNI_RX_LOOP_NUM; j++) {
303                         list_for_each_entry(dev, &knet->kni_list_head, list) {
304 #ifdef RTE_KNI_VHOST
305                                 kni_chk_vhost_rx(dev);
306 #else
307                                 kni_net_rx(dev);
308 #endif
309                                 kni_net_poll_resp(dev);
310                         }
311                 }
312                 up_read(&knet->kni_list_lock);
313 #ifdef RTE_KNI_PREEMPT_DEFAULT
314                 /* reschedule out for a while */
315                 schedule_timeout_interruptible(
316                         usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL));
317 #endif
318         }
319
320         return 0;
321 }
322
323 static int
324 kni_thread_multiple(void *param)
325 {
326         int j;
327         struct kni_dev *dev = (struct kni_dev *)param;
328
329         while (!kthread_should_stop()) {
330                 for (j = 0; j < KNI_RX_LOOP_NUM; j++) {
331 #ifdef RTE_KNI_VHOST
332                         kni_chk_vhost_rx(dev);
333 #else
334                         kni_net_rx(dev);
335 #endif
336                         kni_net_poll_resp(dev);
337                 }
338 #ifdef RTE_KNI_PREEMPT_DEFAULT
339                 schedule_timeout_interruptible(
340                         usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL));
341 #endif
342         }
343
344         return 0;
345 }
346
347 static int
348 kni_dev_remove(struct kni_dev *dev)
349 {
350         if (!dev)
351                 return -ENODEV;
352
353         if (dev->pci_dev) {
354                 if (pci_match_id(ixgbe_pci_tbl, dev->pci_dev))
355                         ixgbe_kni_remove(dev->pci_dev);
356                 else if (pci_match_id(igb_pci_tbl, dev->pci_dev))
357                         igb_kni_remove(dev->pci_dev);
358         }
359
360         if (dev->net_dev) {
361                 unregister_netdev(dev->net_dev);
362                 free_netdev(dev->net_dev);
363         }
364
365         return 0;
366 }
367
368 static int
369 kni_check_param(struct kni_dev *kni, struct rte_kni_device_info *dev)
370 {
371         if (!kni || !dev)
372                 return -1;
373
374         /* Check if network name has been used */
375         if (!strncmp(kni->name, dev->name, RTE_KNI_NAMESIZE)) {
376                 KNI_ERR("KNI name %s duplicated\n", dev->name);
377                 return -1;
378         }
379
380         return 0;
381 }
382
383 static int
384 kni_run_thread(struct kni_net *knet, struct kni_dev *kni, uint8_t force_bind)
385 {
386         /**
387          * Create a new kernel thread for multiple mode, set its core affinity,
388          * and finally wake it up.
389          */
390         if (multiple_kthread_on) {
391                 kni->pthread = kthread_create(kni_thread_multiple,
392                         (void *)kni, "kni_%s", kni->name);
393                 if (IS_ERR(kni->pthread)) {
394                         kni_dev_remove(kni);
395                         return -ECANCELED;
396                 }
397
398                 if (force_bind)
399                         kthread_bind(kni->pthread, kni->core_id);
400                 wake_up_process(kni->pthread);
401         } else {
402                 mutex_lock(&knet->kni_kthread_lock);
403
404                 if (knet->kni_kthread == NULL) {
405                         knet->kni_kthread = kthread_create(kni_thread_single,
406                                 (void *)knet, "kni_single");
407                         if (IS_ERR(knet->kni_kthread)) {
408                                 mutex_unlock(&knet->kni_kthread_lock);
409                                 kni_dev_remove(kni);
410                                 return -ECANCELED;
411                         }
412
413                         if (force_bind)
414                                 kthread_bind(knet->kni_kthread, kni->core_id);
415                         wake_up_process(knet->kni_kthread);
416                 }
417
418                 mutex_unlock(&knet->kni_kthread_lock);
419         }
420
421         return 0;
422 }
423
424 static int
425 kni_ioctl_create(struct net *net,
426                 unsigned int ioctl_num, unsigned long ioctl_param)
427 {
428         struct kni_net *knet = net_generic(net, kni_net_id);
429         int ret;
430         struct rte_kni_device_info dev_info;
431         struct pci_dev *pci = NULL;
432         struct pci_dev *found_pci = NULL;
433         struct net_device *net_dev = NULL;
434         struct net_device *lad_dev = NULL;
435         struct kni_dev *kni, *dev, *n;
436
437         printk(KERN_INFO "KNI: Creating kni...\n");
438         /* Check the buffer size, to avoid warning */
439         if (_IOC_SIZE(ioctl_num) > sizeof(dev_info))
440                 return -EINVAL;
441
442         /* Copy kni info from user space */
443         ret = copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info));
444         if (ret) {
445                 KNI_ERR("copy_from_user in kni_ioctl_create");
446                 return -EIO;
447         }
448
449         /**
450          * Check if the cpu core id is valid for binding.
451          */
452         if (dev_info.force_bind && !cpu_online(dev_info.core_id)) {
453                 KNI_ERR("cpu %u is not online\n", dev_info.core_id);
454                 return -EINVAL;
455         }
456
457         /* Check if it has been created */
458         down_read(&knet->kni_list_lock);
459         list_for_each_entry_safe(dev, n, &knet->kni_list_head, list) {
460                 if (kni_check_param(dev, &dev_info) < 0) {
461                         up_read(&knet->kni_list_lock);
462                         return -EINVAL;
463                 }
464         }
465         up_read(&knet->kni_list_lock);
466
467         net_dev = alloc_netdev(sizeof(struct kni_dev), dev_info.name,
468 #ifdef NET_NAME_UNKNOWN
469                                                         NET_NAME_UNKNOWN,
470 #endif
471                                                         kni_net_init);
472         if (net_dev == NULL) {
473                 KNI_ERR("error allocating device \"%s\"\n", dev_info.name);
474                 return -EBUSY;
475         }
476
477         dev_net_set(net_dev, net);
478
479         kni = netdev_priv(net_dev);
480
481         kni->net_dev = net_dev;
482         kni->group_id = dev_info.group_id;
483         kni->core_id = dev_info.core_id;
484         strncpy(kni->name, dev_info.name, RTE_KNI_NAMESIZE);
485
486         /* Translate user space info into kernel space info */
487         kni->tx_q = phys_to_virt(dev_info.tx_phys);
488         kni->rx_q = phys_to_virt(dev_info.rx_phys);
489         kni->alloc_q = phys_to_virt(dev_info.alloc_phys);
490         kni->free_q = phys_to_virt(dev_info.free_phys);
491
492         kni->req_q = phys_to_virt(dev_info.req_phys);
493         kni->resp_q = phys_to_virt(dev_info.resp_phys);
494         kni->sync_va = dev_info.sync_va;
495         kni->sync_kva = phys_to_virt(dev_info.sync_phys);
496
497 #ifdef RTE_KNI_VHOST
498         kni->vhost_queue = NULL;
499         kni->vq_status = BE_STOP;
500 #endif
501         kni->mbuf_size = dev_info.mbuf_size;
502
503         KNI_PRINT("tx_phys:      0x%016llx, tx_q addr:      0x%p\n",
504                 (unsigned long long) dev_info.tx_phys, kni->tx_q);
505         KNI_PRINT("rx_phys:      0x%016llx, rx_q addr:      0x%p\n",
506                 (unsigned long long) dev_info.rx_phys, kni->rx_q);
507         KNI_PRINT("alloc_phys:   0x%016llx, alloc_q addr:   0x%p\n",
508                 (unsigned long long) dev_info.alloc_phys, kni->alloc_q);
509         KNI_PRINT("free_phys:    0x%016llx, free_q addr:    0x%p\n",
510                 (unsigned long long) dev_info.free_phys, kni->free_q);
511         KNI_PRINT("req_phys:     0x%016llx, req_q addr:     0x%p\n",
512                 (unsigned long long) dev_info.req_phys, kni->req_q);
513         KNI_PRINT("resp_phys:    0x%016llx, resp_q addr:    0x%p\n",
514                 (unsigned long long) dev_info.resp_phys, kni->resp_q);
515         KNI_PRINT("mbuf_size:    %u\n", kni->mbuf_size);
516
517         KNI_DBG("PCI: %02x:%02x.%02x %04x:%04x\n",
518                                         dev_info.bus,
519                                         dev_info.devid,
520                                         dev_info.function,
521                                         dev_info.vendor_id,
522                                         dev_info.device_id);
523
524         pci = pci_get_device(dev_info.vendor_id, dev_info.device_id, NULL);
525
526         /* Support Ethtool */
527         while (pci) {
528                 KNI_PRINT("pci_bus: %02x:%02x:%02x\n",
529                                         pci->bus->number,
530                                         PCI_SLOT(pci->devfn),
531                                         PCI_FUNC(pci->devfn));
532
533                 if ((pci->bus->number == dev_info.bus) &&
534                         (PCI_SLOT(pci->devfn) == dev_info.devid) &&
535                         (PCI_FUNC(pci->devfn) == dev_info.function)) {
536                         found_pci = pci;
537
538                         if (pci_match_id(ixgbe_pci_tbl, found_pci))
539                                 ret = ixgbe_kni_probe(found_pci, &lad_dev);
540                         else if (pci_match_id(igb_pci_tbl, found_pci))
541                                 ret = igb_kni_probe(found_pci, &lad_dev);
542                         else
543                                 ret = -1;
544
545                         KNI_DBG("PCI found: pci=0x%p, lad_dev=0x%p\n",
546                                                         pci, lad_dev);
547                         if (ret == 0) {
548                                 kni->lad_dev = lad_dev;
549                                 kni_set_ethtool_ops(kni->net_dev);
550                         } else {
551                                 KNI_ERR("Device not supported by ethtool");
552                                 kni->lad_dev = NULL;
553                         }
554
555                         kni->pci_dev = found_pci;
556                         kni->device_id = dev_info.device_id;
557                         break;
558                 }
559                 pci = pci_get_device(dev_info.vendor_id,
560                                 dev_info.device_id, pci);
561         }
562         if (pci)
563                 pci_dev_put(pci);
564
565         if (kni->lad_dev)
566                 memcpy(net_dev->dev_addr, kni->lad_dev->dev_addr, ETH_ALEN);
567         else
568                 /*
569                  * Generate random mac address. eth_random_addr() is the newer
570                  * version of generating mac address in linux kernel.
571                  */
572                 random_ether_addr(net_dev->dev_addr);
573
574         ret = register_netdev(net_dev);
575         if (ret) {
576                 KNI_ERR("error %i registering device \"%s\"\n",
577                                         ret, dev_info.name);
578                 kni->net_dev = NULL;
579                 kni_dev_remove(kni);
580                 free_netdev(net_dev);
581                 return -ENODEV;
582         }
583
584 #ifdef RTE_KNI_VHOST
585         kni_vhost_init(kni);
586 #endif
587
588         ret = kni_run_thread(knet, kni, dev_info.force_bind);
589         if (ret != 0)
590                 return ret;
591
592         down_write(&knet->kni_list_lock);
593         list_add(&kni->list, &knet->kni_list_head);
594         up_write(&knet->kni_list_lock);
595
596         return 0;
597 }
598
599 static int
600 kni_ioctl_release(struct net *net,
601                 unsigned int ioctl_num, unsigned long ioctl_param)
602 {
603         struct kni_net *knet = net_generic(net, kni_net_id);
604         int ret = -EINVAL;
605         struct kni_dev *dev, *n;
606         struct rte_kni_device_info dev_info;
607
608         if (_IOC_SIZE(ioctl_num) > sizeof(dev_info))
609                 return -EINVAL;
610
611         ret = copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info));
612         if (ret) {
613                 KNI_ERR("copy_from_user in kni_ioctl_release");
614                 return -EIO;
615         }
616
617         /* Release the network device according to its name */
618         if (strlen(dev_info.name) == 0)
619                 return ret;
620
621         down_write(&knet->kni_list_lock);
622         list_for_each_entry_safe(dev, n, &knet->kni_list_head, list) {
623                 if (strncmp(dev->name, dev_info.name, RTE_KNI_NAMESIZE) != 0)
624                         continue;
625
626                 if (multiple_kthread_on && dev->pthread != NULL) {
627                         kthread_stop(dev->pthread);
628                         dev->pthread = NULL;
629                 }
630
631 #ifdef RTE_KNI_VHOST
632                 kni_vhost_backend_release(dev);
633 #endif
634                 kni_dev_remove(dev);
635                 list_del(&dev->list);
636                 ret = 0;
637                 break;
638         }
639         up_write(&knet->kni_list_lock);
640         printk(KERN_INFO "KNI: %s release kni named %s\n",
641                 (ret == 0 ? "Successfully" : "Unsuccessfully"), dev_info.name);
642
643         return ret;
644 }
645
646 static int
647 kni_ioctl(struct inode *inode,
648         unsigned int ioctl_num,
649         unsigned long ioctl_param)
650 {
651         int ret = -EINVAL;
652         struct net *net = current->nsproxy->net_ns;
653
654         KNI_DBG("IOCTL num=0x%0x param=0x%0lx\n", ioctl_num, ioctl_param);
655
656         /*
657          * Switch according to the ioctl called
658          */
659         switch (_IOC_NR(ioctl_num)) {
660         case _IOC_NR(RTE_KNI_IOCTL_TEST):
661                 /* For test only, not used */
662                 break;
663         case _IOC_NR(RTE_KNI_IOCTL_CREATE):
664                 ret = kni_ioctl_create(net, ioctl_num, ioctl_param);
665                 break;
666         case _IOC_NR(RTE_KNI_IOCTL_RELEASE):
667                 ret = kni_ioctl_release(net, ioctl_num, ioctl_param);
668                 break;
669         default:
670                 KNI_DBG("IOCTL default\n");
671                 break;
672         }
673
674         return ret;
675 }
676
677 static int
678 kni_compat_ioctl(struct inode *inode,
679                 unsigned int ioctl_num,
680                 unsigned long ioctl_param)
681 {
682         /* 32 bits app on 64 bits OS to be supported later */
683         KNI_PRINT("Not implemented.\n");
684
685         return -EINVAL;
686 }
687
688 module_init(kni_init);
689 module_exit(kni_exit);
690
691 module_param(lo_mode, charp, S_IRUGO | S_IWUSR);
692 MODULE_PARM_DESC(lo_mode,
693 "KNI loopback mode (default=lo_mode_none):\n"
694 "    lo_mode_none        Kernel loopback disabled\n"
695 "    lo_mode_fifo        Enable kernel loopback with fifo\n"
696 "    lo_mode_fifo_skb    Enable kernel loopback with fifo and skb buffer\n"
697 "\n"
698 );
699
700 module_param(kthread_mode, charp, S_IRUGO);
701 MODULE_PARM_DESC(kthread_mode,
702 "Kernel thread mode (default=single):\n"
703 "    single    Single kernel thread mode enabled.\n"
704 "    multiple  Multiple kernel thread mode enabled.\n"
705 "\n"
706 );