aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_helper_macros.h
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-11-25 16:02:24 +0100
committerOle Tr�an <otroan@employees.org>2021-11-26 14:11:20 +0000
commita4abdac55f474e9c1876444dcd6c4b461c25993d (patch)
treec842fa80b9cbfb1a3f9e7dfbda5af184fb4b6708 /src/vlibapi/api_helper_macros.h
parent09abed65b5c62cca5b850cc060e72192e3490811 (diff)
api: add helper macros for native endian
Type: improvement Change-Id: Ifa074dfd337f9cd68858468d34abf641fe7f247f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vlibapi/api_helper_macros.h')
-rw-r--r--src/vlibapi/api_helper_macros.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/vlibapi/api_helper_macros.h b/src/vlibapi/api_helper_macros.h
index 7a04bb056f2..320390534a5 100644
--- a/src/vlibapi/api_helper_macros.h
+++ b/src/vlibapi/api_helper_macros.h
@@ -273,6 +273,17 @@ do { \
} \
} while(0);
+#define VALIDATE_SW_IF_INDEX_END(mp) \
+ do \
+ { \
+ if (!vnet_sw_if_index_is_api_valid ((mp)->sw_if_index)) \
+ { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_sw_if_index; \
+ } \
+ } \
+ while (0);
+
#define BAD_SW_IF_INDEX_LABEL \
do { \
bad_sw_if_index: \
@@ -287,6 +298,17 @@ bad_sw_if_index: \
} \
} while(0);
+#define VALIDATE_RX_SW_IF_INDEX_END(mp) \
+ do \
+ { \
+ if (!vnet_sw_if_index_is_api_valid ((mp)->rx_sw_if_index)) \
+ { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_rx_sw_if_index; \
+ } \
+ } \
+ while (0);
+
#define BAD_RX_SW_IF_INDEX_LABEL \
do { \
bad_rx_sw_if_index: \
@@ -301,6 +323,17 @@ bad_rx_sw_if_index: \
} \
} while(0);
+#define VALIDATE_TX_SW_IF_INDEX_END(mp) \
+ do \
+ { \
+ if (!vnet_sw_if_index_is_api_valid (mp->tx_sw_if_index)) \
+ { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_tx_sw_if_index; \
+ } \
+ } \
+ while (0);
+
#define BAD_TX_SW_IF_INDEX_LABEL \
do { \
bad_tx_sw_if_index: \
@@ -315,6 +348,17 @@ bad_tx_sw_if_index: \
} \
} while(0);
+#define VALIDATE_BD_ID_END(mp) \
+ do \
+ { \
+ if (mp->bd_id > L2_BD_ID_MAX) \
+ { \
+ rv = VNET_API_ERROR_BD_ID_EXCEED_MAX; \
+ goto bad_bd_id; \
+ } \
+ } \
+ while (0);
+
#define BAD_BD_ID_LABEL \
do { \
bad_bd_id: \