.. | .. |
---|
21 | 21 | #include <linux/firmware.h> |
---|
22 | 22 | #include <net/vxlan.h> |
---|
23 | 23 | #include <linux/kthread.h> |
---|
24 | | -#include <net/switchdev.h> |
---|
25 | 24 | #include "liquidio_common.h" |
---|
26 | 25 | #include "octeon_droq.h" |
---|
27 | 26 | #include "octeon_iq.h" |
---|
.. | .. |
---|
40 | 39 | MODULE_AUTHOR("Cavium Networks, <support@cavium.com>"); |
---|
41 | 40 | MODULE_DESCRIPTION("Cavium LiquidIO Intelligent Server Adapter Driver"); |
---|
42 | 41 | MODULE_LICENSE("GPL"); |
---|
43 | | -MODULE_VERSION(LIQUIDIO_VERSION); |
---|
44 | 42 | MODULE_FIRMWARE(LIO_FW_DIR LIO_FW_BASE_NAME LIO_210SV_NAME |
---|
45 | 43 | "_" LIO_FW_NAME_TYPE_NIC LIO_FW_NAME_SUFFIX); |
---|
46 | 44 | MODULE_FIRMWARE(LIO_FW_DIR LIO_FW_BASE_NAME LIO_210NV_NAME |
---|
.. | .. |
---|
71 | 69 | "Bitmask indicating which consoles have debug output redirected to syslog."); |
---|
72 | 70 | |
---|
73 | 71 | /** |
---|
74 | | - * \brief determines if a given console has debug enabled. |
---|
75 | | - * @param console console to check |
---|
76 | | - * @returns 1 = enabled. 0 otherwise |
---|
| 72 | + * octeon_console_debug_enabled - determines if a given console has debug enabled. |
---|
| 73 | + * @console: console to check |
---|
| 74 | + * Return: 1 = enabled. 0 otherwise |
---|
77 | 75 | */ |
---|
78 | 76 | static int octeon_console_debug_enabled(u32 console) |
---|
79 | 77 | { |
---|
.. | .. |
---|
97 | 95 | struct lio_trusted_vf_ctx { |
---|
98 | 96 | struct completion complete; |
---|
99 | 97 | int status; |
---|
100 | | -}; |
---|
101 | | - |
---|
102 | | -struct liquidio_rx_ctl_context { |
---|
103 | | - int octeon_id; |
---|
104 | | - |
---|
105 | | - wait_queue_head_t wc; |
---|
106 | | - |
---|
107 | | - int cond; |
---|
108 | 98 | }; |
---|
109 | 99 | |
---|
110 | 100 | struct oct_link_status_resp { |
---|
.. | .. |
---|
136 | 126 | } s; |
---|
137 | 127 | }; |
---|
138 | 128 | |
---|
139 | | -/** Octeon device properties to be used by the NIC module. |
---|
| 129 | +/* Octeon device properties to be used by the NIC module. |
---|
140 | 130 | * Each octeon device in the system will be represented |
---|
141 | 131 | * by this structure in the NIC module. |
---|
142 | 132 | */ |
---|
.. | .. |
---|
171 | 161 | static struct handshake handshake[MAX_OCTEON_DEVICES]; |
---|
172 | 162 | static struct completion first_stage; |
---|
173 | 163 | |
---|
174 | | -static void octeon_droq_bh(unsigned long pdev) |
---|
| 164 | +static void octeon_droq_bh(struct tasklet_struct *t) |
---|
175 | 165 | { |
---|
176 | 166 | int q_no; |
---|
177 | 167 | int reschedule = 0; |
---|
178 | | - struct octeon_device *oct = (struct octeon_device *)pdev; |
---|
179 | | - struct octeon_device_priv *oct_priv = |
---|
180 | | - (struct octeon_device_priv *)oct->priv; |
---|
| 168 | + struct octeon_device_priv *oct_priv = from_tasklet(oct_priv, t, |
---|
| 169 | + droq_tasklet); |
---|
| 170 | + struct octeon_device *oct = oct_priv->dev; |
---|
181 | 171 | |
---|
182 | 172 | for (q_no = 0; q_no < MAX_OCTEON_OUTPUT_QUEUES(oct); q_no++) { |
---|
183 | 173 | if (!(oct->io_qmask.oq & BIT_ULL(q_no))) |
---|
.. | .. |
---|
232 | 222 | } |
---|
233 | 223 | |
---|
234 | 224 | /** |
---|
235 | | - * \brief Forces all IO queues off on a given device |
---|
236 | | - * @param oct Pointer to Octeon device |
---|
| 225 | + * force_io_queues_off - Forces all IO queues off on a given device |
---|
| 226 | + * @oct: Pointer to Octeon device |
---|
237 | 227 | */ |
---|
238 | 228 | static void force_io_queues_off(struct octeon_device *oct) |
---|
239 | 229 | { |
---|
.. | .. |
---|
248 | 238 | } |
---|
249 | 239 | |
---|
250 | 240 | /** |
---|
251 | | - * \brief Cause device to go quiet so it can be safely removed/reset/etc |
---|
252 | | - * @param oct Pointer to Octeon device |
---|
| 241 | + * pcierror_quiesce_device - Cause device to go quiet so it can be safely removed/reset/etc |
---|
| 242 | + * @oct: Pointer to Octeon device |
---|
253 | 243 | */ |
---|
254 | 244 | static inline void pcierror_quiesce_device(struct octeon_device *oct) |
---|
255 | 245 | { |
---|
.. | .. |
---|
293 | 283 | } |
---|
294 | 284 | |
---|
295 | 285 | /** |
---|
296 | | - * \brief Cleanup PCI AER uncorrectable error status |
---|
297 | | - * @param dev Pointer to PCI device |
---|
| 286 | + * cleanup_aer_uncorrect_error_status - Cleanup PCI AER uncorrectable error status |
---|
| 287 | + * @dev: Pointer to PCI device |
---|
298 | 288 | */ |
---|
299 | 289 | static void cleanup_aer_uncorrect_error_status(struct pci_dev *dev) |
---|
300 | 290 | { |
---|
.. | .. |
---|
313 | 303 | } |
---|
314 | 304 | |
---|
315 | 305 | /** |
---|
316 | | - * \brief Stop all PCI IO to a given device |
---|
317 | | - * @param dev Pointer to Octeon device |
---|
| 306 | + * stop_pci_io - Stop all PCI IO to a given device |
---|
| 307 | + * @oct: Pointer to Octeon device |
---|
318 | 308 | */ |
---|
319 | 309 | static void stop_pci_io(struct octeon_device *oct) |
---|
320 | 310 | { |
---|
.. | .. |
---|
342 | 332 | } |
---|
343 | 333 | |
---|
344 | 334 | /** |
---|
345 | | - * \brief called when PCI error is detected |
---|
346 | | - * @param pdev Pointer to PCI device |
---|
347 | | - * @param state The current pci connection state |
---|
| 335 | + * liquidio_pcie_error_detected - called when PCI error is detected |
---|
| 336 | + * @pdev: Pointer to PCI device |
---|
| 337 | + * @state: The current pci connection state |
---|
348 | 338 | * |
---|
349 | 339 | * This function is called after a PCI bus error affecting |
---|
350 | 340 | * this device has been detected. |
---|
.. | .. |
---|
372 | 362 | } |
---|
373 | 363 | |
---|
374 | 364 | /** |
---|
375 | | - * \brief mmio handler |
---|
376 | | - * @param pdev Pointer to PCI device |
---|
| 365 | + * liquidio_pcie_mmio_enabled - mmio handler |
---|
| 366 | + * @pdev: Pointer to PCI device |
---|
377 | 367 | */ |
---|
378 | | -static pci_ers_result_t liquidio_pcie_mmio_enabled( |
---|
379 | | - struct pci_dev *pdev __attribute__((unused))) |
---|
| 368 | +static pci_ers_result_t liquidio_pcie_mmio_enabled(struct pci_dev __maybe_unused *pdev) |
---|
380 | 369 | { |
---|
381 | 370 | /* We should never hit this since we never ask for a reset for a Fatal |
---|
382 | 371 | * Error. We always return DISCONNECT in io_error above. |
---|
.. | .. |
---|
386 | 375 | } |
---|
387 | 376 | |
---|
388 | 377 | /** |
---|
389 | | - * \brief called after the pci bus has been reset. |
---|
390 | | - * @param pdev Pointer to PCI device |
---|
| 378 | + * liquidio_pcie_slot_reset - called after the pci bus has been reset. |
---|
| 379 | + * @pdev: Pointer to PCI device |
---|
391 | 380 | * |
---|
392 | 381 | * Restart the card from scratch, as if from a cold-boot. Implementation |
---|
393 | 382 | * resembles the first-half of the octeon_resume routine. |
---|
394 | 383 | */ |
---|
395 | | -static pci_ers_result_t liquidio_pcie_slot_reset( |
---|
396 | | - struct pci_dev *pdev __attribute__((unused))) |
---|
| 384 | +static pci_ers_result_t liquidio_pcie_slot_reset(struct pci_dev __maybe_unused *pdev) |
---|
397 | 385 | { |
---|
398 | 386 | /* We should never hit this since we never ask for a reset for a Fatal |
---|
399 | 387 | * Error. We always return DISCONNECT in io_error above. |
---|
.. | .. |
---|
403 | 391 | } |
---|
404 | 392 | |
---|
405 | 393 | /** |
---|
406 | | - * \brief called when traffic can start flowing again. |
---|
407 | | - * @param pdev Pointer to PCI device |
---|
| 394 | + * liquidio_pcie_resume - called when traffic can start flowing again. |
---|
| 395 | + * @pdev: Pointer to PCI device |
---|
408 | 396 | * |
---|
409 | 397 | * This callback is called when the error recovery driver tells us that |
---|
410 | 398 | * its OK to resume normal operation. Implementation resembles the |
---|
411 | 399 | * second-half of the octeon_resume routine. |
---|
412 | 400 | */ |
---|
413 | | -static void liquidio_pcie_resume(struct pci_dev *pdev __attribute__((unused))) |
---|
| 401 | +static void liquidio_pcie_resume(struct pci_dev __maybe_unused *pdev) |
---|
414 | 402 | { |
---|
415 | 403 | /* Nothing to be done here. */ |
---|
416 | 404 | } |
---|
417 | 405 | |
---|
418 | | -#ifdef CONFIG_PM |
---|
419 | | -/** |
---|
420 | | - * \brief called when suspending |
---|
421 | | - * @param pdev Pointer to PCI device |
---|
422 | | - * @param state state to suspend to |
---|
423 | | - */ |
---|
424 | | -static int liquidio_suspend(struct pci_dev *pdev __attribute__((unused)), |
---|
425 | | - pm_message_t state __attribute__((unused))) |
---|
426 | | -{ |
---|
427 | | - return 0; |
---|
428 | | -} |
---|
429 | | - |
---|
430 | | -/** |
---|
431 | | - * \brief called when resuming |
---|
432 | | - * @param pdev Pointer to PCI device |
---|
433 | | - */ |
---|
434 | | -static int liquidio_resume(struct pci_dev *pdev __attribute__((unused))) |
---|
435 | | -{ |
---|
436 | | - return 0; |
---|
437 | | -} |
---|
438 | | -#endif |
---|
| 406 | +#define liquidio_suspend NULL |
---|
| 407 | +#define liquidio_resume NULL |
---|
439 | 408 | |
---|
440 | 409 | /* For PCI-E Advanced Error Recovery (AER) Interface */ |
---|
441 | 410 | static const struct pci_error_handlers liquidio_err_handler = { |
---|
.. | .. |
---|
461 | 430 | }; |
---|
462 | 431 | MODULE_DEVICE_TABLE(pci, liquidio_pci_tbl); |
---|
463 | 432 | |
---|
| 433 | +static SIMPLE_DEV_PM_OPS(liquidio_pm_ops, liquidio_suspend, liquidio_resume); |
---|
| 434 | + |
---|
464 | 435 | static struct pci_driver liquidio_pci_driver = { |
---|
465 | 436 | .name = "LiquidIO", |
---|
466 | 437 | .id_table = liquidio_pci_tbl, |
---|
467 | 438 | .probe = liquidio_probe, |
---|
468 | 439 | .remove = liquidio_remove, |
---|
469 | 440 | .err_handler = &liquidio_err_handler, /* For AER */ |
---|
470 | | - |
---|
471 | | -#ifdef CONFIG_PM |
---|
472 | | - .suspend = liquidio_suspend, |
---|
473 | | - .resume = liquidio_resume, |
---|
474 | | -#endif |
---|
| 441 | + .driver.pm = &liquidio_pm_ops, |
---|
475 | 442 | #ifdef CONFIG_PCI_IOV |
---|
476 | 443 | .sriov_configure = liquidio_enable_sriov, |
---|
477 | 444 | #endif |
---|
478 | 445 | }; |
---|
479 | 446 | |
---|
480 | 447 | /** |
---|
481 | | - * \brief register PCI driver |
---|
| 448 | + * liquidio_init_pci - register PCI driver |
---|
482 | 449 | */ |
---|
483 | 450 | static int liquidio_init_pci(void) |
---|
484 | 451 | { |
---|
.. | .. |
---|
486 | 453 | } |
---|
487 | 454 | |
---|
488 | 455 | /** |
---|
489 | | - * \brief unregister PCI driver |
---|
| 456 | + * liquidio_deinit_pci - unregister PCI driver |
---|
490 | 457 | */ |
---|
491 | 458 | static void liquidio_deinit_pci(void) |
---|
492 | 459 | { |
---|
.. | .. |
---|
494 | 461 | } |
---|
495 | 462 | |
---|
496 | 463 | /** |
---|
497 | | - * \brief Check Tx queue status, and take appropriate action |
---|
498 | | - * @param lio per-network private data |
---|
499 | | - * @returns 0 if full, number of queues woken up otherwise |
---|
| 464 | + * check_txq_status - Check Tx queue status, and take appropriate action |
---|
| 465 | + * @lio: per-network private data |
---|
| 466 | + * Return: 0 if full, number of queues woken up otherwise |
---|
500 | 467 | */ |
---|
501 | 468 | static inline int check_txq_status(struct lio *lio) |
---|
502 | 469 | { |
---|
.. | .. |
---|
522 | 489 | } |
---|
523 | 490 | |
---|
524 | 491 | /** |
---|
525 | | - * \brief Print link information |
---|
526 | | - * @param netdev network device |
---|
| 492 | + * print_link_info - Print link information |
---|
| 493 | + * @netdev: network device |
---|
527 | 494 | */ |
---|
528 | 495 | static void print_link_info(struct net_device *netdev) |
---|
529 | 496 | { |
---|
.. | .. |
---|
544 | 511 | } |
---|
545 | 512 | |
---|
546 | 513 | /** |
---|
547 | | - * \brief Routine to notify MTU change |
---|
548 | | - * @param work work_struct data structure |
---|
| 514 | + * octnet_link_status_change - Routine to notify MTU change |
---|
| 515 | + * @work: work_struct data structure |
---|
549 | 516 | */ |
---|
550 | 517 | static void octnet_link_status_change(struct work_struct *work) |
---|
551 | 518 | { |
---|
.. | .. |
---|
562 | 529 | } |
---|
563 | 530 | |
---|
564 | 531 | /** |
---|
565 | | - * \brief Sets up the mtu status change work |
---|
566 | | - * @param netdev network device |
---|
| 532 | + * setup_link_status_change_wq - Sets up the mtu status change work |
---|
| 533 | + * @netdev: network device |
---|
567 | 534 | */ |
---|
568 | 535 | static inline int setup_link_status_change_wq(struct net_device *netdev) |
---|
569 | 536 | { |
---|
.. | .. |
---|
594 | 561 | } |
---|
595 | 562 | |
---|
596 | 563 | /** |
---|
597 | | - * \brief Update link status |
---|
598 | | - * @param netdev network device |
---|
599 | | - * @param ls link status structure |
---|
| 564 | + * update_link_status - Update link status |
---|
| 565 | + * @netdev: network device |
---|
| 566 | + * @ls: link status structure |
---|
600 | 567 | * |
---|
601 | 568 | * Called on receipt of a link status response from the core application to |
---|
602 | 569 | * update each interface's link status. |
---|
.. | .. |
---|
642 | 609 | } |
---|
643 | 610 | |
---|
644 | 611 | /** |
---|
645 | | - * lio_sync_octeon_time_cb - callback that is invoked when soft command |
---|
646 | | - * sent by lio_sync_octeon_time() has completed successfully or failed |
---|
647 | | - * |
---|
648 | | - * @oct - octeon device structure |
---|
649 | | - * @status - indicates success or failure |
---|
650 | | - * @buf - pointer to the command that was sent to firmware |
---|
651 | | - **/ |
---|
652 | | -static void lio_sync_octeon_time_cb(struct octeon_device *oct, |
---|
653 | | - u32 status, void *buf) |
---|
654 | | -{ |
---|
655 | | - struct octeon_soft_command *sc = (struct octeon_soft_command *)buf; |
---|
656 | | - |
---|
657 | | - if (status) |
---|
658 | | - dev_err(&oct->pci_dev->dev, |
---|
659 | | - "Failed to sync time to octeon; error=%d\n", status); |
---|
660 | | - |
---|
661 | | - octeon_free_soft_command(oct, sc); |
---|
662 | | -} |
---|
663 | | - |
---|
664 | | -/** |
---|
665 | 612 | * lio_sync_octeon_time - send latest localtime to octeon firmware so that |
---|
666 | 613 | * firmware will correct it's time, in case there is a time skew |
---|
667 | 614 | * |
---|
.. | .. |
---|
677 | 624 | struct lio_time *lt; |
---|
678 | 625 | int ret; |
---|
679 | 626 | |
---|
680 | | - sc = octeon_alloc_soft_command(oct, sizeof(struct lio_time), 0, 0); |
---|
| 627 | + sc = octeon_alloc_soft_command(oct, sizeof(struct lio_time), 16, 0); |
---|
681 | 628 | if (!sc) { |
---|
682 | 629 | dev_err(&oct->pci_dev->dev, |
---|
683 | 630 | "Failed to sync time to octeon: soft command allocation failed\n"); |
---|
.. | .. |
---|
696 | 643 | octeon_prepare_soft_command(oct, sc, OPCODE_NIC, |
---|
697 | 644 | OPCODE_NIC_SYNC_OCTEON_TIME, 0, 0, 0); |
---|
698 | 645 | |
---|
699 | | - sc->callback = lio_sync_octeon_time_cb; |
---|
700 | | - sc->callback_arg = sc; |
---|
701 | | - sc->wait_time = 1000; |
---|
| 646 | + init_completion(&sc->complete); |
---|
| 647 | + sc->sc_status = OCTEON_REQUEST_PENDING; |
---|
702 | 648 | |
---|
703 | 649 | ret = octeon_send_soft_command(oct, sc); |
---|
704 | 650 | if (ret == IQ_SEND_FAILED) { |
---|
705 | 651 | dev_err(&oct->pci_dev->dev, |
---|
706 | 652 | "Failed to sync time to octeon: failed to send soft command\n"); |
---|
707 | 653 | octeon_free_soft_command(oct, sc); |
---|
| 654 | + } else { |
---|
| 655 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
708 | 656 | } |
---|
709 | 657 | |
---|
710 | 658 | queue_delayed_work(lio->sync_octeon_time_wq.wq, |
---|
.. | .. |
---|
713 | 661 | } |
---|
714 | 662 | |
---|
715 | 663 | /** |
---|
716 | | - * setup_sync_octeon_time_wq - Sets up the work to periodically update |
---|
717 | | - * local time to octeon firmware |
---|
| 664 | + * setup_sync_octeon_time_wq - prepare work to periodically update local time to octeon firmware |
---|
718 | 665 | * |
---|
719 | | - * @netdev - network device which should send time update to firmware |
---|
| 666 | + * @netdev: network device which should send time update to firmware |
---|
720 | 667 | **/ |
---|
721 | 668 | static inline int setup_sync_octeon_time_wq(struct net_device *netdev) |
---|
722 | 669 | { |
---|
.. | .. |
---|
740 | 687 | } |
---|
741 | 688 | |
---|
742 | 689 | /** |
---|
743 | | - * cleanup_sync_octeon_time_wq - stop scheduling and destroy the work created |
---|
744 | | - * to periodically update local time to octeon firmware |
---|
| 690 | + * cleanup_sync_octeon_time_wq - destroy wq |
---|
745 | 691 | * |
---|
746 | | - * @netdev - network device which should send time update to firmware |
---|
| 692 | + * @netdev: network device which should send time update to firmware |
---|
| 693 | + * |
---|
| 694 | + * Stop scheduling and destroy the work created to periodically update local |
---|
| 695 | + * time to octeon firmware. |
---|
747 | 696 | **/ |
---|
748 | 697 | static inline void cleanup_sync_octeon_time_wq(struct net_device *netdev) |
---|
749 | 698 | { |
---|
.. | .. |
---|
878 | 827 | } |
---|
879 | 828 | |
---|
880 | 829 | /** |
---|
881 | | - * \brief PCI probe handler |
---|
882 | | - * @param pdev PCI device structure |
---|
883 | | - * @param ent unused |
---|
| 830 | + * liquidio_probe - PCI probe handler |
---|
| 831 | + * @pdev: PCI device structure |
---|
| 832 | + * @ent: unused |
---|
884 | 833 | */ |
---|
885 | 834 | static int |
---|
886 | | -liquidio_probe(struct pci_dev *pdev, |
---|
887 | | - const struct pci_device_id *ent __attribute__((unused))) |
---|
| 835 | +liquidio_probe(struct pci_dev *pdev, const struct pci_device_id __maybe_unused *ent) |
---|
888 | 836 | { |
---|
889 | 837 | struct octeon_device *oct_dev = NULL; |
---|
890 | 838 | struct handshake *hs; |
---|
.. | .. |
---|
974 | 922 | } |
---|
975 | 923 | |
---|
976 | 924 | /** |
---|
977 | | - * \brief PCI FLR for each Octeon device. |
---|
978 | | - * @param oct octeon device |
---|
| 925 | + * octeon_pci_flr - PCI FLR for each Octeon device. |
---|
| 926 | + * @oct: octeon device |
---|
979 | 927 | */ |
---|
980 | 928 | static void octeon_pci_flr(struct octeon_device *oct) |
---|
981 | 929 | { |
---|
.. | .. |
---|
1001 | 949 | } |
---|
1002 | 950 | |
---|
1003 | 951 | /** |
---|
1004 | | - *\brief Destroy resources associated with octeon device |
---|
1005 | | - * @param pdev PCI device structure |
---|
1006 | | - * @param ent unused |
---|
| 952 | + * octeon_destroy_resources - Destroy resources associated with octeon device |
---|
| 953 | + * @oct: octeon device |
---|
1007 | 954 | */ |
---|
1008 | 955 | static void octeon_destroy_resources(struct octeon_device *oct) |
---|
1009 | 956 | { |
---|
.. | .. |
---|
1027 | 974 | |
---|
1028 | 975 | schedule_timeout_uninterruptible(HZ / 10); |
---|
1029 | 976 | |
---|
1030 | | - /* fallthrough */ |
---|
| 977 | + fallthrough; |
---|
1031 | 978 | case OCT_DEV_HOST_OK: |
---|
1032 | 979 | |
---|
1033 | | - /* fallthrough */ |
---|
1034 | 980 | case OCT_DEV_CONSOLE_INIT_DONE: |
---|
1035 | 981 | /* Remove any consoles */ |
---|
1036 | 982 | octeon_remove_consoles(oct); |
---|
1037 | 983 | |
---|
1038 | | - /* fallthrough */ |
---|
| 984 | + fallthrough; |
---|
1039 | 985 | case OCT_DEV_IO_QUEUES_DONE: |
---|
1040 | | - if (wait_for_pending_requests(oct)) |
---|
1041 | | - dev_err(&oct->pci_dev->dev, "There were pending requests\n"); |
---|
1042 | | - |
---|
1043 | 986 | if (lio_wait_for_instr_fetch(oct)) |
---|
1044 | 987 | dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n"); |
---|
| 988 | + |
---|
| 989 | + if (wait_for_pending_requests(oct)) |
---|
| 990 | + dev_err(&oct->pci_dev->dev, "There were pending requests\n"); |
---|
1045 | 991 | |
---|
1046 | 992 | /* Disable the input and output queues now. No more packets will |
---|
1047 | 993 | * arrive from Octeon, but we should wait for all packet |
---|
.. | .. |
---|
1052 | 998 | if (lio_wait_for_oq_pkts(oct)) |
---|
1053 | 999 | dev_err(&oct->pci_dev->dev, "OQ had pending packets\n"); |
---|
1054 | 1000 | |
---|
1055 | | - /* fallthrough */ |
---|
| 1001 | + /* Force all requests waiting to be fetched by OCTEON to |
---|
| 1002 | + * complete. |
---|
| 1003 | + */ |
---|
| 1004 | + for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) { |
---|
| 1005 | + struct octeon_instr_queue *iq; |
---|
| 1006 | + |
---|
| 1007 | + if (!(oct->io_qmask.iq & BIT_ULL(i))) |
---|
| 1008 | + continue; |
---|
| 1009 | + iq = oct->instr_queue[i]; |
---|
| 1010 | + |
---|
| 1011 | + if (atomic_read(&iq->instr_pending)) { |
---|
| 1012 | + spin_lock_bh(&iq->lock); |
---|
| 1013 | + iq->fill_cnt = 0; |
---|
| 1014 | + iq->octeon_read_index = iq->host_write_index; |
---|
| 1015 | + iq->stats.instr_processed += |
---|
| 1016 | + atomic_read(&iq->instr_pending); |
---|
| 1017 | + lio_process_iq_request_list(oct, iq, 0); |
---|
| 1018 | + spin_unlock_bh(&iq->lock); |
---|
| 1019 | + } |
---|
| 1020 | + } |
---|
| 1021 | + |
---|
| 1022 | + lio_process_ordered_list(oct, 1); |
---|
| 1023 | + octeon_free_sc_done_list(oct); |
---|
| 1024 | + octeon_free_sc_zombie_list(oct); |
---|
| 1025 | + |
---|
| 1026 | + fallthrough; |
---|
1056 | 1027 | case OCT_DEV_INTR_SET_DONE: |
---|
1057 | 1028 | /* Disable interrupts */ |
---|
1058 | 1029 | oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); |
---|
.. | .. |
---|
1087 | 1058 | kfree(oct->irq_name_storage); |
---|
1088 | 1059 | oct->irq_name_storage = NULL; |
---|
1089 | 1060 | |
---|
1090 | | - /* fallthrough */ |
---|
| 1061 | + fallthrough; |
---|
1091 | 1062 | case OCT_DEV_MSIX_ALLOC_VECTOR_DONE: |
---|
1092 | 1063 | if (OCTEON_CN23XX_PF(oct)) |
---|
1093 | 1064 | octeon_free_ioq_vector(oct); |
---|
1094 | 1065 | |
---|
1095 | | - /* fallthrough */ |
---|
| 1066 | + fallthrough; |
---|
1096 | 1067 | case OCT_DEV_MBOX_SETUP_DONE: |
---|
1097 | 1068 | if (OCTEON_CN23XX_PF(oct)) |
---|
1098 | 1069 | oct->fn_list.free_mbox(oct); |
---|
1099 | 1070 | |
---|
1100 | | - /* fallthrough */ |
---|
| 1071 | + fallthrough; |
---|
1101 | 1072 | case OCT_DEV_IN_RESET: |
---|
1102 | 1073 | case OCT_DEV_DROQ_INIT_DONE: |
---|
1103 | 1074 | /* Wait for any pending operations */ |
---|
.. | .. |
---|
1120 | 1091 | } |
---|
1121 | 1092 | } |
---|
1122 | 1093 | |
---|
1123 | | - /* fallthrough */ |
---|
| 1094 | + fallthrough; |
---|
1124 | 1095 | case OCT_DEV_RESP_LIST_INIT_DONE: |
---|
1125 | 1096 | octeon_delete_response_list(oct); |
---|
1126 | 1097 | |
---|
1127 | | - /* fallthrough */ |
---|
| 1098 | + fallthrough; |
---|
1128 | 1099 | case OCT_DEV_INSTR_QUEUE_INIT_DONE: |
---|
1129 | 1100 | for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) { |
---|
1130 | 1101 | if (!(oct->io_qmask.iq & BIT_ULL(i))) |
---|
.. | .. |
---|
1135 | 1106 | if (oct->sriov_info.sriov_enabled) |
---|
1136 | 1107 | pci_disable_sriov(oct->pci_dev); |
---|
1137 | 1108 | #endif |
---|
1138 | | - /* fallthrough */ |
---|
| 1109 | + fallthrough; |
---|
1139 | 1110 | case OCT_DEV_SC_BUFF_POOL_INIT_DONE: |
---|
1140 | 1111 | octeon_free_sc_buffer_pool(oct); |
---|
1141 | 1112 | |
---|
1142 | | - /* fallthrough */ |
---|
| 1113 | + fallthrough; |
---|
1143 | 1114 | case OCT_DEV_DISPATCH_INIT_DONE: |
---|
1144 | 1115 | octeon_delete_dispatch_list(oct); |
---|
1145 | 1116 | cancel_delayed_work_sync(&oct->nic_poll_work.work); |
---|
1146 | 1117 | |
---|
1147 | | - /* fallthrough */ |
---|
| 1118 | + fallthrough; |
---|
1148 | 1119 | case OCT_DEV_PCI_MAP_DONE: |
---|
1149 | 1120 | refcount = octeon_deregister_device(oct); |
---|
1150 | 1121 | |
---|
.. | .. |
---|
1162 | 1133 | octeon_unmap_pci_barx(oct, 0); |
---|
1163 | 1134 | octeon_unmap_pci_barx(oct, 1); |
---|
1164 | 1135 | |
---|
1165 | | - /* fallthrough */ |
---|
| 1136 | + fallthrough; |
---|
1166 | 1137 | case OCT_DEV_PCI_ENABLE_DONE: |
---|
1167 | 1138 | pci_clear_master(oct->pci_dev); |
---|
1168 | 1139 | /* Disable the device, releasing the PCI INT */ |
---|
1169 | 1140 | pci_disable_device(oct->pci_dev); |
---|
1170 | 1141 | |
---|
1171 | | - /* fallthrough */ |
---|
| 1142 | + fallthrough; |
---|
1172 | 1143 | case OCT_DEV_BEGIN_STATE: |
---|
1173 | 1144 | /* Nothing to be done here either */ |
---|
1174 | 1145 | break; |
---|
.. | .. |
---|
1178 | 1149 | } |
---|
1179 | 1150 | |
---|
1180 | 1151 | /** |
---|
1181 | | - * \brief Callback for rx ctrl |
---|
1182 | | - * @param status status of request |
---|
1183 | | - * @param buf pointer to resp structure |
---|
| 1152 | + * send_rx_ctrl_cmd - Send Rx control command |
---|
| 1153 | + * @lio: per-network private data |
---|
| 1154 | + * @start_stop: whether to start or stop |
---|
1184 | 1155 | */ |
---|
1185 | | -static void rx_ctl_callback(struct octeon_device *oct, |
---|
1186 | | - u32 status, |
---|
1187 | | - void *buf) |
---|
1188 | | -{ |
---|
1189 | | - struct octeon_soft_command *sc = (struct octeon_soft_command *)buf; |
---|
1190 | | - struct liquidio_rx_ctl_context *ctx; |
---|
1191 | | - |
---|
1192 | | - ctx = (struct liquidio_rx_ctl_context *)sc->ctxptr; |
---|
1193 | | - |
---|
1194 | | - oct = lio_get_device(ctx->octeon_id); |
---|
1195 | | - if (status) |
---|
1196 | | - dev_err(&oct->pci_dev->dev, "rx ctl instruction failed. Status: %llx\n", |
---|
1197 | | - CVM_CAST64(status)); |
---|
1198 | | - WRITE_ONCE(ctx->cond, 1); |
---|
1199 | | - |
---|
1200 | | - /* This barrier is required to be sure that the response has been |
---|
1201 | | - * written fully before waking up the handler |
---|
1202 | | - */ |
---|
1203 | | - wmb(); |
---|
1204 | | - |
---|
1205 | | - wake_up_interruptible(&ctx->wc); |
---|
1206 | | -} |
---|
1207 | | - |
---|
1208 | | -/** |
---|
1209 | | - * \brief Send Rx control command |
---|
1210 | | - * @param lio per-network private data |
---|
1211 | | - * @param start_stop whether to start or stop |
---|
1212 | | - */ |
---|
1213 | | -static void send_rx_ctrl_cmd(struct lio *lio, int start_stop) |
---|
| 1156 | +static int send_rx_ctrl_cmd(struct lio *lio, int start_stop) |
---|
1214 | 1157 | { |
---|
1215 | 1158 | struct octeon_soft_command *sc; |
---|
1216 | | - struct liquidio_rx_ctl_context *ctx; |
---|
1217 | 1159 | union octnet_cmd *ncmd; |
---|
1218 | | - int ctx_size = sizeof(struct liquidio_rx_ctl_context); |
---|
1219 | 1160 | struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; |
---|
1220 | 1161 | int retval; |
---|
1221 | 1162 | |
---|
1222 | 1163 | if (oct->props[lio->ifidx].rx_on == start_stop) |
---|
1223 | | - return; |
---|
| 1164 | + return 0; |
---|
1224 | 1165 | |
---|
1225 | 1166 | sc = (struct octeon_soft_command *) |
---|
1226 | 1167 | octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, |
---|
1227 | | - 16, ctx_size); |
---|
| 1168 | + 16, 0); |
---|
| 1169 | + if (!sc) { |
---|
| 1170 | + netif_info(lio, rx_err, lio->netdev, |
---|
| 1171 | + "Failed to allocate octeon_soft_command struct\n"); |
---|
| 1172 | + return -ENOMEM; |
---|
| 1173 | + } |
---|
1228 | 1174 | |
---|
1229 | 1175 | ncmd = (union octnet_cmd *)sc->virtdptr; |
---|
1230 | | - ctx = (struct liquidio_rx_ctl_context *)sc->ctxptr; |
---|
1231 | | - |
---|
1232 | | - WRITE_ONCE(ctx->cond, 0); |
---|
1233 | | - ctx->octeon_id = lio_get_device_id(oct); |
---|
1234 | | - init_waitqueue_head(&ctx->wc); |
---|
1235 | 1176 | |
---|
1236 | 1177 | ncmd->u64 = 0; |
---|
1237 | 1178 | ncmd->s.cmd = OCTNET_CMD_RX_CTL; |
---|
.. | .. |
---|
1244 | 1185 | octeon_prepare_soft_command(oct, sc, OPCODE_NIC, |
---|
1245 | 1186 | OPCODE_NIC_CMD, 0, 0, 0); |
---|
1246 | 1187 | |
---|
1247 | | - sc->callback = rx_ctl_callback; |
---|
1248 | | - sc->callback_arg = sc; |
---|
1249 | | - sc->wait_time = 5000; |
---|
| 1188 | + init_completion(&sc->complete); |
---|
| 1189 | + sc->sc_status = OCTEON_REQUEST_PENDING; |
---|
1250 | 1190 | |
---|
1251 | 1191 | retval = octeon_send_soft_command(oct, sc); |
---|
1252 | 1192 | if (retval == IQ_SEND_FAILED) { |
---|
1253 | 1193 | netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n"); |
---|
| 1194 | + octeon_free_soft_command(oct, sc); |
---|
1254 | 1195 | } else { |
---|
1255 | 1196 | /* Sleep on a wait queue till the cond flag indicates that the |
---|
1256 | 1197 | * response arrived or timed-out. |
---|
1257 | 1198 | */ |
---|
1258 | | - if (sleep_cond(&ctx->wc, &ctx->cond) == -EINTR) |
---|
1259 | | - return; |
---|
| 1199 | + retval = wait_for_sc_completion_timeout(oct, sc, 0); |
---|
| 1200 | + if (retval) |
---|
| 1201 | + return retval; |
---|
| 1202 | + |
---|
1260 | 1203 | oct->props[lio->ifidx].rx_on = start_stop; |
---|
| 1204 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
1261 | 1205 | } |
---|
1262 | 1206 | |
---|
1263 | | - octeon_free_soft_command(oct, sc); |
---|
| 1207 | + return retval; |
---|
1264 | 1208 | } |
---|
1265 | 1209 | |
---|
1266 | 1210 | /** |
---|
1267 | | - * \brief Destroy NIC device interface |
---|
1268 | | - * @param oct octeon device |
---|
1269 | | - * @param ifidx which interface to destroy |
---|
| 1211 | + * liquidio_destroy_nic_device - Destroy NIC device interface |
---|
| 1212 | + * @oct: octeon device |
---|
| 1213 | + * @ifidx: which interface to destroy |
---|
1270 | 1214 | * |
---|
1271 | 1215 | * Cleanup associated with each interface for an Octeon device when NIC |
---|
1272 | 1216 | * module is being unloaded or if initialization fails during load. |
---|
.. | .. |
---|
1274 | 1218 | static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx) |
---|
1275 | 1219 | { |
---|
1276 | 1220 | struct net_device *netdev = oct->props[ifidx].netdev; |
---|
1277 | | - struct lio *lio; |
---|
| 1221 | + struct octeon_device_priv *oct_priv = |
---|
| 1222 | + (struct octeon_device_priv *)oct->priv; |
---|
1278 | 1223 | struct napi_struct *napi, *n; |
---|
| 1224 | + struct lio *lio; |
---|
1279 | 1225 | |
---|
1280 | 1226 | if (!netdev) { |
---|
1281 | 1227 | dev_err(&oct->pci_dev->dev, "%s No netdevice ptr for index %d\n", |
---|
.. | .. |
---|
1304 | 1250 | list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) |
---|
1305 | 1251 | netif_napi_del(napi); |
---|
1306 | 1252 | |
---|
| 1253 | + tasklet_enable(&oct_priv->droq_tasklet); |
---|
| 1254 | + |
---|
1307 | 1255 | if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED) |
---|
1308 | 1256 | unregister_netdev(netdev); |
---|
1309 | 1257 | |
---|
.. | .. |
---|
1322 | 1270 | } |
---|
1323 | 1271 | |
---|
1324 | 1272 | /** |
---|
1325 | | - * \brief Stop complete NIC functionality |
---|
1326 | | - * @param oct octeon device |
---|
| 1273 | + * liquidio_stop_nic_module - Stop complete NIC functionality |
---|
| 1274 | + * @oct: octeon device |
---|
1327 | 1275 | */ |
---|
1328 | 1276 | static int liquidio_stop_nic_module(struct octeon_device *oct) |
---|
1329 | 1277 | { |
---|
.. | .. |
---|
1363 | 1311 | } |
---|
1364 | 1312 | |
---|
1365 | 1313 | /** |
---|
1366 | | - * \brief Cleans up resources at unload time |
---|
1367 | | - * @param pdev PCI device structure |
---|
| 1314 | + * liquidio_remove - Cleans up resources at unload time |
---|
| 1315 | + * @pdev: PCI device structure |
---|
1368 | 1316 | */ |
---|
1369 | 1317 | static void liquidio_remove(struct pci_dev *pdev) |
---|
1370 | 1318 | { |
---|
.. | .. |
---|
1396 | 1344 | } |
---|
1397 | 1345 | |
---|
1398 | 1346 | /** |
---|
1399 | | - * \brief Identify the Octeon device and to map the BAR address space |
---|
1400 | | - * @param oct octeon device |
---|
| 1347 | + * octeon_chip_specific_setup - Identify the Octeon device and to map the BAR address space |
---|
| 1348 | + * @oct: octeon device |
---|
1401 | 1349 | */ |
---|
1402 | 1350 | static int octeon_chip_specific_setup(struct octeon_device *oct) |
---|
1403 | 1351 | { |
---|
1404 | 1352 | u32 dev_id, rev_id; |
---|
1405 | 1353 | int ret = 1; |
---|
1406 | | - char *s; |
---|
1407 | 1354 | |
---|
1408 | 1355 | pci_read_config_dword(oct->pci_dev, 0, &dev_id); |
---|
1409 | 1356 | pci_read_config_dword(oct->pci_dev, 8, &rev_id); |
---|
.. | .. |
---|
1413 | 1360 | case OCTEON_CN68XX_PCIID: |
---|
1414 | 1361 | oct->chip_id = OCTEON_CN68XX; |
---|
1415 | 1362 | ret = lio_setup_cn68xx_octeon_device(oct); |
---|
1416 | | - s = "CN68XX"; |
---|
1417 | 1363 | break; |
---|
1418 | 1364 | |
---|
1419 | 1365 | case OCTEON_CN66XX_PCIID: |
---|
1420 | 1366 | oct->chip_id = OCTEON_CN66XX; |
---|
1421 | 1367 | ret = lio_setup_cn66xx_octeon_device(oct); |
---|
1422 | | - s = "CN66XX"; |
---|
1423 | 1368 | break; |
---|
1424 | 1369 | |
---|
1425 | 1370 | case OCTEON_CN23XX_PCIID_PF: |
---|
.. | .. |
---|
1432 | 1377 | pci_sriov_set_totalvfs(oct->pci_dev, |
---|
1433 | 1378 | oct->sriov_info.max_vfs); |
---|
1434 | 1379 | #endif |
---|
1435 | | - s = "CN23XX"; |
---|
1436 | 1380 | break; |
---|
1437 | 1381 | |
---|
1438 | 1382 | default: |
---|
1439 | | - s = "?"; |
---|
1440 | 1383 | dev_err(&oct->pci_dev->dev, "Unknown device found (dev_id: %x)\n", |
---|
1441 | 1384 | dev_id); |
---|
1442 | 1385 | } |
---|
1443 | | - |
---|
1444 | | - if (!ret) |
---|
1445 | | - dev_info(&oct->pci_dev->dev, "%s PASS%d.%d %s Version: %s\n", s, |
---|
1446 | | - OCTEON_MAJOR_REV(oct), |
---|
1447 | | - OCTEON_MINOR_REV(oct), |
---|
1448 | | - octeon_get_conf(oct)->card_name, |
---|
1449 | | - LIQUIDIO_VERSION); |
---|
1450 | 1386 | |
---|
1451 | 1387 | return ret; |
---|
1452 | 1388 | } |
---|
1453 | 1389 | |
---|
1454 | 1390 | /** |
---|
1455 | | - * \brief PCI initialization for each Octeon device. |
---|
1456 | | - * @param oct octeon device |
---|
| 1391 | + * octeon_pci_os_setup - PCI initialization for each Octeon device. |
---|
| 1392 | + * @oct: octeon device |
---|
1457 | 1393 | */ |
---|
1458 | 1394 | static int octeon_pci_os_setup(struct octeon_device *oct) |
---|
1459 | 1395 | { |
---|
.. | .. |
---|
1476 | 1412 | } |
---|
1477 | 1413 | |
---|
1478 | 1414 | /** |
---|
1479 | | - * \brief Unmap and free network buffer |
---|
1480 | | - * @param buf buffer |
---|
| 1415 | + * free_netbuf - Unmap and free network buffer |
---|
| 1416 | + * @buf: buffer |
---|
1481 | 1417 | */ |
---|
1482 | 1418 | static void free_netbuf(void *buf) |
---|
1483 | 1419 | { |
---|
.. | .. |
---|
1496 | 1432 | } |
---|
1497 | 1433 | |
---|
1498 | 1434 | /** |
---|
1499 | | - * \brief Unmap and free gather buffer |
---|
1500 | | - * @param buf buffer |
---|
| 1435 | + * free_netsgbuf - Unmap and free gather buffer |
---|
| 1436 | + * @buf: buffer |
---|
1501 | 1437 | */ |
---|
1502 | 1438 | static void free_netsgbuf(void *buf) |
---|
1503 | 1439 | { |
---|
.. | .. |
---|
1519 | 1455 | |
---|
1520 | 1456 | i = 1; |
---|
1521 | 1457 | while (frags--) { |
---|
1522 | | - struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; |
---|
| 1458 | + skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; |
---|
1523 | 1459 | |
---|
1524 | 1460 | pci_unmap_page((lio->oct_dev)->pci_dev, |
---|
1525 | 1461 | g->sg[(i >> 2)].ptr[(i & 3)], |
---|
1526 | | - frag->size, DMA_TO_DEVICE); |
---|
| 1462 | + skb_frag_size(frag), DMA_TO_DEVICE); |
---|
1527 | 1463 | i++; |
---|
1528 | 1464 | } |
---|
1529 | 1465 | |
---|
.. | .. |
---|
1536 | 1472 | } |
---|
1537 | 1473 | |
---|
1538 | 1474 | /** |
---|
1539 | | - * \brief Unmap and free gather buffer with response |
---|
1540 | | - * @param buf buffer |
---|
| 1475 | + * free_netsgbuf_with_resp - Unmap and free gather buffer with response |
---|
| 1476 | + * @buf: buffer |
---|
1541 | 1477 | */ |
---|
1542 | 1478 | static void free_netsgbuf_with_resp(void *buf) |
---|
1543 | 1479 | { |
---|
.. | .. |
---|
1562 | 1498 | |
---|
1563 | 1499 | i = 1; |
---|
1564 | 1500 | while (frags--) { |
---|
1565 | | - struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; |
---|
| 1501 | + skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; |
---|
1566 | 1502 | |
---|
1567 | 1503 | pci_unmap_page((lio->oct_dev)->pci_dev, |
---|
1568 | 1504 | g->sg[(i >> 2)].ptr[(i & 3)], |
---|
1569 | | - frag->size, DMA_TO_DEVICE); |
---|
| 1505 | + skb_frag_size(frag), DMA_TO_DEVICE); |
---|
1570 | 1506 | i++; |
---|
1571 | 1507 | } |
---|
1572 | 1508 | |
---|
.. | .. |
---|
1580 | 1516 | } |
---|
1581 | 1517 | |
---|
1582 | 1518 | /** |
---|
1583 | | - * \brief Adjust ptp frequency |
---|
1584 | | - * @param ptp PTP clock info |
---|
1585 | | - * @param ppb how much to adjust by, in parts-per-billion |
---|
| 1519 | + * liquidio_ptp_adjfreq - Adjust ptp frequency |
---|
| 1520 | + * @ptp: PTP clock info |
---|
| 1521 | + * @ppb: how much to adjust by, in parts-per-billion |
---|
1586 | 1522 | */ |
---|
1587 | 1523 | static int liquidio_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) |
---|
1588 | 1524 | { |
---|
.. | .. |
---|
1617 | 1553 | } |
---|
1618 | 1554 | |
---|
1619 | 1555 | /** |
---|
1620 | | - * \brief Adjust ptp time |
---|
1621 | | - * @param ptp PTP clock info |
---|
1622 | | - * @param delta how much to adjust by, in nanosecs |
---|
| 1556 | + * liquidio_ptp_adjtime - Adjust ptp time |
---|
| 1557 | + * @ptp: PTP clock info |
---|
| 1558 | + * @delta: how much to adjust by, in nanosecs |
---|
1623 | 1559 | */ |
---|
1624 | 1560 | static int liquidio_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) |
---|
1625 | 1561 | { |
---|
.. | .. |
---|
1634 | 1570 | } |
---|
1635 | 1571 | |
---|
1636 | 1572 | /** |
---|
1637 | | - * \brief Get hardware clock time, including any adjustment |
---|
1638 | | - * @param ptp PTP clock info |
---|
1639 | | - * @param ts timespec |
---|
| 1573 | + * liquidio_ptp_gettime - Get hardware clock time, including any adjustment |
---|
| 1574 | + * @ptp: PTP clock info |
---|
| 1575 | + * @ts: timespec |
---|
1640 | 1576 | */ |
---|
1641 | 1577 | static int liquidio_ptp_gettime(struct ptp_clock_info *ptp, |
---|
1642 | 1578 | struct timespec64 *ts) |
---|
.. | .. |
---|
1657 | 1593 | } |
---|
1658 | 1594 | |
---|
1659 | 1595 | /** |
---|
1660 | | - * \brief Set hardware clock time. Reset adjustment |
---|
1661 | | - * @param ptp PTP clock info |
---|
1662 | | - * @param ts timespec |
---|
| 1596 | + * liquidio_ptp_settime - Set hardware clock time. Reset adjustment |
---|
| 1597 | + * @ptp: PTP clock info |
---|
| 1598 | + * @ts: timespec |
---|
1663 | 1599 | */ |
---|
1664 | 1600 | static int liquidio_ptp_settime(struct ptp_clock_info *ptp, |
---|
1665 | 1601 | const struct timespec64 *ts) |
---|
.. | .. |
---|
1680 | 1616 | } |
---|
1681 | 1617 | |
---|
1682 | 1618 | /** |
---|
1683 | | - * \brief Check if PTP is enabled |
---|
1684 | | - * @param ptp PTP clock info |
---|
1685 | | - * @param rq request |
---|
1686 | | - * @param on is it on |
---|
| 1619 | + * liquidio_ptp_enable - Check if PTP is enabled |
---|
| 1620 | + * @ptp: PTP clock info |
---|
| 1621 | + * @rq: request |
---|
| 1622 | + * @on: is it on |
---|
1687 | 1623 | */ |
---|
1688 | 1624 | static int |
---|
1689 | | -liquidio_ptp_enable(struct ptp_clock_info *ptp __attribute__((unused)), |
---|
1690 | | - struct ptp_clock_request *rq __attribute__((unused)), |
---|
1691 | | - int on __attribute__((unused))) |
---|
| 1625 | +liquidio_ptp_enable(struct ptp_clock_info __maybe_unused *ptp, |
---|
| 1626 | + struct ptp_clock_request __maybe_unused *rq, |
---|
| 1627 | + int __maybe_unused on) |
---|
1692 | 1628 | { |
---|
1693 | 1629 | return -EOPNOTSUPP; |
---|
1694 | 1630 | } |
---|
1695 | 1631 | |
---|
1696 | 1632 | /** |
---|
1697 | | - * \brief Open PTP clock source |
---|
1698 | | - * @param netdev network device |
---|
| 1633 | + * oct_ptp_open - Open PTP clock source |
---|
| 1634 | + * @netdev: network device |
---|
1699 | 1635 | */ |
---|
1700 | 1636 | static void oct_ptp_open(struct net_device *netdev) |
---|
1701 | 1637 | { |
---|
.. | .. |
---|
1727 | 1663 | } |
---|
1728 | 1664 | |
---|
1729 | 1665 | /** |
---|
1730 | | - * \brief Init PTP clock |
---|
1731 | | - * @param oct octeon device |
---|
| 1666 | + * liquidio_ptp_init - Init PTP clock |
---|
| 1667 | + * @oct: octeon device |
---|
1732 | 1668 | */ |
---|
1733 | 1669 | static void liquidio_ptp_init(struct octeon_device *oct) |
---|
1734 | 1670 | { |
---|
.. | .. |
---|
1744 | 1680 | } |
---|
1745 | 1681 | |
---|
1746 | 1682 | /** |
---|
1747 | | - * \brief Load firmware to device |
---|
1748 | | - * @param oct octeon device |
---|
| 1683 | + * load_firmware - Load firmware to device |
---|
| 1684 | + * @oct: octeon device |
---|
1749 | 1685 | * |
---|
1750 | 1686 | * Maps device to firmware filename, requests firmware, and downloads it |
---|
1751 | 1687 | */ |
---|
.. | .. |
---|
1783 | 1719 | } |
---|
1784 | 1720 | |
---|
1785 | 1721 | /** |
---|
1786 | | - * \brief Poll routine for checking transmit queue status |
---|
1787 | | - * @param work work_struct data structure |
---|
| 1722 | + * octnet_poll_check_txq_status - Poll routine for checking transmit queue status |
---|
| 1723 | + * @work: work_struct data structure |
---|
1788 | 1724 | */ |
---|
1789 | 1725 | static void octnet_poll_check_txq_status(struct work_struct *work) |
---|
1790 | 1726 | { |
---|
.. | .. |
---|
1800 | 1736 | } |
---|
1801 | 1737 | |
---|
1802 | 1738 | /** |
---|
1803 | | - * \brief Sets up the txq poll check |
---|
1804 | | - * @param netdev network device |
---|
| 1739 | + * setup_tx_poll_fn - Sets up the txq poll check |
---|
| 1740 | + * @netdev: network device |
---|
1805 | 1741 | */ |
---|
1806 | 1742 | static inline int setup_tx_poll_fn(struct net_device *netdev) |
---|
1807 | 1743 | { |
---|
.. | .. |
---|
1833 | 1769 | } |
---|
1834 | 1770 | |
---|
1835 | 1771 | /** |
---|
1836 | | - * \brief Net device open for LiquidIO |
---|
1837 | | - * @param netdev network device |
---|
| 1772 | + * liquidio_open - Net device open for LiquidIO |
---|
| 1773 | + * @netdev: network device |
---|
1838 | 1774 | */ |
---|
1839 | 1775 | static int liquidio_open(struct net_device *netdev) |
---|
1840 | 1776 | { |
---|
1841 | 1777 | struct lio *lio = GET_LIO(netdev); |
---|
1842 | 1778 | struct octeon_device *oct = lio->oct_dev; |
---|
| 1779 | + struct octeon_device_priv *oct_priv = |
---|
| 1780 | + (struct octeon_device_priv *)oct->priv; |
---|
1843 | 1781 | struct napi_struct *napi, *n; |
---|
| 1782 | + int ret = 0; |
---|
1844 | 1783 | |
---|
1845 | 1784 | if (oct->props[lio->ifidx].napi_enabled == 0) { |
---|
| 1785 | + tasklet_disable(&oct_priv->droq_tasklet); |
---|
| 1786 | + |
---|
1846 | 1787 | list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) |
---|
1847 | 1788 | napi_enable(napi); |
---|
1848 | 1789 | |
---|
.. | .. |
---|
1857 | 1798 | |
---|
1858 | 1799 | ifstate_set(lio, LIO_IFSTATE_RUNNING); |
---|
1859 | 1800 | |
---|
1860 | | - if (OCTEON_CN23XX_PF(oct)) { |
---|
1861 | | - if (!oct->msix_on) |
---|
1862 | | - if (setup_tx_poll_fn(netdev)) |
---|
1863 | | - return -1; |
---|
1864 | | - } else { |
---|
1865 | | - if (setup_tx_poll_fn(netdev)) |
---|
1866 | | - return -1; |
---|
| 1801 | + if (!OCTEON_CN23XX_PF(oct) || !oct->msix_on) { |
---|
| 1802 | + ret = setup_tx_poll_fn(netdev); |
---|
| 1803 | + if (ret) |
---|
| 1804 | + goto err_poll; |
---|
1867 | 1805 | } |
---|
1868 | 1806 | |
---|
1869 | 1807 | netif_tx_start_all_queues(netdev); |
---|
.. | .. |
---|
1874 | 1812 | netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n"); |
---|
1875 | 1813 | |
---|
1876 | 1814 | /* tell Octeon to start forwarding packets to host */ |
---|
1877 | | - send_rx_ctrl_cmd(lio, 1); |
---|
| 1815 | + ret = send_rx_ctrl_cmd(lio, 1); |
---|
| 1816 | + if (ret) |
---|
| 1817 | + goto err_rx_ctrl; |
---|
| 1818 | + |
---|
| 1819 | + /* start periodical statistics fetch */ |
---|
| 1820 | + INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats); |
---|
| 1821 | + lio->stats_wk.ctxptr = lio; |
---|
| 1822 | + schedule_delayed_work(&lio->stats_wk.work, msecs_to_jiffies |
---|
| 1823 | + (LIQUIDIO_NDEV_STATS_POLL_TIME_MS)); |
---|
1878 | 1824 | |
---|
1879 | 1825 | dev_info(&oct->pci_dev->dev, "%s interface is opened\n", |
---|
1880 | 1826 | netdev->name); |
---|
1881 | 1827 | |
---|
1882 | 1828 | return 0; |
---|
| 1829 | + |
---|
| 1830 | +err_rx_ctrl: |
---|
| 1831 | + if (!OCTEON_CN23XX_PF(oct) || !oct->msix_on) |
---|
| 1832 | + cleanup_tx_poll_fn(netdev); |
---|
| 1833 | +err_poll: |
---|
| 1834 | + if (lio->ptp_clock) { |
---|
| 1835 | + ptp_clock_unregister(lio->ptp_clock); |
---|
| 1836 | + lio->ptp_clock = NULL; |
---|
| 1837 | + } |
---|
| 1838 | + |
---|
| 1839 | + if (oct->props[lio->ifidx].napi_enabled == 1) { |
---|
| 1840 | + list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) |
---|
| 1841 | + napi_disable(napi); |
---|
| 1842 | + |
---|
| 1843 | + oct->props[lio->ifidx].napi_enabled = 0; |
---|
| 1844 | + |
---|
| 1845 | + if (OCTEON_CN23XX_PF(oct)) |
---|
| 1846 | + oct->droq[0]->ops.poll_mode = 0; |
---|
| 1847 | + } |
---|
| 1848 | + |
---|
| 1849 | + return ret; |
---|
1883 | 1850 | } |
---|
1884 | 1851 | |
---|
1885 | 1852 | /** |
---|
1886 | | - * \brief Net device stop for LiquidIO |
---|
1887 | | - * @param netdev network device |
---|
| 1853 | + * liquidio_stop - Net device stop for LiquidIO |
---|
| 1854 | + * @netdev: network device |
---|
1888 | 1855 | */ |
---|
1889 | 1856 | static int liquidio_stop(struct net_device *netdev) |
---|
1890 | 1857 | { |
---|
1891 | 1858 | struct lio *lio = GET_LIO(netdev); |
---|
1892 | 1859 | struct octeon_device *oct = lio->oct_dev; |
---|
| 1860 | + struct octeon_device_priv *oct_priv = |
---|
| 1861 | + (struct octeon_device_priv *)oct->priv; |
---|
1893 | 1862 | struct napi_struct *napi, *n; |
---|
| 1863 | + int ret = 0; |
---|
1894 | 1864 | |
---|
1895 | 1865 | ifstate_reset(lio, LIO_IFSTATE_RUNNING); |
---|
1896 | 1866 | |
---|
.. | .. |
---|
1907 | 1877 | lio->link_changes++; |
---|
1908 | 1878 | |
---|
1909 | 1879 | /* Tell Octeon that nic interface is down. */ |
---|
1910 | | - send_rx_ctrl_cmd(lio, 0); |
---|
| 1880 | + ret = send_rx_ctrl_cmd(lio, 0); |
---|
| 1881 | + if (ret) |
---|
| 1882 | + return ret; |
---|
1911 | 1883 | |
---|
1912 | 1884 | if (OCTEON_CN23XX_PF(oct)) { |
---|
1913 | 1885 | if (!oct->msix_on) |
---|
.. | .. |
---|
1915 | 1887 | } else { |
---|
1916 | 1888 | cleanup_tx_poll_fn(netdev); |
---|
1917 | 1889 | } |
---|
| 1890 | + |
---|
| 1891 | + cancel_delayed_work_sync(&lio->stats_wk.work); |
---|
1918 | 1892 | |
---|
1919 | 1893 | if (lio->ptp_clock) { |
---|
1920 | 1894 | ptp_clock_unregister(lio->ptp_clock); |
---|
.. | .. |
---|
1934 | 1908 | |
---|
1935 | 1909 | if (OCTEON_CN23XX_PF(oct)) |
---|
1936 | 1910 | oct->droq[0]->ops.poll_mode = 0; |
---|
| 1911 | + |
---|
| 1912 | + tasklet_enable(&oct_priv->droq_tasklet); |
---|
1937 | 1913 | } |
---|
1938 | 1914 | |
---|
1939 | 1915 | dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); |
---|
1940 | 1916 | |
---|
1941 | | - return 0; |
---|
| 1917 | + return ret; |
---|
1942 | 1918 | } |
---|
1943 | 1919 | |
---|
1944 | 1920 | /** |
---|
1945 | | - * \brief Converts a mask based on net device flags |
---|
1946 | | - * @param netdev network device |
---|
| 1921 | + * get_new_flags - Converts a mask based on net device flags |
---|
| 1922 | + * @netdev: network device |
---|
1947 | 1923 | * |
---|
1948 | 1924 | * This routine generates a octnet_ifflags mask from the net device flags |
---|
1949 | 1925 | * received from the OS. |
---|
.. | .. |
---|
1975 | 1951 | } |
---|
1976 | 1952 | |
---|
1977 | 1953 | /** |
---|
1978 | | - * \brief Net device set_multicast_list |
---|
1979 | | - * @param netdev network device |
---|
| 1954 | + * liquidio_set_mcast_list - Net device set_multicast_list |
---|
| 1955 | + * @netdev: network device |
---|
1980 | 1956 | */ |
---|
1981 | 1957 | static void liquidio_set_mcast_list(struct net_device *netdev) |
---|
1982 | 1958 | { |
---|
.. | .. |
---|
2014 | 1990 | /* Apparently, any activity in this call from the kernel has to |
---|
2015 | 1991 | * be atomic. So we won't wait for response. |
---|
2016 | 1992 | */ |
---|
2017 | | - nctrl.wait_time = 0; |
---|
2018 | 1993 | |
---|
2019 | 1994 | ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); |
---|
2020 | | - if (ret < 0) { |
---|
| 1995 | + if (ret) { |
---|
2021 | 1996 | dev_err(&oct->pci_dev->dev, "DEVFLAGS change failed in core (ret: 0x%x)\n", |
---|
2022 | 1997 | ret); |
---|
2023 | 1998 | } |
---|
2024 | 1999 | } |
---|
2025 | 2000 | |
---|
2026 | 2001 | /** |
---|
2027 | | - * \brief Net device set_mac_address |
---|
2028 | | - * @param netdev network device |
---|
| 2002 | + * liquidio_set_mac - Net device set_mac_address |
---|
| 2003 | + * @netdev: network device |
---|
| 2004 | + * @p: pointer to sockaddr |
---|
2029 | 2005 | */ |
---|
2030 | 2006 | static int liquidio_set_mac(struct net_device *netdev, void *p) |
---|
2031 | 2007 | { |
---|
.. | .. |
---|
2046 | 2022 | nctrl.ncmd.s.more = 1; |
---|
2047 | 2023 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2048 | 2024 | nctrl.netpndev = (u64)netdev; |
---|
2049 | | - nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2050 | | - nctrl.wait_time = 100; |
---|
2051 | 2025 | |
---|
2052 | 2026 | nctrl.udd[0] = 0; |
---|
2053 | 2027 | /* The MAC Address is presented in network byte order. */ |
---|
.. | .. |
---|
2058 | 2032 | dev_err(&oct->pci_dev->dev, "MAC Address change failed\n"); |
---|
2059 | 2033 | return -ENOMEM; |
---|
2060 | 2034 | } |
---|
| 2035 | + |
---|
| 2036 | + if (nctrl.sc_status) { |
---|
| 2037 | + dev_err(&oct->pci_dev->dev, |
---|
| 2038 | + "%s: MAC Address change failed. sc return=%x\n", |
---|
| 2039 | + __func__, nctrl.sc_status); |
---|
| 2040 | + return -EIO; |
---|
| 2041 | + } |
---|
| 2042 | + |
---|
2061 | 2043 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
---|
2062 | 2044 | memcpy(((u8 *)&lio->linfo.hw_addr) + 2, addr->sa_data, ETH_ALEN); |
---|
2063 | 2045 | |
---|
.. | .. |
---|
2111 | 2093 | lstats->rx_packets = pkts; |
---|
2112 | 2094 | lstats->rx_dropped = drop; |
---|
2113 | 2095 | |
---|
2114 | | - octnet_get_link_stats(netdev); |
---|
2115 | 2096 | lstats->multicast = oct->link_stats.fromwire.fw_total_mcast; |
---|
2116 | 2097 | lstats->collisions = oct->link_stats.fromhost.total_collisions; |
---|
2117 | 2098 | |
---|
.. | .. |
---|
2138 | 2119 | } |
---|
2139 | 2120 | |
---|
2140 | 2121 | /** |
---|
2141 | | - * \brief Handler for SIOCSHWTSTAMP ioctl |
---|
2142 | | - * @param netdev network device |
---|
2143 | | - * @param ifr interface request |
---|
2144 | | - * @param cmd command |
---|
| 2122 | + * hwtstamp_ioctl - Handler for SIOCSHWTSTAMP ioctl |
---|
| 2123 | + * @netdev: network device |
---|
| 2124 | + * @ifr: interface request |
---|
2145 | 2125 | */ |
---|
2146 | 2126 | static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr) |
---|
2147 | 2127 | { |
---|
.. | .. |
---|
2196 | 2176 | } |
---|
2197 | 2177 | |
---|
2198 | 2178 | /** |
---|
2199 | | - * \brief ioctl handler |
---|
2200 | | - * @param netdev network device |
---|
2201 | | - * @param ifr interface request |
---|
2202 | | - * @param cmd command |
---|
| 2179 | + * liquidio_ioctl - ioctl handler |
---|
| 2180 | + * @netdev: network device |
---|
| 2181 | + * @ifr: interface request |
---|
| 2182 | + * @cmd: command |
---|
2203 | 2183 | */ |
---|
2204 | 2184 | static int liquidio_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
---|
2205 | 2185 | { |
---|
.. | .. |
---|
2209 | 2189 | case SIOCSHWTSTAMP: |
---|
2210 | 2190 | if (lio->oct_dev->ptp_enable) |
---|
2211 | 2191 | return hwtstamp_ioctl(netdev, ifr); |
---|
2212 | | - /* fall through */ |
---|
| 2192 | + fallthrough; |
---|
2213 | 2193 | default: |
---|
2214 | 2194 | return -EOPNOTSUPP; |
---|
2215 | 2195 | } |
---|
2216 | 2196 | } |
---|
2217 | 2197 | |
---|
2218 | 2198 | /** |
---|
2219 | | - * \brief handle a Tx timestamp response |
---|
2220 | | - * @param status response status |
---|
2221 | | - * @param buf pointer to skb |
---|
| 2199 | + * handle_timestamp - handle a Tx timestamp response |
---|
| 2200 | + * @oct: octeon device |
---|
| 2201 | + * @status: response status |
---|
| 2202 | + * @buf: pointer to skb |
---|
2222 | 2203 | */ |
---|
2223 | 2204 | static void handle_timestamp(struct octeon_device *oct, |
---|
2224 | 2205 | u32 status, |
---|
.. | .. |
---|
2259 | 2240 | tx_buffer_free(skb); |
---|
2260 | 2241 | } |
---|
2261 | 2242 | |
---|
2262 | | -/* \brief Send a data packet that will be timestamped |
---|
2263 | | - * @param oct octeon device |
---|
2264 | | - * @param ndata pointer to network data |
---|
2265 | | - * @param finfo pointer to private network data |
---|
| 2243 | +/** |
---|
| 2244 | + * send_nic_timestamp_pkt - Send a data packet that will be timestamped |
---|
| 2245 | + * @oct: octeon device |
---|
| 2246 | + * @ndata: pointer to network data |
---|
| 2247 | + * @finfo: pointer to private network data |
---|
| 2248 | + * @xmit_more: more is coming |
---|
2266 | 2249 | */ |
---|
2267 | 2250 | static inline int send_nic_timestamp_pkt(struct octeon_device *oct, |
---|
2268 | 2251 | struct octnic_data_pkt *ndata, |
---|
.. | .. |
---|
2318 | 2301 | return retval; |
---|
2319 | 2302 | } |
---|
2320 | 2303 | |
---|
2321 | | -/** \brief Transmit networks packets to the Octeon interface |
---|
2322 | | - * @param skbuff skbuff struct to be passed to network layer. |
---|
2323 | | - * @param netdev pointer to network device |
---|
2324 | | - * @returns whether the packet was transmitted to the device okay or not |
---|
| 2304 | +/** |
---|
| 2305 | + * liquidio_xmit - Transmit networks packets to the Octeon interface |
---|
| 2306 | + * @skb: skbuff struct to be passed to network layer. |
---|
| 2307 | + * @netdev: pointer to network device |
---|
| 2308 | + * |
---|
| 2309 | + * Return: whether the packet was transmitted to the device okay or not |
---|
2325 | 2310 | * (NETDEV_TX_OK or NETDEV_TX_BUSY) |
---|
2326 | 2311 | */ |
---|
2327 | 2312 | static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) |
---|
.. | .. |
---|
2431 | 2416 | |
---|
2432 | 2417 | } else { |
---|
2433 | 2418 | int i, frags; |
---|
2434 | | - struct skb_frag_struct *frag; |
---|
| 2419 | + skb_frag_t *frag; |
---|
2435 | 2420 | struct octnic_gather *g; |
---|
2436 | 2421 | |
---|
2437 | 2422 | spin_lock(&lio->glist_lock[q_idx]); |
---|
.. | .. |
---|
2469 | 2454 | frag = &skb_shinfo(skb)->frags[i - 1]; |
---|
2470 | 2455 | |
---|
2471 | 2456 | g->sg[(i >> 2)].ptr[(i & 3)] = |
---|
2472 | | - dma_map_page(&oct->pci_dev->dev, |
---|
2473 | | - frag->page.p, |
---|
2474 | | - frag->page_offset, |
---|
2475 | | - frag->size, |
---|
2476 | | - DMA_TO_DEVICE); |
---|
| 2457 | + skb_frag_dma_map(&oct->pci_dev->dev, |
---|
| 2458 | + frag, 0, skb_frag_size(frag), |
---|
| 2459 | + DMA_TO_DEVICE); |
---|
2477 | 2460 | |
---|
2478 | 2461 | if (dma_mapping_error(&oct->pci_dev->dev, |
---|
2479 | 2462 | g->sg[i >> 2].ptr[i & 3])) { |
---|
.. | .. |
---|
2485 | 2468 | frag = &skb_shinfo(skb)->frags[j - 1]; |
---|
2486 | 2469 | dma_unmap_page(&oct->pci_dev->dev, |
---|
2487 | 2470 | g->sg[j >> 2].ptr[j & 3], |
---|
2488 | | - frag->size, |
---|
| 2471 | + skb_frag_size(frag), |
---|
2489 | 2472 | DMA_TO_DEVICE); |
---|
2490 | 2473 | } |
---|
2491 | 2474 | dev_err(&oct->pci_dev->dev, "%s DMA mapping error 3\n", |
---|
.. | .. |
---|
2493 | 2476 | return NETDEV_TX_BUSY; |
---|
2494 | 2477 | } |
---|
2495 | 2478 | |
---|
2496 | | - add_sg_size(&g->sg[(i >> 2)], frag->size, (i & 3)); |
---|
| 2479 | + add_sg_size(&g->sg[(i >> 2)], skb_frag_size(frag), |
---|
| 2480 | + (i & 3)); |
---|
2497 | 2481 | i++; |
---|
2498 | 2482 | } |
---|
2499 | 2483 | |
---|
.. | .. |
---|
2529 | 2513 | irh->vlan = skb_vlan_tag_get(skb) & 0xfff; |
---|
2530 | 2514 | } |
---|
2531 | 2515 | |
---|
2532 | | - xmit_more = skb->xmit_more; |
---|
| 2516 | + xmit_more = netdev_xmit_more(); |
---|
2533 | 2517 | |
---|
2534 | 2518 | if (unlikely(cmdsetup.s.timestamp)) |
---|
2535 | 2519 | status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more); |
---|
.. | .. |
---|
2567 | 2551 | return NETDEV_TX_OK; |
---|
2568 | 2552 | } |
---|
2569 | 2553 | |
---|
2570 | | -/** \brief Network device Tx timeout |
---|
2571 | | - * @param netdev pointer to network device |
---|
| 2554 | +/** |
---|
| 2555 | + * liquidio_tx_timeout - Network device Tx timeout |
---|
| 2556 | + * @netdev: pointer to network device |
---|
| 2557 | + * @txqueue: index of the hung transmit queue |
---|
2572 | 2558 | */ |
---|
2573 | | -static void liquidio_tx_timeout(struct net_device *netdev) |
---|
| 2559 | +static void liquidio_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
---|
2574 | 2560 | { |
---|
2575 | 2561 | struct lio *lio; |
---|
2576 | 2562 | |
---|
.. | .. |
---|
2598 | 2584 | nctrl.ncmd.s.cmd = OCTNET_CMD_ADD_VLAN_FILTER; |
---|
2599 | 2585 | nctrl.ncmd.s.param1 = vid; |
---|
2600 | 2586 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2601 | | - nctrl.wait_time = 100; |
---|
2602 | 2587 | nctrl.netpndev = (u64)netdev; |
---|
2603 | 2588 | nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2604 | 2589 | |
---|
2605 | 2590 | ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); |
---|
2606 | | - if (ret < 0) { |
---|
| 2591 | + if (ret) { |
---|
2607 | 2592 | dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n", |
---|
2608 | 2593 | ret); |
---|
| 2594 | + if (ret > 0) |
---|
| 2595 | + ret = -EIO; |
---|
2609 | 2596 | } |
---|
2610 | 2597 | |
---|
2611 | 2598 | return ret; |
---|
.. | .. |
---|
2626 | 2613 | nctrl.ncmd.s.cmd = OCTNET_CMD_DEL_VLAN_FILTER; |
---|
2627 | 2614 | nctrl.ncmd.s.param1 = vid; |
---|
2628 | 2615 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2629 | | - nctrl.wait_time = 100; |
---|
2630 | 2616 | nctrl.netpndev = (u64)netdev; |
---|
2631 | 2617 | nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2632 | 2618 | |
---|
2633 | 2619 | ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); |
---|
2634 | | - if (ret < 0) { |
---|
| 2620 | + if (ret) { |
---|
2635 | 2621 | dev_err(&oct->pci_dev->dev, "Del VLAN filter failed in core (ret: 0x%x)\n", |
---|
2636 | 2622 | ret); |
---|
| 2623 | + if (ret > 0) |
---|
| 2624 | + ret = -EIO; |
---|
2637 | 2625 | } |
---|
2638 | 2626 | return ret; |
---|
2639 | 2627 | } |
---|
2640 | 2628 | |
---|
2641 | | -/** Sending command to enable/disable RX checksum offload |
---|
2642 | | - * @param netdev pointer to network device |
---|
2643 | | - * @param command OCTNET_CMD_TNL_RX_CSUM_CTL |
---|
2644 | | - * @param rx_cmd_bit OCTNET_CMD_RXCSUM_ENABLE/ |
---|
2645 | | - * OCTNET_CMD_RXCSUM_DISABLE |
---|
2646 | | - * @returns SUCCESS or FAILURE |
---|
| 2629 | +/** |
---|
| 2630 | + * liquidio_set_rxcsum_command - Sending command to enable/disable RX checksum offload |
---|
| 2631 | + * @netdev: pointer to network device |
---|
| 2632 | + * @command: OCTNET_CMD_TNL_RX_CSUM_CTL |
---|
| 2633 | + * @rx_cmd: OCTNET_CMD_RXCSUM_ENABLE/OCTNET_CMD_RXCSUM_DISABLE |
---|
| 2634 | + * Returns: SUCCESS or FAILURE |
---|
2647 | 2635 | */ |
---|
2648 | 2636 | static int liquidio_set_rxcsum_command(struct net_device *netdev, int command, |
---|
2649 | 2637 | u8 rx_cmd) |
---|
.. | .. |
---|
2659 | 2647 | nctrl.ncmd.s.cmd = command; |
---|
2660 | 2648 | nctrl.ncmd.s.param1 = rx_cmd; |
---|
2661 | 2649 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2662 | | - nctrl.wait_time = 100; |
---|
2663 | 2650 | nctrl.netpndev = (u64)netdev; |
---|
2664 | 2651 | nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2665 | 2652 | |
---|
2666 | 2653 | ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); |
---|
2667 | | - if (ret < 0) { |
---|
| 2654 | + if (ret) { |
---|
2668 | 2655 | dev_err(&oct->pci_dev->dev, |
---|
2669 | 2656 | "DEVFLAGS RXCSUM change failed in core(ret:0x%x)\n", |
---|
2670 | 2657 | ret); |
---|
| 2658 | + if (ret > 0) |
---|
| 2659 | + ret = -EIO; |
---|
2671 | 2660 | } |
---|
2672 | 2661 | return ret; |
---|
2673 | 2662 | } |
---|
2674 | 2663 | |
---|
2675 | | -/** Sending command to add/delete VxLAN UDP port to firmware |
---|
2676 | | - * @param netdev pointer to network device |
---|
2677 | | - * @param command OCTNET_CMD_VXLAN_PORT_CONFIG |
---|
2678 | | - * @param vxlan_port VxLAN port to be added or deleted |
---|
2679 | | - * @param vxlan_cmd_bit OCTNET_CMD_VXLAN_PORT_ADD, |
---|
| 2664 | +/** |
---|
| 2665 | + * liquidio_vxlan_port_command - Sending command to add/delete VxLAN UDP port to firmware |
---|
| 2666 | + * @netdev: pointer to network device |
---|
| 2667 | + * @command: OCTNET_CMD_VXLAN_PORT_CONFIG |
---|
| 2668 | + * @vxlan_port: VxLAN port to be added or deleted |
---|
| 2669 | + * @vxlan_cmd_bit: OCTNET_CMD_VXLAN_PORT_ADD, |
---|
2680 | 2670 | * OCTNET_CMD_VXLAN_PORT_DEL |
---|
2681 | | - * @returns SUCCESS or FAILURE |
---|
| 2671 | + * Return: SUCCESS or FAILURE |
---|
2682 | 2672 | */ |
---|
2683 | 2673 | static int liquidio_vxlan_port_command(struct net_device *netdev, int command, |
---|
2684 | 2674 | u16 vxlan_port, u8 vxlan_cmd_bit) |
---|
.. | .. |
---|
2695 | 2685 | nctrl.ncmd.s.more = vxlan_cmd_bit; |
---|
2696 | 2686 | nctrl.ncmd.s.param1 = vxlan_port; |
---|
2697 | 2687 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2698 | | - nctrl.wait_time = 100; |
---|
2699 | 2688 | nctrl.netpndev = (u64)netdev; |
---|
2700 | 2689 | nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2701 | 2690 | |
---|
2702 | 2691 | ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); |
---|
2703 | | - if (ret < 0) { |
---|
| 2692 | + if (ret) { |
---|
2704 | 2693 | dev_err(&oct->pci_dev->dev, |
---|
2705 | 2694 | "VxLAN port add/delete failed in core (ret:0x%x)\n", |
---|
2706 | 2695 | ret); |
---|
| 2696 | + if (ret > 0) |
---|
| 2697 | + ret = -EIO; |
---|
2707 | 2698 | } |
---|
2708 | 2699 | return ret; |
---|
2709 | 2700 | } |
---|
2710 | 2701 | |
---|
2711 | | -/** \brief Net device fix features |
---|
2712 | | - * @param netdev pointer to network device |
---|
2713 | | - * @param request features requested |
---|
2714 | | - * @returns updated features list |
---|
| 2702 | +static int liquidio_udp_tunnel_set_port(struct net_device *netdev, |
---|
| 2703 | + unsigned int table, unsigned int entry, |
---|
| 2704 | + struct udp_tunnel_info *ti) |
---|
| 2705 | +{ |
---|
| 2706 | + return liquidio_vxlan_port_command(netdev, |
---|
| 2707 | + OCTNET_CMD_VXLAN_PORT_CONFIG, |
---|
| 2708 | + htons(ti->port), |
---|
| 2709 | + OCTNET_CMD_VXLAN_PORT_ADD); |
---|
| 2710 | +} |
---|
| 2711 | + |
---|
| 2712 | +static int liquidio_udp_tunnel_unset_port(struct net_device *netdev, |
---|
| 2713 | + unsigned int table, |
---|
| 2714 | + unsigned int entry, |
---|
| 2715 | + struct udp_tunnel_info *ti) |
---|
| 2716 | +{ |
---|
| 2717 | + return liquidio_vxlan_port_command(netdev, |
---|
| 2718 | + OCTNET_CMD_VXLAN_PORT_CONFIG, |
---|
| 2719 | + htons(ti->port), |
---|
| 2720 | + OCTNET_CMD_VXLAN_PORT_DEL); |
---|
| 2721 | +} |
---|
| 2722 | + |
---|
| 2723 | +static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { |
---|
| 2724 | + .set_port = liquidio_udp_tunnel_set_port, |
---|
| 2725 | + .unset_port = liquidio_udp_tunnel_unset_port, |
---|
| 2726 | + .tables = { |
---|
| 2727 | + { .n_entries = 1024, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, }, |
---|
| 2728 | + }, |
---|
| 2729 | +}; |
---|
| 2730 | + |
---|
| 2731 | +/** |
---|
| 2732 | + * liquidio_fix_features - Net device fix features |
---|
| 2733 | + * @netdev: pointer to network device |
---|
| 2734 | + * @request: features requested |
---|
| 2735 | + * Return: updated features list |
---|
2715 | 2736 | */ |
---|
2716 | 2737 | static netdev_features_t liquidio_fix_features(struct net_device *netdev, |
---|
2717 | 2738 | netdev_features_t request) |
---|
.. | .. |
---|
2747 | 2768 | return request; |
---|
2748 | 2769 | } |
---|
2749 | 2770 | |
---|
2750 | | -/** \brief Net device set features |
---|
2751 | | - * @param netdev pointer to network device |
---|
2752 | | - * @param features features to enable/disable |
---|
| 2771 | +/** |
---|
| 2772 | + * liquidio_set_features - Net device set features |
---|
| 2773 | + * @netdev: pointer to network device |
---|
| 2774 | + * @features: features to enable/disable |
---|
2753 | 2775 | */ |
---|
2754 | 2776 | static int liquidio_set_features(struct net_device *netdev, |
---|
2755 | 2777 | netdev_features_t features) |
---|
.. | .. |
---|
2796 | 2818 | return 0; |
---|
2797 | 2819 | } |
---|
2798 | 2820 | |
---|
2799 | | -static void liquidio_add_vxlan_port(struct net_device *netdev, |
---|
2800 | | - struct udp_tunnel_info *ti) |
---|
2801 | | -{ |
---|
2802 | | - if (ti->type != UDP_TUNNEL_TYPE_VXLAN) |
---|
2803 | | - return; |
---|
2804 | | - |
---|
2805 | | - liquidio_vxlan_port_command(netdev, |
---|
2806 | | - OCTNET_CMD_VXLAN_PORT_CONFIG, |
---|
2807 | | - htons(ti->port), |
---|
2808 | | - OCTNET_CMD_VXLAN_PORT_ADD); |
---|
2809 | | -} |
---|
2810 | | - |
---|
2811 | | -static void liquidio_del_vxlan_port(struct net_device *netdev, |
---|
2812 | | - struct udp_tunnel_info *ti) |
---|
2813 | | -{ |
---|
2814 | | - if (ti->type != UDP_TUNNEL_TYPE_VXLAN) |
---|
2815 | | - return; |
---|
2816 | | - |
---|
2817 | | - liquidio_vxlan_port_command(netdev, |
---|
2818 | | - OCTNET_CMD_VXLAN_PORT_CONFIG, |
---|
2819 | | - htons(ti->port), |
---|
2820 | | - OCTNET_CMD_VXLAN_PORT_DEL); |
---|
2821 | | -} |
---|
2822 | | - |
---|
2823 | 2821 | static int __liquidio_set_vf_mac(struct net_device *netdev, int vfidx, |
---|
2824 | 2822 | u8 *mac, bool is_admin_assigned) |
---|
2825 | 2823 | { |
---|
2826 | 2824 | struct lio *lio = GET_LIO(netdev); |
---|
2827 | 2825 | struct octeon_device *oct = lio->oct_dev; |
---|
2828 | 2826 | struct octnic_ctrl_pkt nctrl; |
---|
| 2827 | + int ret = 0; |
---|
2829 | 2828 | |
---|
2830 | 2829 | if (!is_valid_ether_addr(mac)) |
---|
2831 | 2830 | return -EINVAL; |
---|
.. | .. |
---|
2839 | 2838 | nctrl.ncmd.s.cmd = OCTNET_CMD_CHANGE_MACADDR; |
---|
2840 | 2839 | /* vfidx is 0 based, but vf_num (param1) is 1 based */ |
---|
2841 | 2840 | nctrl.ncmd.s.param1 = vfidx + 1; |
---|
2842 | | - nctrl.ncmd.s.param2 = (is_admin_assigned ? 1 : 0); |
---|
2843 | 2841 | nctrl.ncmd.s.more = 1; |
---|
2844 | 2842 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2845 | 2843 | nctrl.netpndev = (u64)netdev; |
---|
2846 | | - nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
2847 | | - nctrl.wait_time = LIO_CMD_WAIT_TM; |
---|
| 2844 | + if (is_admin_assigned) { |
---|
| 2845 | + nctrl.ncmd.s.param2 = true; |
---|
| 2846 | + nctrl.cb_fn = liquidio_link_ctrl_cmd_completion; |
---|
| 2847 | + } |
---|
2848 | 2848 | |
---|
2849 | 2849 | nctrl.udd[0] = 0; |
---|
2850 | 2850 | /* The MAC Address is presented in network byte order. */ |
---|
.. | .. |
---|
2852 | 2852 | |
---|
2853 | 2853 | oct->sriov_info.vf_macaddr[vfidx] = nctrl.udd[0]; |
---|
2854 | 2854 | |
---|
2855 | | - octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 2855 | + ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 2856 | + if (ret > 0) |
---|
| 2857 | + ret = -EIO; |
---|
2856 | 2858 | |
---|
2857 | | - return 0; |
---|
| 2859 | + return ret; |
---|
2858 | 2860 | } |
---|
2859 | 2861 | |
---|
2860 | 2862 | static int liquidio_set_vf_mac(struct net_device *netdev, int vfidx, u8 *mac) |
---|
.. | .. |
---|
2873 | 2875 | return retval; |
---|
2874 | 2876 | } |
---|
2875 | 2877 | |
---|
| 2878 | +static int liquidio_set_vf_spoofchk(struct net_device *netdev, int vfidx, |
---|
| 2879 | + bool enable) |
---|
| 2880 | +{ |
---|
| 2881 | + struct lio *lio = GET_LIO(netdev); |
---|
| 2882 | + struct octeon_device *oct = lio->oct_dev; |
---|
| 2883 | + struct octnic_ctrl_pkt nctrl; |
---|
| 2884 | + int retval; |
---|
| 2885 | + |
---|
| 2886 | + if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SPOOFCHK_CAP)) { |
---|
| 2887 | + netif_info(lio, drv, lio->netdev, |
---|
| 2888 | + "firmware does not support spoofchk\n"); |
---|
| 2889 | + return -EOPNOTSUPP; |
---|
| 2890 | + } |
---|
| 2891 | + |
---|
| 2892 | + if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) { |
---|
| 2893 | + netif_info(lio, drv, lio->netdev, "Invalid vfidx %d\n", vfidx); |
---|
| 2894 | + return -EINVAL; |
---|
| 2895 | + } |
---|
| 2896 | + |
---|
| 2897 | + if (enable) { |
---|
| 2898 | + if (oct->sriov_info.vf_spoofchk[vfidx]) |
---|
| 2899 | + return 0; |
---|
| 2900 | + } else { |
---|
| 2901 | + /* Clear */ |
---|
| 2902 | + if (!oct->sriov_info.vf_spoofchk[vfidx]) |
---|
| 2903 | + return 0; |
---|
| 2904 | + } |
---|
| 2905 | + |
---|
| 2906 | + memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt)); |
---|
| 2907 | + nctrl.ncmd.s.cmdgroup = OCTNET_CMD_GROUP1; |
---|
| 2908 | + nctrl.ncmd.s.cmd = OCTNET_CMD_SET_VF_SPOOFCHK; |
---|
| 2909 | + nctrl.ncmd.s.param1 = |
---|
| 2910 | + vfidx + 1; /* vfidx is 0 based, |
---|
| 2911 | + * but vf_num (param1) is 1 based |
---|
| 2912 | + */ |
---|
| 2913 | + nctrl.ncmd.s.param2 = enable; |
---|
| 2914 | + nctrl.ncmd.s.more = 0; |
---|
| 2915 | + nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
| 2916 | + nctrl.cb_fn = NULL; |
---|
| 2917 | + |
---|
| 2918 | + retval = octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 2919 | + |
---|
| 2920 | + if (retval) { |
---|
| 2921 | + netif_info(lio, drv, lio->netdev, |
---|
| 2922 | + "Failed to set VF %d spoofchk %s\n", vfidx, |
---|
| 2923 | + enable ? "on" : "off"); |
---|
| 2924 | + return -1; |
---|
| 2925 | + } |
---|
| 2926 | + |
---|
| 2927 | + oct->sriov_info.vf_spoofchk[vfidx] = enable; |
---|
| 2928 | + netif_info(lio, drv, lio->netdev, "VF %u spoofchk is %s\n", vfidx, |
---|
| 2929 | + enable ? "on" : "off"); |
---|
| 2930 | + |
---|
| 2931 | + return 0; |
---|
| 2932 | +} |
---|
| 2933 | + |
---|
2876 | 2934 | static int liquidio_set_vf_vlan(struct net_device *netdev, int vfidx, |
---|
2877 | 2935 | u16 vlan, u8 qos, __be16 vlan_proto) |
---|
2878 | 2936 | { |
---|
.. | .. |
---|
2880 | 2938 | struct octeon_device *oct = lio->oct_dev; |
---|
2881 | 2939 | struct octnic_ctrl_pkt nctrl; |
---|
2882 | 2940 | u16 vlantci; |
---|
| 2941 | + int ret = 0; |
---|
2883 | 2942 | |
---|
2884 | 2943 | if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) |
---|
2885 | 2944 | return -EINVAL; |
---|
.. | .. |
---|
2911 | 2970 | nctrl.ncmd.s.more = 0; |
---|
2912 | 2971 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2913 | 2972 | nctrl.cb_fn = NULL; |
---|
2914 | | - nctrl.wait_time = LIO_CMD_WAIT_TM; |
---|
2915 | 2973 | |
---|
2916 | | - octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 2974 | + ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 2975 | + if (ret) { |
---|
| 2976 | + if (ret > 0) |
---|
| 2977 | + ret = -EIO; |
---|
| 2978 | + return ret; |
---|
| 2979 | + } |
---|
2917 | 2980 | |
---|
2918 | 2981 | oct->sriov_info.vf_vlantci[vfidx] = vlantci; |
---|
2919 | 2982 | |
---|
2920 | | - return 0; |
---|
| 2983 | + return ret; |
---|
2921 | 2984 | } |
---|
2922 | 2985 | |
---|
2923 | 2986 | static int liquidio_get_vf_config(struct net_device *netdev, int vfidx, |
---|
.. | .. |
---|
2930 | 2993 | if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) |
---|
2931 | 2994 | return -EINVAL; |
---|
2932 | 2995 | |
---|
| 2996 | + memset(ivi, 0, sizeof(struct ifla_vf_info)); |
---|
| 2997 | + |
---|
2933 | 2998 | ivi->vf = vfidx; |
---|
2934 | 2999 | macaddr = 2 + (u8 *)&oct->sriov_info.vf_macaddr[vfidx]; |
---|
2935 | 3000 | ether_addr_copy(&ivi->mac[0], macaddr); |
---|
.. | .. |
---|
2941 | 3006 | else |
---|
2942 | 3007 | ivi->trusted = false; |
---|
2943 | 3008 | ivi->linkstate = oct->sriov_info.vf_linkstate[vfidx]; |
---|
| 3009 | + ivi->spoofchk = oct->sriov_info.vf_spoofchk[vfidx]; |
---|
| 3010 | + ivi->max_tx_rate = lio->linfo.link.s.speed; |
---|
| 3011 | + ivi->min_tx_rate = 0; |
---|
| 3012 | + |
---|
2944 | 3013 | return 0; |
---|
2945 | | -} |
---|
2946 | | - |
---|
2947 | | -static void trusted_vf_callback(struct octeon_device *oct_dev, |
---|
2948 | | - u32 status, void *ptr) |
---|
2949 | | -{ |
---|
2950 | | - struct octeon_soft_command *sc = (struct octeon_soft_command *)ptr; |
---|
2951 | | - struct lio_trusted_vf_ctx *ctx; |
---|
2952 | | - |
---|
2953 | | - ctx = (struct lio_trusted_vf_ctx *)sc->ctxptr; |
---|
2954 | | - ctx->status = status; |
---|
2955 | | - |
---|
2956 | | - complete(&ctx->complete); |
---|
2957 | 3014 | } |
---|
2958 | 3015 | |
---|
2959 | 3016 | static int liquidio_send_vf_trust_cmd(struct lio *lio, int vfidx, bool trusted) |
---|
2960 | 3017 | { |
---|
2961 | 3018 | struct octeon_device *oct = lio->oct_dev; |
---|
2962 | | - struct lio_trusted_vf_ctx *ctx; |
---|
2963 | 3019 | struct octeon_soft_command *sc; |
---|
2964 | | - int ctx_size, retval; |
---|
| 3020 | + int retval; |
---|
2965 | 3021 | |
---|
2966 | | - ctx_size = sizeof(struct lio_trusted_vf_ctx); |
---|
2967 | | - sc = octeon_alloc_soft_command(oct, 0, 0, ctx_size); |
---|
2968 | | - |
---|
2969 | | - ctx = (struct lio_trusted_vf_ctx *)sc->ctxptr; |
---|
2970 | | - init_completion(&ctx->complete); |
---|
| 3022 | + sc = octeon_alloc_soft_command(oct, 0, 16, 0); |
---|
| 3023 | + if (!sc) |
---|
| 3024 | + return -ENOMEM; |
---|
2971 | 3025 | |
---|
2972 | 3026 | sc->iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
2973 | 3027 | |
---|
.. | .. |
---|
2976 | 3030 | OPCODE_NIC_SET_TRUSTED_VF, 0, vfidx + 1, |
---|
2977 | 3031 | trusted); |
---|
2978 | 3032 | |
---|
2979 | | - sc->callback = trusted_vf_callback; |
---|
2980 | | - sc->callback_arg = sc; |
---|
2981 | | - sc->wait_time = 1000; |
---|
| 3033 | + init_completion(&sc->complete); |
---|
| 3034 | + sc->sc_status = OCTEON_REQUEST_PENDING; |
---|
2982 | 3035 | |
---|
2983 | 3036 | retval = octeon_send_soft_command(oct, sc); |
---|
2984 | 3037 | if (retval == IQ_SEND_FAILED) { |
---|
| 3038 | + octeon_free_soft_command(oct, sc); |
---|
2985 | 3039 | retval = -1; |
---|
2986 | 3040 | } else { |
---|
2987 | 3041 | /* Wait for response or timeout */ |
---|
2988 | | - if (wait_for_completion_timeout(&ctx->complete, |
---|
2989 | | - msecs_to_jiffies(2000))) |
---|
2990 | | - retval = ctx->status; |
---|
2991 | | - else |
---|
2992 | | - retval = -1; |
---|
2993 | | - } |
---|
| 3042 | + retval = wait_for_sc_completion_timeout(oct, sc, 0); |
---|
| 3043 | + if (retval) |
---|
| 3044 | + return (retval); |
---|
2994 | 3045 | |
---|
2995 | | - octeon_free_soft_command(oct, sc); |
---|
| 3046 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3047 | + } |
---|
2996 | 3048 | |
---|
2997 | 3049 | return retval; |
---|
2998 | 3050 | } |
---|
.. | .. |
---|
3055 | 3107 | struct lio *lio = GET_LIO(netdev); |
---|
3056 | 3108 | struct octeon_device *oct = lio->oct_dev; |
---|
3057 | 3109 | struct octnic_ctrl_pkt nctrl; |
---|
| 3110 | + int ret = 0; |
---|
3058 | 3111 | |
---|
3059 | 3112 | if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) |
---|
3060 | 3113 | return -EINVAL; |
---|
.. | .. |
---|
3070 | 3123 | nctrl.ncmd.s.more = 0; |
---|
3071 | 3124 | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; |
---|
3072 | 3125 | nctrl.cb_fn = NULL; |
---|
3073 | | - nctrl.wait_time = LIO_CMD_WAIT_TM; |
---|
3074 | 3126 | |
---|
3075 | | - octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
| 3127 | + ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); |
---|
3076 | 3128 | |
---|
3077 | | - oct->sriov_info.vf_linkstate[vfidx] = linkstate; |
---|
| 3129 | + if (!ret) |
---|
| 3130 | + oct->sriov_info.vf_linkstate[vfidx] = linkstate; |
---|
| 3131 | + else if (ret > 0) |
---|
| 3132 | + ret = -EIO; |
---|
3078 | 3133 | |
---|
3079 | | - return 0; |
---|
| 3134 | + return ret; |
---|
3080 | 3135 | } |
---|
3081 | 3136 | |
---|
3082 | 3137 | static int |
---|
.. | .. |
---|
3094 | 3149 | } |
---|
3095 | 3150 | |
---|
3096 | 3151 | static int |
---|
3097 | | -liquidio_eswitch_mode_set(struct devlink *devlink, u16 mode) |
---|
| 3152 | +liquidio_eswitch_mode_set(struct devlink *devlink, u16 mode, |
---|
| 3153 | + struct netlink_ext_ack *extack) |
---|
3098 | 3154 | { |
---|
3099 | 3155 | struct lio_devlink_priv *priv; |
---|
3100 | 3156 | struct octeon_device *oct; |
---|
.. | .. |
---|
3133 | 3189 | }; |
---|
3134 | 3190 | |
---|
3135 | 3191 | static int |
---|
3136 | | -lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr) |
---|
| 3192 | +liquidio_get_port_parent_id(struct net_device *dev, |
---|
| 3193 | + struct netdev_phys_item_id *ppid) |
---|
3137 | 3194 | { |
---|
3138 | 3195 | struct lio *lio = GET_LIO(dev); |
---|
3139 | 3196 | struct octeon_device *oct = lio->oct_dev; |
---|
.. | .. |
---|
3141 | 3198 | if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV) |
---|
3142 | 3199 | return -EOPNOTSUPP; |
---|
3143 | 3200 | |
---|
3144 | | - switch (attr->id) { |
---|
3145 | | - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: |
---|
3146 | | - attr->u.ppid.id_len = ETH_ALEN; |
---|
3147 | | - ether_addr_copy(attr->u.ppid.id, |
---|
3148 | | - (void *)&lio->linfo.hw_addr + 2); |
---|
3149 | | - break; |
---|
3150 | | - |
---|
3151 | | - default: |
---|
3152 | | - return -EOPNOTSUPP; |
---|
3153 | | - } |
---|
| 3201 | + ppid->id_len = ETH_ALEN; |
---|
| 3202 | + ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2); |
---|
3154 | 3203 | |
---|
3155 | 3204 | return 0; |
---|
3156 | 3205 | } |
---|
3157 | | - |
---|
3158 | | -static const struct switchdev_ops lio_pf_switchdev_ops = { |
---|
3159 | | - .switchdev_port_attr_get = lio_pf_switchdev_attr_get, |
---|
3160 | | -}; |
---|
3161 | 3206 | |
---|
3162 | 3207 | static int liquidio_get_vf_stats(struct net_device *netdev, int vfidx, |
---|
3163 | 3208 | struct ifla_vf_stats *vf_stats) |
---|
.. | .. |
---|
3199 | 3244 | .ndo_do_ioctl = liquidio_ioctl, |
---|
3200 | 3245 | .ndo_fix_features = liquidio_fix_features, |
---|
3201 | 3246 | .ndo_set_features = liquidio_set_features, |
---|
3202 | | - .ndo_udp_tunnel_add = liquidio_add_vxlan_port, |
---|
3203 | | - .ndo_udp_tunnel_del = liquidio_del_vxlan_port, |
---|
| 3247 | + .ndo_udp_tunnel_add = udp_tunnel_nic_add_port, |
---|
| 3248 | + .ndo_udp_tunnel_del = udp_tunnel_nic_del_port, |
---|
3204 | 3249 | .ndo_set_vf_mac = liquidio_set_vf_mac, |
---|
3205 | 3250 | .ndo_set_vf_vlan = liquidio_set_vf_vlan, |
---|
3206 | 3251 | .ndo_get_vf_config = liquidio_get_vf_config, |
---|
| 3252 | + .ndo_set_vf_spoofchk = liquidio_set_vf_spoofchk, |
---|
3207 | 3253 | .ndo_set_vf_trust = liquidio_set_vf_trust, |
---|
3208 | 3254 | .ndo_set_vf_link_state = liquidio_set_vf_link_state, |
---|
3209 | 3255 | .ndo_get_vf_stats = liquidio_get_vf_stats, |
---|
| 3256 | + .ndo_get_port_parent_id = liquidio_get_port_parent_id, |
---|
3210 | 3257 | }; |
---|
3211 | 3258 | |
---|
3212 | | -/** \brief Entry point for the liquidio module |
---|
| 3259 | +/** |
---|
| 3260 | + * liquidio_init - Entry point for the liquidio module |
---|
3213 | 3261 | */ |
---|
3214 | 3262 | static int __init liquidio_init(void) |
---|
3215 | 3263 | { |
---|
.. | .. |
---|
3292 | 3340 | } |
---|
3293 | 3341 | |
---|
3294 | 3342 | /** |
---|
3295 | | - * \brief Setup network interfaces |
---|
3296 | | - * @param octeon_dev octeon device |
---|
| 3343 | + * setup_nic_devices - Setup network interfaces |
---|
| 3344 | + * @octeon_dev: octeon device |
---|
3297 | 3345 | * |
---|
3298 | 3346 | * Called during init time for each device. It assumes the NIC |
---|
3299 | 3347 | * is already up and running. The link information for each |
---|
.. | .. |
---|
3307 | 3355 | unsigned long micro; |
---|
3308 | 3356 | u32 cur_ver; |
---|
3309 | 3357 | struct octeon_soft_command *sc; |
---|
3310 | | - struct liquidio_if_cfg_context *ctx; |
---|
3311 | 3358 | struct liquidio_if_cfg_resp *resp; |
---|
3312 | 3359 | struct octdev_props *props; |
---|
3313 | 3360 | int retval, num_iqueues, num_oqueues; |
---|
.. | .. |
---|
3315 | 3362 | union oct_nic_if_cfg if_cfg; |
---|
3316 | 3363 | unsigned int base_queue; |
---|
3317 | 3364 | unsigned int gmx_port_id; |
---|
3318 | | - u32 resp_size, ctx_size, data_size; |
---|
| 3365 | + u32 resp_size, data_size; |
---|
3319 | 3366 | u32 ifidx_or_pfnum; |
---|
3320 | 3367 | struct lio_version *vdata; |
---|
3321 | 3368 | struct devlink *devlink; |
---|
.. | .. |
---|
3340 | 3387 | |
---|
3341 | 3388 | for (i = 0; i < octeon_dev->ifcount; i++) { |
---|
3342 | 3389 | resp_size = sizeof(struct liquidio_if_cfg_resp); |
---|
3343 | | - ctx_size = sizeof(struct liquidio_if_cfg_context); |
---|
3344 | 3390 | data_size = sizeof(struct lio_version); |
---|
3345 | 3391 | sc = (struct octeon_soft_command *) |
---|
3346 | 3392 | octeon_alloc_soft_command(octeon_dev, data_size, |
---|
3347 | | - resp_size, ctx_size); |
---|
| 3393 | + resp_size, 0); |
---|
3348 | 3394 | resp = (struct liquidio_if_cfg_resp *)sc->virtrptr; |
---|
3349 | | - ctx = (struct liquidio_if_cfg_context *)sc->ctxptr; |
---|
3350 | 3395 | vdata = (struct lio_version *)sc->virtdptr; |
---|
3351 | 3396 | |
---|
3352 | 3397 | *((u64 *)vdata) = 0; |
---|
.. | .. |
---|
3376 | 3421 | dev_dbg(&octeon_dev->pci_dev->dev, |
---|
3377 | 3422 | "requesting config for interface %d, iqs %d, oqs %d\n", |
---|
3378 | 3423 | ifidx_or_pfnum, num_iqueues, num_oqueues); |
---|
3379 | | - WRITE_ONCE(ctx->cond, 0); |
---|
3380 | | - ctx->octeon_id = lio_get_device_id(octeon_dev); |
---|
3381 | | - init_waitqueue_head(&ctx->wc); |
---|
3382 | 3424 | |
---|
3383 | 3425 | if_cfg.u64 = 0; |
---|
3384 | 3426 | if_cfg.s.num_iqueues = num_iqueues; |
---|
.. | .. |
---|
3392 | 3434 | OPCODE_NIC_IF_CFG, 0, |
---|
3393 | 3435 | if_cfg.u64, 0); |
---|
3394 | 3436 | |
---|
3395 | | - sc->callback = lio_if_cfg_callback; |
---|
3396 | | - sc->callback_arg = sc; |
---|
3397 | | - sc->wait_time = LIO_IFCFG_WAIT_TIME; |
---|
| 3437 | + init_completion(&sc->complete); |
---|
| 3438 | + sc->sc_status = OCTEON_REQUEST_PENDING; |
---|
3398 | 3439 | |
---|
3399 | 3440 | retval = octeon_send_soft_command(octeon_dev, sc); |
---|
3400 | 3441 | if (retval == IQ_SEND_FAILED) { |
---|
.. | .. |
---|
3402 | 3443 | "iq/oq config failed status: %x\n", |
---|
3403 | 3444 | retval); |
---|
3404 | 3445 | /* Soft instr is freed by driver in case of failure. */ |
---|
3405 | | - goto setup_nic_dev_fail; |
---|
| 3446 | + octeon_free_soft_command(octeon_dev, sc); |
---|
| 3447 | + return(-EIO); |
---|
3406 | 3448 | } |
---|
3407 | 3449 | |
---|
3408 | 3450 | /* Sleep on a wait queue till the cond flag indicates that the |
---|
3409 | 3451 | * response arrived or timed-out. |
---|
3410 | 3452 | */ |
---|
3411 | | - if (sleep_cond(&ctx->wc, &ctx->cond) == -EINTR) { |
---|
3412 | | - dev_err(&octeon_dev->pci_dev->dev, "Wait interrupted\n"); |
---|
3413 | | - goto setup_nic_wait_intr; |
---|
3414 | | - } |
---|
| 3453 | + retval = wait_for_sc_completion_timeout(octeon_dev, sc, 0); |
---|
| 3454 | + if (retval) |
---|
| 3455 | + return retval; |
---|
3415 | 3456 | |
---|
3416 | 3457 | retval = resp->status; |
---|
3417 | 3458 | if (retval) { |
---|
3418 | 3459 | dev_err(&octeon_dev->pci_dev->dev, "iq/oq config failed\n"); |
---|
3419 | | - goto setup_nic_dev_fail; |
---|
| 3460 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3461 | + goto setup_nic_dev_done; |
---|
3420 | 3462 | } |
---|
| 3463 | + snprintf(octeon_dev->fw_info.liquidio_firmware_version, |
---|
| 3464 | + 32, "%s", |
---|
| 3465 | + resp->cfg_info.liquidio_firmware_version); |
---|
3421 | 3466 | |
---|
3422 | 3467 | /* Verify f/w version (in case of 'auto' loading from flash) */ |
---|
3423 | 3468 | fw_ver = octeon_dev->fw_info.liquidio_firmware_version; |
---|
.. | .. |
---|
3427 | 3472 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3428 | 3473 | "Unmatched firmware version. Expected %s.x, got %s.\n", |
---|
3429 | 3474 | LIQUIDIO_BASE_VERSION, fw_ver); |
---|
3430 | | - goto setup_nic_dev_fail; |
---|
| 3475 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3476 | + goto setup_nic_dev_done; |
---|
3431 | 3477 | } else if (atomic_read(octeon_dev->adapter_fw_state) == |
---|
3432 | 3478 | FW_IS_PRELOADED) { |
---|
3433 | 3479 | dev_info(&octeon_dev->pci_dev->dev, |
---|
.. | .. |
---|
3454 | 3500 | "Got bad iqueues (%016llx) or oqueues (%016llx) from firmware.\n", |
---|
3455 | 3501 | resp->cfg_info.iqmask, |
---|
3456 | 3502 | resp->cfg_info.oqmask); |
---|
3457 | | - goto setup_nic_dev_fail; |
---|
| 3503 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3504 | + goto setup_nic_dev_done; |
---|
3458 | 3505 | } |
---|
3459 | 3506 | |
---|
3460 | 3507 | if (OCTEON_CN6XXX(octeon_dev)) { |
---|
.. | .. |
---|
3473 | 3520 | |
---|
3474 | 3521 | if (!netdev) { |
---|
3475 | 3522 | dev_err(&octeon_dev->pci_dev->dev, "Device allocation failed\n"); |
---|
3476 | | - goto setup_nic_dev_fail; |
---|
| 3523 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3524 | + goto setup_nic_dev_done; |
---|
3477 | 3525 | } |
---|
3478 | 3526 | |
---|
3479 | 3527 | SET_NETDEV_DEV(netdev, &octeon_dev->pci_dev->dev); |
---|
.. | .. |
---|
3482 | 3530 | * netdev tasks. |
---|
3483 | 3531 | */ |
---|
3484 | 3532 | netdev->netdev_ops = &lionetdevops; |
---|
3485 | | - SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops); |
---|
3486 | 3533 | |
---|
3487 | 3534 | retval = netif_set_real_num_rx_queues(netdev, num_oqueues); |
---|
3488 | 3535 | if (retval) { |
---|
3489 | 3536 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3490 | 3537 | "setting real number rx failed\n"); |
---|
3491 | | - goto setup_nic_dev_fail; |
---|
| 3538 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3539 | + goto setup_nic_dev_free; |
---|
3492 | 3540 | } |
---|
3493 | 3541 | |
---|
3494 | 3542 | retval = netif_set_real_num_tx_queues(netdev, num_iqueues); |
---|
3495 | 3543 | if (retval) { |
---|
3496 | 3544 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3497 | 3545 | "setting real number tx failed\n"); |
---|
3498 | | - goto setup_nic_dev_fail; |
---|
| 3546 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
| 3547 | + goto setup_nic_dev_free; |
---|
3499 | 3548 | } |
---|
3500 | 3549 | |
---|
3501 | 3550 | lio = GET_LIO(netdev); |
---|
.. | .. |
---|
3521 | 3570 | lio->linfo.hw_addr = resp->cfg_info.linfo.hw_addr; |
---|
3522 | 3571 | lio->linfo.gmxport = resp->cfg_info.linfo.gmxport; |
---|
3523 | 3572 | lio->linfo.link.u64 = resp->cfg_info.linfo.link.u64; |
---|
| 3573 | + |
---|
| 3574 | + WRITE_ONCE(sc->caller_is_done, true); |
---|
3524 | 3575 | |
---|
3525 | 3576 | lio->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
---|
3526 | 3577 | |
---|
.. | .. |
---|
3549 | 3600 | |
---|
3550 | 3601 | netdev->hw_enc_features = (lio->enc_dev_capability & |
---|
3551 | 3602 | ~NETIF_F_LRO); |
---|
| 3603 | + |
---|
| 3604 | + netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels; |
---|
3552 | 3605 | |
---|
3553 | 3606 | lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL; |
---|
3554 | 3607 | |
---|
.. | .. |
---|
3588 | 3641 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3589 | 3642 | "Error setting VF%d MAC address\n", |
---|
3590 | 3643 | j); |
---|
3591 | | - goto setup_nic_dev_fail; |
---|
| 3644 | + goto setup_nic_dev_free; |
---|
3592 | 3645 | } |
---|
3593 | 3646 | } |
---|
3594 | 3647 | |
---|
.. | .. |
---|
3610 | 3663 | lio->linfo.num_txpciq, |
---|
3611 | 3664 | lio->linfo.num_rxpciq)) { |
---|
3612 | 3665 | dev_err(&octeon_dev->pci_dev->dev, "I/O queues creation failed\n"); |
---|
3613 | | - goto setup_nic_dev_fail; |
---|
| 3666 | + goto setup_nic_dev_free; |
---|
3614 | 3667 | } |
---|
3615 | 3668 | |
---|
3616 | 3669 | ifstate_set(lio, LIO_IFSTATE_DROQ_OPS); |
---|
.. | .. |
---|
3621 | 3674 | if (lio_setup_glists(octeon_dev, lio, num_iqueues)) { |
---|
3622 | 3675 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3623 | 3676 | "Gather list allocation failed\n"); |
---|
3624 | | - goto setup_nic_dev_fail; |
---|
| 3677 | + goto setup_nic_dev_free; |
---|
3625 | 3678 | } |
---|
3626 | 3679 | |
---|
3627 | 3680 | /* Register ethtool support */ |
---|
.. | .. |
---|
3643 | 3696 | OCTNET_CMD_VERBOSE_ENABLE, 0); |
---|
3644 | 3697 | |
---|
3645 | 3698 | if (setup_link_status_change_wq(netdev)) |
---|
3646 | | - goto setup_nic_dev_fail; |
---|
| 3699 | + goto setup_nic_dev_free; |
---|
3647 | 3700 | |
---|
3648 | 3701 | if ((octeon_dev->fw_info.app_cap_flags & |
---|
3649 | 3702 | LIQUIDIO_TIME_SYNC_CAP) && |
---|
3650 | 3703 | setup_sync_octeon_time_wq(netdev)) |
---|
3651 | | - goto setup_nic_dev_fail; |
---|
| 3704 | + goto setup_nic_dev_free; |
---|
3652 | 3705 | |
---|
3653 | 3706 | if (setup_rx_oom_poll_fn(netdev)) |
---|
3654 | | - goto setup_nic_dev_fail; |
---|
| 3707 | + goto setup_nic_dev_free; |
---|
3655 | 3708 | |
---|
3656 | 3709 | /* Register the network device with the OS */ |
---|
3657 | 3710 | if (register_netdev(netdev)) { |
---|
3658 | 3711 | dev_err(&octeon_dev->pci_dev->dev, "Device registration failed\n"); |
---|
3659 | | - goto setup_nic_dev_fail; |
---|
| 3712 | + goto setup_nic_dev_free; |
---|
3660 | 3713 | } |
---|
3661 | 3714 | |
---|
3662 | 3715 | dev_dbg(&octeon_dev->pci_dev->dev, |
---|
.. | .. |
---|
3678 | 3731 | |
---|
3679 | 3732 | dev_dbg(&octeon_dev->pci_dev->dev, |
---|
3680 | 3733 | "NIC ifidx:%d Setup successful\n", i); |
---|
3681 | | - |
---|
3682 | | - octeon_free_soft_command(octeon_dev, sc); |
---|
3683 | 3734 | |
---|
3684 | 3735 | if (octeon_dev->subsystem_id == |
---|
3685 | 3736 | OCTEON_CN2350_25GB_SUBSYS_ID || |
---|
.. | .. |
---|
3709 | 3760 | } |
---|
3710 | 3761 | octeon_dev->speed_boot = octeon_dev->speed_setting; |
---|
3711 | 3762 | |
---|
| 3763 | + /* don't read FEC setting if unsupported by f/w (see above) */ |
---|
| 3764 | + if (octeon_dev->speed_boot == 25 && |
---|
| 3765 | + !octeon_dev->no_speed_setting) { |
---|
| 3766 | + liquidio_get_fec(lio); |
---|
| 3767 | + octeon_dev->props[lio->ifidx].fec_boot = |
---|
| 3768 | + octeon_dev->props[lio->ifidx].fec; |
---|
| 3769 | + } |
---|
3712 | 3770 | } |
---|
3713 | 3771 | |
---|
3714 | 3772 | devlink = devlink_alloc(&liquidio_devlink_ops, |
---|
3715 | 3773 | sizeof(struct lio_devlink_priv)); |
---|
3716 | 3774 | if (!devlink) { |
---|
3717 | 3775 | dev_err(&octeon_dev->pci_dev->dev, "devlink alloc failed\n"); |
---|
3718 | | - goto setup_nic_wait_intr; |
---|
| 3776 | + goto setup_nic_dev_free; |
---|
3719 | 3777 | } |
---|
3720 | 3778 | |
---|
3721 | 3779 | lio_devlink = devlink_priv(devlink); |
---|
.. | .. |
---|
3725 | 3783 | devlink_free(devlink); |
---|
3726 | 3784 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3727 | 3785 | "devlink registration failed\n"); |
---|
3728 | | - goto setup_nic_wait_intr; |
---|
| 3786 | + goto setup_nic_dev_free; |
---|
3729 | 3787 | } |
---|
3730 | 3788 | |
---|
3731 | 3789 | octeon_dev->devlink = devlink; |
---|
.. | .. |
---|
3733 | 3791 | |
---|
3734 | 3792 | return 0; |
---|
3735 | 3793 | |
---|
3736 | | -setup_nic_dev_fail: |
---|
3737 | | - |
---|
3738 | | - octeon_free_soft_command(octeon_dev, sc); |
---|
3739 | | - |
---|
3740 | | -setup_nic_wait_intr: |
---|
| 3794 | +setup_nic_dev_free: |
---|
3741 | 3795 | |
---|
3742 | 3796 | while (i--) { |
---|
3743 | 3797 | dev_err(&octeon_dev->pci_dev->dev, |
---|
3744 | 3798 | "NIC ifidx:%d Setup failed\n", i); |
---|
3745 | 3799 | liquidio_destroy_nic_device(octeon_dev, i); |
---|
3746 | 3800 | } |
---|
| 3801 | + |
---|
| 3802 | +setup_nic_dev_done: |
---|
| 3803 | + |
---|
3747 | 3804 | return -ENODEV; |
---|
3748 | 3805 | } |
---|
3749 | 3806 | |
---|
.. | .. |
---|
3848 | 3905 | #endif |
---|
3849 | 3906 | |
---|
3850 | 3907 | /** |
---|
3851 | | - * \brief initialize the NIC |
---|
3852 | | - * @param oct octeon device |
---|
| 3908 | + * liquidio_init_nic_module - initialize the NIC |
---|
| 3909 | + * @oct: octeon device |
---|
3853 | 3910 | * |
---|
3854 | 3911 | * This initialization routine is called once the Octeon device application is |
---|
3855 | 3912 | * up and running |
---|
.. | .. |
---|
3904 | 3961 | } |
---|
3905 | 3962 | |
---|
3906 | 3963 | /** |
---|
3907 | | - * \brief starter callback that invokes the remaining initialization work after |
---|
3908 | | - * the NIC is up and running. |
---|
3909 | | - * @param octptr work struct work_struct |
---|
| 3964 | + * nic_starter - finish init |
---|
| 3965 | + * @work: work struct work_struct |
---|
| 3966 | + * |
---|
| 3967 | + * starter callback that invokes the remaining initialization work after the NIC is up and running. |
---|
3910 | 3968 | */ |
---|
3911 | 3969 | static void nic_starter(struct work_struct *work) |
---|
3912 | 3970 | { |
---|
.. | .. |
---|
3999 | 4057 | } |
---|
4000 | 4058 | |
---|
4001 | 4059 | /** |
---|
4002 | | - * \brief Device initialization for each Octeon device that is probed |
---|
4003 | | - * @param octeon_dev octeon device |
---|
| 4060 | + * octeon_device_init - Device initialization for each Octeon device that is probed |
---|
| 4061 | + * @octeon_dev: octeon device |
---|
4004 | 4062 | */ |
---|
4005 | 4063 | static int octeon_device_init(struct octeon_device *octeon_dev) |
---|
4006 | 4064 | { |
---|
.. | .. |
---|
4169 | 4227 | |
---|
4170 | 4228 | /* Initialize the tasklet that handles output queue packet processing.*/ |
---|
4171 | 4229 | dev_dbg(&octeon_dev->pci_dev->dev, "Initializing droq tasklet\n"); |
---|
4172 | | - tasklet_init(&oct_priv->droq_tasklet, octeon_droq_bh, |
---|
4173 | | - (unsigned long)octeon_dev); |
---|
| 4230 | + tasklet_setup(&oct_priv->droq_tasklet, octeon_droq_bh); |
---|
4174 | 4231 | |
---|
4175 | 4232 | /* Setup the interrupt handler and record the INT SUM register address |
---|
4176 | 4233 | */ |
---|
.. | .. |
---|
4274 | 4331 | complete(&handshake[octeon_dev->octeon_id].init); |
---|
4275 | 4332 | |
---|
4276 | 4333 | atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK); |
---|
| 4334 | + oct_priv->dev = octeon_dev; |
---|
4277 | 4335 | |
---|
4278 | 4336 | return 0; |
---|
4279 | 4337 | } |
---|
4280 | 4338 | |
---|
4281 | 4339 | /** |
---|
4282 | | - * \brief Debug console print function |
---|
4283 | | - * @param octeon_dev octeon device |
---|
4284 | | - * @param console_num console number |
---|
4285 | | - * @param prefix first portion of line to display |
---|
4286 | | - * @param suffix second portion of line to display |
---|
| 4340 | + * octeon_dbg_console_print - Debug console print function |
---|
| 4341 | + * @oct: octeon device |
---|
| 4342 | + * @console_num: console number |
---|
| 4343 | + * @prefix: first portion of line to display |
---|
| 4344 | + * @suffix: second portion of line to display |
---|
4287 | 4345 | * |
---|
4288 | 4346 | * The OCTEON debug console outputs entire lines (excluding '\n'). |
---|
4289 | 4347 | * Normally, the line will be passed in the 'prefix' parameter. |
---|
.. | .. |
---|
4306 | 4364 | } |
---|
4307 | 4365 | |
---|
4308 | 4366 | /** |
---|
4309 | | - * \brief Exits the module |
---|
| 4367 | + * liquidio_exit - Exits the module |
---|
4310 | 4368 | */ |
---|
4311 | 4369 | static void __exit liquidio_exit(void) |
---|
4312 | 4370 | { |
---|