Lines Matching +full:stream +full:- +full:match +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2020-2022 Xilinx Inc.
29 return -EINVAL; in efx_mae_allocate_mport()
31 return -EINVAL; in efx_mae_allocate_mport()
42 return -EIO; in efx_mae_allocate_mport()
64 MAE_MPORT_SELECTOR_PPORT_ID, efx->port_num); in efx_mae_mport_wire()
104 return -EIO; in efx_mae_fw_lookup_mport()
120 efx->net_dev->mtu); in efx_mae_start_counters()
129 return -EIO; in efx_mae_start_counters()
132 netif_dbg(efx, drv, efx->net_dev, in efx_mae_start_counters()
133 "MAE counter stream uses credits\n"); in efx_mae_start_counters()
134 rx_queue->grant_credits = true; in efx_mae_start_counters()
138 netif_err(efx, drv, efx->net_dev, in efx_mae_start_counters()
139 "MAE counter stream start: unrecognised flags %x\n", in efx_mae_start_counters()
146 return -EOPNOTSUPP; in efx_mae_start_counters()
154 if ((s32)(flush_gen[i] - seen_gen[i]) > 0) in efx_mae_counters_flushed()
174 netif_dbg(efx, drv, efx->net_dev, "Draining counters:\n"); in efx_mae_stop_counters()
177 efx->tc->flush_gen[i] = MCDI_ARRAY_DWORD(outbuf, in efx_mae_stop_counters()
180 netif_dbg(efx, drv, efx->net_dev, in efx_mae_stop_counters()
182 efx->tc->flush_gen[i]); in efx_mae_stop_counters()
185 efx->tc->flush_counters = true; in efx_mae_stop_counters()
187 /* Drain can take up to 2 seconds owing to FWRIVERHD-2884; whatever in efx_mae_stop_counters()
191 if (!wait_event_timeout(efx->tc->flush_wq, in efx_mae_stop_counters()
192 efx_mae_counters_flushed(efx->tc->flush_gen, in efx_mae_stop_counters()
193 efx->tc->seen_gen), in efx_mae_stop_counters()
195 netif_warn(efx, drv, efx->net_dev, in efx_mae_stop_counters()
198 efx->tc->flush_counters = false; in efx_mae_stop_counters()
208 struct efx_nic *efx = rx_queue->efx; in efx_mae_counters_grant_credits()
212 credits = READ_ONCE(rx_queue->notified_count) - rx_queue->granted_count; in efx_mae_counters_grant_credits()
217 rx_queue->granted_count += credits; in efx_mae_counters_grant_credits()
240 rc = -EIO; in efx_mae_table_get_desc()
244 desc->type = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_TYPE); in efx_mae_table_get_desc()
245 desc->key_width = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_KEY_WIDTH); in efx_mae_table_get_desc()
246 desc->resp_width = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_RESP_WIDTH); in efx_mae_table_get_desc()
247 desc->n_keys = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_N_KEY_FIELDS); in efx_mae_table_get_desc()
248 desc->n_resps = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_N_RESP_FIELDS); in efx_mae_table_get_desc()
249 desc->n_prios = MCDI_WORD(outbuf, TABLE_DESCRIPTOR_OUT_N_PRIORITIES); in efx_mae_table_get_desc()
250 desc->flags = MCDI_BYTE(outbuf, TABLE_DESCRIPTOR_OUT_FLAGS); in efx_mae_table_get_desc()
251 rc = -EOPNOTSUPP; in efx_mae_table_get_desc()
252 if (desc->flags) in efx_mae_table_get_desc()
254 desc->scheme = MCDI_BYTE(outbuf, TABLE_DESCRIPTOR_OUT_SCHEME); in efx_mae_table_get_desc()
255 if (desc->scheme) in efx_mae_table_get_desc()
257 rc = -ENOMEM; in efx_mae_table_get_desc()
258 desc->keys = kcalloc(desc->n_keys, in efx_mae_table_get_desc()
261 if (!desc->keys) in efx_mae_table_get_desc()
263 desc->resps = kcalloc(desc->n_resps, in efx_mae_table_get_desc()
266 if (!desc->resps) in efx_mae_table_get_desc()
273 for (i = 0; i + offset < desc->n_keys + desc->n_resps; i++) { in efx_mae_table_get_desc()
281 if (i + offset < desc->n_keys) in efx_mae_table_get_desc()
282 field = desc->keys + i + offset; in efx_mae_table_get_desc()
284 field = desc->resps + (i + offset - desc->n_keys); in efx_mae_table_get_desc()
287 field->field_id = MCDI_STRUCT_WORD(fdesc, in efx_mae_table_get_desc()
289 field->lbn = MCDI_STRUCT_WORD(fdesc, TABLE_FIELD_DESCR_LBN); in efx_mae_table_get_desc()
290 field->width = MCDI_STRUCT_WORD(fdesc, TABLE_FIELD_DESCR_WIDTH); in efx_mae_table_get_desc()
291 field->masking = MCDI_STRUCT_BYTE(fdesc, TABLE_FIELD_DESCR_MASK_TYPE); in efx_mae_table_get_desc()
292 field->scheme = MCDI_STRUCT_BYTE(fdesc, TABLE_FIELD_DESCR_SCHEME); in efx_mae_table_get_desc()
297 kfree(desc->keys); in efx_mae_table_get_desc()
298 kfree(desc->resps); in efx_mae_table_get_desc()
312 return -EPROTO; in efx_mae_table_hook_find()
316 efx_mae_table_hook_find((_desc)->n_keys, (_desc)->keys, _id)
318 efx_mae_table_hook_find((_desc)->n_resps, (_desc)->resps, _id)
321 int _rc = TABLE_FIND_KEY(&_meta->desc, TABLE_FIELD_ID_##_mcdi_name); \
324 _rc = -EOPNOTSUPP; \
326 _meta->keys._name##_idx = _rc; \
332 int _rc = TABLE_FIND_RESP(&_meta->desc, TABLE_FIELD_ID_##_mcdi_name); \
335 _rc = -EOPNOTSUPP; \
337 _meta->resps._name##_idx = _rc; \
384 meta_ct->hooked = true; in efx_mae_table_hook_ct()
390 kfree(desc->keys); in efx_mae_table_free_desc()
391 kfree(desc->resps); in efx_mae_table_free_desc()
405 efx->tc->meta_ct.hooked = false; in efx_mae_check_table_exists()
439 efx->tc->meta_ct.hooked = false; in efx_mae_get_tables()
441 rc = efx_mae_table_get_desc(efx, &efx->tc->meta_ct.desc, in efx_mae_get_tables()
444 pci_info(efx->pci_dev, in efx_mae_get_tables()
450 rc = efx_mae_table_hook_ct(efx, &efx->tc->meta_ct); in efx_mae_get_tables()
452 pci_info(efx->pci_dev, in efx_mae_get_tables()
458 pci_info(efx->pci_dev, in efx_mae_get_tables()
466 efx_mae_table_free_desc(&efx->tc->meta_ct.desc); in efx_mae_free_tables()
467 efx->tc->meta_ct.hooked = false; in efx_mae_free_tables()
483 return -EIO; in efx_mae_get_basic_caps()
484 caps->match_field_count = MCDI_DWORD(outbuf, MAE_GET_CAPS_OUT_MATCH_FIELD_COUNT); in efx_mae_get_basic_caps()
485 caps->encap_types = MCDI_DWORD(outbuf, MAE_GET_CAPS_OUT_ENCAP_TYPES_SUPPORTED); in efx_mae_get_basic_caps()
486 caps->action_prios = MCDI_DWORD(outbuf, MAE_GET_CAPS_OUT_ACTION_PRIOS); in efx_mae_get_basic_caps()
534 caps->action_rule_fields); in efx_mae_get_caps()
538 caps->outer_rule_fields); in efx_mae_get_caps()
555 return "all-1s"; in mask_type_name()
557 return "all-0s"; in mask_type_name()
567 /* Checks a (big-endian) bytestring is a bit prefix */
568 static enum mask_type classify_mask(const u8 *mask, size_t len) in classify_mask() argument
577 if (!is_prefix_byte(mask[i])) in classify_mask()
579 } else if (mask[i]) { in classify_mask()
582 if (mask[i] != 0xff) in classify_mask()
584 if (mask[i]) in classify_mask()
603 return -EOPNOTSUPP; in efx_mae_match_check_cap_typ()
611 return -EINVAL; in efx_mae_match_check_cap_typ()
614 return -EOPNOTSUPP; in efx_mae_match_check_cap_typ()
619 return -EIO; in efx_mae_match_check_cap_typ()
623 /* Validate field mask against hardware capabilities. Captures caller's 'rc' */
625 enum mask_type typ = classify_mask((const u8 *)&mask->_field, \
626 sizeof(mask->_field)); \
632 "No support for %s mask in field %s", \
638 enum mask_type typ = mask->_field ? MASK_ONES : MASK_ZEROES; \
644 "No support for %s mask in field %s", \
650 const struct efx_tc_match_fields *mask, in efx_mae_match_check_caps() argument
653 const u8 *supported_fields = efx->tc->caps->action_rule_fields; in efx_mae_match_check_caps()
654 __be32 ingress_port = cpu_to_be32(mask->ingress_port); in efx_mae_match_check_caps()
658 /* Check for _PREFIX assumes big-endian, so we need to convert */ in efx_mae_match_check_caps()
664 NL_SET_ERR_MSG_FMT_MOD(extack, "No support for %s mask in field ingress_port", in efx_mae_match_check_caps()
698 * exact match on Outer Rule ID if any outer field matches are in efx_mae_match_check_caps()
700 * available to the Action Rule match iff the Outer Rule matched in efx_mae_match_check_caps()
703 if (efx_tc_match_is_encap(mask)) { in efx_mae_match_check_caps()
713 } else if (mask->enc_keyid) { in efx_mae_match_check_caps()
714 NL_SET_ERR_MSG_MOD(extack, "Match on enc_keyid requires other encap fields"); in efx_mae_match_check_caps()
715 return -EINVAL; in efx_mae_match_check_caps()
720 /* Checks for match fields not supported in LHS Outer Rules */
722 enum mask_type typ = classify_mask((const u8 *)&mask->_field, \
723 sizeof(mask->_field)); \
726 NL_SET_ERR_MSG_MOD(extack, "Unsupported match field " #_field);\
727 rc = -EOPNOTSUPP; \
732 if (mask->_field) { \
733 NL_SET_ERR_MSG_MOD(extack, "Unsupported match field " #_field);\
734 rc = -EOPNOTSUPP; \
740 * they use ENC_ fields in hardware to match regular (not enc_) fields from
744 const struct efx_tc_match_fields *mask, in efx_mae_match_check_caps_lhs() argument
747 const u8 *supported_fields = efx->tc->caps->outer_rule_fields; in efx_mae_match_check_caps_lhs()
748 __be32 ingress_port = cpu_to_be32(mask->ingress_port); in efx_mae_match_check_caps_lhs()
752 /* Check for _PREFIX assumes big-endian, so we need to convert */ in efx_mae_match_check_caps_lhs()
758 NL_SET_ERR_MSG_FMT_MOD(extack, "No support for %s mask in field %s", in efx_mae_match_check_caps_lhs()
786 if (efx_tc_match_is_encap(mask)) { in efx_mae_match_check_caps_lhs()
790 NL_SET_ERR_MSG_MOD(extack, "Unexpected encap match in LHS rule"); in efx_mae_match_check_caps_lhs()
791 return -EOPNOTSUPP; in efx_mae_match_check_caps_lhs()
814 /* Checks that the fields needed for encap-rule matches are supported by the
815 * MAE. All the fields are exact-match, except possibly ENC_IP_TOS.
821 u8 *supported_fields = efx->tc->caps->outer_rule_fields; in efx_mae_check_encap_match_caps()
843 NL_SET_ERR_MSG_FMT_MOD(extack, "No support for %s mask in field %s", in efx_mae_check_encap_match_caps()
851 NL_SET_ERR_MSG_FMT_MOD(extack, "No support for %s mask in field %s", in efx_mae_check_encap_match_caps()
871 return -EOPNOTSUPP; in efx_mae_check_encap_type_supported()
873 if (efx->tc->caps->encap_types & BIT(bit)) in efx_mae_check_encap_type_supported()
875 return -EOPNOTSUPP; in efx_mae_check_encap_type_supported()
886 return -EINVAL; in efx_mae_allocate_counter()
889 MCDI_SET_DWORD(inbuf, MAE_COUNTER_ALLOC_V2_IN_COUNTER_TYPE, cnt->type); in efx_mae_allocate_counter()
896 return -EIO; in efx_mae_allocate_counter()
897 cnt->fw_id = MCDI_DWORD(outbuf, MAE_COUNTER_ALLOC_OUT_COUNTER_ID); in efx_mae_allocate_counter()
898 cnt->gen = MCDI_DWORD(outbuf, MAE_COUNTER_ALLOC_OUT_GENERATION_COUNT); in efx_mae_allocate_counter()
910 MCDI_SET_DWORD(inbuf, MAE_COUNTER_FREE_V2_IN_FREE_COUNTER_ID, cnt->fw_id); in efx_mae_free_counter()
911 MCDI_SET_DWORD(inbuf, MAE_COUNTER_FREE_V2_IN_COUNTER_TYPE, cnt->type); in efx_mae_free_counter()
918 return -EIO; in efx_mae_free_counter()
924 cnt->fw_id)) in efx_mae_free_counter()
925 return -EIO; in efx_mae_free_counter()
939 return -EOPNOTSUPP; in efx_mae_encap_type_to_mae_type()
951 rc = efx_mae_encap_type_to_mae_type(encap->type); in efx_mae_allocate_encap_md()
955 inlen = MC_CMD_MAE_ENCAP_HEADER_ALLOC_IN_LEN(encap->encap_hdr_len); in efx_mae_allocate_encap_md()
957 return -EINVAL; in efx_mae_allocate_encap_md()
959 encap->encap_hdr, in efx_mae_allocate_encap_md()
960 encap->encap_hdr_len); in efx_mae_allocate_encap_md()
966 return -EIO; in efx_mae_allocate_encap_md()
967 encap->fw_id = MCDI_DWORD(outbuf, MAE_ENCAP_HEADER_ALLOC_OUT_ENCAP_HEADER_ID); in efx_mae_allocate_encap_md()
978 rc = efx_mae_encap_type_to_mae_type(encap->type); in efx_mae_update_encap_md()
983 encap->fw_id); in efx_mae_update_encap_md()
984 inlen = MC_CMD_MAE_ENCAP_HEADER_UPDATE_IN_LEN(encap->encap_hdr_len); in efx_mae_update_encap_md()
986 return -EINVAL; in efx_mae_update_encap_md()
988 encap->encap_hdr, in efx_mae_update_encap_md()
989 encap->encap_hdr_len); in efx_mae_update_encap_md()
1004 MCDI_SET_DWORD(inbuf, MAE_ENCAP_HEADER_FREE_IN_EH_ID, encap->fw_id); in efx_mae_free_encap_md()
1010 return -EIO; in efx_mae_free_encap_md()
1015 if (WARN_ON(MCDI_DWORD(outbuf, MAE_ENCAP_HEADER_FREE_OUT_FREED_EH_ID) != encap->fw_id)) in efx_mae_free_encap_md()
1016 return -EIO; in efx_mae_free_encap_md()
1020 encap->fw_id = MC_CMD_MAE_ENCAP_HEADER_ALLOC_OUT_ENCAP_HEADER_ID_NULL; in efx_mae_free_encap_md()
1026 struct ef100_nic_data *nic_data = efx->nic_data; in efx_mae_lookup_mport()
1027 struct efx_mae *mae = efx->mae; in efx_mae_lookup_mport()
1030 int rc = -ENOENT; in efx_mae_lookup_mport()
1032 rhashtable_walk_enter(&mae->mports_ht, &walk); in efx_mae_lookup_mport()
1035 if (m->mport_type == MAE_MPORT_DESC_MPORT_TYPE_VNIC && in efx_mae_lookup_mport()
1036 m->interface_idx == nic_data->local_mae_intf && in efx_mae_lookup_mport()
1037 m->pf_idx == 0 && in efx_mae_lookup_mport()
1038 m->vf_idx == vf_idx) { in efx_mae_lookup_mport()
1039 *id = m->mport_id; in efx_mae_lookup_mport()
1063 return rhashtable_lookup_fast(&efx->mae->mports_ht, &mport_id, in efx_mae_get_mport()
1069 struct efx_mae *mae = efx->mae; in efx_mae_add_mport()
1072 rc = rhashtable_insert_fast(&mae->mports_ht, &desc->linkage, in efx_mae_add_mport()
1076 pci_err(efx->pci_dev, "Failed to insert MPORT %08x, rc %d\n", in efx_mae_add_mport()
1077 desc->mport_id, rc); in efx_mae_add_mport()
1099 struct ef100_nic_data *nic_data = efx->nic_data; in efx_mae_process_mport()
1102 mport = efx_mae_get_mport(efx, desc->mport_id); in efx_mae_process_mport()
1104 netif_err(efx, drv, efx->net_dev, in efx_mae_process_mport()
1105 "mport with id %u does exist!!!\n", desc->mport_id); in efx_mae_process_mport()
1107 return -EEXIST; in efx_mae_process_mport()
1110 if (nic_data->have_own_mport && in efx_mae_process_mport()
1111 desc->mport_id == nic_data->own_mport) { in efx_mae_process_mport()
1112 WARN_ON(desc->mport_type != MAE_MPORT_DESC_MPORT_TYPE_VNIC); in efx_mae_process_mport()
1113 WARN_ON(desc->vnic_client_type != in efx_mae_process_mport()
1115 nic_data->local_mae_intf = desc->interface_idx; in efx_mae_process_mport()
1116 nic_data->have_local_intf = true; in efx_mae_process_mport()
1117 pci_dbg(efx->pci_dev, "MAE interface_idx is %u\n", in efx_mae_process_mport()
1118 nic_data->local_mae_intf); in efx_mae_process_mport()
1136 return -ENOMEM; in efx_mae_enumerate_mports()
1144 rc = -EIO; in efx_mae_enumerate_mports()
1152 rc = -EIO; in efx_mae_enumerate_mports()
1156 rc = -EIO; in efx_mae_enumerate_mports()
1165 rc = -ENOMEM; in efx_mae_enumerate_mports()
1172 d->mport_id = MCDI_STRUCT_DWORD(desc, MAE_MPORT_DESC_MPORT_ID); in efx_mae_enumerate_mports()
1173 d->flags = MCDI_STRUCT_DWORD(desc, MAE_MPORT_DESC_FLAGS); in efx_mae_enumerate_mports()
1174 d->caller_flags = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1176 d->mport_type = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1178 switch (d->mport_type) { in efx_mae_enumerate_mports()
1180 d->port_idx = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1184 d->alias_mport_id = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1188 d->vnic_client_type = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1190 d->interface_idx = MCDI_STRUCT_DWORD(desc, in efx_mae_enumerate_mports()
1192 d->pf_idx = MCDI_STRUCT_WORD(desc, in efx_mae_enumerate_mports()
1194 d->vf_idx = MCDI_STRUCT_WORD(desc, in efx_mae_enumerate_mports()
1216 * efx_mae_allocate_pedit_mac() - allocate pedit MAC address in HW.
1234 sizeof(ped->h_addr)); in efx_mae_allocate_pedit_mac()
1235 memcpy(MCDI_PTR(inbuf, MAE_MAC_ADDR_ALLOC_IN_MAC_ADDR), ped->h_addr, in efx_mae_allocate_pedit_mac()
1236 sizeof(ped->h_addr)); in efx_mae_allocate_pedit_mac()
1242 return -EIO; in efx_mae_allocate_pedit_mac()
1243 ped->fw_id = MCDI_DWORD(outbuf, MAE_MAC_ADDR_ALLOC_OUT_MAC_ID); in efx_mae_allocate_pedit_mac()
1248 * efx_mae_free_pedit_mac() - free pedit MAC address in HW.
1263 MCDI_SET_DWORD(inbuf, MAE_MAC_ADDR_FREE_IN_MAC_ID, ped->fw_id); in efx_mae_free_pedit_mac()
1272 if (WARN_ON(MCDI_DWORD(outbuf, MAE_MAC_ADDR_FREE_OUT_FREED_MAC_ID) != ped->fw_id)) in efx_mae_free_pedit_mac()
1277 ped->fw_id = MC_CMD_MAE_MAC_ADDR_ALLOC_OUT_MAC_ID_NULL; in efx_mae_free_pedit_mac()
1288 MAE_ACTION_SET_ALLOC_IN_VLAN_PUSH, act->vlan_push, in efx_mae_alloc_action_set()
1289 MAE_ACTION_SET_ALLOC_IN_VLAN_POP, act->vlan_pop, in efx_mae_alloc_action_set()
1290 MAE_ACTION_SET_ALLOC_IN_DECAP, act->decap, in efx_mae_alloc_action_set()
1291 MAE_ACTION_SET_ALLOC_IN_DO_NAT, act->do_nat, in efx_mae_alloc_action_set()
1293 act->do_ttl_dec); in efx_mae_alloc_action_set()
1295 if (act->src_mac) in efx_mae_alloc_action_set()
1297 act->src_mac->fw_id); in efx_mae_alloc_action_set()
1302 if (act->dst_mac) in efx_mae_alloc_action_set()
1304 act->dst_mac->fw_id); in efx_mae_alloc_action_set()
1309 if (act->count && !WARN_ON(!act->count->cnt)) in efx_mae_alloc_action_set()
1311 act->count->cnt->fw_id); in efx_mae_alloc_action_set()
1317 if (act->vlan_push) { in efx_mae_alloc_action_set()
1319 act->vlan_tci[0]); in efx_mae_alloc_action_set()
1321 act->vlan_proto[0]); in efx_mae_alloc_action_set()
1323 if (act->vlan_push >= 2) { in efx_mae_alloc_action_set()
1325 act->vlan_tci[1]); in efx_mae_alloc_action_set()
1327 act->vlan_proto[1]); in efx_mae_alloc_action_set()
1329 if (act->encap_md) in efx_mae_alloc_action_set()
1331 act->encap_md->fw_id); in efx_mae_alloc_action_set()
1335 if (act->deliver) in efx_mae_alloc_action_set()
1337 act->dest_mport); in efx_mae_alloc_action_set()
1344 return -EIO; in efx_mae_alloc_action_set()
1345 act->fw_id = MCDI_DWORD(outbuf, MAE_ACTION_SET_ALLOC_OUT_AS_ID); in efx_mae_alloc_action_set()
1349 if (WARN_ON_ONCE(efx_mae_asl_id(act->fw_id))) { in efx_mae_alloc_action_set()
1350 efx_mae_free_action_set(efx, act->fw_id); in efx_mae_alloc_action_set()
1351 return -EIO; in efx_mae_alloc_action_set()
1369 return -EIO; in efx_mae_free_action_set()
1372 * what action-sets exist, which could cause mayhem later. in efx_mae_free_action_set()
1375 return -EIO; in efx_mae_free_action_set()
1388 list_for_each_entry(act, &acts->list, list) in efx_mae_alloc_action_set_list()
1391 return -EINVAL; in efx_mae_alloc_action_set_list()
1396 act = list_first_entry(&acts->list, struct efx_tc_action_set, list); in efx_mae_alloc_action_set_list()
1397 acts->fw_id = act->fw_id; in efx_mae_alloc_action_set_list()
1401 return -EOPNOTSUPP; /* Too many actions */ in efx_mae_alloc_action_set_list()
1405 return -ENOMEM; in efx_mae_alloc_action_set_list()
1407 list_for_each_entry(act, &acts->list, list) { in efx_mae_alloc_action_set_list()
1409 i, act->fw_id); in efx_mae_alloc_action_set_list()
1418 rc = -EIO; in efx_mae_alloc_action_set_list()
1421 acts->fw_id = MCDI_DWORD(outbuf, MAE_ACTION_SET_LIST_ALLOC_OUT_ASL_ID); in efx_mae_alloc_action_set_list()
1425 if (WARN_ON_ONCE(!efx_mae_asl_id(acts->fw_id))) { in efx_mae_alloc_action_set_list()
1427 rc = -EIO; in efx_mae_alloc_action_set_list()
1445 if (efx_mae_asl_id(acts->fw_id)) { in efx_mae_free_action_set_list()
1447 acts->fw_id); in efx_mae_free_action_set_list()
1453 return -EIO; in efx_mae_free_action_set_list()
1456 * what action-set-lists exist, which could cause mayhem later. in efx_mae_free_action_set_list()
1458 if (WARN_ON(MCDI_DWORD(outbuf, MAE_ACTION_SET_LIST_FREE_OUT_FREED_ASL_ID) != acts->fw_id)) in efx_mae_free_action_set_list()
1459 return -EIO; in efx_mae_free_action_set_list()
1464 acts->fw_id = MC_CMD_MAE_ACTION_SET_LIST_ALLOC_OUT_ACTION_SET_LIST_ID_NULL; in efx_mae_free_action_set_list()
1477 rc = efx_mae_encap_type_to_mae_type(encap->tun_type); in efx_mae_register_encap_match()
1487 if (encap->src_ip | encap->dst_ip) { in efx_mae_register_encap_match()
1490 encap->src_ip); in efx_mae_register_encap_match()
1494 encap->dst_ip); in efx_mae_register_encap_match()
1502 &encap->src_ip6, sizeof(encap->src_ip6)); in efx_mae_register_encap_match()
1504 0xff, sizeof(encap->src_ip6)); in efx_mae_register_encap_match()
1506 &encap->dst_ip6, sizeof(encap->dst_ip6)); in efx_mae_register_encap_match()
1508 0xff, sizeof(encap->dst_ip6)); in efx_mae_register_encap_match()
1516 encap->udp_dport); in efx_mae_register_encap_match()
1520 encap->udp_sport); in efx_mae_register_encap_match()
1522 encap->udp_sport_mask); in efx_mae_register_encap_match()
1526 encap->ip_tos); in efx_mae_register_encap_match()
1528 encap->ip_tos_mask); in efx_mae_register_encap_match()
1534 return -EIO; in efx_mae_register_encap_match()
1535 encap->fw_id = MCDI_DWORD(outbuf, MAE_OUTER_RULE_INSERT_OUT_OR_ID); in efx_mae_register_encap_match()
1547 MCDI_SET_DWORD(inbuf, MAE_OUTER_RULE_REMOVE_IN_OR_ID, encap->fw_id); in efx_mae_unregister_encap_match()
1553 return -EIO; in efx_mae_unregister_encap_match()
1558 if (WARN_ON(MCDI_DWORD(outbuf, MAE_OUTER_RULE_REMOVE_OUT_REMOVED_OR_ID) != encap->fw_id)) in efx_mae_unregister_encap_match()
1559 return -EIO; in efx_mae_unregister_encap_match()
1563 encap->fw_id = MC_CMD_MAE_OUTER_RULE_INSERT_OUT_OUTER_RULE_ID_NULL; in efx_mae_unregister_encap_match()
1568 const struct efx_tc_match *match) in efx_mae_populate_lhs_match_criteria() argument
1570 if (match->mask.ingress_port) { in efx_mae_populate_lhs_match_criteria()
1571 if (~match->mask.ingress_port) in efx_mae_populate_lhs_match_criteria()
1572 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1575 match->value.ingress_port); in efx_mae_populate_lhs_match_criteria()
1578 match->mask.ingress_port); in efx_mae_populate_lhs_match_criteria()
1580 match->value.eth_proto); in efx_mae_populate_lhs_match_criteria()
1582 match->mask.eth_proto); in efx_mae_populate_lhs_match_criteria()
1584 match->value.vlan_tci[0]); in efx_mae_populate_lhs_match_criteria()
1586 match->mask.vlan_tci[0]); in efx_mae_populate_lhs_match_criteria()
1588 match->value.vlan_proto[0]); in efx_mae_populate_lhs_match_criteria()
1590 match->mask.vlan_proto[0]); in efx_mae_populate_lhs_match_criteria()
1592 match->value.vlan_tci[1]); in efx_mae_populate_lhs_match_criteria()
1594 match->mask.vlan_tci[1]); in efx_mae_populate_lhs_match_criteria()
1596 match->value.vlan_proto[1]); in efx_mae_populate_lhs_match_criteria()
1598 match->mask.vlan_proto[1]); in efx_mae_populate_lhs_match_criteria()
1600 match->value.eth_saddr, ETH_ALEN); in efx_mae_populate_lhs_match_criteria()
1602 match->mask.eth_saddr, ETH_ALEN); in efx_mae_populate_lhs_match_criteria()
1604 match->value.eth_daddr, ETH_ALEN); in efx_mae_populate_lhs_match_criteria()
1606 match->mask.eth_daddr, ETH_ALEN); in efx_mae_populate_lhs_match_criteria()
1608 match->value.ip_proto); in efx_mae_populate_lhs_match_criteria()
1610 match->mask.ip_proto); in efx_mae_populate_lhs_match_criteria()
1612 match->value.ip_tos); in efx_mae_populate_lhs_match_criteria()
1614 match->mask.ip_tos); in efx_mae_populate_lhs_match_criteria()
1616 match->value.ip_ttl); in efx_mae_populate_lhs_match_criteria()
1618 match->mask.ip_ttl); in efx_mae_populate_lhs_match_criteria()
1622 match->value.ip_frag); in efx_mae_populate_lhs_match_criteria()
1626 match->mask.ip_frag); in efx_mae_populate_lhs_match_criteria()
1628 match->value.src_ip); in efx_mae_populate_lhs_match_criteria()
1630 match->mask.src_ip); in efx_mae_populate_lhs_match_criteria()
1632 match->value.dst_ip); in efx_mae_populate_lhs_match_criteria()
1634 match->mask.dst_ip); in efx_mae_populate_lhs_match_criteria()
1637 &match->value.src_ip6, sizeof(struct in6_addr)); in efx_mae_populate_lhs_match_criteria()
1639 &match->mask.src_ip6, sizeof(struct in6_addr)); in efx_mae_populate_lhs_match_criteria()
1641 &match->value.dst_ip6, sizeof(struct in6_addr)); in efx_mae_populate_lhs_match_criteria()
1643 &match->mask.dst_ip6, sizeof(struct in6_addr)); in efx_mae_populate_lhs_match_criteria()
1646 match->value.l4_sport); in efx_mae_populate_lhs_match_criteria()
1648 match->mask.l4_sport); in efx_mae_populate_lhs_match_criteria()
1650 match->value.l4_dport); in efx_mae_populate_lhs_match_criteria()
1652 match->mask.l4_dport); in efx_mae_populate_lhs_match_criteria()
1653 /* No enc-keys in LHS rules. Caps check should have caught this; any in efx_mae_populate_lhs_match_criteria()
1654 * enc-keys from an fLHS should have been translated to regular keys in efx_mae_populate_lhs_match_criteria()
1658 if (WARN_ON_ONCE(match->encap && !match->encap->type)) in efx_mae_populate_lhs_match_criteria()
1659 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1660 if (WARN_ON_ONCE(match->mask.enc_src_ip)) in efx_mae_populate_lhs_match_criteria()
1661 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1662 if (WARN_ON_ONCE(match->mask.enc_dst_ip)) in efx_mae_populate_lhs_match_criteria()
1663 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1665 if (WARN_ON_ONCE(!ipv6_addr_any(&match->mask.enc_src_ip6))) in efx_mae_populate_lhs_match_criteria()
1666 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1667 if (WARN_ON_ONCE(!ipv6_addr_any(&match->mask.enc_dst_ip6))) in efx_mae_populate_lhs_match_criteria()
1668 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1670 if (WARN_ON_ONCE(match->mask.enc_ip_tos)) in efx_mae_populate_lhs_match_criteria()
1671 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1672 if (WARN_ON_ONCE(match->mask.enc_ip_ttl)) in efx_mae_populate_lhs_match_criteria()
1673 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1674 if (WARN_ON_ONCE(match->mask.enc_sport)) in efx_mae_populate_lhs_match_criteria()
1675 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1676 if (WARN_ON_ONCE(match->mask.enc_dport)) in efx_mae_populate_lhs_match_criteria()
1677 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1678 if (WARN_ON_ONCE(match->mask.enc_keyid)) in efx_mae_populate_lhs_match_criteria()
1679 return -EOPNOTSUPP; in efx_mae_populate_lhs_match_criteria()
1694 /* match */ in efx_mae_insert_lhs_outer_rule()
1696 rc = efx_mae_populate_lhs_match_criteria(match_crit, &rule->match); in efx_mae_insert_lhs_outer_rule()
1701 act = &rule->lhs_act; in efx_mae_insert_lhs_outer_rule()
1702 rc = efx_mae_encap_type_to_mae_type(act->tun_type); in efx_mae_insert_lhs_outer_rule()
1711 MAE_OUTER_RULE_INSERT_IN_DO_CT, !!act->zone, in efx_mae_insert_lhs_outer_rule()
1714 act->zone ? act->zone->zone : 0, in efx_mae_insert_lhs_outer_rule()
1717 MAE_OUTER_RULE_INSERT_IN_DO_COUNT, !!act->count, in efx_mae_insert_lhs_outer_rule()
1719 act->rid ? act->rid->fw_id : 0); in efx_mae_insert_lhs_outer_rule()
1720 if (act->count) in efx_mae_insert_lhs_outer_rule()
1722 act->count->cnt->fw_id); in efx_mae_insert_lhs_outer_rule()
1728 return -EIO; in efx_mae_insert_lhs_outer_rule()
1729 rule->fw_id = MCDI_DWORD(outbuf, MAE_OUTER_RULE_INSERT_OUT_OR_ID); in efx_mae_insert_lhs_outer_rule()
1734 const struct efx_tc_match *match);
1742 struct efx_tc_lhs_action *act = &rule->lhs_act; in efx_mae_insert_lhs_action_rule()
1755 MAE_ACTION_RULE_RESPONSE_DO_CT, !!act->zone, in efx_mae_insert_lhs_action_rule()
1757 act->rid && !act->zone, in efx_mae_insert_lhs_action_rule()
1761 act->rid ? act->rid->fw_id : 0, in efx_mae_insert_lhs_action_rule()
1763 act->zone ? act->zone->zone : 0); in efx_mae_insert_lhs_action_rule()
1765 act->count ? act->count->cnt->fw_id : in efx_mae_insert_lhs_action_rule()
1768 rc = efx_mae_populate_match_criteria(match_crit, &rule->match); in efx_mae_insert_lhs_action_rule()
1777 return -EIO; in efx_mae_insert_lhs_action_rule()
1778 rule->fw_id = MCDI_DWORD(outbuf, MAE_ACTION_RULE_INSERT_OUT_AR_ID); in efx_mae_insert_lhs_action_rule()
1785 if (rule->is_ar) in efx_mae_insert_lhs_rule()
1798 MCDI_SET_DWORD(inbuf, MAE_OUTER_RULE_REMOVE_IN_OR_ID, rule->fw_id); in efx_mae_remove_lhs_outer_rule()
1804 return -EIO; in efx_mae_remove_lhs_outer_rule()
1809 if (WARN_ON(MCDI_DWORD(outbuf, MAE_OUTER_RULE_REMOVE_OUT_REMOVED_OR_ID) != rule->fw_id)) in efx_mae_remove_lhs_outer_rule()
1810 return -EIO; in efx_mae_remove_lhs_outer_rule()
1814 rule->fw_id = MC_CMD_MAE_OUTER_RULE_INSERT_OUT_OUTER_RULE_ID_NULL; in efx_mae_remove_lhs_outer_rule()
1820 if (rule->is_ar) in efx_mae_remove_lhs_rule()
1821 return efx_mae_delete_rule(efx, rule->fw_id); in efx_mae_remove_lhs_rule()
1826 * it in the appropriate bits of @row. @value must be big-endian; we
1827 * convert it to little-endianness as we go.
1840 return -EOPNOTSUPP; in efx_mae_table_populate()
1842 return -EINVAL; in efx_mae_table_populate()
1844 return -EINVAL; in efx_mae_table_populate()
1850 v = ((u8 *)value)[value_size - i - 1]; in efx_mae_table_populate()
1865 return -EINVAL; in efx_mae_table_populate_bool()
1872 /* IPv4 is placed in the first 4 bytes of an IPv6-sized field */ in efx_mae_table_populate_ipv4()
1876 return -EINVAL; in efx_mae_table_populate_ipv4()
1888 * the most significant byte for a big-endian 4-bytes value. in efx_mae_table_populate_u24()
1891 sizeof(v) - 1); in efx_mae_table_populate_u24()
1899 sizeof(_v)) : -EINVAL; \
1902 efx_mae_table_populate_ipv4(efx->tc->meta_##_table.desc.keys \
1903 [efx->tc->meta_##_table.keys._field##_idx],\
1904 dst, efx->tc->meta_##_table.desc.key_width,\
1907 _TABLE_POPULATE(dst, efx->tc->meta_##_table.desc.key_width, \
1908 efx->tc->meta_##_table.desc.keys \
1909 [efx->tc->meta_##_table.keys._field##_idx], \
1913 efx_mae_table_populate_bool(efx->tc->meta_##_table.desc.resps \
1914 [efx->tc->meta_##_table.resps._field##_idx],\
1915 dst, efx->tc->meta_##_table.desc.resp_width,\
1918 _TABLE_POPULATE(dst, efx->tc->meta_##_table.desc.resp_width, \
1919 efx->tc->meta_##_table.desc.resps \
1920 [efx->tc->meta_##_table.resps._field##_idx], \
1924 efx_mae_table_populate_u24(efx->tc->meta_##_table.desc.resps \
1925 [efx->tc->meta_##_table.resps._field##_idx],\
1926 dst, efx->tc->meta_##_table.desc.resp_width,\
1932 bool ipv6 = conn->eth_proto == htons(ETH_P_IPV6); in efx_mae_populate_ct_key()
1935 rc = TABLE_POPULATE_KEY(key, ct, eth_proto, conn->eth_proto); in efx_mae_populate_ct_key()
1938 rc = TABLE_POPULATE_KEY(key, ct, ip_proto, conn->ip_proto); in efx_mae_populate_ct_key()
1942 rc = TABLE_POPULATE_KEY(key, ct, src_ip, conn->src_ip6); in efx_mae_populate_ct_key()
1944 rc = TABLE_POPULATE_KEY_IPV4(key, ct, src_ip, conn->src_ip); in efx_mae_populate_ct_key()
1948 rc = TABLE_POPULATE_KEY(key, ct, dst_ip, conn->dst_ip6); in efx_mae_populate_ct_key()
1950 rc = TABLE_POPULATE_KEY_IPV4(key, ct, dst_ip, conn->dst_ip); in efx_mae_populate_ct_key()
1953 rc = TABLE_POPULATE_KEY(key, ct, l4_sport, conn->l4_sport); in efx_mae_populate_ct_key()
1956 rc = TABLE_POPULATE_KEY(key, ct, l4_dport, conn->l4_dport); in efx_mae_populate_ct_key()
1959 return TABLE_POPULATE_KEY(key, ct, zone, cpu_to_be16(conn->zone->zone)); in efx_mae_populate_ct_key()
1964 bool ipv6 = conn->eth_proto == htons(ETH_P_IPV6); in efx_mae_insert_ct()
1968 int rc = -ENOMEM; in efx_mae_insert_ct()
1971 if (!efx->tc->meta_ct.hooked) in efx_mae_insert_ct()
1972 return -EOPNOTSUPP; in efx_mae_insert_ct()
1975 kw = DIV_ROUND_UP(efx->tc->meta_ct.desc.key_width, 32); in efx_mae_insert_ct()
1976 rw = DIV_ROUND_UP(efx->tc->meta_ct.desc.resp_width, 32); in efx_mae_insert_ct()
1980 return -E2BIG; in efx_mae_insert_ct()
1983 return -ENOMEM; in efx_mae_insert_ct()
1996 rc = TABLE_POPULATE_RESP_BOOL(resp, ct, dnat, conn->dnat); in efx_mae_insert_ct()
2001 rc = TABLE_POPULATE_RESP(resp, ct, nat_ip, conn->nat_ip); in efx_mae_insert_ct()
2004 rc = TABLE_POPULATE_RESP(resp, ct, l4_natport, conn->l4_natport); in efx_mae_insert_ct()
2007 rc = TABLE_POPULATE_RESP(resp, ct, mark, cpu_to_be32(conn->mark)); in efx_mae_insert_ct()
2010 rc = TABLE_POPULATE_RESP_U24(resp, ct, counter_id, conn->cnt->fw_id); in efx_mae_insert_ct()
2016 efx->tc->meta_ct.desc.key_width); in efx_mae_insert_ct()
2019 efx->tc->meta_ct.desc.resp_width); in efx_mae_insert_ct()
2040 int rc = -ENOMEM; in efx_mae_remove_ct()
2043 if (!efx->tc->meta_ct.hooked) in efx_mae_remove_ct()
2044 return -EOPNOTSUPP; in efx_mae_remove_ct()
2047 kw = DIV_ROUND_UP(efx->tc->meta_ct.desc.key_width, 32); in efx_mae_remove_ct()
2051 return -E2BIG; in efx_mae_remove_ct()
2054 return -ENOMEM; in efx_mae_remove_ct()
2066 efx->tc->meta_ct.desc.key_width); in efx_mae_remove_ct()
2082 const struct efx_tc_match *match) in efx_mae_populate_match_criteria() argument
2084 if (match->mask.ingress_port) { in efx_mae_populate_match_criteria()
2085 if (~match->mask.ingress_port) in efx_mae_populate_match_criteria()
2086 return -EOPNOTSUPP; in efx_mae_populate_match_criteria()
2089 match->value.ingress_port); in efx_mae_populate_match_criteria()
2092 match->mask.ingress_port); in efx_mae_populate_match_criteria()
2095 match->value.ct_state_trk, in efx_mae_populate_match_criteria()
2097 match->value.ct_state_est, in efx_mae_populate_match_criteria()
2099 match->value.ip_frag, in efx_mae_populate_match_criteria()
2101 match->value.ip_firstfrag, in efx_mae_populate_match_criteria()
2103 match->value.tcp_syn_fin_rst); in efx_mae_populate_match_criteria()
2106 match->mask.ct_state_trk, in efx_mae_populate_match_criteria()
2108 match->mask.ct_state_est, in efx_mae_populate_match_criteria()
2110 match->mask.ip_frag, in efx_mae_populate_match_criteria()
2112 match->mask.ip_firstfrag, in efx_mae_populate_match_criteria()
2114 match->mask.tcp_syn_fin_rst); in efx_mae_populate_match_criteria()
2116 match->value.recirc_id); in efx_mae_populate_match_criteria()
2118 match->mask.recirc_id); in efx_mae_populate_match_criteria()
2120 match->value.ct_mark); in efx_mae_populate_match_criteria()
2122 match->mask.ct_mark); in efx_mae_populate_match_criteria()
2124 match->value.ct_zone); in efx_mae_populate_match_criteria()
2126 match->mask.ct_zone); in efx_mae_populate_match_criteria()
2128 match->value.eth_proto); in efx_mae_populate_match_criteria()
2130 match->mask.eth_proto); in efx_mae_populate_match_criteria()
2132 match->value.vlan_tci[0]); in efx_mae_populate_match_criteria()
2134 match->mask.vlan_tci[0]); in efx_mae_populate_match_criteria()
2136 match->value.vlan_proto[0]); in efx_mae_populate_match_criteria()
2138 match->mask.vlan_proto[0]); in efx_mae_populate_match_criteria()
2140 match->value.vlan_tci[1]); in efx_mae_populate_match_criteria()
2142 match->mask.vlan_tci[1]); in efx_mae_populate_match_criteria()
2144 match->value.vlan_proto[1]); in efx_mae_populate_match_criteria()
2146 match->mask.vlan_proto[1]); in efx_mae_populate_match_criteria()
2148 match->value.eth_saddr, ETH_ALEN); in efx_mae_populate_match_criteria()
2150 match->mask.eth_saddr, ETH_ALEN); in efx_mae_populate_match_criteria()
2152 match->value.eth_daddr, ETH_ALEN); in efx_mae_populate_match_criteria()
2154 match->mask.eth_daddr, ETH_ALEN); in efx_mae_populate_match_criteria()
2156 match->value.ip_proto); in efx_mae_populate_match_criteria()
2158 match->mask.ip_proto); in efx_mae_populate_match_criteria()
2160 match->value.ip_tos); in efx_mae_populate_match_criteria()
2162 match->mask.ip_tos); in efx_mae_populate_match_criteria()
2164 match->value.ip_ttl); in efx_mae_populate_match_criteria()
2166 match->mask.ip_ttl); in efx_mae_populate_match_criteria()
2168 match->value.src_ip); in efx_mae_populate_match_criteria()
2170 match->mask.src_ip); in efx_mae_populate_match_criteria()
2172 match->value.dst_ip); in efx_mae_populate_match_criteria()
2174 match->mask.dst_ip); in efx_mae_populate_match_criteria()
2177 &match->value.src_ip6, sizeof(struct in6_addr)); in efx_mae_populate_match_criteria()
2179 &match->mask.src_ip6, sizeof(struct in6_addr)); in efx_mae_populate_match_criteria()
2181 &match->value.dst_ip6, sizeof(struct in6_addr)); in efx_mae_populate_match_criteria()
2183 &match->mask.dst_ip6, sizeof(struct in6_addr)); in efx_mae_populate_match_criteria()
2186 match->value.l4_sport); in efx_mae_populate_match_criteria()
2188 match->mask.l4_sport); in efx_mae_populate_match_criteria()
2190 match->value.l4_dport); in efx_mae_populate_match_criteria()
2192 match->mask.l4_dport); in efx_mae_populate_match_criteria()
2194 match->value.tcp_flags); in efx_mae_populate_match_criteria()
2196 match->mask.tcp_flags); in efx_mae_populate_match_criteria()
2197 /* enc-keys are handled indirectly, through encap_match ID */ in efx_mae_populate_match_criteria()
2198 if (match->encap) { in efx_mae_populate_match_criteria()
2200 match->encap->fw_id); in efx_mae_populate_match_criteria()
2205 match->value.enc_keyid); in efx_mae_populate_match_criteria()
2207 match->mask.enc_keyid); in efx_mae_populate_match_criteria()
2208 } else if (WARN_ON_ONCE(match->mask.enc_src_ip) || in efx_mae_populate_match_criteria()
2209 WARN_ON_ONCE(match->mask.enc_dst_ip) || in efx_mae_populate_match_criteria()
2210 WARN_ON_ONCE(!ipv6_addr_any(&match->mask.enc_src_ip6)) || in efx_mae_populate_match_criteria()
2211 WARN_ON_ONCE(!ipv6_addr_any(&match->mask.enc_dst_ip6)) || in efx_mae_populate_match_criteria()
2212 WARN_ON_ONCE(match->mask.enc_ip_tos) || in efx_mae_populate_match_criteria()
2213 WARN_ON_ONCE(match->mask.enc_ip_ttl) || in efx_mae_populate_match_criteria()
2214 WARN_ON_ONCE(match->mask.enc_sport) || in efx_mae_populate_match_criteria()
2215 WARN_ON_ONCE(match->mask.enc_dport) || in efx_mae_populate_match_criteria()
2216 WARN_ON_ONCE(match->mask.enc_keyid)) { in efx_mae_populate_match_criteria()
2217 /* No enc-keys should appear in a rule without an encap_match */ in efx_mae_populate_match_criteria()
2218 return -EOPNOTSUPP; in efx_mae_populate_match_criteria()
2223 int efx_mae_insert_rule(struct efx_nic *efx, const struct efx_tc_match *match, in efx_mae_insert_rule() argument
2234 return -EINVAL; in efx_mae_insert_rule()
2249 rc = efx_mae_populate_match_criteria(match_crit, match); in efx_mae_insert_rule()
2258 return -EIO; in efx_mae_insert_rule()
2299 return -EIO; in efx_mae_delete_rule()
2305 return -EIO; in efx_mae_delete_rule()
2311 struct ef100_nic_data *nic_data = efx->nic_data; in efx_init_mae()
2315 if (!nic_data->have_mport) in efx_init_mae()
2316 return -EINVAL; in efx_init_mae()
2320 return -ENOMEM; in efx_init_mae()
2322 rc = rhashtable_init(&mae->mports_ht, &efx_mae_mports_ht_params); in efx_init_mae()
2327 efx->mae = mae; in efx_init_mae()
2328 mae->efx = efx; in efx_init_mae()
2334 struct efx_mae *mae = efx->mae; in efx_fini_mae()
2337 efx->mae = NULL; in efx_fini_mae()