forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
....@@ -52,12 +52,15 @@
5252 #include <linux/ptp_clock_kernel.h>
5353 #include <linux/ptp_classify.h>
5454 #include <linux/crash_dump.h>
55
+#include <linux/thermal.h>
5556 #include <asm/io.h>
5657 #include "t4_chip_type.h"
5758 #include "cxgb4_uld.h"
59
+#include "t4fw_api.h"
5860
5961 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
6062 extern struct list_head adapter_list;
63
+extern struct list_head uld_list;
6164 extern struct mutex uld_mutex;
6265
6366 /* Suspend an Ethernet Tx queue with fewer available descriptors than this.
....@@ -66,6 +69,16 @@
6669 */
6770 #define ETHTXQ_STOP_THRES \
6871 (1 + DIV_ROUND_UP((3 * MAX_SKB_FRAGS) / 2 + (MAX_SKB_FRAGS & 1), 8))
72
+
73
+#define FW_PARAM_DEV(param) \
74
+ (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | \
75
+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_##param))
76
+
77
+#define FW_PARAM_PFVF(param) \
78
+ (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_PFVF) | \
79
+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_PFVF_##param) | \
80
+ FW_PARAMS_PARAM_Y_V(0) | \
81
+ FW_PARAMS_PARAM_Z_V(0))
6982
7083 enum {
7184 MAX_NPORTS = 4, /* max # of ports */
....@@ -124,6 +137,69 @@
124137 FEC_AUTO = 1 << 0, /* IEEE 802.3 "automatic" */
125138 FEC_RS = 1 << 1, /* Reed-Solomon */
126139 FEC_BASER_RS = 1 << 2 /* BaseR/Reed-Solomon */
140
+};
141
+
142
+enum {
143
+ CXGB4_ETHTOOL_FLASH_FW = 1,
144
+ CXGB4_ETHTOOL_FLASH_PHY = 2,
145
+ CXGB4_ETHTOOL_FLASH_BOOT = 3,
146
+ CXGB4_ETHTOOL_FLASH_BOOTCFG = 4
147
+};
148
+
149
+enum cxgb4_netdev_tls_ops {
150
+ CXGB4_TLSDEV_OPS = 1,
151
+ CXGB4_XFRMDEV_OPS
152
+};
153
+
154
+struct cxgb4_bootcfg_data {
155
+ __le16 signature;
156
+ __u8 reserved[2];
157
+};
158
+
159
+struct cxgb4_pcir_data {
160
+ __le32 signature; /* Signature. The string "PCIR" */
161
+ __le16 vendor_id; /* Vendor Identification */
162
+ __le16 device_id; /* Device Identification */
163
+ __u8 vital_product[2]; /* Pointer to Vital Product Data */
164
+ __u8 length[2]; /* PCIR Data Structure Length */
165
+ __u8 revision; /* PCIR Data Structure Revision */
166
+ __u8 class_code[3]; /* Class Code */
167
+ __u8 image_length[2]; /* Image Length. Multiple of 512B */
168
+ __u8 code_revision[2]; /* Revision Level of Code/Data */
169
+ __u8 code_type;
170
+ __u8 indicator;
171
+ __u8 reserved[2];
172
+};
173
+
174
+/* BIOS boot headers */
175
+struct cxgb4_pci_exp_rom_header {
176
+ __le16 signature; /* ROM Signature. Should be 0xaa55 */
177
+ __u8 reserved[22]; /* Reserved per processor Architecture data */
178
+ __le16 pcir_offset; /* Offset to PCI Data Structure */
179
+};
180
+
181
+/* Legacy PCI Expansion ROM Header */
182
+struct legacy_pci_rom_hdr {
183
+ __u8 signature[2]; /* ROM Signature. Should be 0xaa55 */
184
+ __u8 size512; /* Current Image Size in units of 512 bytes */
185
+ __u8 initentry_point[4];
186
+ __u8 cksum; /* Checksum computed on the entire Image */
187
+ __u8 reserved[16]; /* Reserved */
188
+ __le16 pcir_offset; /* Offset to PCI Data Struture */
189
+};
190
+
191
+#define CXGB4_HDR_CODE1 0x00
192
+#define CXGB4_HDR_CODE2 0x03
193
+#define CXGB4_HDR_INDI 0x80
194
+
195
+/* BOOT constants */
196
+enum {
197
+ BOOT_CFG_SIG = 0x4243,
198
+ BOOT_SIZE_INC = 512,
199
+ BOOT_SIGNATURE = 0xaa55,
200
+ BOOT_MIN_SIZE = sizeof(struct cxgb4_pci_exp_rom_header),
201
+ BOOT_MAX_SIZE = 1024 * BOOT_SIZE_INC,
202
+ PCIR_SIGNATURE = 0x52494350
127203 };
128204
129205 struct port_stats {
....@@ -279,6 +355,7 @@
279355 unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */
280356
281357 u32 vlan_pri_map; /* cached TP_VLAN_PRI_MAP */
358
+ u32 filter_mask;
282359 u32 ingress_config; /* cached TP_INGRESS_CONFIG */
283360
284361 /* cached TP_OUT_CONFIG compressed error vector
....@@ -390,6 +467,7 @@
390467 struct arch_specific_params arch; /* chip specific params */
391468 unsigned char offload;
392469 unsigned char crypto; /* HW capability for crypto */
470
+ unsigned char ethofld; /* QoS support */
393471
394472 unsigned char bypass;
395473 unsigned char hash_filter;
....@@ -403,6 +481,7 @@
403481 bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */
404482 u8 fw_caps_support; /* 32-bit Port Capabilities */
405483 bool filter2_wr_support; /* FW support for FILTER2_WR */
484
+ unsigned int viid_smt_extn_support:1; /* FW returns vin and smt index */
406485
407486 /* MPS Buffer Group Map[per Port]. Bit i is set if buffer group i is
408487 * used by the Port
....@@ -451,14 +530,18 @@
451530 return &((struct mbox_cmd *)&(log)[1])[entry_idx];
452531 }
453532
454
-#include "t4fw_api.h"
455
-
456533 #define FW_VERSION(chip) ( \
457534 FW_HDR_FW_VER_MAJOR_G(chip##FW_VERSION_MAJOR) | \
458535 FW_HDR_FW_VER_MINOR_G(chip##FW_VERSION_MINOR) | \
459536 FW_HDR_FW_VER_MICRO_G(chip##FW_VERSION_MICRO) | \
460537 FW_HDR_FW_VER_BUILD_G(chip##FW_VERSION_BUILD))
461538 #define FW_INTFVER(chip, intf) (FW_HDR_INTFVER_##intf)
539
+
540
+struct cxgb4_ethtool_lb_test {
541
+ struct completion completion;
542
+ int result;
543
+ int loopback;
544
+};
462545
463546 struct fw_info {
464547 u8 chip;
....@@ -476,6 +559,11 @@
476559 unsigned char skip_len;
477560 unsigned char invert;
478561 unsigned char port;
562
+};
563
+
564
+struct cxgb4_fw_data {
565
+ __be32 signature;
566
+ __u8 reserved[4];
479567 };
480568
481569 /* Firmware Port Capabilities types. */
....@@ -500,6 +588,7 @@
500588
501589 enum cc_pause requested_fc; /* flow control user has requested */
502590 enum cc_pause fc; /* actual link flow control */
591
+ enum cc_pause advertised_fc; /* actual advertised flow control */
503592
504593 enum cc_fec requested_fec; /* Forward Error Correction: */
505594 enum cc_fec fec; /* requested and actual in use */
....@@ -533,6 +622,13 @@
533622 };
534623
535624 enum {
625
+ MAX_TXQ_DESC_SIZE = 64,
626
+ MAX_RXQ_DESC_SIZE = 128,
627
+ MAX_FL_DESC_SIZE = 8,
628
+ MAX_CTRL_TXQ_DESC_SIZE = 64,
629
+};
630
+
631
+enum {
536632 INGQ_EXTRAS = 2, /* firmware event queue and */
537633 /* forwarded interrupts */
538634 MAX_INGQ = MAX_ETH_QSETS + INGQ_EXTRAS,
....@@ -559,7 +655,7 @@
559655 struct port_info {
560656 struct adapter *adapter;
561657 u16 viid;
562
- s16 xact_addr_filt; /* index of exact MAC address filter */
658
+ int xact_addr_filt; /* index of exact MAC address filter */
563659 u16 rss_size; /* size of VI's RSS table slice */
564660 s8 mdio_addr;
565661 enum fw_port_type port_type;
....@@ -584,29 +680,55 @@
584680 bool ptp_enable;
585681 struct sched_table *sched_tbl;
586682 u32 eth_flags;
683
+
684
+ /* viid and smt fields either returned by fw
685
+ * or decoded by parsing viid by driver.
686
+ */
687
+ u8 vin;
688
+ u8 vivld;
689
+ u8 smt_idx;
690
+ u8 rx_cchan;
691
+
692
+ bool tc_block_shared;
693
+
694
+ /* Mirror VI information */
695
+ u16 viid_mirror;
696
+ u16 nmirrorqsets;
697
+ u32 vi_mirror_count;
698
+ struct mutex vi_mirror_mutex; /* Sync access to Mirror VI info */
699
+ struct cxgb4_ethtool_lb_test ethtool_lb;
587700 };
588701
589702 struct dentry;
590703 struct work_struct;
591704
592705 enum { /* adapter flags */
593
- FULL_INIT_DONE = (1 << 0),
594
- DEV_ENABLED = (1 << 1),
595
- USING_MSI = (1 << 2),
596
- USING_MSIX = (1 << 3),
597
- FW_OK = (1 << 4),
598
- RSS_TNLALLLOOKUP = (1 << 5),
599
- USING_SOFT_PARAMS = (1 << 6),
600
- MASTER_PF = (1 << 7),
601
- FW_OFLD_CONN = (1 << 9),
602
- ROOT_NO_RELAXED_ORDERING = (1 << 10),
603
- SHUTTING_DOWN = (1 << 11),
706
+ CXGB4_FULL_INIT_DONE = (1 << 0),
707
+ CXGB4_DEV_ENABLED = (1 << 1),
708
+ CXGB4_USING_MSI = (1 << 2),
709
+ CXGB4_USING_MSIX = (1 << 3),
710
+ CXGB4_FW_OK = (1 << 4),
711
+ CXGB4_RSS_TNLALLLOOKUP = (1 << 5),
712
+ CXGB4_USING_SOFT_PARAMS = (1 << 6),
713
+ CXGB4_MASTER_PF = (1 << 7),
714
+ CXGB4_FW_OFLD_CONN = (1 << 9),
715
+ CXGB4_ROOT_NO_RELAXED_ORDERING = (1 << 10),
716
+ CXGB4_SHUTTING_DOWN = (1 << 11),
717
+ CXGB4_SGE_DBQ_TIMER = (1 << 12),
604718 };
605719
606720 enum {
607721 ULP_CRYPTO_LOOKASIDE = 1 << 0,
608722 ULP_CRYPTO_IPSEC_INLINE = 1 << 1,
723
+ ULP_CRYPTO_KTLS_INLINE = 1 << 3,
609724 };
725
+
726
+#define CXGB4_MIRROR_RXQ_DEFAULT_DESC_NUM 1024
727
+#define CXGB4_MIRROR_RXQ_DEFAULT_DESC_SIZE 64
728
+#define CXGB4_MIRROR_RXQ_DEFAULT_INTR_USEC 5
729
+#define CXGB4_MIRROR_RXQ_DEFAULT_PKT_CNT 8
730
+
731
+#define CXGB4_MIRROR_FLQ_DEFAULT_DESC_NUM 72
610732
611733 struct rx_sw_desc;
612734
....@@ -685,12 +807,14 @@
685807 unsigned long rx_cso; /* # of Rx checksum offloads */
686808 unsigned long vlan_ex; /* # of Rx VLAN extractions */
687809 unsigned long rx_drops; /* # of packets dropped due to no mem */
810
+ unsigned long bad_rx_pkts; /* # of packets with err_vec!=0 */
688811 };
689812
690813 struct sge_eth_rxq { /* SW Ethernet Rx queue */
691814 struct sge_rspq rspq;
692815 struct sge_fl fl;
693816 struct sge_eth_stats stats;
817
+ struct msix_info *msix;
694818 } ____cacheline_aligned_in_smp;
695819
696820 struct sge_ofld_stats { /* offload queue statistics */
....@@ -704,13 +828,19 @@
704828 struct sge_rspq rspq;
705829 struct sge_fl fl;
706830 struct sge_ofld_stats stats;
831
+ struct msix_info *msix;
707832 } ____cacheline_aligned_in_smp;
708833
709834 struct tx_desc {
710835 __be64 flit[8];
711836 };
712837
713
-struct tx_sw_desc;
838
+struct ulptx_sgl;
839
+
840
+struct tx_sw_desc {
841
+ struct sk_buff *skb; /* SKB to free after getting completion */
842
+ dma_addr_t addr[MAX_SKB_FRAGS + 1]; /* DMA mapped addresses */
843
+};
714844
715845 struct sge_txq {
716846 unsigned int in_use; /* # of in-use Tx descriptors */
....@@ -739,7 +869,10 @@
739869 #ifdef CONFIG_CHELSIO_T4_DCB
740870 u8 dcb_prio; /* DCB Priority bound to queue */
741871 #endif
872
+ u8 dbqt; /* SGE Doorbell Queue Timer in use */
873
+ unsigned int dbqtimerix; /* SGE Doorbell Queue Timer Index */
742874 unsigned long tso; /* # of TSO requests */
875
+ unsigned long uso; /* # of USO requests */
743876 unsigned long tx_cso; /* # of Tx checksum offloads */
744877 unsigned long vlan_ins; /* # of Tx VLAN insertions */
745878 unsigned long mapping_err; /* # of I/O MMU packet mapping errors */
....@@ -766,7 +899,6 @@
766899 struct sge_uld_rxq_info {
767900 char name[IFNAMSIZ]; /* name of ULD driver */
768901 struct sge_ofld_rxq *uldrxq; /* Rxq's for ULD */
769
- u16 *msix_tbl; /* msix_tbl for uld */
770902 u16 *rspq_id; /* response queue id's of rxq */
771903 u16 nrxq; /* # of ingress uld queues */
772904 u16 nciq; /* # of completion queues */
....@@ -777,6 +909,58 @@
777909 struct sge_uld_txq *uldtxq; /* Txq's for ULD */
778910 atomic_t users; /* num users */
779911 u16 ntxq; /* # of egress uld queues */
912
+};
913
+
914
+/* struct to maintain ULD list to reallocate ULD resources on hotplug */
915
+struct cxgb4_uld_list {
916
+ struct cxgb4_uld_info uld_info;
917
+ struct list_head list_node;
918
+ enum cxgb4_uld uld_type;
919
+};
920
+
921
+enum sge_eosw_state {
922
+ CXGB4_EO_STATE_CLOSED = 0, /* Not ready to accept traffic */
923
+ CXGB4_EO_STATE_FLOWC_OPEN_SEND, /* Send FLOWC open request */
924
+ CXGB4_EO_STATE_FLOWC_OPEN_REPLY, /* Waiting for FLOWC open reply */
925
+ CXGB4_EO_STATE_ACTIVE, /* Ready to accept traffic */
926
+ CXGB4_EO_STATE_FLOWC_CLOSE_SEND, /* Send FLOWC close request */
927
+ CXGB4_EO_STATE_FLOWC_CLOSE_REPLY, /* Waiting for FLOWC close reply */
928
+};
929
+
930
+struct sge_eosw_txq {
931
+ spinlock_t lock; /* Per queue lock to synchronize completions */
932
+ enum sge_eosw_state state; /* Current ETHOFLD State */
933
+ struct tx_sw_desc *desc; /* Descriptor ring to hold packets */
934
+ u32 ndesc; /* Number of descriptors */
935
+ u32 pidx; /* Current Producer Index */
936
+ u32 last_pidx; /* Last successfully transmitted Producer Index */
937
+ u32 cidx; /* Current Consumer Index */
938
+ u32 last_cidx; /* Last successfully reclaimed Consumer Index */
939
+ u32 flowc_idx; /* Descriptor containing a FLOWC request */
940
+ u32 inuse; /* Number of packets held in ring */
941
+
942
+ u32 cred; /* Current available credits */
943
+ u32 ncompl; /* # of completions posted */
944
+ u32 last_compl; /* # of credits consumed since last completion req */
945
+
946
+ u32 eotid; /* Index into EOTID table in software */
947
+ u32 hwtid; /* Hardware EOTID index */
948
+
949
+ u32 hwqid; /* Underlying hardware queue index */
950
+ struct net_device *netdev; /* Pointer to netdevice */
951
+ struct tasklet_struct qresume_tsk; /* Restarts the queue */
952
+ struct completion completion; /* completion for FLOWC rendezvous */
953
+};
954
+
955
+struct sge_eohw_txq {
956
+ spinlock_t lock; /* Per queue lock */
957
+ struct sge_txq q; /* HW Txq */
958
+ struct adapter *adap; /* Backpointer to adapter */
959
+ unsigned long tso; /* # of TSO requests */
960
+ unsigned long uso; /* # of USO requests */
961
+ unsigned long tx_cso; /* # of Tx checksum offloads */
962
+ unsigned long vlan_ins; /* # of Tx VLAN insertions */
963
+ unsigned long mapping_err; /* # of I/O MMU packet mapping errors */
780964 };
781965
782966 struct sge {
....@@ -792,13 +976,23 @@
792976 struct sge_rspq intrq ____cacheline_aligned_in_smp;
793977 spinlock_t intrq_lock;
794978
979
+ struct sge_eohw_txq *eohw_txq;
980
+ struct sge_ofld_rxq *eohw_rxq;
981
+
982
+ struct sge_eth_rxq *mirror_rxq[NCHAN];
983
+
795984 u16 max_ethqsets; /* # of available Ethernet queue sets */
796985 u16 ethqsets; /* # of active Ethernet queue sets */
797986 u16 ethtxq_rover; /* Tx queue to clean up next */
798987 u16 ofldqsets; /* # of active ofld queue sets */
799988 u16 nqs_per_uld; /* # of Rx queues per ULD */
989
+ u16 eoqsets; /* # of ETHOFLD queues */
990
+ u16 mirrorqsets; /* # of Mirror queues */
991
+
800992 u16 timer_val[SGE_NTIMERS];
801993 u8 counter_val[SGE_NCOUNTERS];
994
+ u16 dbqtimer_tick;
995
+ u16 dbqtimer_val[SGE_NDBQTIMERS];
802996 u32 fl_pg_order; /* large page allocation size */
803997 u32 stat_len; /* length of status page at ring end */
804998 u32 pktshift; /* padding between CPL & packet data */
....@@ -817,6 +1011,9 @@
8171011 unsigned long *blocked_fl;
8181012 struct timer_list rx_timer; /* refills starving FLs */
8191013 struct timer_list tx_timer; /* checks Tx queues */
1014
+
1015
+ int fwevtq_msix_idx; /* Index to firmware event queue MSI-X info */
1016
+ int nd_msix_idx; /* Index to non-data interrupts MSI-X info */
8201017 };
8211018
8221019 #define for_each_ethrxq(sge, i) for (i = 0; i < (sge)->ethqsets; i++)
....@@ -843,18 +1040,20 @@
8431040 struct hash_mac_addr {
8441041 struct list_head list;
8451042 u8 addr[ETH_ALEN];
1043
+ unsigned int iface_mac;
8461044 };
8471045
848
-struct uld_msix_bmap {
1046
+struct msix_bmap {
8491047 unsigned long *msix_bmap;
8501048 unsigned int mapsize;
8511049 spinlock_t lock; /* lock for acquiring bitmap */
8521050 };
8531051
854
-struct uld_msix_info {
1052
+struct msix_info {
8551053 unsigned short vec;
8561054 char desc[IFNAMSIZ + 10];
8571055 unsigned int idx;
1056
+ cpumask_var_t aff_mask;
8581057 };
8591058
8601059 struct vf_info {
....@@ -862,6 +1061,7 @@
8621061 unsigned int tx_rate;
8631062 bool pf_set_mac;
8641063 u16 vlan;
1064
+ int link_state;
8651065 };
8661066
8671067 enum {
....@@ -878,8 +1078,31 @@
8781078 struct list_head list;
8791079 };
8801080
881
-struct mps_encap_entry {
882
- atomic_t refcnt;
1081
+#if IS_ENABLED(CONFIG_THERMAL)
1082
+struct ch_thermal {
1083
+ struct thermal_zone_device *tzdev;
1084
+ int trip_temp;
1085
+ int trip_type;
1086
+};
1087
+#endif
1088
+
1089
+struct mps_entries_ref {
1090
+ struct list_head list;
1091
+ u8 addr[ETH_ALEN];
1092
+ u8 mask[ETH_ALEN];
1093
+ u16 idx;
1094
+ refcount_t refcnt;
1095
+};
1096
+
1097
+struct cxgb4_ethtool_filter_info {
1098
+ u32 *loc_array; /* Array holding the actual TIDs set to filters */
1099
+ unsigned long *bmap; /* Bitmap for managing filters in use */
1100
+ u32 in_use; /* # of filters in use */
1101
+};
1102
+
1103
+struct cxgb4_ethtool_filter {
1104
+ u32 nentries; /* Adapter wide number of supported filters */
1105
+ struct cxgb4_ethtool_filter_info *port; /* Per port entry */
8831106 };
8841107
8851108 struct adapter {
....@@ -898,21 +1121,15 @@
8981121
8991122 int msg_enable;
9001123 __be16 vxlan_port;
901
- u8 vxlan_port_cnt;
9021124 __be16 geneve_port;
903
- u8 geneve_port_cnt;
9041125
9051126 struct adapter_params params;
9061127 struct cxgb4_virt_res vres;
9071128 unsigned int swintr;
9081129
909
- struct {
910
- unsigned short vec;
911
- char desc[IFNAMSIZ + 10];
912
- } msix_info[MAX_INGQ + 1];
913
- struct uld_msix_info *msix_info_ulds; /* msix info for uld's */
914
- struct uld_msix_bmap msix_bmap_ulds; /* msix bitmap for all uld */
915
- int msi_idx;
1130
+ /* MSI-X Info for NIC and OFLD queues */
1131
+ struct msix_info *msix_info;
1132
+ struct msix_bmap msix_bmap;
9161133
9171134 struct doorbell_stats db_stats;
9181135 struct sge sge;
....@@ -933,7 +1150,6 @@
9331150 unsigned int rawf_start;
9341151 unsigned int rawf_cnt;
9351152 struct smt_data *smt;
936
- struct mps_encap_entry *mps_encap;
9371153 struct cxgb4_uld_info *uld;
9381154 void *uld_handle[CXGB4_ULD_MAX];
9391155 unsigned int num_uld;
....@@ -941,6 +1157,8 @@
9411157 struct list_head list_node;
9421158 struct list_head rcu_node;
9431159 struct list_head mac_hlist; /* list of MAC addresses in MPS Hash */
1160
+ struct list_head mps_ref;
1161
+ spinlock_t mps_ref_lock; /* lock for syncing mps ref/def activities */
9441162
9451163 void *iscsi_ppm;
9461164
....@@ -981,7 +1199,14 @@
9811199
9821200 /* TC u32 offload */
9831201 struct cxgb4_tc_u32_table *tc_u32;
1202
+ struct chcr_ktls chcr_ktls;
9841203 struct chcr_stats_debug chcr_stats;
1204
+#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
1205
+ struct ch_ktls_stats_debug ch_ktls_stats;
1206
+#endif
1207
+#if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE)
1208
+ struct ch_ipsec_stats_debug ch_ipsec_stats;
1209
+#endif
9851210
9861211 /* TC flower offload */
9871212 bool tc_flower_initialized;
....@@ -1000,25 +1225,38 @@
10001225
10011226 /* Dump buffer for collecting logs in kdump kernel */
10021227 struct vmcoredd_data vmcoredd;
1228
+#if IS_ENABLED(CONFIG_THERMAL)
1229
+ struct ch_thermal ch_thermal;
1230
+#endif
1231
+
1232
+ /* TC MQPRIO offload */
1233
+ struct cxgb4_tc_mqprio *tc_mqprio;
1234
+
1235
+ /* TC MATCHALL classifier offload */
1236
+ struct cxgb4_tc_matchall *tc_matchall;
1237
+
1238
+ /* Ethtool n-tuple */
1239
+ struct cxgb4_ethtool_filter *ethtool_filters;
10031240 };
10041241
10051242 /* Support for "sched-class" command to allow a TX Scheduling Class to be
10061243 * programmed with various parameters.
10071244 */
10081245 struct ch_sched_params {
1009
- s8 type; /* packet or flow */
1246
+ u8 type; /* packet or flow */
10101247 union {
10111248 struct {
1012
- s8 level; /* scheduler hierarchy level */
1013
- s8 mode; /* per-class or per-flow */
1014
- s8 rateunit; /* bit or packet rate */
1015
- s8 ratemode; /* %port relative or kbps absolute */
1016
- s8 channel; /* scheduler channel [0..N] */
1017
- s8 class; /* scheduler class [0..N] */
1018
- s32 minrate; /* minimum rate */
1019
- s32 maxrate; /* maximum rate */
1020
- s16 weight; /* percent weight */
1021
- s16 pktsize; /* average packet size */
1249
+ u8 level; /* scheduler hierarchy level */
1250
+ u8 mode; /* per-class or per-flow */
1251
+ u8 rateunit; /* bit or packet rate */
1252
+ u8 ratemode; /* %port relative or kbps absolute */
1253
+ u8 channel; /* scheduler channel [0..N] */
1254
+ u8 class; /* scheduler class [0..N] */
1255
+ u32 minrate; /* minimum rate */
1256
+ u32 maxrate; /* maximum rate */
1257
+ u16 weight; /* percent weight */
1258
+ u16 pktsize; /* average packet size */
1259
+ u16 burstsize; /* burst buffer size */
10221260 } params;
10231261 } u;
10241262 };
....@@ -1029,10 +1267,12 @@
10291267
10301268 enum {
10311269 SCHED_CLASS_LEVEL_CL_RL = 0, /* class rate limiter */
1270
+ SCHED_CLASS_LEVEL_CH_RL = 2, /* channel rate limiter */
10321271 };
10331272
10341273 enum {
10351274 SCHED_CLASS_MODE_CLASS = 0, /* per-class scheduling */
1275
+ SCHED_CLASS_MODE_FLOW, /* per-flow scheduling */
10361276 };
10371277
10381278 enum {
....@@ -1043,17 +1283,20 @@
10431283 SCHED_CLASS_RATEMODE_ABS = 1, /* Kb/s */
10441284 };
10451285
1046
-struct tx_sw_desc { /* SW state per Tx descriptor */
1047
- struct sk_buff *skb;
1048
- struct ulptx_sgl *sgl;
1049
-};
1050
-
10511286 /* Support for "sched_queue" command to allow one or more NIC TX Queues
10521287 * to be bound to a TX Scheduling Class.
10531288 */
10541289 struct ch_sched_queue {
10551290 s8 queue; /* queue index */
10561291 s8 class; /* class index */
1292
+};
1293
+
1294
+/* Support for "sched_flowc" command to allow one or more FLOWC
1295
+ * to be bound to a TX Scheduling Class.
1296
+ */
1297
+struct ch_sched_flowc {
1298
+ s32 tid; /* TID to bind */
1299
+ s8 class; /* class index */
10571300 };
10581301
10591302 /* Defined bit width of user definable filter tuples
....@@ -1170,8 +1413,11 @@
11701413 u16 nat_lport; /* local port to use after NAT'ing */
11711414 u16 nat_fport; /* foreign port to use after NAT'ing */
11721415
1416
+ u32 tc_prio; /* TC's filter priority index */
1417
+ u64 tc_cookie; /* Unique cookie identifying TC rules */
1418
+
11731419 /* reservation for future additions */
1174
- u8 rsvd[24];
1420
+ u8 rsvd[12];
11751421
11761422 /* Filter rule value/mask pairs.
11771423 */
....@@ -1202,6 +1448,8 @@
12021448 NAT_MODE_DIP_SIP_SP, /* NAT on Dst IP, Src IP and Src Port */
12031449 NAT_MODE_ALL /* NAT on entire 4-tuple */
12041450 };
1451
+
1452
+#define CXGB4_FILTER_TYPE_MAX 2
12051453
12061454 /* Host shadow copy of ingress filter entry. This is in host native format
12071455 * and doesn't match the ordering or bit order, etc. of the hardware of the
....@@ -1247,6 +1495,11 @@
12471495 static inline int is_uld(const struct adapter *adap)
12481496 {
12491497 return (adap->params.offload || adap->params.crypto);
1498
+}
1499
+
1500
+static inline int is_ethofld(const struct adapter *adap)
1501
+{
1502
+ return adap->params.ethofld;
12501503 }
12511504
12521505 static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr)
....@@ -1352,9 +1605,8 @@
13521605 return idx < SGE_NTIMERS ? adap->sge.timer_val[idx] : 0;
13531606 }
13541607
1355
-/* driver version & name used for ethtool_drvinfo */
1608
+/* driver name used for ethtool_drvinfo */
13561609 extern char cxgb4_driver_name[];
1357
-extern const char cxgb4_driver_version[];
13581610
13591611 void t4_os_portmod_changed(struct adapter *adap, int port_id);
13601612 void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
....@@ -1363,6 +1615,7 @@
13631615 void t4_free_ofld_rxqs(struct adapter *adap, int n, struct sge_ofld_rxq *q);
13641616 irq_handler_t t4_intr_handler(struct adapter *adap);
13651617 netdev_tx_t t4_start_xmit(struct sk_buff *skb, struct net_device *dev);
1618
+int cxgb4_selftest_lb_pkt(struct net_device *netdev);
13661619 int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
13671620 const struct pkt_gl *gl);
13681621 int t4_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
....@@ -1373,7 +1626,7 @@
13731626 rspq_flush_handler_t flush_handler, int cong);
13741627 int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
13751628 struct net_device *dev, struct netdev_queue *netdevq,
1376
- unsigned int iqid);
1629
+ unsigned int iqid, u8 dbqt);
13771630 int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
13781631 struct net_device *dev, unsigned int iqid,
13791632 unsigned int cmplqid);
....@@ -1382,10 +1635,15 @@
13821635 int t4_sge_alloc_uld_txq(struct adapter *adap, struct sge_uld_txq *txq,
13831636 struct net_device *dev, unsigned int iqid,
13841637 unsigned int uld_type);
1638
+int t4_sge_alloc_ethofld_txq(struct adapter *adap, struct sge_eohw_txq *txq,
1639
+ struct net_device *dev, u32 iqid);
1640
+void t4_sge_free_ethofld_txq(struct adapter *adap, struct sge_eohw_txq *txq);
13851641 irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
13861642 int t4_sge_init(struct adapter *adap);
13871643 void t4_sge_start(struct adapter *adap);
13881644 void t4_sge_stop(struct adapter *adap);
1645
+int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *q,
1646
+ int maxreclaim);
13891647 void cxgb4_set_ethtool_ops(struct net_device *netdev);
13901648 int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
13911649 enum cpl_tx_tnl_lso_type cxgb_encap_offload_supported(struct sk_buff *skb);
....@@ -1538,9 +1796,11 @@
15381796
15391797 int t4_wait_dev_ready(void __iomem *regs);
15401798
1799
+fw_port_cap32_t t4_link_acaps(struct adapter *adapter, unsigned int port,
1800
+ struct link_config *lc);
15411801 int t4_link_l1cfg_core(struct adapter *adap, unsigned int mbox,
15421802 unsigned int port, struct link_config *lc,
1543
- bool sleep_ok, int timeout);
1803
+ u8 sleep_ok, int timeout);
15441804
15451805 static inline int t4_link_l1cfg(struct adapter *adapter, unsigned int mbox,
15461806 unsigned int port, struct link_config *lc)
....@@ -1588,8 +1848,7 @@
15881848 int t4_read_flash(struct adapter *adapter, unsigned int addr,
15891849 unsigned int nwords, u32 *data, int byte_oriented);
15901850 int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
1591
-int t4_load_phy_fw(struct adapter *adap,
1592
- int win, spinlock_t *lock,
1851
+int t4_load_phy_fw(struct adapter *adap, int win,
15931852 int (*phy_fw_version)(const u8 *, size_t),
15941853 const u8 *phy_fw_data, size_t phy_fw_size);
15951854 int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver);
....@@ -1633,6 +1892,8 @@
16331892 int t4_init_portinfo(struct port_info *pi, int mbox,
16341893 int port, int pf, int vf, u8 mac[]);
16351894 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
1895
+int t4_init_port_mirror(struct port_info *pi, u8 mbox, u8 port, u8 pf, u8 vf,
1896
+ u16 *mirror_viid);
16361897 void t4_fatal_err(struct adapter *adapter);
16371898 unsigned int t4_chip_rss_size(struct adapter *adapter);
16381899 int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
....@@ -1737,13 +1998,13 @@
17371998 unsigned int nexact, unsigned int rcaps, unsigned int wxcaps);
17381999 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
17392000 unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
1740
- unsigned int *rss_size);
2001
+ unsigned int *rss_size, u8 *vivld, u8 *vin);
17412002 int t4_free_vi(struct adapter *adap, unsigned int mbox,
17422003 unsigned int pf, unsigned int vf,
17432004 unsigned int viid);
17442005 int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
1745
- int mtu, int promisc, int all_multi, int bcast, int vlanex,
1746
- bool sleep_ok);
2006
+ unsigned int viid_mirror, int mtu, int promisc, int all_multi,
2007
+ int bcast, int vlanex, bool sleep_ok);
17472008 int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid,
17482009 const u8 *addr, const u8 *mask, unsigned int idx,
17492010 u8 lookup_type, u8 port_id, bool sleep_ok);
....@@ -1763,7 +2024,7 @@
17632024 unsigned int viid, unsigned int naddr,
17642025 const u8 **addr, bool sleep_ok);
17652026 int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
1766
- int idx, const u8 *addr, bool persist, bool add_smt);
2027
+ int idx, const u8 *addr, bool persist, u8 *smt_idx);
17672028 int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid,
17682029 bool ucast, u64 vec, bool sleep_ok);
17692030 int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
....@@ -1792,6 +2053,8 @@
17922053 int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
17932054 unsigned int vf, unsigned int eqid);
17942055 int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type);
2056
+int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
2057
+ u16 *dbqtimers);
17952058 void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl);
17962059 int t4_update_port_info(struct port_info *pi);
17972060 int t4_get_link_params(struct port_info *pi, unsigned int *link_okp,
....@@ -1812,9 +2075,10 @@
18122075 enum ctxt_type ctype, u32 *data);
18132076 int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid,
18142077 enum ctxt_type ctype, u32 *data);
1815
-int t4_sched_params(struct adapter *adapter, int type, int level, int mode,
1816
- int rateunit, int ratemode, int channel, int class,
1817
- int minrate, int maxrate, int weight, int pktsize);
2078
+int t4_sched_params(struct adapter *adapter, u8 type, u8 level, u8 mode,
2079
+ u8 rateunit, u8 ratemode, u8 channel, u8 class,
2080
+ u32 minrate, u32 maxrate, u16 weight, u16 pktsize,
2081
+ u16 burstsize);
18182082 void t4_sge_decode_idma_state(struct adapter *adapter, int state);
18192083 void t4_idma_monitor_init(struct adapter *adapter,
18202084 struct sge_idma_monitor_state *idma);
....@@ -1837,9 +2101,19 @@
18372101 int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port,
18382102 unsigned int devid, unsigned int offset,
18392103 unsigned int len, u8 *buf);
2104
+int t4_load_boot(struct adapter *adap, u8 *boot_data,
2105
+ unsigned int boot_addr, unsigned int size);
2106
+int t4_load_bootcfg(struct adapter *adap,
2107
+ const u8 *cfg_data, unsigned int size);
18402108 void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, struct sge_fl *fl);
18412109 void free_tx_desc(struct adapter *adap, struct sge_txq *q,
18422110 unsigned int n, bool unmap);
2111
+void cxgb4_eosw_txq_free_desc(struct adapter *adap, struct sge_eosw_txq *txq,
2112
+ u32 ndesc);
2113
+int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc);
2114
+void cxgb4_ethofld_restart(struct tasklet_struct *t);
2115
+int cxgb4_ethofld_rx_handler(struct sge_rspq *q, const __be64 *rsp,
2116
+ const struct pkt_gl *si);
18432117 void free_txq(struct adapter *adap, struct sge_txq *q);
18442118 void cxgb4_reclaim_completed_tx(struct adapter *adap,
18452119 struct sge_txq *q, bool unmap);
....@@ -1850,8 +2124,64 @@
18502124 void cxgb4_write_sgl(const struct sk_buff *skb, struct sge_txq *q,
18512125 struct ulptx_sgl *sgl, u64 *end, unsigned int start,
18522126 const dma_addr_t *addr);
2127
+void cxgb4_write_partial_sgl(const struct sk_buff *skb, struct sge_txq *q,
2128
+ struct ulptx_sgl *sgl, u64 *end,
2129
+ const dma_addr_t *addr, u32 start, u32 send_len);
18532130 void cxgb4_ring_tx_db(struct adapter *adap, struct sge_txq *q, int n);
18542131 int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf,
18552132 u16 vlan);
18562133 int cxgb4_dcb_enabled(const struct net_device *dev);
2134
+
2135
+int cxgb4_thermal_init(struct adapter *adap);
2136
+int cxgb4_thermal_remove(struct adapter *adap);
2137
+int cxgb4_set_msix_aff(struct adapter *adap, unsigned short vec,
2138
+ cpumask_var_t *aff_mask, int idx);
2139
+void cxgb4_clear_msix_aff(unsigned short vec, cpumask_var_t aff_mask);
2140
+
2141
+int cxgb4_change_mac(struct port_info *pi, unsigned int viid,
2142
+ int *tcam_idx, const u8 *addr,
2143
+ bool persistent, u8 *smt_idx);
2144
+
2145
+int cxgb4_alloc_mac_filt(struct adapter *adap, unsigned int viid,
2146
+ bool free, unsigned int naddr,
2147
+ const u8 **addr, u16 *idx,
2148
+ u64 *hash, bool sleep_ok);
2149
+int cxgb4_free_mac_filt(struct adapter *adap, unsigned int viid,
2150
+ unsigned int naddr, const u8 **addr, bool sleep_ok);
2151
+int cxgb4_init_mps_ref_entries(struct adapter *adap);
2152
+void cxgb4_free_mps_ref_entries(struct adapter *adap);
2153
+int cxgb4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid,
2154
+ const u8 *addr, const u8 *mask,
2155
+ unsigned int vni, unsigned int vni_mask,
2156
+ u8 dip_hit, u8 lookup_type, bool sleep_ok);
2157
+int cxgb4_free_encap_mac_filt(struct adapter *adap, unsigned int viid,
2158
+ int idx, bool sleep_ok);
2159
+int cxgb4_free_raw_mac_filt(struct adapter *adap,
2160
+ unsigned int viid,
2161
+ const u8 *addr,
2162
+ const u8 *mask,
2163
+ unsigned int idx,
2164
+ u8 lookup_type,
2165
+ u8 port_id,
2166
+ bool sleep_ok);
2167
+int cxgb4_alloc_raw_mac_filt(struct adapter *adap,
2168
+ unsigned int viid,
2169
+ const u8 *addr,
2170
+ const u8 *mask,
2171
+ unsigned int idx,
2172
+ u8 lookup_type,
2173
+ u8 port_id,
2174
+ bool sleep_ok);
2175
+int cxgb4_update_mac_filt(struct port_info *pi, unsigned int viid,
2176
+ int *tcam_idx, const u8 *addr,
2177
+ bool persistent, u8 *smt_idx);
2178
+int cxgb4_get_msix_idx_from_bmap(struct adapter *adap);
2179
+void cxgb4_free_msix_idx_in_bmap(struct adapter *adap, u32 msix_idx);
2180
+void cxgb4_enable_rx(struct adapter *adap, struct sge_rspq *q);
2181
+void cxgb4_quiesce_rx(struct sge_rspq *q);
2182
+int cxgb4_port_mirror_alloc(struct net_device *dev);
2183
+void cxgb4_port_mirror_free(struct net_device *dev);
2184
+#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
2185
+int cxgb4_set_ktls_feature(struct adapter *adap, bool enable);
2186
+#endif
18572187 #endif /* __CXGB4_H__ */