1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Aquantia Corporation
12 #include <netinet/in.h>
23 #define min(a, b) RTE_MIN(a, b)
24 #define max(a, b) RTE_MAX(a, b)
26 #include "hw_atl/hw_atl_b0_internal.h"
27 #include "hw_atl/hw_atl_utils.h"
29 struct aq_hw_link_status_s {
55 struct aq_rss_parameters {
57 u16 indirection_table_size;
58 u16 hash_secret_key_size;
59 u32 hash_secret_key[HW_ATL_B0_RSS_HASHKEY_BITS / 8];
60 u8 indirection_table[HW_ATL_B0_RSS_REDIRECTION_MAX];
64 struct aq_macsec_config {
67 u32 encryption_enabled;
68 u32 replay_protection_enabled;
73 u32 mac[2]; /* 6 bytes */
78 u32 an; /* association number on the local side */
79 u32 pn; /* packet number on the local side */
80 u32 key[4]; /* 128 bit key */
84 u32 mac[2]; /* 6 bytes */
90 u32 an; /* association number on the remote side */
91 u32 pn; /* packet number on the remote side */
92 u32 key[4]; /* 128 bit key */
99 unsigned int num_rss_queues;
108 uint32_t vlan_filter[HW_ATL_B0_MAX_VLAN_IDS];
109 uint32_t flow_control;
111 struct aq_rss_parameters aq_rss;
112 struct aq_macsec_config aq_macsec;
118 bool adapter_stopped;
121 struct aq_hw_cfg_s *aq_nic_cfg;
122 const struct aq_fw_ops *aq_fw_ops;
125 struct aq_hw_link_status_s aq_link_status;
128 struct hw_aq_atl_utils_mbox mbox;
129 struct hw_atl_stats_s last_stats;
130 struct aq_stats_s curr_stats;
135 unsigned int chip_features;
140 struct hw_aq_atl_utils_fw_rpc rpc;
142 pthread_mutex_t mbox_mutex;
146 int (*init)(struct aq_hw_s *self);
148 int (*deinit)(struct aq_hw_s *self);
150 int (*reset)(struct aq_hw_s *self);
152 int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
154 int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
156 int (*set_state)(struct aq_hw_s *self,
157 enum hal_atl_utils_fw_state_e state);
159 int (*update_link_status)(struct aq_hw_s *self);
161 int (*update_stats)(struct aq_hw_s *self);
163 int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
166 int (*get_temp)(struct aq_hw_s *self, int *temp);
168 int (*get_cable_len)(struct aq_hw_s *self, int *cable_len);
170 int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
172 int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
173 u32 *supported_rates);
175 int (*get_flow_control)(struct aq_hw_s *self, u32 *fc);
176 int (*set_flow_control)(struct aq_hw_s *self);
178 int (*led_control)(struct aq_hw_s *self, u32 mode);
180 int (*get_eeprom)(struct aq_hw_s *self, int dev_addr,
181 u32 *data, u32 len, u32 offset);
183 int (*set_eeprom)(struct aq_hw_s *self, int dev_addr,
184 u32 *data, u32 len, u32 offset);
186 int (*send_macsec_req)(struct aq_hw_s *self,
187 struct macsec_msg_fw_request *req,
188 struct macsec_msg_fw_response *response);
191 struct atl_sw_stats {
225 u64 q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
226 u64 q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
227 u64 q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
228 u64 q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
229 u64 q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];