Lines Matching +full:one +full:- +full:to +full:- +full:one
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright 2014-2016 Freescale Semiconductor Inc.
4 * Copyright 2017-2021 NXP
10 #include "dpsw-cmd.h"
23 * dpsw_open() - Open a control session for the specified object
24 * @mc_io: Pointer to MC portal's I/O object
25 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
29 * This function can be used to open a control session for an
50 cmd_params->dpsw_id = cpu_to_le32(dpsw_id); in dpsw_open()
52 /* send command to mc*/ in dpsw_open()
64 * dpsw_close() - Close the control session of the object
65 * @mc_io: Pointer to MC portal's I/O object
66 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
83 /* send command to mc*/ in dpsw_close()
88 * dpsw_enable() - Enable DPSW functionality
89 * @mc_io: Pointer to MC portal's I/O object
90 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
104 /* send command to mc*/ in dpsw_enable()
109 * dpsw_disable() - Disable DPSW functionality
110 * @mc_io: Pointer to MC portal's I/O object
111 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
125 /* send command to mc*/ in dpsw_disable()
130 * dpsw_reset() - Reset the DPSW, returns the object to initial state.
131 * @mc_io: Pointer to MC portal's I/O object
132 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
146 /* send command to mc*/ in dpsw_reset()
151 * dpsw_set_irq_enable() - Set overall interrupt state.
152 * @mc_io: Pointer to MC portal's I/O object
153 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
155 * @irq_index: The interrupt index to configure
156 * @en: Interrupt state - enable = 1, disable = 0
158 * Allows GPP software to control when interrupts are generated.
159 * Each interrupt can have up to 32 causes. The enable/disable control's the
176 dpsw_set_field(cmd_params->enable_state, ENABLE, en); in dpsw_set_irq_enable()
177 cmd_params->irq_index = irq_index; in dpsw_set_irq_enable()
179 /* send command to mc*/ in dpsw_set_irq_enable()
184 * dpsw_set_irq_mask() - Set interrupt mask.
185 * @mc_io: Pointer to MC portal's I/O object
186 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
188 * @irq_index: The interrupt index to configure
189 * @mask: Event mask to trigger interrupt;
194 * Every interrupt can have up to 32 causes and the interrupt model supports
210 cmd_params->mask = cpu_to_le32(mask); in dpsw_set_irq_mask()
211 cmd_params->irq_index = irq_index; in dpsw_set_irq_mask()
213 /* send command to mc*/ in dpsw_set_irq_mask()
218 * dpsw_get_irq_status() - Get the current status of any pending interrupts
219 * @mc_io: Pointer to MC portal's I/O object
220 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
222 * @irq_index: The interrupt index to configure
223 * @status: Returned interrupts status - one bit per cause:
242 cmd_params->status = cpu_to_le32(*status); in dpsw_get_irq_status()
243 cmd_params->irq_index = irq_index; in dpsw_get_irq_status()
245 /* send command to mc*/ in dpsw_get_irq_status()
252 *status = le32_to_cpu(rsp_params->status); in dpsw_get_irq_status()
258 * dpsw_clear_irq_status() - Clear a pending interrupt's status
259 * @mc_io: Pointer to MC portal's I/O object
260 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
262 * @irq_index: The interrupt index to configure
263 * @status: bits to clear (W1C) - one bit per cause:
280 cmd_params->status = cpu_to_le32(status); in dpsw_clear_irq_status()
281 cmd_params->irq_index = irq_index; in dpsw_clear_irq_status()
283 /* send command to mc*/ in dpsw_clear_irq_status()
288 * dpsw_get_attributes() - Retrieve DPSW attributes
289 * @mc_io: Pointer to MC portal's I/O object
290 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
308 /* send command to mc*/ in dpsw_get_attributes()
315 attr->num_ifs = le16_to_cpu(rsp_params->num_ifs); in dpsw_get_attributes()
316 attr->max_fdbs = rsp_params->max_fdbs; in dpsw_get_attributes()
317 attr->num_fdbs = rsp_params->num_fdbs; in dpsw_get_attributes()
318 attr->max_vlans = le16_to_cpu(rsp_params->max_vlans); in dpsw_get_attributes()
319 attr->num_vlans = le16_to_cpu(rsp_params->num_vlans); in dpsw_get_attributes()
320 attr->max_fdb_entries = le16_to_cpu(rsp_params->max_fdb_entries); in dpsw_get_attributes()
321 attr->fdb_aging_time = le16_to_cpu(rsp_params->fdb_aging_time); in dpsw_get_attributes()
322 attr->id = le32_to_cpu(rsp_params->dpsw_id); in dpsw_get_attributes()
323 attr->mem_size = le16_to_cpu(rsp_params->mem_size); in dpsw_get_attributes()
324 attr->max_fdb_mc_groups = le16_to_cpu(rsp_params->max_fdb_mc_groups); in dpsw_get_attributes()
325 attr->max_meters_per_if = rsp_params->max_meters_per_if; in dpsw_get_attributes()
326 attr->options = le64_to_cpu(rsp_params->options); in dpsw_get_attributes()
327 attr->component_type = dpsw_get_field(rsp_params->component_type, COMPONENT_TYPE); in dpsw_get_attributes()
328 attr->flooding_cfg = dpsw_get_field(rsp_params->repl_cfg, FLOODING_CFG); in dpsw_get_attributes()
329 attr->broadcast_cfg = dpsw_get_field(rsp_params->repl_cfg, BROADCAST_CFG); in dpsw_get_attributes()
334 * dpsw_if_set_link_cfg() - Set the link configuration.
335 * @mc_io: Pointer to MC portal's I/O object
336 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
354 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_set_link_cfg()
355 cmd_params->rate = cpu_to_le32(cfg->rate); in dpsw_if_set_link_cfg()
356 cmd_params->options = cpu_to_le64(cfg->options); in dpsw_if_set_link_cfg()
358 /* send command to mc*/ in dpsw_if_set_link_cfg()
363 * dpsw_if_get_link_state - Return the link state
364 * @mc_io: Pointer to MC portal's I/O object
365 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
368 * @state: Link state 1 - linkup, 0 - link down or disconnected
385 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_get_link_state()
387 /* send command to mc*/ in dpsw_if_get_link_state()
394 state->rate = le32_to_cpu(rsp_params->rate); in dpsw_if_get_link_state()
395 state->options = le64_to_cpu(rsp_params->options); in dpsw_if_get_link_state()
396 state->up = dpsw_get_field(rsp_params->up, UP); in dpsw_if_get_link_state()
402 * dpsw_if_set_tci() - Set default VLAN Tag Control Information (TCI)
403 * @mc_io: Pointer to MC portal's I/O object
404 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
423 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_set_tci()
424 dpsw_set_field(tmp_conf, VLAN_ID, cfg->vlan_id); in dpsw_if_set_tci()
425 dpsw_set_field(tmp_conf, DEI, cfg->dei); in dpsw_if_set_tci()
426 dpsw_set_field(tmp_conf, PCP, cfg->pcp); in dpsw_if_set_tci()
427 cmd_params->conf = cpu_to_le16(tmp_conf); in dpsw_if_set_tci()
429 /* send command to mc*/ in dpsw_if_set_tci()
434 * dpsw_if_get_tci() - Get default VLAN Tag Control Information (TCI)
435 * @mc_io: Pointer to MC portal's I/O object
436 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
456 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_get_tci()
458 /* send command to mc*/ in dpsw_if_get_tci()
465 cfg->pcp = rsp_params->pcp; in dpsw_if_get_tci()
466 cfg->dei = rsp_params->dei; in dpsw_if_get_tci()
467 cfg->vlan_id = le16_to_cpu(rsp_params->vlan_id); in dpsw_if_get_tci()
473 * dpsw_if_set_stp() - Function sets Spanning Tree Protocol (STP) state.
474 * @mc_io: Pointer to MC portal's I/O object
475 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
480 * The following STP states are supported -
496 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_set_stp()
497 cmd_params->vlan_id = cpu_to_le16(cfg->vlan_id); in dpsw_if_set_stp()
498 dpsw_set_field(cmd_params->state, STATE, cfg->state); in dpsw_if_set_stp()
500 /* send command to mc*/ in dpsw_if_set_stp()
505 * dpsw_if_get_counter() - Get specific counter of particular interface
506 * @mc_io: Pointer to MC portal's I/O object
507 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
528 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_get_counter()
529 dpsw_set_field(cmd_params->type, COUNTER_TYPE, type); in dpsw_if_get_counter()
531 /* send command to mc*/ in dpsw_if_get_counter()
538 *counter = le64_to_cpu(rsp_params->counter); in dpsw_if_get_counter()
544 * dpsw_if_enable() - Enable Interface
545 * @mc_io: Pointer to MC portal's I/O object
546 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
562 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_enable()
564 /* send command to mc*/ in dpsw_if_enable()
569 * dpsw_if_disable() - Disable Interface
570 * @mc_io: Pointer to MC portal's I/O object
571 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
587 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_disable()
589 /* send command to mc*/ in dpsw_if_disable()
594 * dpsw_if_get_attributes() - Function obtains attributes of interface
595 * @mc_io: Pointer to MC portal's I/O object
596 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
614 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_get_attributes()
621 attr->num_tcs = rsp_params->num_tcs; in dpsw_if_get_attributes()
622 attr->rate = le32_to_cpu(rsp_params->rate); in dpsw_if_get_attributes()
623 attr->options = le32_to_cpu(rsp_params->options); in dpsw_if_get_attributes()
624 attr->qdid = le16_to_cpu(rsp_params->qdid); in dpsw_if_get_attributes()
625 attr->enabled = dpsw_get_field(rsp_params->conf, ENABLED); in dpsw_if_get_attributes()
626 attr->accept_all_vlan = dpsw_get_field(rsp_params->conf, in dpsw_if_get_attributes()
628 attr->admit_untagged = dpsw_get_field(rsp_params->conf, in dpsw_if_get_attributes()
635 * dpsw_if_set_max_frame_length() - Set Maximum Receive frame length.
636 * @mc_io: Pointer to MC portal's I/O object
637 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
655 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_set_max_frame_length()
656 cmd_params->frame_length = cpu_to_le16(frame_length); in dpsw_if_set_max_frame_length()
658 /* send command to mc*/ in dpsw_if_set_max_frame_length()
663 * dpsw_vlan_add() - Adding new VLAN to DPSW.
664 * @mc_io: Pointer to MC portal's I/O object
665 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
690 cmd_params->fdb_id = cpu_to_le16(cfg->fdb_id); in dpsw_vlan_add()
691 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_add()
693 /* send command to mc*/ in dpsw_vlan_add()
698 * dpsw_vlan_add_if() - Adding a set of interfaces to an existing VLAN.
699 * @mc_io: Pointer to MC portal's I/O object
700 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
703 * @cfg: Set of interfaces to add
705 * It adds only interfaces not belonging to this VLAN yet,
723 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_add_if()
724 cmd_params->options = cpu_to_le16(cfg->options); in dpsw_vlan_add_if()
725 cmd_params->fdb_id = cpu_to_le16(cfg->fdb_id); in dpsw_vlan_add_if()
726 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_vlan_add_if()
728 /* send command to mc*/ in dpsw_vlan_add_if()
733 * dpsw_vlan_add_if_untagged() - Defining a set of interfaces that should be
735 * @mc_io: Pointer to MC portal's I/O object
736 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
741 * These interfaces should already belong to this VLAN.
743 * Providing un-existing interface or untagged interface that is
760 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_add_if_untagged()
761 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_vlan_add_if_untagged()
763 /* send command to mc*/ in dpsw_vlan_add_if_untagged()
768 * dpsw_vlan_remove_if() - Remove interfaces from an existing VLAN.
769 * @mc_io: Pointer to MC portal's I/O object
770 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
775 * Interfaces must belong to this VLAN, otherwise an error
791 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_remove_if()
792 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_vlan_remove_if()
794 /* send command to mc*/ in dpsw_vlan_remove_if()
799 * dpsw_vlan_remove_if_untagged() - Define a set of interfaces that should be
800 * converted from transmitted as untagged to transmit as tagged.
801 * @mc_io: Pointer to MC portal's I/O object
802 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
807 * Interfaces provided by API have to belong to this VLAN and
824 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_remove_if_untagged()
825 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_vlan_remove_if_untagged()
827 /* send command to mc*/ in dpsw_vlan_remove_if_untagged()
832 * dpsw_vlan_remove() - Remove an entire VLAN
833 * @mc_io: Pointer to MC portal's I/O object
834 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
851 cmd_params->vlan_id = cpu_to_le16(vlan_id); in dpsw_vlan_remove()
853 /* send command to mc*/ in dpsw_vlan_remove()
858 * dpsw_fdb_add() - Add FDB to switch and Returns handle to FDB table for
860 * @mc_io: Pointer to MC portal's I/O object
861 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
880 cmd_params->fdb_ageing_time = cpu_to_le16(cfg->fdb_ageing_time); in dpsw_fdb_add()
881 cmd_params->num_fdb_entries = cpu_to_le16(cfg->num_fdb_entries); in dpsw_fdb_add()
888 *fdb_id = le16_to_cpu(rsp_params->fdb_id); in dpsw_fdb_add()
894 * dpsw_fdb_remove() - Remove FDB from switch
895 * @mc_io: Pointer to MC portal's I/O object
896 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
912 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_remove()
918 * dpsw_fdb_add_unicast() - Function adds an unicast entry into MAC lookup table
919 * @mc_io: Pointer to MC portal's I/O object
920 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
939 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_add_unicast()
940 cmd_params->if_egress = cpu_to_le16(cfg->if_egress); in dpsw_fdb_add_unicast()
942 cmd_params->mac_addr[i] = cfg->mac_addr[5 - i]; in dpsw_fdb_add_unicast()
943 dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type); in dpsw_fdb_add_unicast()
945 /* send command to mc*/ in dpsw_fdb_add_unicast()
950 * dpsw_fdb_dump() - Dump the content of FDB table into memory.
951 * @mc_io: Pointer to MC portal's I/O object
952 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
965 * area or until an entry with mac_addr set to zero is found.
980 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_dump()
981 cmd_params->iova_addr = cpu_to_le64(iova_addr); in dpsw_fdb_dump()
982 cmd_params->iova_size = cpu_to_le32(iova_size); in dpsw_fdb_dump()
984 /* send command to mc */ in dpsw_fdb_dump()
990 *num_entries = le16_to_cpu(rsp_params->num_entries); in dpsw_fdb_dump()
996 * dpsw_fdb_remove_unicast() - removes an entry from MAC lookup table
997 * @mc_io: Pointer to MC portal's I/O object
998 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1017 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_remove_unicast()
1019 cmd_params->mac_addr[i] = cfg->mac_addr[5 - i]; in dpsw_fdb_remove_unicast()
1020 cmd_params->if_egress = cpu_to_le16(cfg->if_egress); in dpsw_fdb_remove_unicast()
1021 dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type); in dpsw_fdb_remove_unicast()
1023 /* send command to mc*/ in dpsw_fdb_remove_unicast()
1028 * dpsw_fdb_add_multicast() - Add a set of egress interfaces to multi-cast group
1029 * @mc_io: Pointer to MC portal's I/O object
1030 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1036 * It adds only interfaces not belonging to this multicast group
1056 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_add_multicast()
1057 cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs); in dpsw_fdb_add_multicast()
1058 dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type); in dpsw_fdb_add_multicast()
1059 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_fdb_add_multicast()
1061 cmd_params->mac_addr[i] = cfg->mac_addr[5 - i]; in dpsw_fdb_add_multicast()
1063 /* send command to mc*/ in dpsw_fdb_add_multicast()
1068 * dpsw_fdb_remove_multicast() - Removing interfaces from an existing multicast
1070 * @mc_io: Pointer to MC portal's I/O object
1071 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1076 * Interfaces provided by this API have to exist in the group,
1095 cmd_params->fdb_id = cpu_to_le16(fdb_id); in dpsw_fdb_remove_multicast()
1096 cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs); in dpsw_fdb_remove_multicast()
1097 dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type); in dpsw_fdb_remove_multicast()
1098 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_fdb_remove_multicast()
1100 cmd_params->mac_addr[i] = cfg->mac_addr[5 - i]; in dpsw_fdb_remove_multicast()
1102 /* send command to mc*/ in dpsw_fdb_remove_multicast()
1107 * dpsw_ctrl_if_get_attributes() - Obtain control interface attributes
1108 * @mc_io: Pointer to MC portal's I/O object
1109 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1130 attr->rx_fqid = le32_to_cpu(rsp_params->rx_fqid); in dpsw_ctrl_if_get_attributes()
1131 attr->rx_err_fqid = le32_to_cpu(rsp_params->rx_err_fqid); in dpsw_ctrl_if_get_attributes()
1132 attr->tx_err_conf_fqid = le32_to_cpu(rsp_params->tx_err_conf_fqid); in dpsw_ctrl_if_get_attributes()
1138 * dpsw_ctrl_if_set_pools() - Set control interface buffer pools
1139 * @mc_io: Pointer to MC portal's I/O object
1140 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1156 cmd_params->num_dpbp = cfg->num_dpbp; in dpsw_ctrl_if_set_pools()
1158 cmd_params->dpbp_id[i] = cpu_to_le32(cfg->pools[i].dpbp_id); in dpsw_ctrl_if_set_pools()
1159 cmd_params->buffer_size[i] = in dpsw_ctrl_if_set_pools()
1160 cpu_to_le16(cfg->pools[i].buffer_size); in dpsw_ctrl_if_set_pools()
1161 cmd_params->backup_pool_mask |= in dpsw_ctrl_if_set_pools()
1162 DPSW_BACKUP_POOL(cfg->pools[i].backup_pool, i); in dpsw_ctrl_if_set_pools()
1169 * dpsw_ctrl_if_set_queue() - Set Rx queue configuration
1170 * @mc_io: Pointer to MC portal's I/O object
1171 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1189 cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id); in dpsw_ctrl_if_set_queue()
1190 cmd_params->dest_priority = cfg->dest_cfg.priority; in dpsw_ctrl_if_set_queue()
1191 cmd_params->qtype = qtype; in dpsw_ctrl_if_set_queue()
1192 cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx); in dpsw_ctrl_if_set_queue()
1193 cmd_params->options = cpu_to_le32(cfg->options); in dpsw_ctrl_if_set_queue()
1194 dpsw_set_field(cmd_params->dest_type, in dpsw_ctrl_if_set_queue()
1196 cfg->dest_cfg.dest_type); in dpsw_ctrl_if_set_queue()
1202 * dpsw_get_api_version() - Get Data Path Switch API version
1203 * @mc_io: Pointer to MC portal's I/O object
1204 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1226 *major_ver = le16_to_cpu(rsp_params->version_major); in dpsw_get_api_version()
1227 *minor_ver = le16_to_cpu(rsp_params->version_minor); in dpsw_get_api_version()
1233 * dpsw_if_get_port_mac_addr() - Retrieve MAC address associated to the physical port
1234 * @mc_io: Pointer to MC portal's I/O object
1235 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1255 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_get_port_mac_addr()
1257 /* send command to mc*/ in dpsw_if_get_port_mac_addr()
1265 mac_addr[5 - i] = rsp_params->mac_addr[i]; in dpsw_if_get_port_mac_addr()
1271 * dpsw_ctrl_if_enable() - Enable control interface
1272 * @mc_io: Pointer to MC portal's I/O object
1273 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1289 * dpsw_ctrl_if_disable() - Function disables control interface
1290 * @mc_io: Pointer to MC portal's I/O object
1291 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1308 * dpsw_set_egress_flood() - Set egress parameters associated with an FDB ID
1309 * @mc_io: Pointer to MC portal's I/O object
1310 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1324 cmd_params->fdb_id = cpu_to_le16(cfg->fdb_id); in dpsw_set_egress_flood()
1325 cmd_params->flood_type = cfg->flood_type; in dpsw_set_egress_flood()
1326 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_set_egress_flood()
1332 * dpsw_if_set_learning_mode() - Configure the learning mode on an interface.
1334 * @mc_io: Pointer to MC portal's I/O object
1335 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1352 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_set_learning_mode()
1353 dpsw_set_field(cmd_params->mode, LEARNING_MODE, mode); in dpsw_if_set_learning_mode()
1359 * dpsw_acl_add() - Create an ACL table
1360 * @mc_io: Pointer to MC portal's I/O object
1361 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1367 * co-exist in L2 switch
1381 cmd_params->max_entries = cpu_to_le16(cfg->max_entries); in dpsw_acl_add()
1388 *acl_id = le16_to_cpu(rsp_params->acl_id); in dpsw_acl_add()
1394 * dpsw_acl_remove() - Remove an ACL table from L2 switch.
1395 * @mc_io: Pointer to MC portal's I/O object
1396 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1411 cmd_params->acl_id = cpu_to_le16(acl_id); in dpsw_acl_remove()
1417 * dpsw_acl_add_if() - Associate interface/interfaces with an ACL table.
1418 * @mc_io: Pointer to MC portal's I/O object
1419 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1435 cmd_params->acl_id = cpu_to_le16(acl_id); in dpsw_acl_add_if()
1436 cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs); in dpsw_acl_add_if()
1437 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_acl_add_if()
1443 * dpsw_acl_remove_if() - De-associate interface/interfaces from an ACL table
1444 * @mc_io: Pointer to MC portal's I/O object
1445 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1462 cmd_params->acl_id = cpu_to_le16(acl_id); in dpsw_acl_remove_if()
1463 cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs); in dpsw_acl_remove_if()
1464 build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs); in dpsw_acl_remove_if()
1466 /* send command to mc*/ in dpsw_acl_remove_if()
1471 * dpsw_acl_prepare_entry_cfg() - Setup an ACL entry
1473 * @entry_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA
1475 * This function has to be called before adding or removing acl_entry
1487 ext_params->match_l2_dest_mac[i] = key->match.l2_dest_mac[5 - i]; in dpsw_acl_prepare_entry_cfg()
1488 ext_params->match_l2_source_mac[i] = key->match.l2_source_mac[5 - i]; in dpsw_acl_prepare_entry_cfg()
1489 ext_params->mask_l2_dest_mac[i] = key->mask.l2_dest_mac[5 - i]; in dpsw_acl_prepare_entry_cfg()
1490 ext_params->mask_l2_source_mac[i] = key->mask.l2_source_mac[5 - i]; in dpsw_acl_prepare_entry_cfg()
1493 ext_params->match_l2_tpid = cpu_to_le16(key->match.l2_tpid); in dpsw_acl_prepare_entry_cfg()
1494 ext_params->match_l2_vlan_id = cpu_to_le16(key->match.l2_vlan_id); in dpsw_acl_prepare_entry_cfg()
1495 ext_params->match_l3_dest_ip = cpu_to_le32(key->match.l3_dest_ip); in dpsw_acl_prepare_entry_cfg()
1496 ext_params->match_l3_source_ip = cpu_to_le32(key->match.l3_source_ip); in dpsw_acl_prepare_entry_cfg()
1497 ext_params->match_l4_dest_port = cpu_to_le16(key->match.l4_dest_port); in dpsw_acl_prepare_entry_cfg()
1498 ext_params->match_l4_source_port = cpu_to_le16(key->match.l4_source_port); in dpsw_acl_prepare_entry_cfg()
1499 ext_params->match_l2_ether_type = cpu_to_le16(key->match.l2_ether_type); in dpsw_acl_prepare_entry_cfg()
1500 ext_params->match_l2_pcp_dei = key->match.l2_pcp_dei; in dpsw_acl_prepare_entry_cfg()
1501 ext_params->match_l3_dscp = key->match.l3_dscp; in dpsw_acl_prepare_entry_cfg()
1503 ext_params->mask_l2_tpid = cpu_to_le16(key->mask.l2_tpid); in dpsw_acl_prepare_entry_cfg()
1504 ext_params->mask_l2_vlan_id = cpu_to_le16(key->mask.l2_vlan_id); in dpsw_acl_prepare_entry_cfg()
1505 ext_params->mask_l3_dest_ip = cpu_to_le32(key->mask.l3_dest_ip); in dpsw_acl_prepare_entry_cfg()
1506 ext_params->mask_l3_source_ip = cpu_to_le32(key->mask.l3_source_ip); in dpsw_acl_prepare_entry_cfg()
1507 ext_params->mask_l4_dest_port = cpu_to_le16(key->mask.l4_dest_port); in dpsw_acl_prepare_entry_cfg()
1508 ext_params->mask_l4_source_port = cpu_to_le16(key->mask.l4_source_port); in dpsw_acl_prepare_entry_cfg()
1509 ext_params->mask_l2_ether_type = cpu_to_le16(key->mask.l2_ether_type); in dpsw_acl_prepare_entry_cfg()
1510 ext_params->mask_l2_pcp_dei = key->mask.l2_pcp_dei; in dpsw_acl_prepare_entry_cfg()
1511 ext_params->mask_l3_dscp = key->mask.l3_dscp; in dpsw_acl_prepare_entry_cfg()
1512 ext_params->match_l3_protocol = key->match.l3_protocol; in dpsw_acl_prepare_entry_cfg()
1513 ext_params->mask_l3_protocol = key->mask.l3_protocol; in dpsw_acl_prepare_entry_cfg()
1517 * dpsw_acl_add_entry() - Add a rule to the ACL table.
1518 * @mc_io: Pointer to MC portal's I/O object
1519 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1524 * warning: This function has to be called after dpsw_acl_prepare_entry_cfg()
1537 cmd_params->acl_id = cpu_to_le16(acl_id); in dpsw_acl_add_entry()
1538 cmd_params->result_if_id = cpu_to_le16(cfg->result.if_id); in dpsw_acl_add_entry()
1539 cmd_params->precedence = cpu_to_le32(cfg->precedence); in dpsw_acl_add_entry()
1540 cmd_params->key_iova = cpu_to_le64(cfg->key_iova); in dpsw_acl_add_entry()
1541 dpsw_set_field(cmd_params->result_action, in dpsw_acl_add_entry()
1543 cfg->result.action); in dpsw_acl_add_entry()
1549 * dpsw_acl_remove_entry() - Removes an entry from ACL.
1550 * @mc_io: Pointer to MC portal's I/O object
1551 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1556 * warning: This function has to be called after dpsw_acl_set_entry_cfg()
1571 cmd_params->acl_id = cpu_to_le16(acl_id); in dpsw_acl_remove_entry()
1572 cmd_params->result_if_id = cpu_to_le16(cfg->result.if_id); in dpsw_acl_remove_entry()
1573 cmd_params->precedence = cpu_to_le32(cfg->precedence); in dpsw_acl_remove_entry()
1574 cmd_params->key_iova = cpu_to_le64(cfg->key_iova); in dpsw_acl_remove_entry()
1575 dpsw_set_field(cmd_params->result_action, in dpsw_acl_remove_entry()
1577 cfg->result.action); in dpsw_acl_remove_entry()
1579 /* send command to mc*/ in dpsw_acl_remove_entry()
1584 * dpsw_set_reflection_if() - Set target interface for traffic mirrored
1585 * @mc_io: Pointer to MC portal's I/O object
1586 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1590 * Only one mirroring destination is allowed per switch
1604 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_set_reflection_if()
1610 * dpsw_if_add_reflection() - Setup mirroring rule
1611 * @mc_io: Pointer to MC portal's I/O object
1612 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1629 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_add_reflection()
1630 cmd_params->vlan_id = cpu_to_le16(cfg->vlan_id); in dpsw_if_add_reflection()
1631 dpsw_set_field(cmd_params->filter, FILTER, cfg->filter); in dpsw_if_add_reflection()
1637 * dpsw_if_remove_reflection() - Remove mirroring rule
1638 * @mc_io: Pointer to MC portal's I/O object
1639 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1656 cmd_params->if_id = cpu_to_le16(if_id); in dpsw_if_remove_reflection()
1657 cmd_params->vlan_id = cpu_to_le16(cfg->vlan_id); in dpsw_if_remove_reflection()
1658 dpsw_set_field(cmd_params->filter, FILTER, cfg->filter); in dpsw_if_remove_reflection()