hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/intel/i40e/i40e_adminq.c
....@@ -508,6 +508,70 @@
508508 }
509509
510510 /**
511
+ * i40e_set_hw_flags - set HW flags
512
+ * @hw: pointer to the hardware structure
513
+ **/
514
+static void i40e_set_hw_flags(struct i40e_hw *hw)
515
+{
516
+ struct i40e_adminq_info *aq = &hw->aq;
517
+
518
+ hw->flags = 0;
519
+
520
+ switch (hw->mac.type) {
521
+ case I40E_MAC_XL710:
522
+ if (aq->api_maj_ver > 1 ||
523
+ (aq->api_maj_ver == 1 &&
524
+ aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) {
525
+ hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
526
+ hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
527
+ /* The ability to RX (not drop) 802.1ad frames */
528
+ hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
529
+ }
530
+ break;
531
+ case I40E_MAC_X722:
532
+ hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
533
+ I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
534
+
535
+ if (aq->api_maj_ver > 1 ||
536
+ (aq->api_maj_ver == 1 &&
537
+ aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
538
+ hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
539
+
540
+ if (aq->api_maj_ver > 1 ||
541
+ (aq->api_maj_ver == 1 &&
542
+ aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
543
+ hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
544
+
545
+ if (aq->api_maj_ver > 1 ||
546
+ (aq->api_maj_ver == 1 &&
547
+ aq->api_min_ver >= I40E_MINOR_VER_FW_REQUEST_FEC_X722))
548
+ hw->flags |= I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE;
549
+
550
+ fallthrough;
551
+ default:
552
+ break;
553
+ }
554
+
555
+ /* Newer versions of firmware require lock when reading the NVM */
556
+ if (aq->api_maj_ver > 1 ||
557
+ (aq->api_maj_ver == 1 &&
558
+ aq->api_min_ver >= 5))
559
+ hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
560
+
561
+ if (aq->api_maj_ver > 1 ||
562
+ (aq->api_maj_ver == 1 &&
563
+ aq->api_min_ver >= 8)) {
564
+ hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
565
+ hw->flags |= I40E_HW_FLAG_DROP_MODE;
566
+ }
567
+
568
+ if (aq->api_maj_ver > 1 ||
569
+ (aq->api_maj_ver == 1 &&
570
+ aq->api_min_ver >= 9))
571
+ hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED;
572
+}
573
+
574
+/**
511575 * i40e_init_adminq - main initialization routine for Admin Queue
512576 * @hw: pointer to the hardware structure
513577 *
....@@ -571,6 +635,11 @@
571635 if (ret_code != I40E_SUCCESS)
572636 goto init_adminq_free_arq;
573637
638
+ /* Some features were introduced in different FW API version
639
+ * for different MAC type.
640
+ */
641
+ i40e_set_hw_flags(hw);
642
+
574643 /* get the NVM version info */
575644 i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION,
576645 &hw->nvm.version);
....@@ -588,13 +657,13 @@
588657 hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
589658 hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
590659 hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
660
+ hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
591661 }
592
-
593
- /* Newer versions of firmware require lock when reading the NVM */
594
- if (hw->aq.api_maj_ver > 1 ||
595
- (hw->aq.api_maj_ver == 1 &&
596
- hw->aq.api_min_ver >= 5))
597
- hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
662
+ if (hw->mac.type == I40E_MAC_X722 &&
663
+ hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
664
+ hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
665
+ hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
666
+ }
598667
599668 /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
600669 if (hw->aq.api_maj_ver > 1 ||
....@@ -631,10 +700,8 @@
631700 * i40e_shutdown_adminq - shutdown routine for the Admin Queue
632701 * @hw: pointer to the hardware structure
633702 **/
634
-i40e_status i40e_shutdown_adminq(struct i40e_hw *hw)
703
+void i40e_shutdown_adminq(struct i40e_hw *hw)
635704 {
636
- i40e_status ret_code = 0;
637
-
638705 if (i40e_check_asq_alive(hw))
639706 i40e_aq_queue_shutdown(hw, true);
640707
....@@ -643,8 +710,6 @@
643710
644711 if (hw->nvm_buff.va)
645712 i40e_free_virt_mem(hw, &hw->nvm_buff);
646
-
647
- return ret_code;
648713 }
649714
650715 /**
....@@ -664,7 +729,7 @@
664729 desc = I40E_ADMINQ_DESC(*asq, ntc);
665730 details = I40E_ADMINQ_DETAILS(*asq, ntc);
666731 while (rd32(hw, hw->aq.asq.head) != ntc) {
667
- i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
732
+ i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
668733 "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
669734
670735 if (details->callback) {
....@@ -743,7 +808,7 @@
743808 if (val >= hw->aq.num_asq_entries) {
744809 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
745810 "AQTX: head overrun at %d\n", val);
746
- status = I40E_ERR_QUEUE_EMPTY;
811
+ status = I40E_ERR_ADMIN_QUEUE_FULL;
747812 goto asq_send_command_error;
748813 }
749814
....@@ -824,7 +889,7 @@
824889 }
825890
826891 /* bump the tail */
827
- i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n");
892
+ i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n");
828893 i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,
829894 buff, buff_size);
830895 (hw->aq.asq.next_to_use)++;
....@@ -875,7 +940,7 @@
875940 hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
876941 }
877942
878
- i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
943
+ i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
879944 "AQTX: desc and buffer writeback:\n");
880945 i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);
881946
....@@ -984,7 +1049,7 @@
9841049 memcpy(e->msg_buf, hw->aq.arq.r.arq_bi[desc_idx].va,
9851050 e->msg_len);
9861051
987
- i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
1052
+ i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n");
9881053 i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,
9891054 hw->aq.arq_buf_size);
9901055