1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Aquantia Corporation
12 #include <netinet/in.h>
15 #include <rte_common.h>
25 #define min(a, b) RTE_MIN(a, b)
26 #define max(a, b) RTE_MAX(a, b)
28 #include "hw_atl/hw_atl_b0_internal.h"
29 #include "hw_atl/hw_atl_utils.h"
31 struct aq_hw_link_status_s {
57 struct aq_rss_parameters {
59 u16 indirection_table_size;
60 u16 hash_secret_key_size;
61 u32 hash_secret_key[HW_ATL_B0_RSS_HASHKEY_BITS / 8];
62 u8 indirection_table[HW_ATL_B0_RSS_REDIRECTION_MAX];
66 struct aq_macsec_config {
69 u32 encryption_enabled;
70 u32 replay_protection_enabled;
75 u32 mac[2]; /* 6 bytes */
80 u32 an; /* association number on the local side */
81 u32 pn; /* packet number on the local side */
82 u32 key[4]; /* 128 bit key */
86 u32 mac[2]; /* 6 bytes */
92 u32 an; /* association number on the remote side */
93 u32 pn; /* packet number on the remote side */
94 u32 key[4]; /* 128 bit key */
101 unsigned int num_rss_queues;
110 uint32_t vlan_filter[HW_ATL_B0_MAX_VLAN_IDS];
111 uint32_t flow_control;
113 struct aq_rss_parameters aq_rss;
114 struct aq_macsec_config aq_macsec;
120 bool adapter_stopped;
123 struct aq_hw_cfg_s *aq_nic_cfg;
124 const struct aq_fw_ops *aq_fw_ops;
127 struct aq_hw_link_status_s aq_link_status;
130 struct hw_aq_atl_utils_mbox mbox;
131 struct hw_atl_stats_s last_stats;
132 struct aq_stats_s curr_stats;
137 unsigned int chip_features;
142 struct hw_aq_atl_utils_fw_rpc rpc;
144 pthread_mutex_t mbox_mutex;
148 int (*init)(struct aq_hw_s *self);
150 int (*deinit)(struct aq_hw_s *self);
152 int (*reset)(struct aq_hw_s *self);
154 int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
156 int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
158 int (*set_state)(struct aq_hw_s *self,
159 enum hal_atl_utils_fw_state_e state);
161 int (*update_link_status)(struct aq_hw_s *self);
163 int (*update_stats)(struct aq_hw_s *self);
165 int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
168 int (*get_temp)(struct aq_hw_s *self, int *temp);
170 int (*get_cable_len)(struct aq_hw_s *self, int *cable_len);
172 int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
174 int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
175 u32 *supported_rates);
177 int (*get_flow_control)(struct aq_hw_s *self, u32 *fc);
178 int (*set_flow_control)(struct aq_hw_s *self);
180 int (*led_control)(struct aq_hw_s *self, u32 mode);
182 int (*get_eeprom)(struct aq_hw_s *self, int dev_addr,
183 u32 *data, u32 len, u32 offset);
185 int (*set_eeprom)(struct aq_hw_s *self, int dev_addr,
186 u32 *data, u32 len, u32 offset);
188 int (*send_macsec_req)(struct aq_hw_s *self,
189 struct macsec_msg_fw_request *req,
190 struct macsec_msg_fw_response *response);
193 struct atl_sw_stats {
227 u64 q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
228 u64 q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
229 u64 q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
230 u64 q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
231 u64 q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];