Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 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 Denk | cb3761e | 2013-07-28 22:12:47 +0200 | [diff] [blame] | 16 | * SPDX-License-Identifier: BSD-3-Clause |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 17 | * @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 Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 28 | * @param blocked true to block the port or false to unblock it |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 29 | * |
| 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 | */ |
| 36 | IX_ETH_DB_PUBLIC |
| 37 | IxEthDBStatus 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 | */ |
| 69 | IX_ETH_DB_PUBLIC |
| 70 | IxEthDBStatus 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 | } |