1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Aquantia Corporation
12 #include <netinet/in.h>
22 #define min(a, b) RTE_MIN(a, b)
23 #define max(a, b) RTE_MAX(a, b)
25 #include "hw_atl/hw_atl_b0_internal.h"
26 #include "hw_atl/hw_atl_utils.h"
28 struct aq_hw_link_status_s {
54 struct aq_rss_parameters {
56 u16 indirection_table_size;
57 u16 hash_secret_key_size;
58 u32 hash_secret_key[HW_ATL_B0_RSS_HASHKEY_BITS / 8];
59 u8 indirection_table[HW_ATL_B0_RSS_REDIRECTION_MAX];
63 struct aq_macsec_config {
66 u32 encryption_enabled;
67 u32 replay_protection_enabled;
72 u32 mac[2]; /* 6 bytes */
77 u32 an; /* association number on the local side */
78 u32 pn; /* packet number on the local side */
79 u32 key[4]; /* 128 bit key */
83 u32 mac[2]; /* 6 bytes */
89 u32 an; /* association number on the remote side */
90 u32 pn; /* packet number on the remote side */
91 u32 key[4]; /* 128 bit key */
98 unsigned int num_rss_queues;
107 uint32_t vlan_filter[HW_ATL_B0_MAX_VLAN_IDS];
108 uint32_t flow_control;
110 struct aq_rss_parameters aq_rss;
111 struct aq_macsec_config aq_macsec;
117 bool adapter_stopped;
120 struct aq_hw_cfg_s *aq_nic_cfg;
121 const struct aq_fw_ops *aq_fw_ops;
124 struct aq_hw_link_status_s aq_link_status;
127 struct hw_aq_atl_utils_mbox mbox;
128 struct hw_atl_stats_s last_stats;
129 struct aq_stats_s curr_stats;
132 unsigned int chip_features;
137 struct hw_aq_atl_utils_fw_rpc rpc;
141 int (*init)(struct aq_hw_s *self);
143 int (*deinit)(struct aq_hw_s *self);
145 int (*reset)(struct aq_hw_s *self);
147 int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
149 int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
151 int (*set_state)(struct aq_hw_s *self,
152 enum hal_atl_utils_fw_state_e state);
154 int (*update_link_status)(struct aq_hw_s *self);
156 int (*update_stats)(struct aq_hw_s *self);
158 int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
161 int (*get_temp)(struct aq_hw_s *self, int *temp);
163 int (*get_cable_len)(struct aq_hw_s *self, int *cable_len);
165 int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
167 int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
168 u32 *supported_rates);
170 int (*set_flow_control)(struct aq_hw_s *self);
172 int (*led_control)(struct aq_hw_s *self, u32 mode);
174 int (*get_eeprom)(struct aq_hw_s *self, int dev_addr,
175 u32 *data, u32 len, u32 offset);
177 int (*set_eeprom)(struct aq_hw_s *self, int dev_addr,
180 int (*send_macsec_req)(struct aq_hw_s *self,
181 struct macsec_msg_fw_request *req,
182 struct macsec_msg_fw_response *response);
185 struct atl_sw_stats {
219 u64 q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
220 u64 q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
221 u64 q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
222 u64 q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
223 u64 q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];