blob: e12be0d884ab330d574c94d7b1667de9da224b24 [file] [log] [blame]
Wolfgang Denkba94a1b2006-05-30 15:56:48 +02001/**
2 * @file IxEthDBSpanningTree.c
3 *
4 * @brief Implementation of the STP API
5 *
6 * @par
7 * IXP400 SW Release version 2.0
8 *
9 * -- Copyright Notice --
10 *
11 * @par
12 * Copyright 2001-2005, Intel Corporation.
13 * All rights reserved.
14 *
15 * @par
Wolfgang Denkcb3761e2013-07-28 22:12:47 +020016 * SPDX-License-Identifier: BSD-3-Clause
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020017 * @par
18 * -- End of Copyright Notice --
19 */
20
21
22#include "IxEthDB_p.h"
23
24/**
25 * @brief sets the STP blocking state of a port
26 *
27 * @param portID ID of the port
York Sun472d5462013-04-01 11:29:11 -070028 * @param blocked true to block the port or false to unblock it
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020029 *
30 * Note that this function is documented in the main component
31 * header file, IxEthDB.h.
32 *
33 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
34 * or an appropriate error message otherwise
35 */
36IX_ETH_DB_PUBLIC
37IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked)
38{
39 IxNpeMhMessage message;
40 IX_STATUS result;
41
42 IX_ETH_DB_CHECK_PORT(portID);
43
44 IX_ETH_DB_CHECK_SINGLE_NPE(portID);
45
46 IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
47
48 ixEthDBPortInfo[portID].stpBlocked = blocked;
49
50 FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked);
51
52 IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
53
54 return result;
55}
56
57/**
58 * @brief retrieves the STP blocking state of a port
59 *
60 * @param portID ID of the port
61 * @param blocked address to write the blocked status into
62 *
63 * Note that this function is documented in the main component
64 * header file, IxEthDB.h.
65 *
66 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
67 * or an appropriate error message otherwise
68 */
69IX_ETH_DB_PUBLIC
70IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
71{
72 IX_ETH_DB_CHECK_PORT(portID);
73
74 IX_ETH_DB_CHECK_SINGLE_NPE(portID);
75
76 IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
77
78 IX_ETH_DB_CHECK_REFERENCE(blocked);
79
80 *blocked = ixEthDBPortInfo[portID].stpBlocked;
81
82 return IX_ETH_DB_SUCCESS;
83}