dpni.c (6aa90fe2d96745b63d4ccc74c0c37b90d31b699e) dpni.c (f395b69f40f580491ef56f2395a98e3189baa53c)
1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/* Copyright 2013-2016 Freescale Semiconductor Inc.
3 * Copyright 2016 NXP
4 */
5#include <linux/kernel.h>
6#include <linux/errno.h>
7#include <linux/fsl/mc.h>
8#include "dpni.h"

--- 1341 unchanged lines hidden (view full) ---

1350 cmd_params->default_flow_id = cpu_to_le16(cfg->fs_cfg.default_flow_id);
1351 cmd_params->key_cfg_iova = cpu_to_le64(cfg->key_cfg_iova);
1352
1353 /* send command to mc*/
1354 return mc_send_command(mc_io, &cmd);
1355}
1356
1357/**
1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/* Copyright 2013-2016 Freescale Semiconductor Inc.
3 * Copyright 2016 NXP
4 */
5#include <linux/kernel.h>
6#include <linux/errno.h>
7#include <linux/fsl/mc.h>
8#include "dpni.h"

--- 1341 unchanged lines hidden (view full) ---

1350 cmd_params->default_flow_id = cpu_to_le16(cfg->fs_cfg.default_flow_id);
1351 cmd_params->key_cfg_iova = cpu_to_le64(cfg->key_cfg_iova);
1352
1353 /* send command to mc*/
1354 return mc_send_command(mc_io, &cmd);
1355}
1356
1357/**
1358 * dpni_set_congestion_notification() - Set traffic class congestion
1359 * notification configuration
1360 * @mc_io: Pointer to MC portal's I/O object
1361 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1362 * @token: Token of DPNI object
1363 * @qtype: Type of queue - Rx, Tx and Tx confirm types are supported
1364 * @tc_id: Traffic class selection (0-7)
1365 * @cfg: Congestion notification configuration
1366 *
1367 * Return: '0' on Success; error code otherwise.
1368 */
1369int dpni_set_congestion_notification(
1370 struct fsl_mc_io *mc_io,
1371 u32 cmd_flags,
1372 u16 token,
1373 enum dpni_queue_type qtype,
1374 u8 tc_id,
1375 const struct dpni_congestion_notification_cfg *cfg)
1376{
1377 struct dpni_cmd_set_congestion_notification *cmd_params;
1378 struct fsl_mc_command cmd = { 0 };
1379
1380 /* prepare command */
1381 cmd.header =
1382 mc_encode_cmd_header(DPNI_CMDID_SET_CONGESTION_NOTIFICATION,
1383 cmd_flags,
1384 token);
1385 cmd_params = (struct dpni_cmd_set_congestion_notification *)cmd.params;
1386 cmd_params->qtype = qtype;
1387 cmd_params->tc = tc_id;
1388 cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
1389 cmd_params->notification_mode = cpu_to_le16(cfg->notification_mode);
1390 cmd_params->dest_priority = cfg->dest_cfg.priority;
1391 dpni_set_field(cmd_params->type_units, DEST_TYPE,
1392 cfg->dest_cfg.dest_type);
1393 dpni_set_field(cmd_params->type_units, CONG_UNITS, cfg->units);
1394 cmd_params->message_iova = cpu_to_le64(cfg->message_iova);
1395 cmd_params->message_ctx = cpu_to_le64(cfg->message_ctx);
1396 cmd_params->threshold_entry = cpu_to_le32(cfg->threshold_entry);
1397 cmd_params->threshold_exit = cpu_to_le32(cfg->threshold_exit);
1398
1399 /* send command to mc*/
1400 return mc_send_command(mc_io, &cmd);
1401}
1402
1403/**
1358 * dpni_set_queue() - Set queue parameters
1359 * @mc_io: Pointer to MC portal's I/O object
1360 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1361 * @token: Token of DPNI object
1362 * @qtype: Type of queue - all queue types are supported, although
1363 * the command is ignored for Tx
1364 * @tc: Traffic class, in range 0 to NUM_TCS - 1
1365 * @index: Selects the specific queue out of the set allocated for the

--- 554 unchanged lines hidden ---
1404 * dpni_set_queue() - Set queue parameters
1405 * @mc_io: Pointer to MC portal's I/O object
1406 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1407 * @token: Token of DPNI object
1408 * @qtype: Type of queue - all queue types are supported, although
1409 * the command is ignored for Tx
1410 * @tc: Traffic class, in range 0 to NUM_TCS - 1
1411 * @index: Selects the specific queue out of the set allocated for the

--- 554 unchanged lines hidden ---