Lines Matching +full:mac +full:- +full:only
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2007-2017 QLogic Corporation. All rights reserved.
39 * ecore_exe_queue_init - init the Exe Queue object
61 ECORE_LIST_INIT(&o->exe_queue); in ecore_exe_queue_init()
62 ECORE_LIST_INIT(&o->pending_comp); in ecore_exe_queue_init()
64 ECORE_SPIN_LOCK_INIT(&o->lock, sc); in ecore_exe_queue_init()
66 o->exe_chunk_len = exe_len; in ecore_exe_queue_init()
67 o->owner = owner; in ecore_exe_queue_init()
70 o->validate = validate; in ecore_exe_queue_init()
71 o->remove = remove; in ecore_exe_queue_init()
72 o->optimize = optimize; in ecore_exe_queue_init()
73 o->execute = exec; in ecore_exe_queue_init()
74 o->get = get; in ecore_exe_queue_init()
92 ECORE_SPIN_LOCK_BH(&o->lock); in ecore_exe_queue_length()
94 ECORE_LIST_FOR_EACH_ENTRY(elem, &o->exe_queue, link, in ecore_exe_queue_length()
98 ECORE_SPIN_UNLOCK_BH(&o->lock); in ecore_exe_queue_length()
104 * ecore_exe_queue_add - add a new element to the execution queue
109 * @restore: true - do not optimize the command
120 ECORE_SPIN_LOCK_BH(&o->lock); in ecore_exe_queue_add()
124 rc = o->optimize(sc, o->owner, elem); in ecore_exe_queue_add()
129 rc = o->validate(sc, o->owner, elem); in ecore_exe_queue_add()
137 ECORE_LIST_PUSH_TAIL(&elem->link, &o->exe_queue); in ecore_exe_queue_add()
139 ECORE_SPIN_UNLOCK_BH(&o->lock); in ecore_exe_queue_add()
146 ECORE_SPIN_UNLOCK_BH(&o->lock); in ecore_exe_queue_add()
157 while (!ECORE_LIST_IS_EMPTY(&o->pending_comp)) { in __ecore_exe_queue_reset_pending()
158 elem = ECORE_LIST_FIRST_ENTRY(&o->pending_comp, in __ecore_exe_queue_reset_pending()
162 ECORE_LIST_REMOVE_ENTRY(&elem->link, &o->pending_comp); in __ecore_exe_queue_reset_pending()
168 * ecore_exe_queue_step - execute one execution chunk atomically
174 * (Should be called while holding the exe_queue->lock).
191 if (!ECORE_LIST_IS_EMPTY(&o->pending_comp)) { in ecore_exe_queue_step()
203 while (!ECORE_LIST_IS_EMPTY(&o->exe_queue)) { in ecore_exe_queue_step()
204 elem = ECORE_LIST_FIRST_ENTRY(&o->exe_queue, in ecore_exe_queue_step()
207 ECORE_DBG_BREAK_IF(!elem->cmd_len); in ecore_exe_queue_step()
209 if (cur_len + elem->cmd_len <= o->exe_chunk_len) { in ecore_exe_queue_step()
210 cur_len += elem->cmd_len; in ecore_exe_queue_step()
215 ECORE_LIST_PUSH_TAIL(&spacer.link, &o->pending_comp); in ecore_exe_queue_step()
217 ECORE_LIST_REMOVE_ENTRY(&elem->link, &o->exe_queue); in ecore_exe_queue_step()
218 ECORE_LIST_PUSH_TAIL(&elem->link, &o->pending_comp); in ecore_exe_queue_step()
219 ECORE_LIST_REMOVE_ENTRY(&spacer.link, &o->pending_comp); in ecore_exe_queue_step()
228 rc = o->execute(sc, o->owner, &o->pending_comp, ramrod_flags); in ecore_exe_queue_step()
233 ECORE_LIST_SPLICE_INIT(&o->pending_comp, &o->exe_queue); in ecore_exe_queue_step()
245 bool empty = ECORE_LIST_IS_EMPTY(&o->exe_queue); in ecore_exe_queue_empty()
250 return empty && ECORE_LIST_IS_EMPTY(&o->pending_comp); in ecore_exe_queue_empty()
273 return !!ECORE_TEST_BIT(o->state, o->pstate); in ecore_raw_check_pending()
279 ECORE_CLEAR_BIT(o->state, o->pstate); in ecore_raw_clear_pending()
286 ECORE_SET_BIT(o->state, o->pstate); in ecore_raw_set_pending()
291 * ecore_state_wait - wait until the given bit(state) is cleared
311 while (cnt--) { in ecore_state_wait()
314 ECORE_MSG(sc, "exit (cnt %d)\n", 5000 - cnt); in ecore_state_wait()
321 if (sc->panic) in ecore_state_wait()
336 return ecore_state_wait(sc, raw->state, raw->pstate); in ecore_raw_wait()
339 /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/
343 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_get_cam_offset_mac()
347 return mp->get_entry(mp, offset); in ecore_get_cam_offset_mac()
352 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_get_credit_mac()
356 return mp->get(mp, 1); in ecore_get_credit_mac()
361 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_get_cam_offset_vlan()
365 return vp->get_entry(vp, offset); in ecore_get_cam_offset_vlan()
370 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_get_credit_vlan()
374 return vp->get(vp, 1); in ecore_get_credit_vlan()
379 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_get_credit_vlan_mac()
380 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_get_credit_vlan_mac()
382 if (!mp->get(mp, 1)) in ecore_get_credit_vlan_mac()
385 if (!vp->get(vp, 1)) { in ecore_get_credit_vlan_mac()
386 mp->put(mp, 1); in ecore_get_credit_vlan_mac()
395 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_put_cam_offset_mac()
397 return mp->put_entry(mp, offset); in ecore_put_cam_offset_mac()
402 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_put_credit_mac()
404 return mp->put(mp, 1); in ecore_put_credit_mac()
409 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_put_cam_offset_vlan()
411 return vp->put_entry(vp, offset); in ecore_put_cam_offset_vlan()
416 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_put_credit_vlan()
418 return vp->put(vp, 1); in ecore_put_credit_vlan()
423 struct ecore_credit_pool_obj *mp = o->macs_pool; in ecore_put_credit_vlan_mac()
424 struct ecore_credit_pool_obj *vp = o->vlans_pool; in ecore_put_credit_vlan_mac()
426 if (!mp->put(mp, 1)) in ecore_put_credit_vlan_mac()
429 if (!vp->put(vp, 1)) { in ecore_put_credit_vlan_mac()
430 mp->get(mp, 1); in ecore_put_credit_vlan_mac()
438 * __ecore_vlan_mac_h_write_trylock - try getting the writer lock on vlan mac
444 * @details: Non-blocking implementation; should be called under execution
450 if (o->head_reader) { in __ecore_vlan_mac_h_write_trylock()
451 ECORE_MSG(sc, "vlan_mac_lock writer - There are readers; Busy\n"); in __ecore_vlan_mac_h_write_trylock()
455 ECORE_MSG(sc, "vlan_mac_lock writer - Taken\n"); in __ecore_vlan_mac_h_write_trylock()
460 * __ecore_vlan_mac_h_exec_pending - execute step instead of a previous step
461 * which wasn't able to run due to a taken lock on vlan mac head list.
473 unsigned long ramrod_flags = o->saved_ramrod_flags; in __ecore_vlan_mac_h_exec_pending()
477 o->head_exe_request = FALSE; in __ecore_vlan_mac_h_exec_pending()
478 o->saved_ramrod_flags = 0; in __ecore_vlan_mac_h_exec_pending()
479 rc = ecore_exe_queue_step(sc, &o->exe_queue, &ramrod_flags); in __ecore_vlan_mac_h_exec_pending()
490 * __ecore_vlan_mac_h_pend - Pend an execution step which couldn't have been
491 * called due to vlan mac head list lock being taken.
503 o->head_exe_request = TRUE; in __ecore_vlan_mac_h_pend()
504 o->saved_ramrod_flags = ramrod_flags; in __ecore_vlan_mac_h_pend()
510 * __ecore_vlan_mac_h_write_unlock - unlock the vlan mac head list writer lock
516 * execution exists, it would perform it - possibly releasing and
525 while(o->head_exe_request) { in __ecore_vlan_mac_h_write_unlock()
526 ECORE_MSG(sc, "vlan_mac_lock - writer release encountered a pending request\n"); in __ecore_vlan_mac_h_write_unlock()
532 * ecore_vlan_mac_h_write_unlock - unlock the vlan mac head list writer lock
537 * @details Notice if a pending execution exists, it would perform it -
543 ECORE_SPIN_LOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_write_unlock()
545 ECORE_SPIN_UNLOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_write_unlock()
549 * __ecore_vlan_mac_h_read_lock - lock the vlan mac head list reader lock
560 /* If we got here, we're holding lock --> no WRITER exists */ in __ecore_vlan_mac_h_read_lock()
561 o->head_reader++; in __ecore_vlan_mac_h_read_lock()
562 ECORE_MSG(sc, "vlan_mac_lock - locked reader - number %d\n", in __ecore_vlan_mac_h_read_lock()
563 o->head_reader); in __ecore_vlan_mac_h_read_lock()
569 * ecore_vlan_mac_h_read_lock - lock the vlan mac head list reader lock
581 ECORE_SPIN_LOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_read_lock()
583 ECORE_SPIN_UNLOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_read_lock()
589 * __ecore_vlan_mac_h_read_unlock - unlock the vlan mac head list reader lock
601 if (!o->head_reader) { in __ecore_vlan_mac_h_read_unlock()
602 ECORE_ERR("Need to release vlan mac reader lock, but lock isn't taken\n"); in __ecore_vlan_mac_h_read_unlock()
607 o->head_reader--; in __ecore_vlan_mac_h_read_unlock()
608 ECORE_MSG(sc, "vlan_mac_lock - decreased readers to %d\n", in __ecore_vlan_mac_h_read_unlock()
609 o->head_reader); in __ecore_vlan_mac_h_read_unlock()
613 * was last - if so we need to execute the command. in __ecore_vlan_mac_h_read_unlock()
615 if (!o->head_reader && o->head_exe_request) { in __ecore_vlan_mac_h_read_unlock()
616 ECORE_MSG(sc, "vlan_mac_lock - reader release encountered a pending request\n"); in __ecore_vlan_mac_h_read_unlock()
624 * ecore_vlan_mac_h_read_unlock - unlock the vlan mac head list reader lock
636 ECORE_SPIN_LOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_read_unlock()
638 ECORE_SPIN_UNLOCK_BH(&o->exe_queue.lock); in ecore_vlan_mac_h_read_unlock()
642 * ecore_vlan_mac_h_read_unlock - unlock the vlan mac head list reader lock
658 ECORE_MSG(sc, "get_n_elements - taking vlan_mac_lock (reader)\n"); in ecore_get_n_elements()
661 ECORE_ERR("get_n_elements failed to get vlan mac reader lock; Access without lock\n"); in ecore_get_n_elements()
664 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_get_n_elements()
667 ECORE_MEMCPY(next, &pos->u, size); in ecore_get_n_elements()
676 ECORE_MSG(sc, "get_n_elements - releasing vlan_mac_lock (reader)\n"); in ecore_get_n_elements()
690 …MAC %02x:%02x:%02x:%02x:%02x:%02x for ADD command\n", data->mac.mac[0], data->mac.mac[1], data->ma… in ecore_check_mac_add()
692 if (!ECORE_IS_VALID_ETHER_ADDR(data->mac.mac)) in ecore_check_mac_add()
695 /* Check if a requested MAC already exists */ in ecore_check_mac_add()
696 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_mac_add()
698 if (!ECORE_MEMCMP(data->mac.mac, pos->u.mac.mac, ETH_ALEN) && in ecore_check_mac_add()
699 (data->mac.is_inner_mac == pos->u.mac.is_inner_mac)) in ecore_check_mac_add()
711 ECORE_MSG(sc, "Checking VLAN %d for ADD command\n", data->vlan.vlan); in ecore_check_vlan_add()
713 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vlan_add()
715 if (data->vlan.vlan == pos->u.vlan.vlan) in ecore_check_vlan_add()
728 …data->vlan_mac.mac[0], data->vlan_mac.mac[1], data->vlan_mac.mac[2], data->vlan_mac.mac[3], data->… in ecore_check_vlan_mac_add()
730 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vlan_mac_add()
732 if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) && in ecore_check_vlan_mac_add()
733 (!ECORE_MEMCMP(data->vlan_mac.mac, pos->u.vlan_mac.mac, in ecore_check_vlan_mac_add()
735 (data->vlan_mac.is_inner_mac == in ecore_check_vlan_mac_add()
736 pos->u.vlan_mac.is_inner_mac)) in ecore_check_vlan_mac_add()
749 data->vxlan_fltr.innermac, data->vxlan_fltr.vni); in ecore_check_vxlan_fltr_add()
751 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vxlan_fltr_add()
753 if ((!ECORE_MEMCMP(data->vxlan_fltr.innermac, in ecore_check_vxlan_fltr_add()
754 pos->u.vxlan_fltr.innermac, in ecore_check_vxlan_fltr_add()
756 (data->vxlan_fltr.vni == pos->u.vxlan_fltr.vni)) in ecore_check_vxlan_fltr_add()
770 …MAC %02x:%02x:%02x:%02x:%02x:%02x for DEL command\n", data->mac.mac[0], data->mac.mac[1], data->ma… in ecore_check_mac_del()
772 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_mac_del()
774 if ((!ECORE_MEMCMP(data->mac.mac, pos->u.mac.mac, ETH_ALEN)) && in ecore_check_mac_del()
775 (data->mac.is_inner_mac == pos->u.mac.is_inner_mac)) in ecore_check_mac_del()
788 ECORE_MSG(sc, "Checking VLAN %d for DEL command\n", data->vlan.vlan); in ecore_check_vlan_del()
790 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vlan_del()
792 if (data->vlan.vlan == pos->u.vlan.vlan) in ecore_check_vlan_del()
806 …data->vlan_mac.mac[0], data->vlan_mac.mac[1], data->vlan_mac.mac[2], data->vlan_mac.mac[3], data->… in ecore_check_vlan_mac_del()
808 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vlan_mac_del()
810 if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) && in ecore_check_vlan_mac_del()
811 (!ECORE_MEMCMP(data->vlan_mac.mac, pos->u.vlan_mac.mac, in ecore_check_vlan_mac_del()
813 (data->vlan_mac.is_inner_mac == in ecore_check_vlan_mac_del()
814 pos->u.vlan_mac.is_inner_mac)) in ecore_check_vlan_mac_del()
829 data->vxlan_fltr.innermac, data->vxlan_fltr.vni); in ecore_check_vxlan_fltr_del()
831 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_check_vxlan_fltr_del()
833 if ((!ECORE_MEMCMP(data->vxlan_fltr.innermac, in ecore_check_vxlan_fltr_del()
834 pos->u.vxlan_fltr.innermac, in ecore_check_vxlan_fltr_del()
836 (data->vxlan_fltr.vni == pos->u.vxlan_fltr.vni)) in ecore_check_vxlan_fltr_del()
854 pos = src_o->check_del(sc, src_o, data); in ecore_check_move()
857 rc = dst_o->check_add(sc, dst_o, data); in ecore_check_move()
860 * or can't be deleted - return an error. in ecore_check_move()
879 struct ecore_raw_obj *raw = &o->raw; in ecore_vlan_mac_get_rx_tx_flag()
882 if ((raw->obj_type == ECORE_OBJ_TYPE_TX) || in ecore_vlan_mac_get_rx_tx_flag()
883 (raw->obj_type == ECORE_OBJ_TYPE_RX_TX)) in ecore_vlan_mac_get_rx_tx_flag()
886 if ((raw->obj_type == ECORE_OBJ_TYPE_RX) || in ecore_vlan_mac_get_rx_tx_flag()
887 (raw->obj_type == ECORE_OBJ_TYPE_RX_TX)) in ecore_vlan_mac_get_rx_tx_flag()
925 * ecore_vlan_mac_set_cmd_hdr_e2 - set a header in a single classify ramrod
938 struct ecore_raw_obj *raw = &o->raw; in ecore_vlan_mac_set_cmd_hdr_e2()
940 hdr->client_id = raw->cl_id; in ecore_vlan_mac_set_cmd_hdr_e2()
941 hdr->func_id = raw->func_id; in ecore_vlan_mac_set_cmd_hdr_e2()
944 hdr->cmd_general_data |= in ecore_vlan_mac_set_cmd_hdr_e2()
948 hdr->cmd_general_data |= ETH_CLASSIFY_CMD_HEADER_IS_ADD; in ecore_vlan_mac_set_cmd_hdr_e2()
950 hdr->cmd_general_data |= in ecore_vlan_mac_set_cmd_hdr_e2()
955 * ecore_vlan_mac_set_rdata_hdr_e2 - set the classify ramrod data header
968 hdr->echo = ECORE_CPU_TO_LE32((cid & ECORE_SWCID_MASK) | in ecore_vlan_mac_set_rdata_hdr_e2()
970 hdr->rule_cnt = (uint8_t)rule_cnt; in ecore_vlan_mac_set_rdata_hdr_e2()
979 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_mac_e2()
981 (struct eth_classify_rules_ramrod_data *)(raw->rdata); in ecore_set_one_mac_e2()
982 int rule_cnt = rule_idx + 1, cmd = elem->cmd_data.vlan_mac.cmd; in ecore_set_one_mac_e2()
983 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; in ecore_set_one_mac_e2()
985 unsigned long *vlan_mac_flags = &elem->cmd_data.vlan_mac.vlan_mac_flags; in ecore_set_one_mac_e2()
986 uint8_t *mac = elem->cmd_data.vlan_mac.u.mac.mac; in ecore_set_one_mac_e2() local
988 /* Set LLH CAM entry: currently only iSCSI and ETH macs are in ecore_set_one_mac_e2()
990 * single ETH MAC. in ecore_set_one_mac_e2()
994 * etc.), consider better utilisation of 8 per function MAC in ecore_set_one_mac_e2()
1000 * MAC and iSCSI L2 MAC. in ecore_set_one_mac_e2()
1002 * If this MAC is moving from one Queue to another, no need to change in ecore_set_one_mac_e2()
1007 ecore_set_mac_in_nig(sc, add, mac, in ecore_set_one_mac_e2()
1010 ecore_set_mac_in_nig(sc, add, mac, in ecore_set_one_mac_e2()
1020 &rule_entry->mac.header); in ecore_set_one_mac_e2()
1022 ECORE_MSG(sc, "About to %s MAC %02x:%02x:%02x:%02x:%02x:%02x for Queue %d\n", in ecore_set_one_mac_e2()
1023 (add ? "add" : "delete"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], raw->cl_id); in ecore_set_one_mac_e2()
1025 /* Set a MAC itself */ in ecore_set_one_mac_e2()
1026 ecore_set_fw_mac_addr(&rule_entry->mac.mac_msb, in ecore_set_one_mac_e2()
1027 &rule_entry->mac.mac_mid, in ecore_set_one_mac_e2()
1028 &rule_entry->mac.mac_lsb, mac); in ecore_set_one_mac_e2()
1029 rule_entry->mac.inner_mac = in ecore_set_one_mac_e2()
1030 ECORE_CPU_TO_LE16(elem->cmd_data.vlan_mac.u.mac.is_inner_mac); in ecore_set_one_mac_e2()
1032 /* MOVE: Add a rule that will add this MAC to the target Queue */ in ecore_set_one_mac_e2()
1039 elem->cmd_data.vlan_mac.target_obj, in ecore_set_one_mac_e2()
1041 &rule_entry->mac.header); in ecore_set_one_mac_e2()
1043 /* Set a MAC itself */ in ecore_set_one_mac_e2()
1044 ecore_set_fw_mac_addr(&rule_entry->mac.mac_msb, in ecore_set_one_mac_e2()
1045 &rule_entry->mac.mac_mid, in ecore_set_one_mac_e2()
1046 &rule_entry->mac.mac_lsb, mac); in ecore_set_one_mac_e2()
1047 rule_entry->mac.inner_mac = in ecore_set_one_mac_e2()
1048 ECORE_CPU_TO_LE16(elem->cmd_data.vlan_mac. in ecore_set_one_mac_e2()
1049 u.mac.is_inner_mac); in ecore_set_one_mac_e2()
1055 ecore_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, &data->header, in ecore_set_one_mac_e2()
1060 * ecore_vlan_mac_set_rdata_hdr_e1x - set a header in a single classify ramrod
1074 struct ecore_raw_obj *r = &o->raw; in ecore_vlan_mac_set_rdata_hdr_e1x()
1076 hdr->length = 1; in ecore_vlan_mac_set_rdata_hdr_e1x()
1077 hdr->offset = (uint8_t)cam_offset; in ecore_vlan_mac_set_rdata_hdr_e1x()
1078 hdr->client_id = ECORE_CPU_TO_LE16(0xff); in ecore_vlan_mac_set_rdata_hdr_e1x()
1079 hdr->echo = ECORE_CPU_TO_LE32((r->cid & ECORE_SWCID_MASK) | in ecore_vlan_mac_set_rdata_hdr_e1x()
1084 struct ecore_vlan_mac_obj *o, bool add, int opcode, uint8_t *mac, in ecore_vlan_mac_set_cfg_entry_e1x() argument
1087 struct ecore_raw_obj *r = &o->raw; in ecore_vlan_mac_set_cfg_entry_e1x()
1088 uint32_t cl_bit_vec = (1 << r->cl_id); in ecore_vlan_mac_set_cfg_entry_e1x()
1090 cfg_entry->clients_bit_vector = ECORE_CPU_TO_LE32(cl_bit_vec); in ecore_vlan_mac_set_cfg_entry_e1x()
1091 cfg_entry->pf_id = r->func_id; in ecore_vlan_mac_set_cfg_entry_e1x()
1092 cfg_entry->vlan_id = ECORE_CPU_TO_LE16(vlan_id); in ecore_vlan_mac_set_cfg_entry_e1x()
1095 ECORE_SET_FLAG(cfg_entry->flags, in ecore_vlan_mac_set_cfg_entry_e1x()
1098 ECORE_SET_FLAG(cfg_entry->flags, in ecore_vlan_mac_set_cfg_entry_e1x()
1102 /* Set a MAC in a ramrod data */ in ecore_vlan_mac_set_cfg_entry_e1x()
1103 ecore_set_fw_mac_addr(&cfg_entry->msb_mac_addr, in ecore_vlan_mac_set_cfg_entry_e1x()
1104 &cfg_entry->middle_mac_addr, in ecore_vlan_mac_set_cfg_entry_e1x()
1105 &cfg_entry->lsb_mac_addr, mac); in ecore_vlan_mac_set_cfg_entry_e1x()
1107 ECORE_SET_FLAG(cfg_entry->flags, in ecore_vlan_mac_set_cfg_entry_e1x()
1114 uint8_t *mac, uint16_t vlan_id, int opcode, struct mac_configuration_cmd *config) in ecore_vlan_mac_set_rdata_e1x() argument
1116 struct mac_configuration_entry *cfg_entry = &config->config_table[0]; in ecore_vlan_mac_set_rdata_e1x()
1117 struct ecore_raw_obj *raw = &o->raw; in ecore_vlan_mac_set_rdata_e1x()
1120 &config->hdr); in ecore_vlan_mac_set_rdata_e1x()
1121 ecore_vlan_mac_set_cfg_entry_e1x(sc, o, add, opcode, mac, vlan_id, in ecore_vlan_mac_set_rdata_e1x()
1124 ECORE_MSG(sc, "%s MAC %02x:%02x:%02x:%02x:%02x:%02x CLID %d CAM offset %d\n", in ecore_vlan_mac_set_rdata_e1x()
1126 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], raw->cl_id, cam_offset); in ecore_vlan_mac_set_rdata_e1x()
1130 * ecore_set_one_mac_e1x - fill a single MAC rule ramrod data
1143 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_mac_e1x()
1145 (struct mac_configuration_cmd *)(raw->rdata); in ecore_set_one_mac_e1x()
1149 bool add = (elem->cmd_data.vlan_mac.cmd == ECORE_VLAN_MAC_ADD) ? in ecore_set_one_mac_e1x()
1155 ecore_vlan_mac_set_rdata_e1x(sc, o, raw->state, in ecore_set_one_mac_e1x()
1157 elem->cmd_data.vlan_mac.u.mac.mac, 0, in ecore_set_one_mac_e1x()
1166 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_vlan_e2()
1168 (struct eth_classify_rules_ramrod_data *)(raw->rdata); in ecore_set_one_vlan_e2()
1170 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; in ecore_set_one_vlan_e2()
1171 enum ecore_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd; in ecore_set_one_vlan_e2()
1173 uint16_t vlan = elem->cmd_data.vlan_mac.u.vlan.vlan; in ecore_set_one_vlan_e2()
1181 &rule_entry->vlan.header); in ecore_set_one_vlan_e2()
1187 rule_entry->vlan.vlan = ECORE_CPU_TO_LE16(vlan); in ecore_set_one_vlan_e2()
1189 /* MOVE: Add a rule that will add this MAC to the target Queue */ in ecore_set_one_vlan_e2()
1196 elem->cmd_data.vlan_mac.target_obj, in ecore_set_one_vlan_e2()
1198 &rule_entry->vlan.header); in ecore_set_one_vlan_e2()
1201 rule_entry->vlan.vlan = ECORE_CPU_TO_LE16(vlan); in ecore_set_one_vlan_e2()
1207 ecore_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, &data->header, in ecore_set_one_vlan_e2()
1216 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_vlan_mac_e2()
1218 (struct eth_classify_rules_ramrod_data *)(raw->rdata); in ecore_set_one_vlan_mac_e2()
1220 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; in ecore_set_one_vlan_mac_e2()
1221 enum ecore_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd; in ecore_set_one_vlan_mac_e2()
1223 uint16_t vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan; in ecore_set_one_vlan_mac_e2()
1224 uint8_t *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac; in ecore_set_one_vlan_mac_e2() local
1232 &rule_entry->pair.header); in ecore_set_one_vlan_mac_e2()
1234 /* Set VLAN and MAC themselves */ in ecore_set_one_vlan_mac_e2()
1235 rule_entry->pair.vlan = ECORE_CPU_TO_LE16(vlan); in ecore_set_one_vlan_mac_e2()
1236 ecore_set_fw_mac_addr(&rule_entry->pair.mac_msb, in ecore_set_one_vlan_mac_e2()
1237 &rule_entry->pair.mac_mid, in ecore_set_one_vlan_mac_e2()
1238 &rule_entry->pair.mac_lsb, mac); in ecore_set_one_vlan_mac_e2()
1239 rule_entry->pair.inner_mac = in ecore_set_one_vlan_mac_e2()
1240 elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac; in ecore_set_one_vlan_mac_e2()
1241 /* MOVE: Add a rule that will add this MAC to the target Queue */ in ecore_set_one_vlan_mac_e2()
1248 elem->cmd_data.vlan_mac.target_obj, in ecore_set_one_vlan_mac_e2()
1250 &rule_entry->pair.header); in ecore_set_one_vlan_mac_e2()
1253 rule_entry->pair.vlan = ECORE_CPU_TO_LE16(vlan); in ecore_set_one_vlan_mac_e2()
1254 ecore_set_fw_mac_addr(&rule_entry->pair.mac_msb, in ecore_set_one_vlan_mac_e2()
1255 &rule_entry->pair.mac_mid, in ecore_set_one_vlan_mac_e2()
1256 &rule_entry->pair.mac_lsb, mac); in ecore_set_one_vlan_mac_e2()
1257 rule_entry->pair.inner_mac = in ecore_set_one_vlan_mac_e2()
1258 elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac; in ecore_set_one_vlan_mac_e2()
1264 ecore_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, &data->header, in ecore_set_one_vlan_mac_e2()
1273 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_vxlan_fltr_e2()
1275 (struct eth_classify_rules_ramrod_data *)(raw->rdata); in ecore_set_one_vxlan_fltr_e2()
1277 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; in ecore_set_one_vxlan_fltr_e2()
1278 enum ecore_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd; in ecore_set_one_vxlan_fltr_e2()
1280 uint32_t vni = elem->cmd_data.vlan_mac.u.vxlan_fltr.vni; in ecore_set_one_vxlan_fltr_e2()
1281 uint8_t *mac = elem->cmd_data.vlan_mac.u.vxlan_fltr.innermac; in ecore_set_one_vxlan_fltr_e2() local
1290 &rule_entry->imac_vni.header); in ecore_set_one_vxlan_fltr_e2()
1292 /* Set VLAN and MAC themselves */ in ecore_set_one_vxlan_fltr_e2()
1293 rule_entry->imac_vni.vni = vni; in ecore_set_one_vxlan_fltr_e2()
1294 ecore_set_fw_mac_addr(&rule_entry->imac_vni.imac_msb, in ecore_set_one_vxlan_fltr_e2()
1295 &rule_entry->imac_vni.imac_mid, in ecore_set_one_vxlan_fltr_e2()
1296 &rule_entry->imac_vni.imac_lsb, mac); in ecore_set_one_vxlan_fltr_e2()
1298 /* MOVE: Add a rule that will add this MAC to the target Queue */ in ecore_set_one_vxlan_fltr_e2()
1305 elem->cmd_data.vlan_mac.target_obj, in ecore_set_one_vxlan_fltr_e2()
1307 &rule_entry->imac_vni.header); in ecore_set_one_vxlan_fltr_e2()
1310 rule_entry->imac_vni.vni = vni; in ecore_set_one_vxlan_fltr_e2()
1311 ecore_set_fw_mac_addr(&rule_entry->imac_vni.imac_msb, in ecore_set_one_vxlan_fltr_e2()
1312 &rule_entry->imac_vni.imac_mid, in ecore_set_one_vxlan_fltr_e2()
1313 &rule_entry->imac_vni.imac_lsb, mac); in ecore_set_one_vxlan_fltr_e2()
1320 ecore_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, in ecore_set_one_vxlan_fltr_e2()
1321 &data->header, rule_cnt); in ecore_set_one_vxlan_fltr_e2()
1325 * ecore_set_one_vlan_mac_e1h -
1338 struct ecore_raw_obj *raw = &o->raw; in ecore_set_one_vlan_mac_e1h()
1340 (struct mac_configuration_cmd *)(raw->rdata); in ecore_set_one_vlan_mac_e1h()
1344 bool add = (elem->cmd_data.vlan_mac.cmd == ECORE_VLAN_MAC_ADD) ? in ecore_set_one_vlan_mac_e1h()
1352 elem->cmd_data.vlan_mac.u.vlan_mac.mac, in ecore_set_one_vlan_mac_e1h()
1353 elem->cmd_data.vlan_mac.u.vlan_mac.vlan, in ecore_set_one_vlan_mac_e1h()
1358 list_entry((pos)->member.next, typeof(*(pos)), member)
1361 * ecore_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element
1367 * reconfigure next MAC/VLAN/VLAN-MAC element from the
1370 * from command parameters only RAMROD_COMP_WAIT bit in ramrod_flags is taken
1373 * pointer to the cookie - that should be given back in the next call to make
1384 struct ecore_vlan_mac_obj *o = p->vlan_mac_obj; in ecore_vlan_mac_restore()
1386 /* If list is empty - there is nothing to do here */ in ecore_vlan_mac_restore()
1387 if (ECORE_LIST_IS_EMPTY(&o->head)) { in ecore_vlan_mac_restore()
1394 *ppos = ECORE_LIST_FIRST_ENTRY(&o->head, in ecore_vlan_mac_restore()
1403 /* If it's the last step - return NULL */ in ecore_vlan_mac_restore()
1404 if (ECORE_LIST_IS_LAST(&pos->link, &o->head)) in ecore_vlan_mac_restore()
1408 ECORE_MEMCPY(&p->user_req.u, &pos->u, sizeof(pos->u)); in ecore_vlan_mac_restore()
1411 p->user_req.cmd = ECORE_VLAN_MAC_ADD; in ecore_vlan_mac_restore()
1414 p->user_req.vlan_mac_flags = pos->vlan_mac_flags; in ecore_vlan_mac_restore()
1417 ECORE_SET_BIT_NA(RAMROD_RESTORE, &p->ramrod_flags); in ecore_vlan_mac_restore()
1431 struct ecore_mac_ramrod_data *data = &elem->cmd_data.vlan_mac.u.mac; in ecore_exeq_get_mac()
1434 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->exe_queue, link, in ecore_exeq_get_mac()
1436 if (!ECORE_MEMCMP(&pos->cmd_data.vlan_mac.u.mac, data, in ecore_exeq_get_mac()
1438 (pos->cmd_data.vlan_mac.cmd == elem->cmd_data.vlan_mac.cmd)) in ecore_exeq_get_mac()
1449 struct ecore_vlan_ramrod_data *data = &elem->cmd_data.vlan_mac.u.vlan; in ecore_exeq_get_vlan()
1452 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->exe_queue, link, in ecore_exeq_get_vlan()
1454 if (!ECORE_MEMCMP(&pos->cmd_data.vlan_mac.u.vlan, data, in ecore_exeq_get_vlan()
1456 (pos->cmd_data.vlan_mac.cmd == elem->cmd_data.vlan_mac.cmd)) in ecore_exeq_get_vlan()
1468 &elem->cmd_data.vlan_mac.u.vlan_mac; in ecore_exeq_get_vlan_mac()
1471 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->exe_queue, link, in ecore_exeq_get_vlan_mac()
1473 if (!ECORE_MEMCMP(&pos->cmd_data.vlan_mac.u.vlan_mac, data, in ecore_exeq_get_vlan_mac()
1475 (pos->cmd_data.vlan_mac.cmd == elem->cmd_data.vlan_mac.cmd)) in ecore_exeq_get_vlan_mac()
1487 &elem->cmd_data.vlan_mac.u.vxlan_fltr; in ecore_exeq_get_vxlan_fltr()
1490 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->exe_queue, link, in ecore_exeq_get_vxlan_fltr()
1492 if (!ECORE_MEMCMP(&pos->cmd_data.vlan_mac.u.vxlan_fltr, data, in ecore_exeq_get_vxlan_fltr()
1494 (pos->cmd_data.vlan_mac.cmd == in ecore_exeq_get_vxlan_fltr()
1495 elem->cmd_data.vlan_mac.cmd)) in ecore_exeq_get_vxlan_fltr()
1502 * ecore_validate_vlan_mac_add - check if an ADD command can be executed
1518 struct ecore_vlan_mac_obj *o = &qo->vlan_mac; in ecore_validate_vlan_mac_add()
1519 struct ecore_exe_queue_obj *exeq = &o->exe_queue; in ecore_validate_vlan_mac_add()
1523 rc = o->check_add(sc, o, &elem->cmd_data.vlan_mac.u); in ecore_validate_vlan_mac_add()
1530 * MAC/VLAN/VLAN-MAC. Return an error if there is. in ecore_validate_vlan_mac_add()
1532 if (exeq->get(exeq, elem)) { in ecore_validate_vlan_mac_add()
1543 &elem->cmd_data.vlan_mac.vlan_mac_flags) || in ecore_validate_vlan_mac_add()
1544 o->get_credit(o))) in ecore_validate_vlan_mac_add()
1551 * ecore_validate_vlan_mac_del - check if the DEL command can be executed
1566 struct ecore_vlan_mac_obj *o = &qo->vlan_mac; in ecore_validate_vlan_mac_del()
1568 struct ecore_exe_queue_obj *exeq = &o->exe_queue; in ecore_validate_vlan_mac_del()
1572 * - return a ECORE_EXIST. in ecore_validate_vlan_mac_del()
1574 pos = o->check_del(sc, o, &elem->cmd_data.vlan_mac.u); in ecore_validate_vlan_mac_del()
1581 * MAC/VLAN/VLAN-MAC. Return an error if so. in ecore_validate_vlan_mac_del()
1587 if (exeq->get(exeq, &query_elem)) { in ecore_validate_vlan_mac_del()
1593 if (exeq->get(exeq, elem)) { in ecore_validate_vlan_mac_del()
1600 &elem->cmd_data.vlan_mac.vlan_mac_flags) || in ecore_validate_vlan_mac_del()
1601 o->put_credit(o))) { in ecore_validate_vlan_mac_del()
1610 * ecore_validate_vlan_mac_move - check if the MOVE command can be executed
1625 struct ecore_vlan_mac_obj *src_o = &qo->vlan_mac; in ecore_validate_vlan_mac_move()
1626 struct ecore_vlan_mac_obj *dest_o = elem->cmd_data.vlan_mac.target_obj; in ecore_validate_vlan_mac_move()
1628 struct ecore_exe_queue_obj *src_exeq = &src_o->exe_queue; in ecore_validate_vlan_mac_move()
1629 struct ecore_exe_queue_obj *dest_exeq = &dest_o->exe_queue; in ecore_validate_vlan_mac_move()
1634 if (!src_o->check_move(sc, src_o, dest_o, in ecore_validate_vlan_mac_move()
1635 &elem->cmd_data.vlan_mac.u)) { in ecore_validate_vlan_mac_move()
1648 if (src_exeq->get(src_exeq, &query_elem)) { in ecore_validate_vlan_mac_move()
1654 if (src_exeq->get(src_exeq, elem)) { in ecore_validate_vlan_mac_move()
1661 if (dest_exeq->get(dest_exeq, &query_elem)) { in ecore_validate_vlan_mac_move()
1668 &elem->cmd_data.vlan_mac.vlan_mac_flags) || in ecore_validate_vlan_mac_move()
1669 dest_o->get_credit(dest_o))) in ecore_validate_vlan_mac_move()
1673 &elem->cmd_data.vlan_mac.vlan_mac_flags) || in ecore_validate_vlan_mac_move()
1674 src_o->put_credit(src_o))) { in ecore_validate_vlan_mac_move()
1676 dest_o->put_credit(dest_o); in ecore_validate_vlan_mac_move()
1687 switch (elem->cmd_data.vlan_mac.cmd) { in ecore_validate_vlan_mac()
1707 &elem->cmd_data.vlan_mac.vlan_mac_flags)) in ecore_remove_vlan_mac()
1710 switch (elem->cmd_data.vlan_mac.cmd) { in ecore_remove_vlan_mac()
1713 rc = qo->vlan_mac.put_credit(&qo->vlan_mac); in ecore_remove_vlan_mac()
1716 rc = qo->vlan_mac.get_credit(&qo->vlan_mac); in ecore_remove_vlan_mac()
1729 * ecore_wait_vlan_mac - passively wait for 5 seconds until all work completes.
1739 struct ecore_exe_queue_obj *exeq = &o->exe_queue; in ecore_wait_vlan_mac()
1740 struct ecore_raw_obj *raw = &o->raw; in ecore_wait_vlan_mac()
1742 while (cnt--) { in ecore_wait_vlan_mac()
1744 rc = raw->wait_comp(sc, raw); in ecore_wait_vlan_mac()
1764 ECORE_SPIN_LOCK_BH(&o->exe_queue.lock); in __ecore_vlan_mac_execute_step()
1766 ECORE_MSG(sc, "vlan_mac_execute_step - trying to take writer lock\n"); in __ecore_vlan_mac_execute_step()
1777 rc = ecore_exe_queue_step(sc, &o->exe_queue, ramrod_flags); in __ecore_vlan_mac_execute_step()
1779 ECORE_SPIN_UNLOCK_BH(&o->exe_queue.lock); in __ecore_vlan_mac_execute_step()
1785 * ecore_complete_vlan_mac - complete one VLAN-MAC ramrod
1798 struct ecore_raw_obj *r = &o->raw; in ecore_complete_vlan_mac()
1804 ECORE_SPIN_LOCK_BH(&o->exe_queue.lock); in ecore_complete_vlan_mac()
1807 __ecore_exe_queue_reset_pending(sc, &o->exe_queue); in ecore_complete_vlan_mac()
1810 r->clear_pending(r); in ecore_complete_vlan_mac()
1812 ECORE_SPIN_UNLOCK_BH(&o->exe_queue.lock); in ecore_complete_vlan_mac()
1815 if (cqe->message.error) in ecore_complete_vlan_mac()
1826 if (!ecore_exe_queue_empty(&o->exe_queue)) in ecore_complete_vlan_mac()
1833 * ecore_optimize_vlan_mac - optimize ADD and DEL commands.
1844 struct ecore_vlan_mac_obj *o = &qo->vlan_mac; in ecore_optimize_vlan_mac()
1845 struct ecore_exe_queue_obj *exeq = &o->exe_queue; in ecore_optimize_vlan_mac()
1849 switch (elem->cmd_data.vlan_mac.cmd) { in ecore_optimize_vlan_mac()
1861 /* If we found the appropriate element - delete it */ in ecore_optimize_vlan_mac()
1862 pos = exeq->get(exeq, &query); in ecore_optimize_vlan_mac()
1867 &pos->cmd_data.vlan_mac.vlan_mac_flags)) { in ecore_optimize_vlan_mac()
1869 ECORE_VLAN_MAC_ADD) && !o->put_credit(o)) { in ecore_optimize_vlan_mac()
1872 } else if (!o->get_credit(o)) { /* VLAN_MAC_DEL */ in ecore_optimize_vlan_mac()
1879 (elem->cmd_data.vlan_mac.cmd == ECORE_VLAN_MAC_ADD) ? in ecore_optimize_vlan_mac()
1882 ECORE_LIST_REMOVE_ENTRY(&pos->link, &exeq->exe_queue); in ecore_optimize_vlan_mac()
1891 * ecore_vlan_mac_get_registry_elem - prepare a registry element
1908 enum ecore_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd; in ecore_vlan_mac_get_registry_elem()
1919 if (!o->get_cam_offset(o, ®_elem->cam_offset)) { in ecore_vlan_mac_get_registry_elem()
1928 ECORE_MSG(sc, "Got cam offset %d\n", reg_elem->cam_offset); in ecore_vlan_mac_get_registry_elem()
1930 /* Set a VLAN-MAC data */ in ecore_vlan_mac_get_registry_elem()
1931 ECORE_MEMCPY(®_elem->u, &elem->cmd_data.vlan_mac.u, in ecore_vlan_mac_get_registry_elem()
1932 sizeof(reg_elem->u)); in ecore_vlan_mac_get_registry_elem()
1935 reg_elem->vlan_mac_flags = in ecore_vlan_mac_get_registry_elem()
1936 elem->cmd_data.vlan_mac.vlan_mac_flags; in ecore_vlan_mac_get_registry_elem()
1938 reg_elem = o->check_del(sc, o, &elem->cmd_data.vlan_mac.u); in ecore_vlan_mac_get_registry_elem()
1945 * ecore_execute_vlan_mac - execute vlan mac command
1960 struct ecore_vlan_mac_obj *o = &qo->vlan_mac, *cam_obj; in ecore_execute_vlan_mac()
1961 struct ecore_raw_obj *r = &o->raw; in ecore_execute_vlan_mac()
1972 ECORE_DBG_BREAK_IF(r->check_pending(r)); in ecore_execute_vlan_mac()
1975 r->set_pending(r); in ecore_execute_vlan_mac()
1980 cmd = elem->cmd_data.vlan_mac.cmd; in ecore_execute_vlan_mac()
1985 cam_obj = elem->cmd_data.vlan_mac.target_obj; in ecore_execute_vlan_mac()
2001 ECORE_LIST_PUSH_HEAD(®_elem->link, in ecore_execute_vlan_mac()
2002 &cam_obj->head); in ecore_execute_vlan_mac()
2005 o->set_one_rule(sc, o, elem, idx, in ecore_execute_vlan_mac()
2006 reg_elem->cam_offset); in ecore_execute_vlan_mac()
2021 rc = ecore_sp_post(sc, o->ramrod_cmd, r->cid, in ecore_execute_vlan_mac()
2022 r->rdata_mapping, in ecore_execute_vlan_mac()
2028 /* Now, when we are done with the ramrod - clean up the registry */ in ecore_execute_vlan_mac()
2031 cmd = elem->cmd_data.vlan_mac.cmd; in ecore_execute_vlan_mac()
2034 reg_elem = o->check_del(sc, o, in ecore_execute_vlan_mac()
2035 &elem->cmd_data.vlan_mac.u); in ecore_execute_vlan_mac()
2039 o->put_cam_offset(o, reg_elem->cam_offset); in ecore_execute_vlan_mac()
2040 ECORE_LIST_REMOVE_ENTRY(®_elem->link, &o->head); in ecore_execute_vlan_mac()
2051 r->clear_pending(r); in ecore_execute_vlan_mac()
2056 cmd = elem->cmd_data.vlan_mac.cmd; in ecore_execute_vlan_mac()
2059 cam_obj = elem->cmd_data.vlan_mac.target_obj; in ecore_execute_vlan_mac()
2067 reg_elem = o->check_del(sc, cam_obj, in ecore_execute_vlan_mac()
2068 &elem->cmd_data.vlan_mac.u); in ecore_execute_vlan_mac()
2070 ECORE_LIST_REMOVE_ENTRY(®_elem->link, in ecore_execute_vlan_mac()
2071 &cam_obj->head); in ecore_execute_vlan_mac()
2085 struct ecore_vlan_mac_obj *o = p->vlan_mac_obj; in ecore_vlan_mac_push_new_cmd()
2086 bool restore = ECORE_TEST_BIT(RAMROD_RESTORE, &p->ramrod_flags); in ecore_vlan_mac_push_new_cmd()
2094 switch (p->user_req.cmd) { in ecore_vlan_mac_push_new_cmd()
2096 elem->cmd_len = 2; in ecore_vlan_mac_push_new_cmd()
2099 elem->cmd_len = 1; in ecore_vlan_mac_push_new_cmd()
2103 ECORE_MEMCPY(&elem->cmd_data.vlan_mac, &p->user_req, sizeof(p->user_req)); in ecore_vlan_mac_push_new_cmd()
2106 return ecore_exe_queue_add(sc, &o->exe_queue, elem, restore); in ecore_vlan_mac_push_new_cmd()
2110 * ecore_config_vlan_mac - configure VLAN/MAC/VLAN_MAC filtering rules.
2120 struct ecore_vlan_mac_obj *o = p->vlan_mac_obj; in ecore_config_vlan_mac()
2121 unsigned long *ramrod_flags = &p->ramrod_flags; in ecore_config_vlan_mac()
2123 struct ecore_raw_obj *raw = &o->raw; in ecore_config_vlan_mac()
2137 if (!ecore_exe_queue_empty(&o->exe_queue)) in ecore_config_vlan_mac()
2142 raw->clear_pending(raw); in ecore_config_vlan_mac()
2148 rc = __ecore_vlan_mac_execute_step(sc, p->vlan_mac_obj, in ecore_config_vlan_mac()
2149 &p->ramrod_flags); in ecore_config_vlan_mac()
2157 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, &p->ramrod_flags)) { in ecore_config_vlan_mac()
2161 int max_iterations = ecore_exe_queue_length(&o->exe_queue) + 1; in ecore_config_vlan_mac()
2163 while (!ecore_exe_queue_empty(&o->exe_queue) && in ecore_config_vlan_mac()
2164 max_iterations--) { in ecore_config_vlan_mac()
2167 rc = raw->wait_comp(sc, raw); in ecore_config_vlan_mac()
2173 p->vlan_mac_obj, in ecore_config_vlan_mac()
2174 &p->ramrod_flags); in ecore_config_vlan_mac()
2186 * ecore_vlan_mac_del_all - delete elements with given vlan_mac_flags spec
2205 struct ecore_exe_queue_obj *exeq = &o->exe_queue; in ecore_vlan_mac_del_all()
2213 ECORE_SPIN_LOCK_BH(&exeq->lock); in ecore_vlan_mac_del_all()
2216 &exeq->exe_queue, link, in ecore_vlan_mac_del_all()
2218 flags = exeq_pos->cmd_data.vlan_mac.vlan_mac_flags; in ecore_vlan_mac_del_all()
2221 rc = exeq->remove(sc, exeq->owner, exeq_pos); in ecore_vlan_mac_del_all()
2224 ECORE_SPIN_UNLOCK_BH(&exeq->lock); in ecore_vlan_mac_del_all()
2227 ECORE_LIST_REMOVE_ENTRY(&exeq_pos->link, in ecore_vlan_mac_del_all()
2228 &exeq->exe_queue); in ecore_vlan_mac_del_all()
2233 ECORE_SPIN_UNLOCK_BH(&exeq->lock); in ecore_vlan_mac_del_all()
2241 /* Add all but the last VLAN-MAC to the execution queue without actually in ecore_vlan_mac_del_all()
2248 ECORE_MSG(sc, "vlan_mac_del_all -- taking vlan_mac_lock (reader)\n"); in ecore_vlan_mac_del_all()
2253 ECORE_LIST_FOR_EACH_ENTRY(pos, &o->head, link, in ecore_vlan_mac_del_all()
2255 flags = pos->vlan_mac_flags; in ecore_vlan_mac_del_all()
2258 p.user_req.vlan_mac_flags = pos->vlan_mac_flags; in ecore_vlan_mac_del_all()
2259 ECORE_MEMCPY(&p.user_req.u, &pos->u, sizeof(pos->u)); in ecore_vlan_mac_del_all()
2269 ECORE_MSG(sc, "vlan_mac_del_all -- releasing vlan_mac_lock (reader)\n"); in ecore_vlan_mac_del_all()
2282 raw->func_id = func_id; in ecore_init_raw_obj()
2283 raw->cid = cid; in ecore_init_raw_obj()
2284 raw->cl_id = cl_id; in ecore_init_raw_obj()
2285 raw->rdata = rdata; in ecore_init_raw_obj()
2286 raw->rdata_mapping = rdata_mapping; in ecore_init_raw_obj()
2287 raw->state = state; in ecore_init_raw_obj()
2288 raw->pstate = pstate; in ecore_init_raw_obj()
2289 raw->obj_type = type; in ecore_init_raw_obj()
2290 raw->check_pending = ecore_raw_check_pending; in ecore_init_raw_obj()
2291 raw->clear_pending = ecore_raw_clear_pending; in ecore_init_raw_obj()
2292 raw->set_pending = ecore_raw_set_pending; in ecore_init_raw_obj()
2293 raw->wait_comp = ecore_raw_wait; in ecore_init_raw_obj()
2302 ECORE_LIST_INIT(&o->head); in ecore_init_vlan_mac_common()
2303 o->head_reader = 0; in ecore_init_vlan_mac_common()
2304 o->head_exe_request = FALSE; in ecore_init_vlan_mac_common()
2305 o->saved_ramrod_flags = 0; in ecore_init_vlan_mac_common()
2307 o->macs_pool = macs_pool; in ecore_init_vlan_mac_common()
2308 o->vlans_pool = vlans_pool; in ecore_init_vlan_mac_common()
2310 o->delete_all = ecore_vlan_mac_del_all; in ecore_init_vlan_mac_common()
2311 o->restore = ecore_vlan_mac_restore; in ecore_init_vlan_mac_common()
2312 o->complete = ecore_complete_vlan_mac; in ecore_init_vlan_mac_common()
2313 o->wait = ecore_wait_vlan_mac; in ecore_init_vlan_mac_common()
2315 ecore_init_raw_obj(&o->raw, cl_id, cid, func_id, rdata, rdata_mapping, in ecore_init_vlan_mac_common()
2333 mac_obj->get_credit = ecore_get_credit_mac; in ecore_init_mac_obj()
2334 mac_obj->put_credit = ecore_put_credit_mac; in ecore_init_mac_obj()
2335 mac_obj->get_cam_offset = ecore_get_cam_offset_mac; in ecore_init_mac_obj()
2336 mac_obj->put_cam_offset = ecore_put_cam_offset_mac; in ecore_init_mac_obj()
2339 mac_obj->set_one_rule = ecore_set_one_mac_e1x; in ecore_init_mac_obj()
2340 mac_obj->check_del = ecore_check_mac_del; in ecore_init_mac_obj()
2341 mac_obj->check_add = ecore_check_mac_add; in ecore_init_mac_obj()
2342 mac_obj->check_move = ecore_check_move_always_err; in ecore_init_mac_obj()
2343 mac_obj->ramrod_cmd = RAMROD_CMD_ID_ETH_SET_MAC; in ecore_init_mac_obj()
2347 &mac_obj->exe_queue, 1, qable_obj, in ecore_init_mac_obj()
2354 mac_obj->set_one_rule = ecore_set_one_mac_e2; in ecore_init_mac_obj()
2355 mac_obj->check_del = ecore_check_mac_del; in ecore_init_mac_obj()
2356 mac_obj->check_add = ecore_check_mac_add; in ecore_init_mac_obj()
2357 mac_obj->check_move = ecore_check_move; in ecore_init_mac_obj()
2358 mac_obj->ramrod_cmd = in ecore_init_mac_obj()
2360 mac_obj->get_n_elements = ecore_get_n_elements; in ecore_init_mac_obj()
2364 &mac_obj->exe_queue, CLASSIFY_RULES_COUNT, in ecore_init_mac_obj()
2386 vlan_obj->get_credit = ecore_get_credit_vlan; in ecore_init_vlan_obj()
2387 vlan_obj->put_credit = ecore_put_credit_vlan; in ecore_init_vlan_obj()
2388 vlan_obj->get_cam_offset = ecore_get_cam_offset_vlan; in ecore_init_vlan_obj()
2389 vlan_obj->put_cam_offset = ecore_put_cam_offset_vlan; in ecore_init_vlan_obj()
2395 vlan_obj->set_one_rule = ecore_set_one_vlan_e2; in ecore_init_vlan_obj()
2396 vlan_obj->check_del = ecore_check_vlan_del; in ecore_init_vlan_obj()
2397 vlan_obj->check_add = ecore_check_vlan_add; in ecore_init_vlan_obj()
2398 vlan_obj->check_move = ecore_check_move; in ecore_init_vlan_obj()
2399 vlan_obj->ramrod_cmd = in ecore_init_vlan_obj()
2401 vlan_obj->get_n_elements = ecore_get_n_elements; in ecore_init_vlan_obj()
2405 &vlan_obj->exe_queue, CLASSIFY_RULES_COUNT, in ecore_init_vlan_obj()
2430 vlan_mac_obj->get_credit = ecore_get_credit_vlan_mac; in ecore_init_vlan_mac_obj()
2431 vlan_mac_obj->put_credit = ecore_put_credit_vlan_mac; in ecore_init_vlan_mac_obj()
2432 /* CAM offset is relevant for 57710 and 57711 chips only which have a in ecore_init_vlan_mac_obj()
2433 * single CAM for both MACs and VLAN-MAC pairs. So the offset in ecore_init_vlan_mac_obj()
2434 * will be taken from MACs' pool object only. in ecore_init_vlan_mac_obj()
2436 vlan_mac_obj->get_cam_offset = ecore_get_cam_offset_mac; in ecore_init_vlan_mac_obj()
2437 vlan_mac_obj->put_cam_offset = ecore_put_cam_offset_mac; in ecore_init_vlan_mac_obj()
2443 vlan_mac_obj->set_one_rule = ecore_set_one_vlan_mac_e1h; in ecore_init_vlan_mac_obj()
2444 vlan_mac_obj->check_del = ecore_check_vlan_mac_del; in ecore_init_vlan_mac_obj()
2445 vlan_mac_obj->check_add = ecore_check_vlan_mac_add; in ecore_init_vlan_mac_obj()
2446 vlan_mac_obj->check_move = ecore_check_move_always_err; in ecore_init_vlan_mac_obj()
2447 vlan_mac_obj->ramrod_cmd = RAMROD_CMD_ID_ETH_SET_MAC; in ecore_init_vlan_mac_obj()
2451 &vlan_mac_obj->exe_queue, 1, qable_obj, in ecore_init_vlan_mac_obj()
2458 vlan_mac_obj->set_one_rule = ecore_set_one_vlan_mac_e2; in ecore_init_vlan_mac_obj()
2459 vlan_mac_obj->check_del = ecore_check_vlan_mac_del; in ecore_init_vlan_mac_obj()
2460 vlan_mac_obj->check_add = ecore_check_vlan_mac_add; in ecore_init_vlan_mac_obj()
2461 vlan_mac_obj->check_move = ecore_check_move; in ecore_init_vlan_mac_obj()
2462 vlan_mac_obj->ramrod_cmd = in ecore_init_vlan_mac_obj()
2467 &vlan_mac_obj->exe_queue, in ecore_init_vlan_mac_obj()
2493 vlan_mac_obj->get_credit = ecore_get_credit_vlan_mac; in ecore_init_vxlan_fltr_obj()
2494 vlan_mac_obj->put_credit = ecore_put_credit_vlan_mac; in ecore_init_vxlan_fltr_obj()
2495 /* CAM offset is relevant for 57710 and 57711 chips only which have a in ecore_init_vxlan_fltr_obj()
2496 * single CAM for both MACs and VLAN-MAC pairs. So the offset in ecore_init_vxlan_fltr_obj()
2497 * will be taken from MACs' pool object only. in ecore_init_vxlan_fltr_obj()
2499 vlan_mac_obj->get_cam_offset = ecore_get_cam_offset_mac; in ecore_init_vxlan_fltr_obj()
2500 vlan_mac_obj->put_cam_offset = ecore_put_cam_offset_mac; in ecore_init_vxlan_fltr_obj()
2506 vlan_mac_obj->set_one_rule = ecore_set_one_vxlan_fltr_e2; in ecore_init_vxlan_fltr_obj()
2507 vlan_mac_obj->check_del = ecore_check_vxlan_fltr_del; in ecore_init_vxlan_fltr_obj()
2508 vlan_mac_obj->check_add = ecore_check_vxlan_fltr_add; in ecore_init_vxlan_fltr_obj()
2509 vlan_mac_obj->check_move = ecore_check_move; in ecore_init_vxlan_fltr_obj()
2510 vlan_mac_obj->ramrod_cmd = in ecore_init_vxlan_fltr_obj()
2515 &vlan_mac_obj->exe_queue, in ecore_init_vxlan_fltr_obj()
2541 /* update the sc MAC filter structure */ in ecore_set_rx_mode_e1x()
2542 uint32_t mask = (1 << p->cl_id); in ecore_set_rx_mode_e1x()
2545 (struct tstorm_eth_mac_filter_config *)p->rdata; in ecore_set_rx_mode_e1x()
2547 /* initial setting is drop-all */ in ecore_set_rx_mode_e1x()
2552 /* In e1x there we only take into account rx accept flag since tx switching in ecore_set_rx_mode_e1x()
2554 if (ECORE_TEST_BIT(ECORE_ACCEPT_UNICAST, &p->rx_accept_flags)) in ecore_set_rx_mode_e1x()
2558 if (ECORE_TEST_BIT(ECORE_ACCEPT_MULTICAST, &p->rx_accept_flags)) in ecore_set_rx_mode_e1x()
2562 if (ECORE_TEST_BIT(ECORE_ACCEPT_ALL_UNICAST, &p->rx_accept_flags)) { in ecore_set_rx_mode_e1x()
2567 if (ECORE_TEST_BIT(ECORE_ACCEPT_ALL_MULTICAST, &p->rx_accept_flags)) { in ecore_set_rx_mode_e1x()
2572 if (ECORE_TEST_BIT(ECORE_ACCEPT_BROADCAST, &p->rx_accept_flags)) in ecore_set_rx_mode_e1x()
2575 if (ECORE_TEST_BIT(ECORE_ACCEPT_UNMATCHED, &p->rx_accept_flags)) in ecore_set_rx_mode_e1x()
2579 mac_filters->ucast_drop_all = drop_all_ucast ? in ecore_set_rx_mode_e1x()
2580 mac_filters->ucast_drop_all | mask : in ecore_set_rx_mode_e1x()
2581 mac_filters->ucast_drop_all & ~mask; in ecore_set_rx_mode_e1x()
2583 mac_filters->mcast_drop_all = drop_all_mcast ? in ecore_set_rx_mode_e1x()
2584 mac_filters->mcast_drop_all | mask : in ecore_set_rx_mode_e1x()
2585 mac_filters->mcast_drop_all & ~mask; in ecore_set_rx_mode_e1x()
2587 mac_filters->ucast_accept_all = accp_all_ucast ? in ecore_set_rx_mode_e1x()
2588 mac_filters->ucast_accept_all | mask : in ecore_set_rx_mode_e1x()
2589 mac_filters->ucast_accept_all & ~mask; in ecore_set_rx_mode_e1x()
2591 mac_filters->mcast_accept_all = accp_all_mcast ? in ecore_set_rx_mode_e1x()
2592 mac_filters->mcast_accept_all | mask : in ecore_set_rx_mode_e1x()
2593 mac_filters->mcast_accept_all & ~mask; in ecore_set_rx_mode_e1x()
2595 mac_filters->bcast_accept_all = accp_all_bcast ? in ecore_set_rx_mode_e1x()
2596 mac_filters->bcast_accept_all | mask : in ecore_set_rx_mode_e1x()
2597 mac_filters->bcast_accept_all & ~mask; in ecore_set_rx_mode_e1x()
2599 mac_filters->unmatched_unicast = unmatched_unicast ? in ecore_set_rx_mode_e1x()
2600 mac_filters->unmatched_unicast | mask : in ecore_set_rx_mode_e1x()
2601 mac_filters->unmatched_unicast & ~mask; in ecore_set_rx_mode_e1x()
2605 mac_filters->ucast_drop_all, mac_filters->mcast_drop_all, in ecore_set_rx_mode_e1x()
2606 mac_filters->ucast_accept_all, mac_filters->mcast_accept_all, in ecore_set_rx_mode_e1x()
2607 mac_filters->bcast_accept_all); in ecore_set_rx_mode_e1x()
2609 /* write the MAC filter structure*/ in ecore_set_rx_mode_e1x()
2610 __storm_memset_mac_filters(sc, mac_filters, p->func_id); in ecore_set_rx_mode_e1x()
2613 ECORE_CLEAR_BIT(p->state, p->pstate); in ecore_set_rx_mode_e1x()
2624 hdr->echo = ECORE_CPU_TO_LE32(cid); in ecore_rx_mode_set_rdata_hdr_e2()
2625 hdr->rule_cnt = rule_cnt; in ecore_rx_mode_set_rdata_hdr_e2()
2635 /* start with 'drop-all' */ in ecore_rx_mode_set_cmd_state_e2()
2672 cmd->state = ECORE_CPU_TO_LE16(state); in ecore_rx_mode_set_cmd_state_e2()
2678 struct eth_filter_rules_ramrod_data *data = p->rdata; in ecore_set_rx_mode_e2()
2688 if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) { in ecore_set_rx_mode_e2()
2689 data->rules[rule_idx].client_id = p->cl_id; in ecore_set_rx_mode_e2()
2690 data->rules[rule_idx].func_id = p->func_id; in ecore_set_rx_mode_e2()
2692 data->rules[rule_idx].cmd_general_data = in ecore_set_rx_mode_e2()
2695 ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags, in ecore_set_rx_mode_e2()
2696 &(data->rules[rule_idx++]), in ecore_set_rx_mode_e2()
2701 if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) { in ecore_set_rx_mode_e2()
2702 data->rules[rule_idx].client_id = p->cl_id; in ecore_set_rx_mode_e2()
2703 data->rules[rule_idx].func_id = p->func_id; in ecore_set_rx_mode_e2()
2705 data->rules[rule_idx].cmd_general_data = in ecore_set_rx_mode_e2()
2708 ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags, in ecore_set_rx_mode_e2()
2709 &(data->rules[rule_idx++]), in ecore_set_rx_mode_e2()
2719 if (ECORE_TEST_BIT(ECORE_RX_MODE_FCOE_ETH, &p->rx_mode_flags)) { in ecore_set_rx_mode_e2()
2721 if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) { in ecore_set_rx_mode_e2()
2722 data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc); in ecore_set_rx_mode_e2()
2723 data->rules[rule_idx].func_id = p->func_id; in ecore_set_rx_mode_e2()
2725 data->rules[rule_idx].cmd_general_data = in ecore_set_rx_mode_e2()
2728 ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags, in ecore_set_rx_mode_e2()
2729 &(data->rules[rule_idx]), in ecore_set_rx_mode_e2()
2735 if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) { in ecore_set_rx_mode_e2()
2736 data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc); in ecore_set_rx_mode_e2()
2737 data->rules[rule_idx].func_id = p->func_id; in ecore_set_rx_mode_e2()
2739 data->rules[rule_idx].cmd_general_data = in ecore_set_rx_mode_e2()
2742 ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags, in ecore_set_rx_mode_e2()
2743 &(data->rules[rule_idx]), in ecore_set_rx_mode_e2()
2749 /* Set the ramrod header (most importantly - number of rules to in ecore_set_rx_mode_e2()
2752 ecore_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx); in ecore_set_rx_mode_e2()
2755 data->header.rule_cnt, p->rx_accept_flags, in ecore_set_rx_mode_e2()
2756 p->tx_accept_flags); in ecore_set_rx_mode_e2()
2768 p->cid, in ecore_set_rx_mode_e2()
2769 p->rdata_mapping, in ecore_set_rx_mode_e2()
2781 return ecore_state_wait(sc, p->state, p->pstate); in ecore_wait_rx_mode_comp_e2()
2797 rc = p->rx_mode_obj->config_rx_mode(sc, p); in ecore_config_rx_mode()
2802 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, &p->ramrod_flags)) { in ecore_config_rx_mode()
2803 rc = p->rx_mode_obj->wait_comp(sc, p); in ecore_config_rx_mode()
2815 o->wait_comp = ecore_empty_rx_mode_wait; in ecore_init_rx_mode_obj()
2816 o->config_rx_mode = ecore_set_rx_mode_e1x; in ecore_init_rx_mode_obj()
2818 o->wait_comp = ecore_wait_rx_mode_comp_e2; in ecore_init_rx_mode_obj()
2819 o->config_rx_mode = ecore_set_rx_mode_e2; in ecore_init_rx_mode_obj()
2824 static inline uint8_t ecore_mcast_bin_from_mac(uint8_t *mac) in ecore_mcast_bin_from_mac() argument
2826 return (ECORE_CRC32_LE(0, mac, ETH_ALEN) >> 24) & 0xff; in ecore_mcast_bin_from_mac()
2831 uint8_t mac[ETH_ALEN]; member
2845 * practically used in 57712 handling only, where one pending
2855 if (ecore_state_wait(sc, o->sched_state, o->raw.pstate) || in ecore_mcast_wait()
2856 o->raw.wait_comp(sc, &o->raw)) in ecore_mcast_wait()
2872 p->mcast_list_len : 0); in ecore_mcast_enqueue_cmd()
2874 /* If the command is empty ("handle pending commands only"), break */ in ecore_mcast_enqueue_cmd()
2875 if (!p->mcast_list_len) in ecore_mcast_enqueue_cmd()
2890 ECORE_LIST_INIT(&new_cmd->data.macs_head); in ecore_mcast_enqueue_cmd()
2892 new_cmd->type = cmd; in ecore_mcast_enqueue_cmd()
2893 new_cmd->done = FALSE; in ecore_mcast_enqueue_cmd()
2903 ECORE_LIST_FOR_EACH_ENTRY(pos, &p->mcast_list, link, in ecore_mcast_enqueue_cmd()
2905 ECORE_MEMCPY(cur_mac->mac, pos->mac, ETH_ALEN); in ecore_mcast_enqueue_cmd()
2906 ECORE_LIST_PUSH_TAIL(&cur_mac->link, in ecore_mcast_enqueue_cmd()
2907 &new_cmd->data.macs_head); in ecore_mcast_enqueue_cmd()
2914 new_cmd->data.macs_num = p->mcast_list_len; in ecore_mcast_enqueue_cmd()
2918 new_cmd->data.next_bin = 0; in ecore_mcast_enqueue_cmd()
2928 ECORE_LIST_PUSH_TAIL(&new_cmd->link, &o->pending_cmds_head); in ecore_mcast_enqueue_cmd()
2930 o->set_sched(o); in ecore_mcast_enqueue_cmd()
2936 * ecore_mcast_get_next_bin - get the next set bin (index)
2948 if (o->registry.aprox_match.vec[i]) in ecore_mcast_get_next_bin()
2951 if (BIT_VEC64_TEST_BIT(o->registry.aprox_match. in ecore_mcast_get_next_bin()
2960 return -1; in ecore_mcast_get_next_bin()
2964 * ecore_mcast_clear_first_bin - find the first set bin and clear it
2968 * returns the index of the found bin or -1 if none is found
2975 BIT_VEC64_CLEAR_BIT(o->registry.aprox_match.vec, cur_bit); in ecore_mcast_clear_first_bin()
2982 struct ecore_raw_obj *raw = &o->raw; in ecore_mcast_get_rx_tx_flag()
2985 if ((raw->obj_type == ECORE_OBJ_TYPE_TX) || in ecore_mcast_get_rx_tx_flag()
2986 (raw->obj_type == ECORE_OBJ_TYPE_RX_TX)) in ecore_mcast_get_rx_tx_flag()
2989 if ((raw->obj_type == ECORE_OBJ_TYPE_RX) || in ecore_mcast_get_rx_tx_flag()
2990 (raw->obj_type == ECORE_OBJ_TYPE_RX_TX)) in ecore_mcast_get_rx_tx_flag()
3001 struct ecore_raw_obj *r = &o->raw; in ecore_mcast_set_one_rule_e2()
3003 (struct eth_multicast_rules_ramrod_data *)(r->rdata); in ecore_mcast_set_one_rule_e2()
3004 uint8_t func_id = r->func_id; in ecore_mcast_set_one_rule_e2()
3011 data->rules[idx].cmd_general_data |= rx_tx_add_flag; in ecore_mcast_set_one_rule_e2()
3016 bin = ecore_mcast_bin_from_mac(cfg_data->mac); in ecore_mcast_set_one_rule_e2()
3017 BIT_VEC64_SET_BIT(o->registry.aprox_match.vec, bin); in ecore_mcast_set_one_rule_e2()
3022 * (ecore_mcast_clear_first_bin() returns -1) then we would in ecore_mcast_set_one_rule_e2()
3031 bin = cfg_data->bin; in ecore_mcast_set_one_rule_e2()
3043 data->rules[idx].bin_id = (uint8_t)bin; in ecore_mcast_set_one_rule_e2()
3044 data->rules[idx].func_id = func_id; in ecore_mcast_set_one_rule_e2()
3045 data->rules[idx].engine_id = o->engine_id; in ecore_mcast_set_one_rule_e2()
3049 * ecore_mcast_handle_restore_cmd_e2 - restore configuration from the registry
3056 * returns last handled bin index or -1 if all bins have been handled
3070 o->set_one_rule(sc, o, cnt, &cfg_data, in ecore_mcast_handle_restore_cmd_e2()
3080 if (cnt >= o->max_cmd_len) in ecore_mcast_handle_restore_cmd_e2()
3098 &cmd_pos->data.macs_head, link, struct ecore_mcast_mac_elem) { in ecore_mcast_hdl_pending_add_e2()
3100 cfg_data.mac = &pmac_pos->mac[0]; in ecore_mcast_hdl_pending_add_e2()
3101 o->set_one_rule(sc, o, cnt, &cfg_data, cmd_pos->type); in ecore_mcast_hdl_pending_add_e2()
3105 ECORE_MSG(sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC\n", in ecore_mcast_hdl_pending_add_e2()
3106 …pmac_pos->mac[0], pmac_pos->mac[1], pmac_pos->mac[2], pmac_pos->mac[3], pmac_pos->mac[4], pmac_pos… in ecore_mcast_hdl_pending_add_e2()
3108 ECORE_LIST_REMOVE_ENTRY(&pmac_pos->link, in ecore_mcast_hdl_pending_add_e2()
3109 &cmd_pos->data.macs_head); in ecore_mcast_hdl_pending_add_e2()
3114 if (cnt >= o->max_cmd_len) in ecore_mcast_hdl_pending_add_e2()
3120 /* if no more MACs to configure - we are done */ in ecore_mcast_hdl_pending_add_e2()
3121 if (ECORE_LIST_IS_EMPTY(&cmd_pos->data.macs_head)) in ecore_mcast_hdl_pending_add_e2()
3122 cmd_pos->done = TRUE; in ecore_mcast_hdl_pending_add_e2()
3131 while (cmd_pos->data.macs_num) { in ecore_mcast_hdl_pending_del_e2()
3132 o->set_one_rule(sc, o, cnt, NULL, cmd_pos->type); in ecore_mcast_hdl_pending_del_e2()
3136 cmd_pos->data.macs_num--; in ecore_mcast_hdl_pending_del_e2()
3138 ECORE_MSG(sc, "Deleting MAC. %d left,cnt is %d\n", in ecore_mcast_hdl_pending_del_e2()
3139 cmd_pos->data.macs_num, cnt); in ecore_mcast_hdl_pending_del_e2()
3144 if (cnt >= o->max_cmd_len) in ecore_mcast_hdl_pending_del_e2()
3150 /* If we cleared all bins - we are done */ in ecore_mcast_hdl_pending_del_e2()
3151 if (!cmd_pos->data.macs_num) in ecore_mcast_hdl_pending_del_e2()
3152 cmd_pos->done = TRUE; in ecore_mcast_hdl_pending_del_e2()
3159 cmd_pos->data.next_bin = o->hdl_restore(sc, o, cmd_pos->data.next_bin, in ecore_mcast_hdl_pending_restore_e2()
3162 if (cmd_pos->data.next_bin < 0) in ecore_mcast_hdl_pending_restore_e2()
3163 /* If o->set_restore returned -1 we are done */ in ecore_mcast_hdl_pending_restore_e2()
3164 cmd_pos->done = TRUE; in ecore_mcast_hdl_pending_restore_e2()
3167 cmd_pos->data.next_bin++; in ecore_mcast_hdl_pending_restore_e2()
3175 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_handle_pending_cmds_e2()
3178 &o->pending_cmds_head, link, struct ecore_pending_mcast_cmd) { in ecore_mcast_handle_pending_cmds_e2()
3179 switch (cmd_pos->type) { in ecore_mcast_handle_pending_cmds_e2()
3194 ECORE_ERR("Unknown command: %d\n", cmd_pos->type); in ecore_mcast_handle_pending_cmds_e2()
3198 /* If the command has been completed - remove it from the list in ecore_mcast_handle_pending_cmds_e2()
3201 if (cmd_pos->done) { in ecore_mcast_handle_pending_cmds_e2()
3202 ECORE_LIST_REMOVE_ENTRY(&cmd_pos->link, in ecore_mcast_handle_pending_cmds_e2()
3203 &o->pending_cmds_head); in ecore_mcast_handle_pending_cmds_e2()
3204 ECORE_FREE(sc, cmd_pos, cmd_pos->alloc_len); in ecore_mcast_handle_pending_cmds_e2()
3208 if (cnt >= o->max_cmd_len) in ecore_mcast_handle_pending_cmds_e2()
3223 ECORE_LIST_FOR_EACH_ENTRY(mlist_pos, &p->mcast_list, link, in ecore_mcast_hdl_add()
3225 cfg_data.mac = mlist_pos->mac; in ecore_mcast_hdl_add()
3226 o->set_one_rule(sc, o, cnt, &cfg_data, ECORE_MCAST_CMD_ADD); in ecore_mcast_hdl_add()
3230 ECORE_MSG(sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC\n", in ecore_mcast_hdl_add()
3231 …mlist_pos->mac[0], mlist_pos->mac[1], mlist_pos->mac[2], mlist_pos->mac[3], mlist_pos->mac[4], mli… in ecore_mcast_hdl_add()
3243 for (i = 0; i < p->mcast_list_len; i++) { in ecore_mcast_hdl_del()
3244 o->set_one_rule(sc, o, cnt, NULL, ECORE_MCAST_CMD_DEL); in ecore_mcast_hdl_del()
3248 ECORE_MSG(sc, "Deleting MAC. %d left\n", in ecore_mcast_hdl_del()
3249 p->mcast_list_len - i - 1); in ecore_mcast_hdl_del()
3256 * ecore_mcast_handle_current_cmd -
3272 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_handle_current_cmd()
3275 ECORE_MSG(sc, "p->mcast_list_len=%d\n", p->mcast_list_len); in ecore_mcast_handle_current_cmd()
3287 o->hdl_restore(sc, o, 0, &cnt); in ecore_mcast_handle_current_cmd()
3296 p->mcast_list_len = 0; in ecore_mcast_handle_current_cmd()
3305 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_validate_e2()
3306 int reg_sz = o->get_registry_size(o); in ecore_mcast_validate_e2()
3311 o->set_registry_size(o, 0); in ecore_mcast_validate_e2()
3317 * fact may be only less as some MACs in postponed ADD in ecore_mcast_validate_e2()
3323 p->mcast_list_len = reg_sz; in ecore_mcast_validate_e2()
3332 o->set_registry_size(o, reg_sz + p->mcast_list_len); in ecore_mcast_validate_e2()
3341 o->total_pending_num += p->mcast_list_len; in ecore_mcast_validate_e2()
3350 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_revert_e2()
3352 o->set_registry_size(o, old_num_bins); in ecore_mcast_revert_e2()
3353 o->total_pending_num -= p->mcast_list_len; in ecore_mcast_revert_e2()
3357 * ecore_mcast_set_rdata_hdr_e2 - sets a header values
3367 struct ecore_raw_obj *r = &p->mcast_obj->raw; in ecore_mcast_set_rdata_hdr_e2()
3369 (struct eth_multicast_rules_ramrod_data *)(r->rdata); in ecore_mcast_set_rdata_hdr_e2()
3371 data->header.echo = ECORE_CPU_TO_LE32((r->cid & ECORE_SWCID_MASK) | in ecore_mcast_set_rdata_hdr_e2()
3374 data->header.rule_cnt = len; in ecore_mcast_set_rdata_hdr_e2()
3378 * ecore_mcast_refresh_registry_e2 - recalculate the actual number of set bins
3395 elem = o->registry.aprox_match.vec[i]; in ecore_mcast_refresh_registry_e2()
3397 elem &= elem - 1; in ecore_mcast_refresh_registry_e2()
3400 o->set_registry_size(o, cnt); in ecore_mcast_refresh_registry_e2()
3409 struct ecore_raw_obj *raw = &p->mcast_obj->raw; in ecore_mcast_setup_e2()
3410 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_setup_e2()
3412 (struct eth_multicast_rules_ramrod_data *)(raw->rdata); in ecore_mcast_setup_e2()
3420 /* If there are no more pending commands - clear SCHEDULED state */ in ecore_mcast_setup_e2()
3421 if (ECORE_LIST_IS_EMPTY(&o->pending_cmds_head)) in ecore_mcast_setup_e2()
3422 o->clear_sched(o); in ecore_mcast_setup_e2()
3427 * to the pending commands and p->mcast_list_len would have been in ecore_mcast_setup_e2()
3430 if (p->mcast_list_len > 0) in ecore_mcast_setup_e2()
3433 /* We've pulled out some MACs - update the total number of in ecore_mcast_setup_e2()
3436 o->total_pending_num -= cnt; in ecore_mcast_setup_e2()
3439 ECORE_DBG_BREAK_IF(o->total_pending_num < 0); in ecore_mcast_setup_e2()
3440 ECORE_DBG_BREAK_IF(cnt > o->max_cmd_len); in ecore_mcast_setup_e2()
3453 * - see ecore_mcast_set_one_rule_e2(). That's because for 57712 we in ecore_mcast_setup_e2()
3455 * with a limited amount of update commands (per MAC/bin) and we don't in ecore_mcast_setup_e2()
3459 if (!o->total_pending_num) in ecore_mcast_setup_e2()
3462 /* If CLEAR_ONLY was requested - don't send a ramrod and clear in ecore_mcast_setup_e2()
3465 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { in ecore_mcast_setup_e2()
3466 raw->clear_pending(raw); in ecore_mcast_setup_e2()
3479 raw->cid, in ecore_mcast_setup_e2()
3480 raw->rdata_mapping, in ecore_mcast_setup_e2()
3496 p->mcast_list_len = 1; in ecore_mcast_validate_e1h()
3521 ECORE_LIST_FOR_EACH_ENTRY(mlist_pos, &p->mcast_list, link, in ecore_mcast_hdl_add_e1h()
3523 bit = ecore_mcast_bin_from_mac(mlist_pos->mac); in ecore_mcast_hdl_add_e1h()
3526 ECORE_MSG(sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC, bin %d\n", in ecore_mcast_hdl_add_e1h()
3527 …mlist_pos->mac[0], mlist_pos->mac[1], mlist_pos->mac[2], mlist_pos->mac[3], mlist_pos->mac[4], mli… in ecore_mcast_hdl_add_e1h()
3530 BIT_VEC64_SET_BIT(o->registry.aprox_match.vec, in ecore_mcast_hdl_add_e1h()
3558 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_setup_e1h()
3559 struct ecore_raw_obj *r = &o->raw; in ecore_mcast_setup_e1h()
3561 /* If CLEAR_ONLY has been requested - clear the registry in ecore_mcast_setup_e1h()
3564 if (!ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { in ecore_mcast_setup_e1h()
3580 ECORE_MEMSET(o->registry.aprox_match.vec, 0, in ecore_mcast_setup_e1h()
3581 sizeof(o->registry.aprox_match.vec)); in ecore_mcast_setup_e1h()
3598 ECORE_MEMSET(o->registry.aprox_match.vec, 0, in ecore_mcast_setup_e1h()
3599 sizeof(o->registry.aprox_match.vec)); in ecore_mcast_setup_e1h()
3602 r->clear_pending(r); in ecore_mcast_setup_e1h()
3611 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_validate_e1()
3612 int reg_sz = o->get_registry_size(o); in ecore_mcast_validate_e1()
3617 o->set_registry_size(o, 0); in ecore_mcast_validate_e1()
3622 p->mcast_list_len = reg_sz; in ecore_mcast_validate_e1()
3623 ECORE_MSG(sc, "Command %d, p->mcast_list_len=%d\n", in ecore_mcast_validate_e1()
3624 cmd, p->mcast_list_len); in ecore_mcast_validate_e1()
3630 * there is only a limited number of CAM entries for that in ecore_mcast_validate_e1()
3633 if (p->mcast_list_len > o->max_cmd_len) { in ecore_mcast_validate_e1()
3635 o->max_cmd_len); in ecore_mcast_validate_e1()
3638 /* Every configured MAC should be cleared if DEL command is in ecore_mcast_validate_e1()
3639 * called. Only the last ADD command is relevant as long as in ecore_mcast_validate_e1()
3642 ECORE_MSG(sc, "p->mcast_list_len=%d\n", p->mcast_list_len); in ecore_mcast_validate_e1()
3643 if (p->mcast_list_len > 0) in ecore_mcast_validate_e1()
3644 o->set_registry_size(o, p->mcast_list_len); in ecore_mcast_validate_e1()
3654 * Therefore each none-empty command will consume o->max_cmd_len. in ecore_mcast_validate_e1()
3656 if (p->mcast_list_len) in ecore_mcast_validate_e1()
3657 o->total_pending_num += o->max_cmd_len; in ecore_mcast_validate_e1()
3666 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_revert_e1()
3668 o->set_registry_size(o, old_num_macs); in ecore_mcast_revert_e1()
3674 if (p->mcast_list_len) in ecore_mcast_revert_e1()
3675 o->total_pending_num -= o->max_cmd_len; in ecore_mcast_revert_e1()
3683 struct ecore_raw_obj *r = &o->raw; in ecore_mcast_set_one_rule_e1()
3685 (struct mac_configuration_cmd *)(r->rdata); in ecore_mcast_set_one_rule_e1()
3687 /* copy mac */ in ecore_mcast_set_one_rule_e1()
3689 ecore_set_fw_mac_addr(&data->config_table[idx].msb_mac_addr, in ecore_mcast_set_one_rule_e1()
3690 &data->config_table[idx].middle_mac_addr, in ecore_mcast_set_one_rule_e1()
3691 &data->config_table[idx].lsb_mac_addr, in ecore_mcast_set_one_rule_e1()
3692 cfg_data->mac); in ecore_mcast_set_one_rule_e1()
3694 data->config_table[idx].vlan_id = 0; in ecore_mcast_set_one_rule_e1()
3695 data->config_table[idx].pf_id = r->func_id; in ecore_mcast_set_one_rule_e1()
3696 data->config_table[idx].clients_bit_vector = in ecore_mcast_set_one_rule_e1()
3697 ECORE_CPU_TO_LE32(1 << r->cl_id); in ecore_mcast_set_one_rule_e1()
3699 ECORE_SET_FLAG(data->config_table[idx].flags, in ecore_mcast_set_one_rule_e1()
3706 * ecore_mcast_set_rdata_hdr_e1 - set header values in mac_configuration_cmd
3716 struct ecore_raw_obj *r = &p->mcast_obj->raw; in ecore_mcast_set_rdata_hdr_e1()
3718 (struct mac_configuration_cmd *)(r->rdata); in ecore_mcast_set_rdata_hdr_e1()
3721 ECORE_MAX_EMUL_MULTI*(1 + r->func_id) : in ecore_mcast_set_rdata_hdr_e1()
3722 ECORE_MAX_MULTICAST*(1 + r->func_id)); in ecore_mcast_set_rdata_hdr_e1()
3724 data->hdr.offset = offset; in ecore_mcast_set_rdata_hdr_e1()
3725 data->hdr.client_id = ECORE_CPU_TO_LE16(0xff); in ecore_mcast_set_rdata_hdr_e1()
3726 data->hdr.echo = ECORE_CPU_TO_LE32((r->cid & ECORE_SWCID_MASK) | in ecore_mcast_set_rdata_hdr_e1()
3729 data->hdr.length = len; in ecore_mcast_set_rdata_hdr_e1()
3733 * ecore_mcast_handle_restore_cmd_e1 - restore command for 57710
3740 * restore command for 57710 is like all other commands - always a stand alone
3741 * command - start_idx and rdata_idx will always be 0. This function will always
3743 * returns -1 to comply with 57712 variant.
3754 ECORE_LIST_FOR_EACH_ENTRY(elem, &o->registry.exact_match.macs, link, in ecore_mcast_handle_restore_cmd_e1()
3756 cfg_data.mac = &elem->mac[0]; in ecore_mcast_handle_restore_cmd_e1()
3757 o->set_one_rule(sc, o, i, &cfg_data, ECORE_MCAST_CMD_RESTORE); in ecore_mcast_handle_restore_cmd_e1()
3761 ECORE_MSG(sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC\n", in ecore_mcast_handle_restore_cmd_e1()
3762 …cfg_data.mac[0], cfg_data.mac[1], cfg_data.mac[2], cfg_data.mac[3], cfg_data.mac[4], cfg_data.mac[… in ecore_mcast_handle_restore_cmd_e1()
3767 return -1; in ecore_mcast_handle_restore_cmd_e1()
3775 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_handle_pending_cmds_e1()
3779 /* If nothing to be done - return */ in ecore_mcast_handle_pending_cmds_e1()
3780 if (ECORE_LIST_IS_EMPTY(&o->pending_cmds_head)) in ecore_mcast_handle_pending_cmds_e1()
3784 cmd_pos = ECORE_LIST_FIRST_ENTRY(&o->pending_cmds_head, in ecore_mcast_handle_pending_cmds_e1()
3787 switch (cmd_pos->type) { in ecore_mcast_handle_pending_cmds_e1()
3789 ECORE_LIST_FOR_EACH_ENTRY(pmac_pos, &cmd_pos->data.macs_head, in ecore_mcast_handle_pending_cmds_e1()
3791 cfg_data.mac = &pmac_pos->mac[0]; in ecore_mcast_handle_pending_cmds_e1()
3792 o->set_one_rule(sc, o, cnt, &cfg_data, cmd_pos->type); in ecore_mcast_handle_pending_cmds_e1()
3796 ECORE_MSG(sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC\n", in ecore_mcast_handle_pending_cmds_e1()
3797 …pmac_pos->mac[0], pmac_pos->mac[1], pmac_pos->mac[2], pmac_pos->mac[3], pmac_pos->mac[4], pmac_pos… in ecore_mcast_handle_pending_cmds_e1()
3802 cnt = cmd_pos->data.macs_num; in ecore_mcast_handle_pending_cmds_e1()
3807 o->hdl_restore(sc, o, 0, &cnt); in ecore_mcast_handle_pending_cmds_e1()
3811 ECORE_ERR("Unknown command: %d\n", cmd_pos->type); in ecore_mcast_handle_pending_cmds_e1()
3815 ECORE_LIST_REMOVE_ENTRY(&cmd_pos->link, &o->pending_cmds_head); in ecore_mcast_handle_pending_cmds_e1()
3816 ECORE_FREE(sc, cmd_pos, cmd_pos->alloc_len); in ecore_mcast_handle_pending_cmds_e1()
3822 * ecore_get_fw_mac_addr - revert the ecore_set_fw_mac_addr().
3827 * @mac:
3830 uint16_t *fw_lo, uint8_t *mac) in ecore_get_fw_mac_addr() argument
3832 mac[1] = ((uint8_t *)fw_hi)[0]; in ecore_get_fw_mac_addr()
3833 mac[0] = ((uint8_t *)fw_hi)[1]; in ecore_get_fw_mac_addr()
3834 mac[3] = ((uint8_t *)fw_mid)[0]; in ecore_get_fw_mac_addr()
3835 mac[2] = ((uint8_t *)fw_mid)[1]; in ecore_get_fw_mac_addr()
3836 mac[5] = ((uint8_t *)fw_lo)[0]; in ecore_get_fw_mac_addr()
3837 mac[4] = ((uint8_t *)fw_lo)[1]; in ecore_get_fw_mac_addr()
3841 * ecore_mcast_refresh_registry_e1 -
3847 * and update the registry correspondingly: if ADD - allocate a memory and add
3848 * the entries to the registry (list), if DELETE - clear the registry and free
3854 struct ecore_raw_obj *raw = &o->raw; in ecore_mcast_refresh_registry_e1()
3857 (struct mac_configuration_cmd *)(raw->rdata); in ecore_mcast_refresh_registry_e1()
3859 /* If first entry contains a SET bit - the command was ADD, in ecore_mcast_refresh_registry_e1()
3860 * otherwise - DEL_ALL in ecore_mcast_refresh_registry_e1()
3862 if (ECORE_GET_FLAG(data->config_table[0].flags, in ecore_mcast_refresh_registry_e1()
3864 int i, len = data->hdr.length; in ecore_mcast_refresh_registry_e1()
3867 if (!ECORE_LIST_IS_EMPTY(&o->registry.exact_match.macs)) in ecore_mcast_refresh_registry_e1()
3878 &data->config_table[i].msb_mac_addr, in ecore_mcast_refresh_registry_e1()
3879 &data->config_table[i].middle_mac_addr, in ecore_mcast_refresh_registry_e1()
3880 &data->config_table[i].lsb_mac_addr, in ecore_mcast_refresh_registry_e1()
3881 elem->mac); in ecore_mcast_refresh_registry_e1()
3883 elem->mac[0], elem->mac[1], elem->mac[2], elem->mac[3], elem->mac[4], elem->mac[5]); in ecore_mcast_refresh_registry_e1()
3884 ECORE_LIST_PUSH_TAIL(&elem->link, in ecore_mcast_refresh_registry_e1()
3885 &o->registry.exact_match.macs); in ecore_mcast_refresh_registry_e1()
3888 elem = ECORE_LIST_FIRST_ENTRY(&o->registry.exact_match.macs, in ecore_mcast_refresh_registry_e1()
3893 ECORE_LIST_INIT(&o->registry.exact_match.macs); in ecore_mcast_refresh_registry_e1()
3903 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_mcast_setup_e1()
3904 struct ecore_raw_obj *raw = &o->raw; in ecore_mcast_setup_e1()
3906 (struct mac_configuration_cmd *)(raw->rdata); in ecore_mcast_setup_e1()
3913 for (i = 0; i < o->max_cmd_len ; i++) in ecore_mcast_setup_e1()
3914 ECORE_SET_FLAG(data->config_table[i].flags, in ecore_mcast_setup_e1()
3921 /* If there are no more pending commands - clear SCHEDULED state */ in ecore_mcast_setup_e1()
3922 if (ECORE_LIST_IS_EMPTY(&o->pending_cmds_head)) in ecore_mcast_setup_e1()
3923 o->clear_sched(o); in ecore_mcast_setup_e1()
3929 /* For 57710 every command has o->max_cmd_len length to ensure that in ecore_mcast_setup_e1()
3932 o->total_pending_num -= o->max_cmd_len; in ecore_mcast_setup_e1()
3936 ECORE_DBG_BREAK_IF(cnt > o->max_cmd_len); in ecore_mcast_setup_e1()
3951 /* If CLEAR_ONLY was requested - don't send a ramrod and clear in ecore_mcast_setup_e1()
3954 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { in ecore_mcast_setup_e1()
3955 raw->clear_pending(raw); in ecore_mcast_setup_e1()
3968 raw->cid, in ecore_mcast_setup_e1()
3969 raw->rdata_mapping, in ecore_mcast_setup_e1()
3981 return o->registry.exact_match.num_macs_set; in ecore_mcast_get_registry_size_exact()
3986 return o->registry.aprox_match.num_bins_set; in ecore_mcast_get_registry_size_aprox()
3992 o->registry.exact_match.num_macs_set = n; in ecore_mcast_set_registry_size_exact()
3998 o->registry.aprox_match.num_bins_set = n; in ecore_mcast_set_registry_size_aprox()
4005 struct ecore_mcast_obj *o = p->mcast_obj; in ecore_config_mcast()
4006 struct ecore_raw_obj *r = &o->raw; in ecore_config_mcast()
4012 old_reg_size = o->get_registry_size(o); in ecore_config_mcast()
4015 rc = o->validate(sc, p, cmd); in ecore_config_mcast()
4020 if ((!p->mcast_list_len) && (!o->check_sched(o))) in ecore_config_mcast()
4023 ECORE_MSG(sc, "o->total_pending_num=%d p->mcast_list_len=%d o->max_cmd_len=%d\n", in ecore_config_mcast()
4024 o->total_pending_num, p->mcast_list_len, o->max_cmd_len); in ecore_config_mcast()
4029 if (r->check_pending(r) || in ecore_config_mcast()
4030 ((o->max_cmd_len > 0) && (o->total_pending_num > o->max_cmd_len))) { in ecore_config_mcast()
4031 rc = o->enqueue_cmd(sc, p->mcast_obj, p, cmd); in ecore_config_mcast()
4038 p->mcast_list_len = 0; in ecore_config_mcast()
4041 if (!r->check_pending(r)) { in ecore_config_mcast()
4044 r->set_pending(r); in ecore_config_mcast()
4047 rc = o->config_mcast(sc, p, cmd); in ecore_config_mcast()
4052 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, &p->ramrod_flags)) in ecore_config_mcast()
4053 rc = o->wait_comp(sc, o); in ecore_config_mcast()
4059 r->clear_pending(r); in ecore_config_mcast()
4062 o->revert(sc, p, old_reg_size); in ecore_config_mcast()
4070 ECORE_CLEAR_BIT(o->sched_state, o->raw.pstate); in ecore_mcast_clear_sched()
4077 ECORE_SET_BIT(o->sched_state, o->raw.pstate); in ecore_mcast_set_sched()
4083 return !!ECORE_TEST_BIT(o->sched_state, o->raw.pstate); in ecore_mcast_check_sched()
4088 return o->raw.check_pending(&o->raw) || o->check_sched(o); in ecore_mcast_check_pending()
4099 ecore_init_raw_obj(&mcast_obj->raw, mcast_cl_id, mcast_cid, func_id, in ecore_init_mcast_obj()
4102 mcast_obj->engine_id = engine_id; in ecore_init_mcast_obj()
4104 ECORE_LIST_INIT(&mcast_obj->pending_cmds_head); in ecore_init_mcast_obj()
4106 mcast_obj->sched_state = ECORE_FILTER_MCAST_SCHED; in ecore_init_mcast_obj()
4107 mcast_obj->check_sched = ecore_mcast_check_sched; in ecore_init_mcast_obj()
4108 mcast_obj->set_sched = ecore_mcast_set_sched; in ecore_init_mcast_obj()
4109 mcast_obj->clear_sched = ecore_mcast_clear_sched; in ecore_init_mcast_obj()
4112 mcast_obj->config_mcast = ecore_mcast_setup_e1; in ecore_init_mcast_obj()
4113 mcast_obj->enqueue_cmd = ecore_mcast_enqueue_cmd; in ecore_init_mcast_obj()
4114 mcast_obj->hdl_restore = in ecore_init_mcast_obj()
4116 mcast_obj->check_pending = ecore_mcast_check_pending; in ecore_init_mcast_obj()
4119 mcast_obj->max_cmd_len = ECORE_MAX_EMUL_MULTI; in ecore_init_mcast_obj()
4121 mcast_obj->max_cmd_len = ECORE_MAX_MULTICAST; in ecore_init_mcast_obj()
4123 mcast_obj->wait_comp = ecore_mcast_wait; in ecore_init_mcast_obj()
4124 mcast_obj->set_one_rule = ecore_mcast_set_one_rule_e1; in ecore_init_mcast_obj()
4125 mcast_obj->validate = ecore_mcast_validate_e1; in ecore_init_mcast_obj()
4126 mcast_obj->revert = ecore_mcast_revert_e1; in ecore_init_mcast_obj()
4127 mcast_obj->get_registry_size = in ecore_init_mcast_obj()
4129 mcast_obj->set_registry_size = in ecore_init_mcast_obj()
4132 /* 57710 is the only chip that uses the exact match for mcast in ecore_init_mcast_obj()
4135 ECORE_LIST_INIT(&mcast_obj->registry.exact_match.macs); in ecore_init_mcast_obj()
4138 mcast_obj->config_mcast = ecore_mcast_setup_e1h; in ecore_init_mcast_obj()
4139 mcast_obj->enqueue_cmd = NULL; in ecore_init_mcast_obj()
4140 mcast_obj->hdl_restore = NULL; in ecore_init_mcast_obj()
4141 mcast_obj->check_pending = ecore_mcast_check_pending; in ecore_init_mcast_obj()
4146 mcast_obj->max_cmd_len = -1; in ecore_init_mcast_obj()
4147 mcast_obj->wait_comp = ecore_mcast_wait; in ecore_init_mcast_obj()
4148 mcast_obj->set_one_rule = NULL; in ecore_init_mcast_obj()
4149 mcast_obj->validate = ecore_mcast_validate_e1h; in ecore_init_mcast_obj()
4150 mcast_obj->revert = ecore_mcast_revert_e1h; in ecore_init_mcast_obj()
4151 mcast_obj->get_registry_size = in ecore_init_mcast_obj()
4153 mcast_obj->set_registry_size = in ecore_init_mcast_obj()
4156 mcast_obj->config_mcast = ecore_mcast_setup_e2; in ecore_init_mcast_obj()
4157 mcast_obj->enqueue_cmd = ecore_mcast_enqueue_cmd; in ecore_init_mcast_obj()
4158 mcast_obj->hdl_restore = in ecore_init_mcast_obj()
4160 mcast_obj->check_pending = ecore_mcast_check_pending; in ecore_init_mcast_obj()
4163 mcast_obj->max_cmd_len = 16; in ecore_init_mcast_obj()
4164 mcast_obj->wait_comp = ecore_mcast_wait; in ecore_init_mcast_obj()
4165 mcast_obj->set_one_rule = ecore_mcast_set_one_rule_e2; in ecore_init_mcast_obj()
4166 mcast_obj->validate = ecore_mcast_validate_e2; in ecore_init_mcast_obj()
4167 mcast_obj->revert = ecore_mcast_revert_e2; in ecore_init_mcast_obj()
4168 mcast_obj->get_registry_size = in ecore_init_mcast_obj()
4170 mcast_obj->set_registry_size = in ecore_init_mcast_obj()
4178 * atomic_add_ifless - add if the result is less than a given value.
4206 * atomic_dec_ifmoe - dec if the result is more or equal than a given value.
4210 * @u: ...if (v - a) is more or equal than u.
4212 * returns TRUE if (v - a) was more or equal than u, and FALSE
4221 if (ECORE_UNLIKELY(c - a < u)) in __atomic_dec_ifmoe()
4224 old = ECORE_ATOMIC_CMPXCHG((v), c, c - a); in __atomic_dec_ifmoe()
4238 rc = __atomic_dec_ifmoe(&o->credit, cnt, 0); in ecore_credit_pool_get()
4251 rc = __atomic_add_ifless(&o->credit, cnt, o->pool_sz + 1); in ecore_credit_pool_put()
4263 cur_credit = ECORE_ATOMIC_READ(&o->credit); in ecore_credit_pool_check()
4280 *offset = -1; in ecore_credit_pool_get_entry()
4282 /* Find "internal cam-offset" then add to base for this object... */ in ecore_credit_pool_get_entry()
4286 if (!o->pool_mirror[vec]) in ecore_credit_pool_get_entry()
4293 if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { in ecore_credit_pool_get_entry()
4295 BIT_VEC64_CLEAR_BIT(o->pool_mirror, idx); in ecore_credit_pool_get_entry()
4296 *offset = o->base_pool_offset + idx; in ecore_credit_pool_get_entry()
4308 if (offset < o->base_pool_offset) in ecore_credit_pool_put_entry()
4311 offset -= o->base_pool_offset; in ecore_credit_pool_put_entry()
4313 if (offset >= o->pool_sz) in ecore_credit_pool_put_entry()
4317 BIT_VEC64_SET_BIT(o->pool_mirror, offset); in ecore_credit_pool_put_entry()
4333 *offset = -1; in ecore_credit_pool_get_entry_always_TRUE()
4337 * ecore_init_credit_pool - initialize credit pool internals.
4354 ECORE_MEMSET(&p->pool_mirror, 0xff, sizeof(p->pool_mirror)); in ecore_init_credit_pool()
4357 ECORE_ATOMIC_SET(&p->credit, credit); in ecore_init_credit_pool()
4360 p->pool_sz = credit; in ecore_init_credit_pool()
4362 p->base_pool_offset = base; in ecore_init_credit_pool()
4367 p->check = ecore_credit_pool_check; in ecore_init_credit_pool()
4369 /* if pool credit is negative - disable the checks */ in ecore_init_credit_pool()
4371 p->put = ecore_credit_pool_put; in ecore_init_credit_pool()
4372 p->get = ecore_credit_pool_get; in ecore_init_credit_pool()
4373 p->put_entry = ecore_credit_pool_put_entry; in ecore_init_credit_pool()
4374 p->get_entry = ecore_credit_pool_get_entry; in ecore_init_credit_pool()
4376 p->put = ecore_credit_pool_always_TRUE; in ecore_init_credit_pool()
4377 p->get = ecore_credit_pool_always_TRUE; in ecore_init_credit_pool()
4378 p->put_entry = ecore_credit_pool_put_entry_always_TRUE; in ecore_init_credit_pool()
4379 p->get_entry = ecore_credit_pool_get_entry_always_TRUE; in ecore_init_credit_pool()
4382 /* If base is negative - disable entries handling */ in ecore_init_credit_pool()
4384 p->put_entry = ecore_credit_pool_put_entry_always_TRUE; in ecore_init_credit_pool()
4385 p->get_entry = ecore_credit_pool_get_entry_always_TRUE; in ecore_init_credit_pool()
4401 cam_sz = (MAX_MAC_CREDIT_E1 / 2) - ECORE_MAX_MULTICAST; in ecore_init_mac_credit_pool()
4403 cam_sz = ECORE_CAM_SIZE_EMUL - ECORE_MAX_EMUL_MULTI; in ecore_init_mac_credit_pool()
4418 /* this should never happen! Block MAC operations. */ in ecore_init_mac_credit_pool()
4435 ecore_init_credit_pool(p, -1, cam_sz); in ecore_init_mac_credit_pool()
4437 /* this should never happen! Block MAC operations. */ in ecore_init_mac_credit_pool()
4449 /* There is no VLAN credit in HW on 57710 and 57711 only in ecore_init_vlan_credit_pool()
4450 * MAC / MAC-VLAN can be set in ecore_init_vlan_credit_pool()
4452 ecore_init_credit_pool(p, 0, -1); in ecore_init_vlan_credit_pool()
4460 ecore_init_credit_pool(p, -1/*unused for E2*/, credit); in ecore_init_vlan_credit_pool()
4470 * ecore_setup_rss - configure RSS
4480 struct ecore_rss_config_obj *o = p->rss_obj; in ecore_setup_rss()
4481 struct ecore_raw_obj *r = &o->raw; in ecore_setup_rss()
4483 (struct eth_rss_update_ramrod_data *)(r->rdata); in ecore_setup_rss()
4493 data->echo = ECORE_CPU_TO_LE32((r->cid & ECORE_SWCID_MASK) | in ecore_setup_rss()
4494 (r->state << ECORE_SWCID_SHIFT)); in ecore_setup_rss()
4497 if (ECORE_TEST_BIT(ECORE_RSS_MODE_DISABLED, &p->rss_flags)) in ecore_setup_rss()
4499 else if (ECORE_TEST_BIT(ECORE_RSS_MODE_REGULAR, &p->rss_flags)) in ecore_setup_rss()
4502 data->rss_mode = rss_mode; in ecore_setup_rss()
4507 if (ECORE_TEST_BIT(ECORE_RSS_IPV4, &p->rss_flags)) in ecore_setup_rss()
4510 if (ECORE_TEST_BIT(ECORE_RSS_IPV4_TCP, &p->rss_flags)) in ecore_setup_rss()
4513 if (ECORE_TEST_BIT(ECORE_RSS_IPV4_UDP, &p->rss_flags)) in ecore_setup_rss()
4516 if (ECORE_TEST_BIT(ECORE_RSS_IPV6, &p->rss_flags)) in ecore_setup_rss()
4519 if (ECORE_TEST_BIT(ECORE_RSS_IPV6_TCP, &p->rss_flags)) in ecore_setup_rss()
4522 if (ECORE_TEST_BIT(ECORE_RSS_IPV6_UDP, &p->rss_flags)) in ecore_setup_rss()
4525 if (ECORE_TEST_BIT(ECORE_RSS_IPV4_VXLAN, &p->rss_flags)) in ecore_setup_rss()
4528 if (ECORE_TEST_BIT(ECORE_RSS_IPV6_VXLAN, &p->rss_flags)) in ecore_setup_rss()
4531 if (ECORE_TEST_BIT(ECORE_RSS_TUNN_INNER_HDRS, &p->rss_flags)) in ecore_setup_rss()
4535 if (ECORE_TEST_BIT(ECORE_RSS_SET_SRCH, &p->rss_flags)) { in ecore_setup_rss()
4536 ECORE_MEMCPY(&data->rss_key[0], &p->rss_key[0], in ecore_setup_rss()
4537 sizeof(data->rss_key)); in ecore_setup_rss()
4541 data->capabilities = ECORE_CPU_TO_LE16(caps); in ecore_setup_rss()
4544 data->rss_result_mask = p->rss_result_mask; in ecore_setup_rss()
4547 data->rss_engine_id = o->engine_id; in ecore_setup_rss()
4549 ECORE_MSG(sc, "rss_engine_id=%d\n", data->rss_engine_id); in ecore_setup_rss()
4552 ECORE_MEMCPY(data->indirection_table, p->ind_table, in ecore_setup_rss()
4556 ECORE_MEMCPY(o->ind_table, p->ind_table, T_ETH_INDIRECTION_TABLE_SIZE); in ecore_setup_rss()
4569 r->cid, in ecore_setup_rss()
4570 r->rdata_mapping, in ecore_setup_rss()
4582 ECORE_MEMCPY(ind_table, rss_obj->ind_table, sizeof(rss_obj->ind_table)); in ecore_get_rss_ind_table()
4589 struct ecore_rss_config_obj *o = p->rss_obj; in ecore_config_rss()
4590 struct ecore_raw_obj *r = &o->raw; in ecore_config_rss()
4592 /* Do nothing if only driver cleanup was requested */ in ecore_config_rss()
4593 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { in ecore_config_rss()
4595 p->ramrod_flags); in ecore_config_rss()
4599 r->set_pending(r); in ecore_config_rss()
4601 rc = o->config_rss(sc, p); in ecore_config_rss()
4603 r->clear_pending(r); in ecore_config_rss()
4607 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, &p->ramrod_flags)) in ecore_config_rss()
4608 rc = r->wait_comp(sc, r); in ecore_config_rss()
4620 ecore_init_raw_obj(&rss_obj->raw, cl_id, cid, func_id, rdata, in ecore_init_rss_config_obj()
4623 rss_obj->engine_id = engine_id; in ecore_init_rss_config_obj()
4624 rss_obj->config_rss = ecore_setup_rss; in ecore_init_rss_config_obj()
4631 * ecore_queue_state_change - perform Queue state change transition
4638 * to that is still pending (possible only if RAMROD_COMP_WAIT is
4639 * not set in params->ramrod_flags for asynchronous commands).
4645 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_queue_state_change()
4647 unsigned long *pending = &o->pending; in ecore_queue_state_change()
4650 rc = o->check_transition(sc, o, params); in ecore_queue_state_change()
4657 ECORE_MSG(sc, "pending bit was=%lx\n", o->pending); in ecore_queue_state_change()
4658 pending_bit = o->set_pending(o, params); in ecore_queue_state_change()
4659 ECORE_MSG(sc, "pending bit now=%lx\n", o->pending); in ecore_queue_state_change()
4661 /* Don't send a command if only driver cleanup was requested */ in ecore_queue_state_change()
4662 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, ¶ms->ramrod_flags)) in ecore_queue_state_change()
4663 o->complete_cmd(sc, o, pending_bit); in ecore_queue_state_change()
4666 rc = o->send_cmd(sc, params); in ecore_queue_state_change()
4668 o->next_state = ECORE_Q_STATE_MAX; in ecore_queue_state_change()
4674 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, ¶ms->ramrod_flags)) { in ecore_queue_state_change()
4675 rc = o->wait_comp(sc, o, pending_bit); in ecore_queue_state_change()
4689 enum ecore_queue_cmd cmd = params->cmd, bit; in ecore_queue_set_pending()
4700 ECORE_SET_BIT(bit, &obj->pending); in ecore_queue_set_pending()
4708 return ecore_state_wait(sc, cmd, &o->pending); in ecore_queue_wait_comp()
4712 * ecore_queue_comp_cmd - complete the state change command.
4724 unsigned long cur_pending = o->pending; in ecore_queue_comp_cmd()
4728 cmd, o->cids[ECORE_PRIMARY_CID_INDEX], in ecore_queue_comp_cmd()
4729 o->state, cur_pending, o->next_state); in ecore_queue_comp_cmd()
4733 if (o->next_tx_only >= o->max_cos) in ecore_queue_comp_cmd()
4734 /* >= because tx only must always be smaller than cos since the in ecore_queue_comp_cmd()
4738 o->next_tx_only, o->max_cos); in ecore_queue_comp_cmd()
4742 cmd, o->cids[ECORE_PRIMARY_CID_INDEX], o->next_state); in ecore_queue_comp_cmd()
4744 if (o->next_tx_only) /* print num tx-only if any exist */ in ecore_queue_comp_cmd()
4745 ECORE_MSG(sc, "primary cid %d: num tx-only cons %d\n", in ecore_queue_comp_cmd()
4746 o->cids[ECORE_PRIMARY_CID_INDEX], o->next_tx_only); in ecore_queue_comp_cmd()
4748 o->state = o->next_state; in ecore_queue_comp_cmd()
4749 o->num_tx_only = o->next_tx_only; in ecore_queue_comp_cmd()
4750 o->next_state = ECORE_Q_STATE_MAX; in ecore_queue_comp_cmd()
4752 /* It's important that o->state and o->next_state are in ecore_queue_comp_cmd()
4753 * updated before o->pending. in ecore_queue_comp_cmd()
4757 ECORE_CLEAR_BIT(cmd, &o->pending); in ecore_queue_comp_cmd()
4767 struct ecore_queue_setup_params *params = &cmd_params->params.setup; in ecore_q_fill_setup_data_e2()
4771 /* IPv6 TPA supported for E2 and above only */ in ecore_q_fill_setup_data_e2()
4772 data->rx.tpa_en |= ECORE_TEST_BIT(ECORE_Q_FLG_TPA_IPV6, in ecore_q_fill_setup_data_e2()
4773 ¶ms->flags) * in ecore_q_fill_setup_data_e2()
4783 gen_data->client_id = o->cl_id; in ecore_q_fill_init_general_data()
4786 gen_data->statistics_counter_id = in ecore_q_fill_init_general_data()
4787 params->stat_id; in ecore_q_fill_init_general_data()
4788 gen_data->statistics_en_flg = 1; in ecore_q_fill_init_general_data()
4789 gen_data->statistics_zero_flg = in ecore_q_fill_init_general_data()
4792 gen_data->statistics_counter_id = in ecore_q_fill_init_general_data()
4795 gen_data->is_fcoe_flg = ECORE_TEST_BIT(ECORE_Q_FLG_FCOE, in ecore_q_fill_init_general_data()
4797 gen_data->activate_flg = ECORE_TEST_BIT(ECORE_Q_FLG_ACTIVE, in ecore_q_fill_init_general_data()
4799 gen_data->sp_client_id = params->spcl_id; in ecore_q_fill_init_general_data()
4800 gen_data->mtu = ECORE_CPU_TO_LE16(params->mtu); in ecore_q_fill_init_general_data()
4801 gen_data->func_id = o->func_id; in ecore_q_fill_init_general_data()
4803 gen_data->cos = params->cos; in ecore_q_fill_init_general_data()
4805 gen_data->traffic_type = in ecore_q_fill_init_general_data()
4809 gen_data->fp_hsi_ver = params->fp_hsi; in ecore_q_fill_init_general_data()
4812 gen_data->activate_flg, gen_data->cos, gen_data->statistics_en_flg); in ecore_q_fill_init_general_data()
4820 tx_data->enforce_security_flg = in ecore_q_fill_init_tx_data()
4822 tx_data->default_vlan = in ecore_q_fill_init_tx_data()
4823 ECORE_CPU_TO_LE16(params->default_vlan); in ecore_q_fill_init_tx_data()
4824 tx_data->default_vlan_flg = in ecore_q_fill_init_tx_data()
4826 tx_data->tx_switching_flg = in ecore_q_fill_init_tx_data()
4828 tx_data->anti_spoofing_flg = in ecore_q_fill_init_tx_data()
4830 tx_data->force_default_pri_flg = in ecore_q_fill_init_tx_data()
4832 tx_data->refuse_outband_vlan_flg = in ecore_q_fill_init_tx_data()
4834 tx_data->tunnel_lso_inc_ip_id = in ecore_q_fill_init_tx_data()
4836 tx_data->tunnel_non_lso_pcsum_location = in ecore_q_fill_init_tx_data()
4840 tx_data->tx_status_block_id = params->fw_sb_id; in ecore_q_fill_init_tx_data()
4841 tx_data->tx_sb_index_number = params->sb_cq_index; in ecore_q_fill_init_tx_data()
4842 tx_data->tss_leading_client_id = params->tss_leading_cl_id; in ecore_q_fill_init_tx_data()
4844 tx_data->tx_bd_page_base.lo = in ecore_q_fill_init_tx_data()
4845 ECORE_CPU_TO_LE32(U64_LO(params->dscr_map)); in ecore_q_fill_init_tx_data()
4846 tx_data->tx_bd_page_base.hi = in ecore_q_fill_init_tx_data()
4847 ECORE_CPU_TO_LE32(U64_HI(params->dscr_map)); in ecore_q_fill_init_tx_data()
4850 tx_data->state = 0; in ecore_q_fill_init_tx_data()
4858 rx_data->cqe_pause_thr_low = ECORE_CPU_TO_LE16(params->rcq_th_lo); in ecore_q_fill_init_pause_data()
4859 rx_data->cqe_pause_thr_high = ECORE_CPU_TO_LE16(params->rcq_th_hi); in ecore_q_fill_init_pause_data()
4860 rx_data->bd_pause_thr_low = ECORE_CPU_TO_LE16(params->bd_th_lo); in ecore_q_fill_init_pause_data()
4861 rx_data->bd_pause_thr_high = ECORE_CPU_TO_LE16(params->bd_th_hi); in ecore_q_fill_init_pause_data()
4862 rx_data->sge_pause_thr_low = ECORE_CPU_TO_LE16(params->sge_th_lo); in ecore_q_fill_init_pause_data()
4863 rx_data->sge_pause_thr_high = ECORE_CPU_TO_LE16(params->sge_th_hi); in ecore_q_fill_init_pause_data()
4864 rx_data->rx_cos_mask = ECORE_CPU_TO_LE16(params->pri_map); in ecore_q_fill_init_pause_data()
4872 rx_data->tpa_en = ECORE_TEST_BIT(ECORE_Q_FLG_TPA, flags) * in ecore_q_fill_init_rx_data()
4874 rx_data->tpa_en |= ECORE_TEST_BIT(ECORE_Q_FLG_TPA_GRO, flags) * in ecore_q_fill_init_rx_data()
4876 rx_data->vmqueue_mode_en_flg = 0; in ecore_q_fill_init_rx_data()
4878 rx_data->extra_data_over_sgl_en_flg = in ecore_q_fill_init_rx_data()
4880 rx_data->cache_line_alignment_log_size = in ecore_q_fill_init_rx_data()
4881 params->cache_line_log; in ecore_q_fill_init_rx_data()
4882 rx_data->enable_dynamic_hc = in ecore_q_fill_init_rx_data()
4884 rx_data->max_sges_for_packet = params->max_sges_pkt; in ecore_q_fill_init_rx_data()
4885 rx_data->client_qzone_id = params->cl_qzone_id; in ecore_q_fill_init_rx_data()
4886 rx_data->max_agg_size = ECORE_CPU_TO_LE16(params->tpa_agg_sz); in ecore_q_fill_init_rx_data()
4889 rx_data->state = ECORE_CPU_TO_LE16(CLIENT_INIT_RX_DATA_UCAST_DROP_ALL | in ecore_q_fill_init_rx_data()
4893 rx_data->drop_ip_cs_err_flg = 0; in ecore_q_fill_init_rx_data()
4894 rx_data->drop_tcp_cs_err_flg = 0; in ecore_q_fill_init_rx_data()
4895 rx_data->drop_ttl0_flg = 0; in ecore_q_fill_init_rx_data()
4896 rx_data->drop_udp_cs_err_flg = 0; in ecore_q_fill_init_rx_data()
4897 rx_data->inner_vlan_removal_enable_flg = in ecore_q_fill_init_rx_data()
4899 rx_data->outer_vlan_removal_enable_flg = in ecore_q_fill_init_rx_data()
4901 rx_data->status_block_id = params->fw_sb_id; in ecore_q_fill_init_rx_data()
4902 rx_data->rx_sb_index_number = params->sb_cq_index; in ecore_q_fill_init_rx_data()
4903 rx_data->max_tpa_queues = params->max_tpa_queues; in ecore_q_fill_init_rx_data()
4904 rx_data->max_bytes_on_bd = ECORE_CPU_TO_LE16(params->buf_sz); in ecore_q_fill_init_rx_data()
4905 rx_data->sge_buff_size = ECORE_CPU_TO_LE16(params->sge_buf_sz); in ecore_q_fill_init_rx_data()
4906 rx_data->bd_page_base.lo = in ecore_q_fill_init_rx_data()
4907 ECORE_CPU_TO_LE32(U64_LO(params->dscr_map)); in ecore_q_fill_init_rx_data()
4908 rx_data->bd_page_base.hi = in ecore_q_fill_init_rx_data()
4909 ECORE_CPU_TO_LE32(U64_HI(params->dscr_map)); in ecore_q_fill_init_rx_data()
4910 rx_data->sge_page_base.lo = in ecore_q_fill_init_rx_data()
4911 ECORE_CPU_TO_LE32(U64_LO(params->sge_map)); in ecore_q_fill_init_rx_data()
4912 rx_data->sge_page_base.hi = in ecore_q_fill_init_rx_data()
4913 ECORE_CPU_TO_LE32(U64_HI(params->sge_map)); in ecore_q_fill_init_rx_data()
4914 rx_data->cqe_page_base.lo = in ecore_q_fill_init_rx_data()
4915 ECORE_CPU_TO_LE32(U64_LO(params->rcq_map)); in ecore_q_fill_init_rx_data()
4916 rx_data->cqe_page_base.hi = in ecore_q_fill_init_rx_data()
4917 ECORE_CPU_TO_LE32(U64_HI(params->rcq_map)); in ecore_q_fill_init_rx_data()
4918 rx_data->is_leading_rss = ECORE_TEST_BIT(ECORE_Q_FLG_LEADING_RSS, in ecore_q_fill_init_rx_data()
4922 rx_data->approx_mcast_engine_id = params->mcast_engine_id; in ecore_q_fill_init_rx_data()
4923 rx_data->is_approx_mcast = 1; in ecore_q_fill_init_rx_data()
4926 rx_data->rss_engine_id = params->rss_engine_id; in ecore_q_fill_init_rx_data()
4929 rx_data->silent_vlan_removal_flg = in ecore_q_fill_init_rx_data()
4931 rx_data->silent_vlan_value = in ecore_q_fill_init_rx_data()
4932 ECORE_CPU_TO_LE16(params->silent_removal_value); in ecore_q_fill_init_rx_data()
4933 rx_data->silent_vlan_mask = in ecore_q_fill_init_rx_data()
4934 ECORE_CPU_TO_LE16(params->silent_removal_mask); in ecore_q_fill_init_rx_data()
4942 ecore_q_fill_init_general_data(sc, cmd_params->q_obj, in ecore_q_fill_setup_data_cmn()
4943 &cmd_params->params.setup.gen_params, in ecore_q_fill_setup_data_cmn()
4944 &data->general, in ecore_q_fill_setup_data_cmn()
4945 &cmd_params->params.setup.flags); in ecore_q_fill_setup_data_cmn()
4947 ecore_q_fill_init_tx_data(cmd_params->q_obj, in ecore_q_fill_setup_data_cmn()
4948 &cmd_params->params.setup.txq_params, in ecore_q_fill_setup_data_cmn()
4949 &data->tx, in ecore_q_fill_setup_data_cmn()
4950 &cmd_params->params.setup.flags); in ecore_q_fill_setup_data_cmn()
4952 ecore_q_fill_init_rx_data(cmd_params->q_obj, in ecore_q_fill_setup_data_cmn()
4953 &cmd_params->params.setup.rxq_params, in ecore_q_fill_setup_data_cmn()
4954 &data->rx, in ecore_q_fill_setup_data_cmn()
4955 &cmd_params->params.setup.flags); in ecore_q_fill_setup_data_cmn()
4957 ecore_q_fill_init_pause_data(cmd_params->q_obj, in ecore_q_fill_setup_data_cmn()
4958 &cmd_params->params.setup.pause_params, in ecore_q_fill_setup_data_cmn()
4959 &data->rx); in ecore_q_fill_setup_data_cmn()
4962 /* initialize the general and tx parts of a tx-only queue object */
4967 ecore_q_fill_init_general_data(sc, cmd_params->q_obj, in ecore_q_fill_setup_tx_only()
4968 &cmd_params->params.tx_only.gen_params, in ecore_q_fill_setup_tx_only()
4969 &data->general, in ecore_q_fill_setup_tx_only()
4970 &cmd_params->params.tx_only.flags); in ecore_q_fill_setup_tx_only()
4972 ecore_q_fill_init_tx_data(cmd_params->q_obj, in ecore_q_fill_setup_tx_only()
4973 &cmd_params->params.tx_only.txq_params, in ecore_q_fill_setup_tx_only()
4974 &data->tx, in ecore_q_fill_setup_tx_only()
4975 &cmd_params->params.tx_only.flags); in ecore_q_fill_setup_tx_only()
4978 cmd_params->q_obj->cids[0], in ecore_q_fill_setup_tx_only()
4979 data->tx.tx_bd_page_base.lo, in ecore_q_fill_setup_tx_only()
4980 data->tx.tx_bd_page_base.hi); in ecore_q_fill_setup_tx_only()
4984 * ecore_q_init - init HW/FW queue
4990 * - HC: Rx and Tx
4991 * - CDU context validation
4997 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_init()
4998 struct ecore_queue_init_params *init = ¶ms->params.init; in ecore_q_init()
5003 if (ECORE_TEST_BIT(ECORE_Q_TYPE_HAS_TX, &o->type) && in ecore_q_init()
5004 ECORE_TEST_BIT(ECORE_Q_FLG_HC, &init->tx.flags)) { in ecore_q_init()
5005 hc_usec = init->tx.hc_rate ? 1000000 / init->tx.hc_rate : 0; in ecore_q_init()
5007 ECORE_UPDATE_COALESCE_SB_INDEX(sc, init->tx.fw_sb_id, in ecore_q_init()
5008 init->tx.sb_cq_index, in ecore_q_init()
5009 !ECORE_TEST_BIT(ECORE_Q_FLG_HC_EN, &init->tx.flags), in ecore_q_init()
5014 if (ECORE_TEST_BIT(ECORE_Q_TYPE_HAS_RX, &o->type) && in ecore_q_init()
5015 ECORE_TEST_BIT(ECORE_Q_FLG_HC, &init->rx.flags)) { in ecore_q_init()
5016 hc_usec = init->rx.hc_rate ? 1000000 / init->rx.hc_rate : 0; in ecore_q_init()
5018 ECORE_UPDATE_COALESCE_SB_INDEX(sc, init->rx.fw_sb_id, in ecore_q_init()
5019 init->rx.sb_cq_index, in ecore_q_init()
5020 !ECORE_TEST_BIT(ECORE_Q_FLG_HC_EN, &init->rx.flags), in ecore_q_init()
5025 for (cos = 0; cos < o->max_cos; cos++) { in ecore_q_init()
5027 o->cids[cos], cos); in ecore_q_init()
5028 ECORE_MSG(sc, "context pointer %p\n", init->cxts[cos]); in ecore_q_init()
5029 ECORE_SET_CTX_VALIDATION(sc, init->cxts[cos], o->cids[cos]); in ecore_q_init()
5033 o->complete_cmd(sc, o, ECORE_Q_CMD_INIT); in ecore_q_init()
5044 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_setup_e1x()
5046 (struct client_init_ramrod_data *)o->rdata; in ecore_q_send_setup_e1x()
5047 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_q_send_setup_e1x()
5064 o->cids[ECORE_PRIMARY_CID_INDEX], in ecore_q_send_setup_e1x()
5072 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_setup_e2()
5074 (struct client_init_ramrod_data *)o->rdata; in ecore_q_send_setup_e2()
5075 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_q_send_setup_e2()
5093 o->cids[ECORE_PRIMARY_CID_INDEX], in ecore_q_send_setup_e2()
5101 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_setup_tx_only()
5103 (struct tx_queue_init_ramrod_data *)o->rdata; in ecore_q_send_setup_tx_only()
5104 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_q_send_setup_tx_only()
5107 ¶ms->params.tx_only; in ecore_q_send_setup_tx_only()
5108 uint8_t cid_index = tx_only_params->cid_index; in ecore_q_send_setup_tx_only()
5110 if (ECORE_TEST_BIT(ECORE_Q_TYPE_FWD, &o->type)) in ecore_q_send_setup_tx_only()
5112 ECORE_MSG(sc, "sending forward tx-only ramrod"); in ecore_q_send_setup_tx_only()
5114 if (cid_index >= o->max_cos) { in ecore_q_send_setup_tx_only()
5116 o->cl_id, cid_index); in ecore_q_send_setup_tx_only()
5120 ECORE_MSG(sc, "parameters received: cos: %d sp-id: %d\n", in ecore_q_send_setup_tx_only()
5121 tx_only_params->gen_params.cos, in ecore_q_send_setup_tx_only()
5122 tx_only_params->gen_params.spcl_id); in ecore_q_send_setup_tx_only()
5130 ECORE_MSG(sc, "sending tx-only ramrod: cid %d, client-id %d, sp-client id %d, cos %d\n", in ecore_q_send_setup_tx_only()
5131 o->cids[cid_index], rdata->general.client_id, in ecore_q_send_setup_tx_only()
5132 rdata->general.sp_client_id, rdata->general.cos); in ecore_q_send_setup_tx_only()
5140 return ecore_sp_post(sc, ramrod, o->cids[cid_index], in ecore_q_send_setup_tx_only()
5150 data->client_id = obj->cl_id; in ecore_q_fill_update_data()
5153 data->func_id = obj->func_id; in ecore_q_fill_update_data()
5156 data->default_vlan = ECORE_CPU_TO_LE16(params->def_vlan); in ecore_q_fill_update_data()
5159 data->inner_vlan_removal_enable_flg = in ecore_q_fill_update_data()
5161 ¶ms->update_flags); in ecore_q_fill_update_data()
5162 data->inner_vlan_removal_change_flg = in ecore_q_fill_update_data()
5164 ¶ms->update_flags); in ecore_q_fill_update_data()
5167 data->outer_vlan_removal_enable_flg = in ecore_q_fill_update_data()
5169 ¶ms->update_flags); in ecore_q_fill_update_data()
5170 data->outer_vlan_removal_change_flg = in ecore_q_fill_update_data()
5172 ¶ms->update_flags); in ecore_q_fill_update_data()
5174 /* Drop packets that have source MAC that doesn't belong to this in ecore_q_fill_update_data()
5177 data->anti_spoofing_enable_flg = in ecore_q_fill_update_data()
5179 ¶ms->update_flags); in ecore_q_fill_update_data()
5180 data->anti_spoofing_change_flg = in ecore_q_fill_update_data()
5182 ¶ms->update_flags); in ecore_q_fill_update_data()
5185 data->activate_flg = in ecore_q_fill_update_data()
5186 ECORE_TEST_BIT(ECORE_Q_UPDATE_ACTIVATE, ¶ms->update_flags); in ecore_q_fill_update_data()
5187 data->activate_change_flg = in ecore_q_fill_update_data()
5189 ¶ms->update_flags); in ecore_q_fill_update_data()
5192 data->default_vlan_enable_flg = in ecore_q_fill_update_data()
5194 ¶ms->update_flags); in ecore_q_fill_update_data()
5195 data->default_vlan_change_flg = in ecore_q_fill_update_data()
5197 ¶ms->update_flags); in ecore_q_fill_update_data()
5200 data->silent_vlan_change_flg = in ecore_q_fill_update_data()
5202 ¶ms->update_flags); in ecore_q_fill_update_data()
5203 data->silent_vlan_removal_flg = in ecore_q_fill_update_data()
5205 ¶ms->update_flags); in ecore_q_fill_update_data()
5206 data->silent_vlan_value = ECORE_CPU_TO_LE16(params->silent_removal_value); in ecore_q_fill_update_data()
5207 data->silent_vlan_mask = ECORE_CPU_TO_LE16(params->silent_removal_mask); in ecore_q_fill_update_data()
5210 data->tx_switching_flg = in ecore_q_fill_update_data()
5212 ¶ms->update_flags); in ecore_q_fill_update_data()
5213 data->tx_switching_change_flg = in ecore_q_fill_update_data()
5215 ¶ms->update_flags); in ecore_q_fill_update_data()
5218 data->handle_ptp_pkts_flg = in ecore_q_fill_update_data()
5220 ¶ms->update_flags); in ecore_q_fill_update_data()
5221 data->handle_ptp_pkts_change_flg = in ecore_q_fill_update_data()
5223 ¶ms->update_flags); in ecore_q_fill_update_data()
5229 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_update()
5231 (struct client_update_ramrod_data *)o->rdata; in ecore_q_send_update()
5232 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_q_send_update()
5234 ¶ms->params.update; in ecore_q_send_update()
5235 uint8_t cid_index = update_params->cid_index; in ecore_q_send_update()
5237 if (cid_index >= o->max_cos) { in ecore_q_send_update()
5239 o->cl_id, cid_index); in ecore_q_send_update()
5256 o->cids[cid_index], data_mapping, in ecore_q_send_update()
5261 * ecore_q_send_deactivate - send DEACTIVATE command
5271 struct ecore_queue_update_params *update = ¶ms->params.update; in ecore_q_send_deactivate()
5275 ECORE_SET_BIT_NA(ECORE_Q_UPDATE_ACTIVATE_CHNG, &update->update_flags); in ecore_q_send_deactivate()
5281 * ecore_q_send_activate - send ACTIVATE command
5291 struct ecore_queue_update_params *update = ¶ms->params.update; in ecore_q_send_activate()
5295 ECORE_SET_BIT_NA(ECORE_Q_UPDATE_ACTIVATE, &update->update_flags); in ecore_q_send_activate()
5296 ECORE_SET_BIT_NA(ECORE_Q_UPDATE_ACTIVATE_CHNG, &update->update_flags); in ecore_q_send_activate()
5306 data->client_id = obj->cl_id; in ecore_q_fill_update_tpa_data()
5307 data->complete_on_both_clients = params->complete_on_both_clients; in ecore_q_fill_update_tpa_data()
5308 data->dont_verify_rings_pause_thr_flg = in ecore_q_fill_update_tpa_data()
5309 params->dont_verify_thr; in ecore_q_fill_update_tpa_data()
5310 data->max_agg_size = ECORE_CPU_TO_LE16(params->max_agg_sz); in ecore_q_fill_update_tpa_data()
5311 data->max_sges_for_packet = params->max_sges_pkt; in ecore_q_fill_update_tpa_data()
5312 data->max_tpa_queues = params->max_tpa_queues; in ecore_q_fill_update_tpa_data()
5313 data->sge_buff_size = ECORE_CPU_TO_LE16(params->sge_buff_sz); in ecore_q_fill_update_tpa_data()
5314 data->sge_page_base_hi = ECORE_CPU_TO_LE32(U64_HI(params->sge_map)); in ecore_q_fill_update_tpa_data()
5315 data->sge_page_base_lo = ECORE_CPU_TO_LE32(U64_LO(params->sge_map)); in ecore_q_fill_update_tpa_data()
5316 data->sge_pause_thr_high = ECORE_CPU_TO_LE16(params->sge_pause_thr_high); in ecore_q_fill_update_tpa_data()
5317 data->sge_pause_thr_low = ECORE_CPU_TO_LE16(params->sge_pause_thr_low); in ecore_q_fill_update_tpa_data()
5318 data->tpa_mode = params->tpa_mode; in ecore_q_fill_update_tpa_data()
5319 data->update_ipv4 = params->update_ipv4; in ecore_q_fill_update_tpa_data()
5320 data->update_ipv6 = params->update_ipv6; in ecore_q_fill_update_tpa_data()
5326 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_update_tpa()
5328 (struct tpa_update_ramrod_data *)o->rdata; in ecore_q_send_update_tpa()
5329 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_q_send_update_tpa()
5331 ¶ms->params.update_tpa; in ecore_q_send_update_tpa()
5341 * doesn't automatically add the PF func-id, this is required in ecore_q_send_update_tpa()
5345 ((o->func_id) << SPE_HDR_T_FUNCTION_ID_SHIFT); in ecore_q_send_update_tpa()
5354 o->cids[ECORE_PRIMARY_CID_INDEX], in ecore_q_send_update_tpa()
5361 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_halt()
5363 /* build eth_halt_ramrod_data.client_id in a big-endian friendly way */ in ecore_q_send_halt()
5365 data_mapping = (ecore_dma_addr_t)o->cl_id; in ecore_q_send_halt()
5375 o->cids[ECORE_PRIMARY_CID_INDEX], in ecore_q_send_halt()
5383 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_cfc_del()
5384 uint8_t cid_idx = params->params.cfc_del.cid_index; in ecore_q_send_cfc_del()
5386 if (cid_idx >= o->max_cos) { in ecore_q_send_cfc_del()
5388 o->cl_id, cid_idx); in ecore_q_send_cfc_del()
5393 o->cids[cid_idx], 0, in ecore_q_send_cfc_del()
5400 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_terminate()
5401 uint8_t cid_index = params->params.terminate.cid_index; in ecore_q_send_terminate()
5403 if (cid_index >= o->max_cos) { in ecore_q_send_terminate()
5405 o->cl_id, cid_index); in ecore_q_send_terminate()
5410 o->cids[cid_index], 0, in ecore_q_send_terminate()
5417 struct ecore_queue_sp_obj *o = params->q_obj; in ecore_q_send_empty()
5420 o->cids[ECORE_PRIMARY_CID_INDEX], 0, in ecore_q_send_empty()
5427 switch (params->cmd) { in ecore_queue_send_cmd_cmn()
5449 ECORE_ERR("Unknown command: %d\n", params->cmd); in ecore_queue_send_cmd_cmn()
5457 switch (params->cmd) { in ecore_queue_send_cmd_e1x()
5472 ECORE_ERR("Unknown command: %d\n", params->cmd); in ecore_queue_send_cmd_e1x()
5480 switch (params->cmd) { in ecore_queue_send_cmd_e2()
5495 ECORE_ERR("Unknown command: %d\n", params->cmd); in ecore_queue_send_cmd_e2()
5501 * ecore_queue_chk_transition - check state machine of a regular Queue
5520 enum ecore_q_state state = o->state, next_state = ECORE_Q_STATE_MAX; in ecore_queue_chk_transition()
5521 enum ecore_queue_cmd cmd = params->cmd; in ecore_queue_chk_transition()
5523 ¶ms->params.update; in ecore_queue_chk_transition()
5524 uint8_t next_tx_only = o->num_tx_only; in ecore_queue_chk_transition()
5526 /* Forget all pending for completion commands if a driver only state in ecore_queue_chk_transition()
5529 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, ¶ms->ramrod_flags)) { in ecore_queue_chk_transition()
5530 o->pending = 0; in ecore_queue_chk_transition()
5531 o->next_state = ECORE_Q_STATE_MAX; in ecore_queue_chk_transition()
5537 if (o->pending) { in ecore_queue_chk_transition()
5539 o->pending); in ecore_queue_chk_transition()
5552 ¶ms->params.setup.flags)) in ecore_queue_chk_transition()
5580 &update_params->update_flags) && in ecore_queue_chk_transition()
5582 &update_params->update_flags)) in ecore_queue_chk_transition()
5595 next_tx_only = o->num_tx_only + 1; in ecore_queue_chk_transition()
5607 &update_params->update_flags) && in ecore_queue_chk_transition()
5609 &update_params->update_flags)) in ecore_queue_chk_transition()
5618 next_tx_only = o->num_tx_only - 1; in ecore_queue_chk_transition()
5642 &update_params->update_flags) && in ecore_queue_chk_transition()
5644 &update_params->update_flags)){ in ecore_queue_chk_transition()
5645 if (o->num_tx_only == 0) in ecore_queue_chk_transition()
5647 else /* tx only queues exist for this queue */ in ecore_queue_chk_transition()
5670 ECORE_MSG(sc, "Good state transition: %d(%d)->%d\n", in ecore_queue_chk_transition()
5672 o->next_state = next_state; in ecore_queue_chk_transition()
5673 o->next_tx_only = next_tx_only; in ecore_queue_chk_transition()
5683 * ecore_queue_chk_fwd_transition - check state machine of a Forwarding Queue.
5701 enum ecore_q_state state = o->state, next_state = ECORE_Q_STATE_MAX; in ecore_queue_chk_fwd_transition()
5702 enum ecore_queue_cmd cmd = params->cmd; in ecore_queue_chk_fwd_transition()
5713 ¶ms->params.tx_only.flags)) in ecore_queue_chk_fwd_transition()
5732 ECORE_MSG(sc, "Good state transition: %d(%d)->%d\n", in ecore_queue_chk_fwd_transition()
5734 o->next_state = next_state; in ecore_queue_chk_fwd_transition()
5750 /* We support only ECORE_MULTI_TX_COS Tx CoS at the moment */ in ecore_init_queue_obj()
5753 memcpy(obj->cids, cids, sizeof(obj->cids[0]) * cid_cnt); in ecore_init_queue_obj()
5754 obj->max_cos = cid_cnt; in ecore_init_queue_obj()
5755 obj->cl_id = cl_id; in ecore_init_queue_obj()
5756 obj->func_id = func_id; in ecore_init_queue_obj()
5757 obj->rdata = rdata; in ecore_init_queue_obj()
5758 obj->rdata_mapping = rdata_mapping; in ecore_init_queue_obj()
5759 obj->type = type; in ecore_init_queue_obj()
5760 obj->next_state = ECORE_Q_STATE_MAX; in ecore_init_queue_obj()
5763 obj->send_cmd = ecore_queue_send_cmd_e1x; in ecore_init_queue_obj()
5765 obj->send_cmd = ecore_queue_send_cmd_e2; in ecore_init_queue_obj()
5768 obj->check_transition = ecore_queue_chk_fwd_transition; in ecore_init_queue_obj()
5770 obj->check_transition = ecore_queue_chk_transition; in ecore_init_queue_obj()
5772 obj->complete_cmd = ecore_queue_comp_cmd; in ecore_init_queue_obj()
5773 obj->wait_comp = ecore_queue_wait_comp; in ecore_init_queue_obj()
5774 obj->set_pending = ecore_queue_set_pending; in ecore_init_queue_obj()
5781 switch (obj->state) { in ecore_get_q_logical_state()
5802 /* in the middle of transaction - return INVALID state */ in ecore_func_get_state()
5803 if (o->pending) in ecore_func_get_state()
5806 /* unsure the order of reading of o->pending and o->state in ecore_func_get_state()
5807 * o->pending should be read first in ecore_func_get_state()
5811 return o->state; in ecore_func_get_state()
5818 return ecore_state_wait(sc, cmd, &o->pending); in ecore_func_wait_comp()
5822 * ecore_func_state_change_comp - complete the state machine transition
5829 * machine transition only - no HW interaction.
5835 unsigned long cur_pending = o->pending; in ecore_func_state_change_comp()
5839 cmd, ECORE_FUNC_ID(sc), o->state, in ecore_func_state_change_comp()
5840 cur_pending, o->next_state); in ecore_func_state_change_comp()
5846 cmd, ECORE_FUNC_ID(sc), o->next_state); in ecore_func_state_change_comp()
5848 o->state = o->next_state; in ecore_func_state_change_comp()
5849 o->next_state = ECORE_F_STATE_MAX; in ecore_func_state_change_comp()
5851 /* It's important that o->state and o->next_state are in ecore_func_state_change_comp()
5852 * updated before o->pending. in ecore_func_state_change_comp()
5856 ECORE_CLEAR_BIT(cmd, &o->pending); in ecore_func_state_change_comp()
5863 * ecore_func_comp_cmd - complete the state change command
5883 * ecore_func_chk_transition - perform function state machine transition
5901 enum ecore_func_state state = o->state, next_state = ECORE_F_STATE_MAX; in ecore_func_chk_transition()
5902 enum ecore_func_cmd cmd = params->cmd; in ecore_func_chk_transition()
5904 /* Forget all pending for completion commands if a driver only state in ecore_func_chk_transition()
5907 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, ¶ms->ramrod_flags)) { in ecore_func_chk_transition()
5908 o->pending = 0; in ecore_func_chk_transition()
5909 o->next_state = ECORE_F_STATE_MAX; in ecore_func_chk_transition()
5915 if (o->pending) in ecore_func_chk_transition()
5935 /* afex ramrods can be sent only in started mode, and only in ecore_func_chk_transition()
5937 * for these events - next state remained STARTED. in ecore_func_chk_transition()
5940 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5944 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5951 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5955 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5964 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5968 (!ECORE_TEST_BIT(ECORE_F_CMD_STOP, &o->pending))) in ecore_func_chk_transition()
5981 ECORE_MSG(sc, "Good function state transition: %d(%d)->%d\n", in ecore_func_chk_transition()
5983 o->next_state = next_state; in ecore_func_chk_transition()
5994 * ecore_func_init_func - performs HW init at function stage
6000 * FW_MSG_CODE_DRV_LOAD_FUNCTION: initialize only FUNCTION-only
6006 return drv->init_hw_func(sc); in ecore_func_init_func()
6010 * ecore_func_init_port - performs HW init at port stage
6016 * FW_MSG_CODE_DRV_LOAD_PORT: initialize PORT-only and
6017 * FUNCTION-only HW blocks.
6023 int rc = drv->init_hw_port(sc); in ecore_func_init_port()
6031 * ecore_func_init_cmn_chip - performs HW init at chip-common stage
6038 * PORT-only and FUNCTION-only HW blocks.
6043 int rc = drv->init_hw_cmn_chip(sc); in ecore_func_init_cmn_chip()
6051 * ecore_func_init_cmn - performs HW init at common stage
6058 * PORT-only and FUNCTION-only HW blocks.
6063 int rc = drv->init_hw_cmn(sc); in ecore_func_init_cmn()
6073 uint32_t load_code = params->params.hw_init.load_phase; in ecore_func_hw_init()
6074 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_hw_init()
6075 const struct ecore_func_sp_drv_ops *drv = o->drv; in ecore_func_hw_init()
6082 rc = drv->gunzip_init(sc); in ecore_func_hw_init()
6087 rc = drv->init_fw(sc); in ecore_func_hw_init()
6125 drv->gunzip_end(sc); in ecore_func_hw_init()
6131 o->complete_cmd(sc, o, ECORE_F_CMD_HW_INIT); in ecore_func_hw_init()
6137 * ecore_func_reset_func - reset HW at function stage
6142 * Reset HW at FW_MSG_CODE_DRV_UNLOAD_FUNCTION stage: reset only
6143 * FUNCTION-only HW blocks.
6148 drv->reset_hw_func(sc); in ecore_func_reset_func()
6152 * ecore_func_reset_port - reser HW at port stage
6158 * FUNCTION-only and PORT-only HW blocks.
6169 drv->reset_hw_port(sc); in ecore_func_reset_port()
6174 * ecore_func_reset_cmn - reser HW at common stage
6181 * COMMON_CHIP, FUNCTION-only and PORT-only HW blocks.
6187 drv->reset_hw_cmn(sc); in ecore_func_reset_cmn()
6193 uint32_t reset_phase = params->params.hw_reset.reset_phase; in ecore_func_hw_reset()
6194 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_hw_reset()
6195 const struct ecore_func_sp_drv_ops *drv = o->drv; in ecore_func_hw_reset()
6217 o->complete_cmd(sc, o, ECORE_F_CMD_HW_RESET); in ecore_func_hw_reset()
6225 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_start()
6227 (struct function_start_data *)o->rdata; in ecore_func_send_start()
6228 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_func_send_start()
6229 struct ecore_func_start_params *start_params = ¶ms->params.start; in ecore_func_send_start()
6234 rdata->function_mode = (uint8_t)start_params->mf_mode; in ecore_func_send_start()
6235 rdata->sd_vlan_tag = ECORE_CPU_TO_LE16(start_params->sd_vlan_tag); in ecore_func_send_start()
6236 rdata->path_id = ECORE_PATH_ID(sc); in ecore_func_send_start()
6237 rdata->network_cos_mode = start_params->network_cos_mode; in ecore_func_send_start()
6239 rdata->vxlan_dst_port = start_params->vxlan_dst_port; in ecore_func_send_start()
6240 rdata->geneve_dst_port = start_params->geneve_dst_port; in ecore_func_send_start()
6241 rdata->inner_clss_l2gre = start_params->inner_clss_l2gre; in ecore_func_send_start()
6242 rdata->inner_clss_l2geneve = start_params->inner_clss_l2geneve; in ecore_func_send_start()
6243 rdata->inner_clss_vxlan = start_params->inner_clss_vxlan; in ecore_func_send_start()
6244 rdata->inner_rss = start_params->inner_rss; in ecore_func_send_start()
6246 rdata->sd_accept_mf_clss_fail = start_params->class_fail; in ecore_func_send_start()
6247 if (start_params->class_fail_ethtype) { in ecore_func_send_start()
6248 rdata->sd_accept_mf_clss_fail_match_ethtype = 1; in ecore_func_send_start()
6249 rdata->sd_accept_mf_clss_fail_ethtype = in ecore_func_send_start()
6250 ECORE_CPU_TO_LE16(start_params->class_fail_ethtype); in ecore_func_send_start()
6252 rdata->sd_vlan_force_pri_flg = start_params->sd_vlan_force_pri; in ecore_func_send_start()
6253 rdata->sd_vlan_force_pri_val = start_params->sd_vlan_force_pri_val; in ecore_func_send_start()
6255 /** @@@TMP - until FW 7.10.7 (which will introduce an HSI change) in ecore_func_send_start()
6260 if (start_params->sd_vlan_eth_type) in ecore_func_send_start()
6261 rdata->sd_vlan_eth_type = in ecore_func_send_start()
6262 ECORE_CPU_TO_LE16(start_params->sd_vlan_eth_type); in ecore_func_send_start()
6264 rdata->sd_vlan_eth_type = in ecore_func_send_start()
6267 rdata->no_added_tags = start_params->no_added_tags; in ecore_func_send_start()
6269 rdata->c2s_pri_tt_valid = start_params->c2s_pri_valid; in ecore_func_send_start()
6270 if (rdata->c2s_pri_tt_valid) { in ecore_func_send_start()
6271 memcpy(rdata->c2s_pri_trans_table.val, in ecore_func_send_start()
6272 start_params->c2s_pri, in ecore_func_send_start()
6274 rdata->c2s_pri_default = start_params->c2s_pri_default; in ecore_func_send_start()
6290 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_switch_update()
6292 (struct function_update_data *)o->rdata; in ecore_func_send_switch_update()
6293 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_func_send_switch_update()
6295 ¶ms->params.switch_update; in ecore_func_send_switch_update()
6301 &switch_update_params->changes)) { in ecore_func_send_switch_update()
6302 rdata->tx_switch_suspend_change_flg = 1; in ecore_func_send_switch_update()
6303 rdata->tx_switch_suspend = in ecore_func_send_switch_update()
6305 &switch_update_params->changes); in ecore_func_send_switch_update()
6309 &switch_update_params->changes)) { in ecore_func_send_switch_update()
6310 rdata->sd_vlan_tag_change_flg = 1; in ecore_func_send_switch_update()
6311 rdata->sd_vlan_tag = in ecore_func_send_switch_update()
6312 ECORE_CPU_TO_LE16(switch_update_params->vlan); in ecore_func_send_switch_update()
6316 &switch_update_params->changes)) { in ecore_func_send_switch_update()
6317 rdata->sd_vlan_eth_type_change_flg = 1; in ecore_func_send_switch_update()
6318 rdata->sd_vlan_eth_type = in ecore_func_send_switch_update()
6319 ECORE_CPU_TO_LE16(switch_update_params->vlan_eth_type); in ecore_func_send_switch_update()
6323 &switch_update_params->changes)) { in ecore_func_send_switch_update()
6324 rdata->sd_vlan_force_pri_change_flg = 1; in ecore_func_send_switch_update()
6326 &switch_update_params->changes)) in ecore_func_send_switch_update()
6327 rdata->sd_vlan_force_pri_flg = 1; in ecore_func_send_switch_update()
6328 rdata->sd_vlan_force_pri_flg = in ecore_func_send_switch_update()
6329 switch_update_params->vlan_force_prio; in ecore_func_send_switch_update()
6333 &switch_update_params->changes)) { in ecore_func_send_switch_update()
6334 rdata->update_tunn_cfg_flg = 1; in ecore_func_send_switch_update()
6336 &switch_update_params->changes)) in ecore_func_send_switch_update()
6337 rdata->inner_clss_l2gre = 1; in ecore_func_send_switch_update()
6339 &switch_update_params->changes)) in ecore_func_send_switch_update()
6340 rdata->inner_clss_vxlan = 1; in ecore_func_send_switch_update()
6342 &switch_update_params->changes)) in ecore_func_send_switch_update()
6343 rdata->inner_clss_l2geneve = 1; in ecore_func_send_switch_update()
6345 &switch_update_params->changes)) in ecore_func_send_switch_update()
6346 rdata->inner_rss = 1; in ecore_func_send_switch_update()
6348 rdata->vxlan_dst_port = in ecore_func_send_switch_update()
6349 ECORE_CPU_TO_LE16(switch_update_params->vxlan_dst_port); in ecore_func_send_switch_update()
6350 rdata->geneve_dst_port = in ecore_func_send_switch_update()
6351 ECORE_CPU_TO_LE16(switch_update_params->geneve_dst_port); in ecore_func_send_switch_update()
6354 rdata->echo = SWITCH_UPDATE; in ecore_func_send_switch_update()
6369 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_afex_update()
6371 (struct function_update_data *)o->afex_rdata; in ecore_func_send_afex_update()
6372 ecore_dma_addr_t data_mapping = o->afex_rdata_mapping; in ecore_func_send_afex_update()
6374 ¶ms->params.afex_update; in ecore_func_send_afex_update()
6379 rdata->vif_id_change_flg = 1; in ecore_func_send_afex_update()
6380 rdata->vif_id = ECORE_CPU_TO_LE16(afex_update_params->vif_id); in ecore_func_send_afex_update()
6381 rdata->afex_default_vlan_change_flg = 1; in ecore_func_send_afex_update()
6382 rdata->afex_default_vlan = in ecore_func_send_afex_update()
6383 ECORE_CPU_TO_LE16(afex_update_params->afex_default_vlan); in ecore_func_send_afex_update()
6384 rdata->allowed_priorities_change_flg = 1; in ecore_func_send_afex_update()
6385 rdata->allowed_priorities = afex_update_params->allowed_priorities; in ecore_func_send_afex_update()
6386 rdata->echo = AFEX_UPDATE; in ecore_func_send_afex_update()
6396 rdata->vif_id, in ecore_func_send_afex_update()
6397 rdata->afex_default_vlan, rdata->allowed_priorities); in ecore_func_send_afex_update()
6407 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_afex_viflists()
6409 (struct afex_vif_list_ramrod_data *)o->afex_rdata; in ecore_func_send_afex_viflists()
6411 ¶ms->params.afex_viflists; in ecore_func_send_afex_viflists()
6417 rdata->vif_list_index = ECORE_CPU_TO_LE16(afex_vif_params->vif_list_index); in ecore_func_send_afex_viflists()
6418 rdata->func_bit_map = afex_vif_params->func_bit_map; in ecore_func_send_afex_viflists()
6419 rdata->afex_vif_list_command = afex_vif_params->afex_vif_list_command; in ecore_func_send_afex_viflists()
6420 rdata->func_to_clear = afex_vif_params->func_to_clear; in ecore_func_send_afex_viflists()
6423 rdata->echo = afex_vif_params->afex_vif_list_command; in ecore_func_send_afex_viflists()
6426 rdata->afex_vif_list_command, rdata->vif_list_index, in ecore_func_send_afex_viflists()
6427 rdata->func_bit_map, rdata->func_to_clear); in ecore_func_send_afex_viflists()
6457 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_tx_start()
6459 (struct flow_control_configuration *)o->rdata; in ecore_func_send_tx_start()
6460 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_func_send_tx_start()
6462 ¶ms->params.tx_start; in ecore_func_send_tx_start()
6467 rdata->dcb_enabled = tx_start_params->dcb_enabled; in ecore_func_send_tx_start()
6468 rdata->dcb_version = tx_start_params->dcb_version; in ecore_func_send_tx_start()
6469 rdata->dont_add_pri_0 = tx_start_params->dont_add_pri_0; in ecore_func_send_tx_start()
6471 for (i = 0; i < ARRAY_SIZE(rdata->traffic_type_to_priority_cos); i++) in ecore_func_send_tx_start()
6472 rdata->traffic_type_to_priority_cos[i] = in ecore_func_send_tx_start()
6473 tx_start_params->traffic_type_to_priority_cos[i]; in ecore_func_send_tx_start()
6476 rdata->dcb_outer_pri[i] = tx_start_params->dcb_outer_pri[i]; in ecore_func_send_tx_start()
6491 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_send_set_timesync()
6493 (struct set_timesync_ramrod_data *)o->rdata; in ecore_func_send_set_timesync()
6494 ecore_dma_addr_t data_mapping = o->rdata_mapping; in ecore_func_send_set_timesync()
6496 ¶ms->params.set_timesync; in ecore_func_send_set_timesync()
6501 rdata->drift_adjust_cmd = set_timesync_params->drift_adjust_cmd; in ecore_func_send_set_timesync()
6502 rdata->offset_cmd = set_timesync_params->offset_cmd; in ecore_func_send_set_timesync()
6503 rdata->add_sub_drift_adjust_value = in ecore_func_send_set_timesync()
6504 set_timesync_params->add_sub_drift_adjust_value; in ecore_func_send_set_timesync()
6505 rdata->drift_adjust_value = set_timesync_params->drift_adjust_value; in ecore_func_send_set_timesync()
6506 rdata->drift_adjust_period = set_timesync_params->drift_adjust_period; in ecore_func_send_set_timesync()
6507 rdata->offset_delta.lo = in ecore_func_send_set_timesync()
6508 ECORE_CPU_TO_LE32(U64_LO(set_timesync_params->offset_delta)); in ecore_func_send_set_timesync()
6509 rdata->offset_delta.hi = in ecore_func_send_set_timesync()
6510 ECORE_CPU_TO_LE32(U64_HI(set_timesync_params->offset_delta)); in ecore_func_send_set_timesync()
6513 rdata->drift_adjust_cmd, rdata->offset_cmd, in ecore_func_send_set_timesync()
6514 rdata->add_sub_drift_adjust_value, rdata->drift_adjust_value, in ecore_func_send_set_timesync()
6515 rdata->drift_adjust_period, rdata->offset_delta.lo, in ecore_func_send_set_timesync()
6516 rdata->offset_delta.hi); in ecore_func_send_set_timesync()
6525 switch (params->cmd) { in ecore_func_send_cmd()
6547 ECORE_ERR("Unknown command: %d\n", params->cmd); in ecore_func_send_cmd()
6560 ECORE_MUTEX_INIT(&obj->one_pending_mutex); in ecore_init_func_obj()
6562 obj->rdata = rdata; in ecore_init_func_obj()
6563 obj->rdata_mapping = rdata_mapping; in ecore_init_func_obj()
6564 obj->afex_rdata = afex_rdata; in ecore_init_func_obj()
6565 obj->afex_rdata_mapping = afex_rdata_mapping; in ecore_init_func_obj()
6566 obj->send_cmd = ecore_func_send_cmd; in ecore_init_func_obj()
6567 obj->check_transition = ecore_func_chk_transition; in ecore_init_func_obj()
6568 obj->complete_cmd = ecore_func_comp_cmd; in ecore_init_func_obj()
6569 obj->wait_comp = ecore_func_wait_comp; in ecore_init_func_obj()
6570 obj->drv = drv_iface; in ecore_init_func_obj()
6574 * ecore_func_state_change - perform Function state change transition
6582 * still pending (possible only if RAMROD_COMP_WAIT is
6583 * not set in params->ramrod_flags for asynchronous
6589 struct ecore_func_sp_obj *o = params->f_obj; in ecore_func_state_change()
6591 enum ecore_func_cmd cmd = params->cmd; in ecore_func_state_change()
6592 unsigned long *pending = &o->pending; in ecore_func_state_change()
6594 ECORE_MUTEX_LOCK(&o->one_pending_mutex); in ecore_func_state_change()
6597 rc = o->check_transition(sc, o, params); in ecore_func_state_change()
6599 (ECORE_TEST_BIT(RAMROD_RETRY, ¶ms->ramrod_flags))) { in ecore_func_state_change()
6600 while ((rc == ECORE_BUSY) && (--cnt > 0)) { in ecore_func_state_change()
6601 ECORE_MUTEX_UNLOCK(&o->one_pending_mutex); in ecore_func_state_change()
6603 ECORE_MUTEX_LOCK(&o->one_pending_mutex); in ecore_func_state_change()
6604 rc = o->check_transition(sc, o, params); in ecore_func_state_change()
6607 ECORE_MUTEX_UNLOCK(&o->one_pending_mutex); in ecore_func_state_change()
6612 ECORE_MUTEX_UNLOCK(&o->one_pending_mutex); in ecore_func_state_change()
6619 /* Don't send a command if only driver cleanup was requested */ in ecore_func_state_change()
6620 if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, ¶ms->ramrod_flags)) { in ecore_func_state_change()
6622 ECORE_MUTEX_UNLOCK(&o->one_pending_mutex); in ecore_func_state_change()
6625 rc = o->send_cmd(sc, params); in ecore_func_state_change()
6627 ECORE_MUTEX_UNLOCK(&o->one_pending_mutex); in ecore_func_state_change()
6630 o->next_state = ECORE_F_STATE_MAX; in ecore_func_state_change()
6636 if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, ¶ms->ramrod_flags)) { in ecore_func_state_change()
6637 rc = o->wait_comp(sc, o, cmd); in ecore_func_state_change()