2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright 2013-2016 Freescale Semiconductor Inc.
8 * Copyright (c) 2016 NXP.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * * Neither the name of the above-listed copyright holders nor the
18 * names of any contributors may be used to endorse or promote products
19 * derived from this software without specific prior written permission.
23 * ALTERNATIVELY, this software may be distributed under the terms of the
24 * GNU General Public License ("GPL") as published by the Free Software
25 * Foundation, either version 2 of that License or (at your option) any
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
40 #include <fsl_mc_sys.h>
41 #include <fsl_mc_cmd.h>
43 #include <fsl_dpni_cmd.h>
45 int dpni_prepare_key_cfg(const struct dpkg_profile_cfg *cfg,
51 uint64_t *params = (uint64_t *)key_cfg_buf;
53 if (!key_cfg_buf || !cfg)
56 params[0] |= mc_enc(0, 8, cfg->num_extracts);
57 params[0] = cpu_to_le64(params[0]);
59 if (cfg->num_extracts >= DPKG_MAX_NUM_OF_EXTRACTS)
62 for (i = 0; i < cfg->num_extracts; i++) {
63 switch (cfg->extracts[i].type) {
64 case DPKG_EXTRACT_FROM_HDR:
65 params[param] |= mc_enc(0, 8,
66 cfg->extracts[i].extract.from_hdr.prot);
67 params[param] |= mc_enc(8, 4,
68 cfg->extracts[i].extract.from_hdr.type);
69 params[param] |= mc_enc(16, 8,
70 cfg->extracts[i].extract.from_hdr.size);
71 params[param] |= mc_enc(24, 8,
72 cfg->extracts[i].extract.
74 params[param] |= mc_enc(32, 32,
75 cfg->extracts[i].extract.
77 params[param] = cpu_to_le64(params[param]);
79 params[param] |= mc_enc(0, 8,
80 cfg->extracts[i].extract.
83 case DPKG_EXTRACT_FROM_DATA:
84 params[param] |= mc_enc(16, 8,
85 cfg->extracts[i].extract.
87 params[param] |= mc_enc(24, 8,
88 cfg->extracts[i].extract.
90 params[param] = cpu_to_le64(params[param]);
93 case DPKG_EXTRACT_FROM_PARSE:
94 params[param] |= mc_enc(16, 8,
95 cfg->extracts[i].extract.
97 params[param] |= mc_enc(24, 8,
98 cfg->extracts[i].extract.
100 params[param] = cpu_to_le64(params[param]);
106 params[param] |= mc_enc(
107 24, 8, cfg->extracts[i].num_of_byte_masks);
108 params[param] |= mc_enc(32, 4, cfg->extracts[i].type);
109 params[param] = cpu_to_le64(params[param]);
111 for (offset = 0, j = 0;
112 j < DPKG_NUM_OF_MASKS;
114 params[param] |= mc_enc(
115 (offset), 8, cfg->extracts[i].masks[j].mask);
116 params[param] |= mc_enc(
118 cfg->extracts[i].masks[j].offset);
120 params[param] = cpu_to_le64(params[param]);
126 int dpni_open(struct fsl_mc_io *mc_io,
131 struct mc_command cmd = { 0 };
134 /* prepare command */
135 cmd.header = mc_encode_cmd_header(DPNI_CMDID_OPEN,
138 DPNI_CMD_OPEN(cmd, dpni_id);
140 /* send command to mc*/
141 err = mc_send_command(mc_io, &cmd);
145 /* retrieve response parameters */
146 *token = MC_CMD_HDR_READ_TOKEN(cmd.header);
151 int dpni_close(struct fsl_mc_io *mc_io,
155 struct mc_command cmd = { 0 };
157 /* prepare command */
158 cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLOSE,
162 /* send command to mc*/
163 return mc_send_command(mc_io, &cmd);
166 int dpni_create(struct fsl_mc_io *mc_io,
169 const struct dpni_cfg *cfg,
172 struct mc_command cmd = { 0 };
175 /* prepare command */
176 cmd.header = mc_encode_cmd_header(DPNI_CMDID_CREATE,
179 DPNI_CMD_CREATE(cmd, cfg);
181 /* send command to mc*/
182 err = mc_send_command(mc_io, &cmd);
186 /* retrieve response parameters */
187 CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
192 int dpni_destroy(struct fsl_mc_io *mc_io,
197 struct mc_command cmd = { 0 };
199 /* prepare command */
200 cmd.header = mc_encode_cmd_header(DPNI_CMDID_DESTROY,
203 /* set object id to destroy */
204 CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
205 /* send command to mc*/
206 return mc_send_command(mc_io, &cmd);
209 int dpni_set_pools(struct fsl_mc_io *mc_io,
212 const struct dpni_pools_cfg *cfg)
214 struct mc_command cmd = { 0 };
216 /* prepare command */
217 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_POOLS,
220 DPNI_CMD_SET_POOLS(cmd, cfg);
222 /* send command to mc*/
223 return mc_send_command(mc_io, &cmd);
226 int dpni_enable(struct fsl_mc_io *mc_io,
230 struct mc_command cmd = { 0 };
232 /* prepare command */
233 cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
237 /* send command to mc*/
238 return mc_send_command(mc_io, &cmd);
241 int dpni_disable(struct fsl_mc_io *mc_io,
245 struct mc_command cmd = { 0 };
247 /* prepare command */
248 cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
252 /* send command to mc*/
253 return mc_send_command(mc_io, &cmd);
256 int dpni_is_enabled(struct fsl_mc_io *mc_io,
261 struct mc_command cmd = { 0 };
263 /* prepare command */
264 cmd.header = mc_encode_cmd_header(DPNI_CMDID_IS_ENABLED, cmd_flags,
267 /* send command to mc*/
268 err = mc_send_command(mc_io, &cmd);
272 /* retrieve response parameters */
273 DPNI_RSP_IS_ENABLED(cmd, *en);
278 int dpni_reset(struct fsl_mc_io *mc_io,
282 struct mc_command cmd = { 0 };
284 /* prepare command */
285 cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
289 /* send command to mc*/
290 return mc_send_command(mc_io, &cmd);
293 int dpni_get_attributes(struct fsl_mc_io *mc_io,
296 struct dpni_attr *attr)
298 struct mc_command cmd = { 0 };
301 /* prepare command */
302 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_ATTR,
306 /* send command to mc*/
307 err = mc_send_command(mc_io, &cmd);
311 /* retrieve response parameters */
312 DPNI_RSP_GET_ATTR(cmd, attr);
317 int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
320 struct dpni_error_cfg *cfg)
322 struct mc_command cmd = { 0 };
324 /* prepare command */
325 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_ERRORS_BEHAVIOR,
328 DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg);
330 /* send command to mc*/
331 return mc_send_command(mc_io, &cmd);
334 int dpni_get_buffer_layout(struct fsl_mc_io *mc_io,
337 enum dpni_queue_type qtype,
338 struct dpni_buffer_layout *layout)
340 struct mc_command cmd = { 0 };
343 /* prepare command */
344 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_BUFFER_LAYOUT,
347 DPNI_CMD_GET_BUFFER_LAYOUT(cmd, qtype);
349 /* send command to mc*/
350 err = mc_send_command(mc_io, &cmd);
354 /* retrieve response parameters */
355 DPNI_RSP_GET_BUFFER_LAYOUT(cmd, layout);
360 int dpni_set_buffer_layout(struct fsl_mc_io *mc_io,
363 enum dpni_queue_type qtype,
364 const struct dpni_buffer_layout *layout)
366 struct mc_command cmd = { 0 };
368 /* prepare command */
369 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_BUFFER_LAYOUT,
372 DPNI_CMD_SET_BUFFER_LAYOUT(cmd, qtype, layout);
374 /* send command to mc*/
375 return mc_send_command(mc_io, &cmd);
378 int dpni_set_offload(struct fsl_mc_io *mc_io,
381 enum dpni_offload type,
384 struct mc_command cmd = { 0 };
386 /* prepare command */
387 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_OFFLOAD,
390 DPNI_CMD_SET_OFFLOAD(cmd, type, config);
392 /* send command to mc*/
393 return mc_send_command(mc_io, &cmd);
396 int dpni_get_offload(struct fsl_mc_io *mc_io,
399 enum dpni_offload type,
402 struct mc_command cmd = { 0 };
405 /* prepare command */
406 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_OFFLOAD,
409 DPNI_CMD_GET_OFFLOAD(cmd, type);
411 /* send command to mc*/
412 err = mc_send_command(mc_io, &cmd);
416 /* retrieve response parameters */
417 DPNI_RSP_GET_OFFLOAD(cmd, *config);
422 int dpni_get_qdid(struct fsl_mc_io *mc_io,
425 enum dpni_queue_type qtype,
428 struct mc_command cmd = { 0 };
431 /* prepare command */
432 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QDID,
435 DPNI_CMD_GET_QDID(cmd, qtype);
437 /* send command to mc*/
438 err = mc_send_command(mc_io, &cmd);
442 /* retrieve response parameters */
443 DPNI_RSP_GET_QDID(cmd, *qdid);
448 int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
451 const struct dpni_link_cfg *cfg)
453 struct mc_command cmd = { 0 };
455 /* prepare command */
456 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG,
459 DPNI_CMD_SET_LINK_CFG(cmd, cfg);
461 /* send command to mc*/
462 return mc_send_command(mc_io, &cmd);
465 int dpni_get_link_state(struct fsl_mc_io *mc_io,
468 struct dpni_link_state *state)
470 struct mc_command cmd = { 0 };
473 /* prepare command */
474 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_LINK_STATE,
478 /* send command to mc*/
479 err = mc_send_command(mc_io, &cmd);
483 /* retrieve response parameters */
484 DPNI_RSP_GET_LINK_STATE(cmd, state);
489 int dpni_set_max_frame_length(struct fsl_mc_io *mc_io,
492 uint16_t max_frame_length)
494 struct mc_command cmd = { 0 };
496 /* prepare command */
497 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_MAX_FRAME_LENGTH,
500 DPNI_CMD_SET_MAX_FRAME_LENGTH(cmd, max_frame_length);
502 /* send command to mc*/
503 return mc_send_command(mc_io, &cmd);
506 int dpni_get_max_frame_length(struct fsl_mc_io *mc_io,
509 uint16_t *max_frame_length)
511 struct mc_command cmd = { 0 };
514 /* prepare command */
515 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_MAX_FRAME_LENGTH,
519 /* send command to mc*/
520 err = mc_send_command(mc_io, &cmd);
524 /* retrieve response parameters */
525 DPNI_RSP_GET_MAX_FRAME_LENGTH(cmd, *max_frame_length);
530 int dpni_set_multicast_promisc(struct fsl_mc_io *mc_io,
535 struct mc_command cmd = { 0 };
537 /* prepare command */
538 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_MCAST_PROMISC,
541 DPNI_CMD_SET_MULTICAST_PROMISC(cmd, en);
543 /* send command to mc*/
544 return mc_send_command(mc_io, &cmd);
547 int dpni_get_multicast_promisc(struct fsl_mc_io *mc_io,
552 struct mc_command cmd = { 0 };
555 /* prepare command */
556 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_MCAST_PROMISC,
560 /* send command to mc*/
561 err = mc_send_command(mc_io, &cmd);
565 /* retrieve response parameters */
566 DPNI_RSP_GET_MULTICAST_PROMISC(cmd, *en);
571 int dpni_set_unicast_promisc(struct fsl_mc_io *mc_io,
576 struct mc_command cmd = { 0 };
578 /* prepare command */
579 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_UNICAST_PROMISC,
582 DPNI_CMD_SET_UNICAST_PROMISC(cmd, en);
584 /* send command to mc*/
585 return mc_send_command(mc_io, &cmd);
588 int dpni_get_unicast_promisc(struct fsl_mc_io *mc_io,
593 struct mc_command cmd = { 0 };
596 /* prepare command */
597 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_UNICAST_PROMISC,
601 /* send command to mc*/
602 err = mc_send_command(mc_io, &cmd);
606 /* retrieve response parameters */
607 DPNI_RSP_GET_UNICAST_PROMISC(cmd, *en);
612 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
615 const uint8_t mac_addr[6])
617 struct mc_command cmd = { 0 };
619 /* prepare command */
620 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PRIM_MAC,
623 DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr);
625 /* send command to mc*/
626 return mc_send_command(mc_io, &cmd);
629 int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
634 struct mc_command cmd = { 0 };
637 /* prepare command */
638 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PRIM_MAC,
642 /* send command to mc*/
643 err = mc_send_command(mc_io, &cmd);
647 /* retrieve response parameters */
648 DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr);
653 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
656 const uint8_t mac_addr[6])
658 struct mc_command cmd = { 0 };
660 /* prepare command */
661 cmd.header = mc_encode_cmd_header(DPNI_CMDID_ADD_MAC_ADDR,
664 DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr);
666 /* send command to mc*/
667 return mc_send_command(mc_io, &cmd);
670 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
673 const uint8_t mac_addr[6])
675 struct mc_command cmd = { 0 };
677 /* prepare command */
678 cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_MAC_ADDR,
681 DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr);
683 /* send command to mc*/
684 return mc_send_command(mc_io, &cmd);
687 int dpni_clear_mac_filters(struct fsl_mc_io *mc_io,
693 struct mc_command cmd = { 0 };
695 /* prepare command */
696 cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLR_MAC_FILTERS,
699 DPNI_CMD_CLEAR_MAC_FILTERS(cmd, unicast, multicast);
701 /* send command to mc*/
702 return mc_send_command(mc_io, &cmd);
705 int dpni_get_port_mac_addr(struct fsl_mc_io *mc_io,
710 struct mc_command cmd = { 0 };
713 /* prepare command */
714 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PORT_MAC_ADDR,
718 /* send command to mc*/
719 err = mc_send_command(mc_io, &cmd);
723 /* retrieve response parameters */
724 DPNI_RSP_GET_PORT_MAC_ADDR(cmd, mac_addr);
729 int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io,
734 struct mc_command cmd = { 0 };
736 /* prepare command */
737 cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE_VLAN_FILTER,
740 DPNI_CMD_ENABLE_VLAN_FILTER(cmd, en);
742 /* send command to mc*/
743 return mc_send_command(mc_io, &cmd);
746 int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
751 struct mc_command cmd = { 0 };
753 /* prepare command */
754 cmd.header = mc_encode_cmd_header(DPNI_CMDID_ADD_VLAN_ID,
757 DPNI_CMD_ADD_VLAN_ID(cmd, vlan_id);
759 /* send command to mc*/
760 return mc_send_command(mc_io, &cmd);
763 int dpni_remove_vlan_id(struct fsl_mc_io *mc_io,
768 struct mc_command cmd = { 0 };
770 /* prepare command */
771 cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_VLAN_ID,
774 DPNI_CMD_REMOVE_VLAN_ID(cmd, vlan_id);
776 /* send command to mc*/
777 return mc_send_command(mc_io, &cmd);
780 int dpni_clear_vlan_filters(struct fsl_mc_io *mc_io,
784 struct mc_command cmd = { 0 };
786 /* prepare command */
787 cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLR_VLAN_FILTERS,
791 /* send command to mc*/
792 return mc_send_command(mc_io, &cmd);
795 int dpni_set_rx_tc_dist(struct fsl_mc_io *mc_io,
799 const struct dpni_rx_tc_dist_cfg *cfg)
801 struct mc_command cmd = { 0 };
803 /* prepare command */
804 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_TC_DIST,
807 DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg);
809 /* send command to mc*/
810 return mc_send_command(mc_io, &cmd);
813 int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io,
816 enum dpni_confirmation_mode mode)
818 struct mc_command cmd = { 0 };
820 /* prepare command */
821 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_CONFIRMATION_MODE,
824 DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode);
826 /* send command to mc*/
827 return mc_send_command(mc_io, &cmd);
830 int dpni_set_congestion_notification(
831 struct fsl_mc_io *mc_io,
834 enum dpni_queue_type qtype,
836 const struct dpni_congestion_notification_cfg *cfg)
838 struct mc_command cmd = { 0 };
840 /* prepare command */
841 cmd.header = mc_encode_cmd_header(
842 DPNI_CMDID_SET_CONGESTION_NOTIFICATION,
845 DPNI_CMD_SET_CONGESTION_NOTIFICATION(cmd, qtype, tc_id, cfg);
847 /* send command to mc*/
848 return mc_send_command(mc_io, &cmd);
851 int dpni_get_congestion_notification(struct fsl_mc_io *mc_io,
854 enum dpni_queue_type qtype,
856 struct dpni_congestion_notification_cfg *cfg)
858 struct mc_command cmd = { 0 };
861 /* prepare command */
862 cmd.header = mc_encode_cmd_header(
863 DPNI_CMDID_GET_CONGESTION_NOTIFICATION,
866 DPNI_CMD_GET_CONGESTION_NOTIFICATION(cmd, qtype, tc_id);
868 /* send command to mc*/
869 err = mc_send_command(mc_io, &cmd);
873 DPNI_RSP_GET_CONGESTION_NOTIFICATION(cmd, cfg);
878 int dpni_get_api_version(struct fsl_mc_io *mc_io,
883 struct mc_command cmd = { 0 };
886 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_API_VERSION,
890 err = mc_send_command(mc_io, &cmd);
894 DPNI_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
899 int dpni_set_queue(struct fsl_mc_io *mc_io,
902 enum dpni_queue_type qtype,
906 const struct dpni_queue *queue)
908 struct mc_command cmd = { 0 };
910 /* prepare command */
911 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_QUEUE,
914 DPNI_CMD_SET_QUEUE(cmd, qtype, tc, index, options, queue);
916 /* send command to mc*/
917 return mc_send_command(mc_io, &cmd);
920 int dpni_get_queue(struct fsl_mc_io *mc_io,
923 enum dpni_queue_type qtype,
926 struct dpni_queue *queue,
927 struct dpni_queue_id *qid)
929 struct mc_command cmd = { 0 };
932 /* prepare command */
933 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QUEUE,
936 DPNI_CMD_GET_QUEUE(cmd, qtype, tc, index);
938 /* send command to mc*/
939 err = mc_send_command(mc_io, &cmd);
943 /* retrieve response parameters */
944 DPNI_RSP_GET_QUEUE(cmd, queue, qid);
949 int dpni_get_statistics(struct fsl_mc_io *mc_io,
953 union dpni_statistics *stat)
955 struct mc_command cmd = { 0 };
958 /* prepare command */
959 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_STATISTICS,
962 DPNI_CMD_GET_STATISTICS(cmd, page);
964 /* send command to mc*/
965 err = mc_send_command(mc_io, &cmd);
969 /* retrieve response parameters */
970 DPNI_RSP_GET_STATISTICS(cmd, stat);
975 int dpni_reset_statistics(struct fsl_mc_io *mc_io,
979 struct mc_command cmd = { 0 };
981 /* prepare command */
982 cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET_STATISTICS,
986 /* send command to mc*/
987 return mc_send_command(mc_io, &cmd);
990 int dpni_set_taildrop(struct fsl_mc_io *mc_io,
993 enum dpni_congestion_point cg_point,
994 enum dpni_queue_type q_type,
997 struct dpni_taildrop *taildrop)
999 struct mc_command cmd = { 0 };
1001 /* prepare command */
1002 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TAILDROP,
1005 DPNI_CMD_SET_TAILDROP(cmd, cg_point, q_type, tc, q_index, taildrop);
1007 /* send command to mc*/
1008 return mc_send_command(mc_io, &cmd);
1011 int dpni_get_taildrop(struct fsl_mc_io *mc_io,
1014 enum dpni_congestion_point cg_point,
1015 enum dpni_queue_type q_type,
1018 struct dpni_taildrop *taildrop)
1020 struct mc_command cmd = { 0 };
1023 /* prepare command */
1024 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TAILDROP,
1027 DPNI_CMD_GET_TAILDROP(cmd, cg_point, q_type, tc, q_index);
1029 /* send command to mc*/
1030 err = mc_send_command(mc_io, &cmd);
1034 /* retrieve response parameters */
1035 DPNI_RSP_GET_TAILDROP(cmd, taildrop);