summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLu Qiuwen <[email protected]>2022-06-24 12:00:50 -0400
committerLu Qiuwen <[email protected]>2022-06-24 12:20:39 -0400
commite38dda5e172b2698e92ed02981e1253ac62af697 (patch)
tree1bc209b630d5108da7dcc89e1926b4765769b872 /tools
parentaba1984874c044bc74f1eb1395d645cebb73cb0d (diff)
适配DPDK-21.11。
Diffstat (limited to 'tools')
-rw-r--r--tools/mrctl/mrctl.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/mrctl/mrctl.c b/tools/mrctl/mrctl.c
index 25c2878..83fcde6 100644
--- a/tools/mrctl/mrctl.c
+++ b/tools/mrctl/mrctl.c
@@ -12,6 +12,7 @@
#include <MESA_prof_load.h>
#include <rte_flow.h>
#include <sc_flow.h>
+#include <rte_version.h>
#define GLOBAL_CONF_FILE_PATH "/opt/tsg/mrzcpd/etc/mrglobal.conf"
#define MR_CLI_ARG_LIST "hcsdg:iep:"
@@ -1138,14 +1139,25 @@ int send_create_request_msg(struct mrctl_instance * instance, struct mrctl_flow_
if (ether_item->arg_flag & MR_RULE_FLOW_ETHER_ARG_SMAC_ENABLE)
{
char mac_addr[MR_RULE_MAC_ADDR_LEN];
+
+#if RTE_VERSION_NUM(21, 11, 0, 0) <= RTE_VERSION
+ ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.src_addr);
+#else
ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.s_addr);
+#endif
cJSON_AddStringToObject(cjson_ether_item, MR_CJSON_KEY_ETHER_SMAC, mac_addr);
}
if (ether_item->arg_flag & MR_RULE_FLOW_ETHER_ARG_DMAC_ENABLE)
{
char mac_addr[MR_RULE_MAC_ADDR_LEN];
+
+#if RTE_VERSION_NUM(21,11,0,0) <= RTE_VERSION
+ ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.dst_addr);
+#else
ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.d_addr);
+#endif
+
cJSON_AddStringToObject(cjson_ether_item, MR_CJSON_KEY_ETHER_DMAC, mac_addr);
}
@@ -1588,10 +1600,20 @@ int main(int argc, char * argv[])
}
case MR_CLI_ITEM_ETHER_SMAC:
{
+#if RTE_VERSION_NUM(21, 11, 0, 0) <= RTE_VERSION
+ if(string_to_mac(optarg,&ether_item->ether_hdr.src_addr) == RT_SUCCESS)
+#else
if(string_to_mac(optarg,&ether_item->ether_hdr.s_addr) == RT_SUCCESS)
+#endif
+
{
ether_item->arg_flag |= MR_RULE_FLOW_ETHER_ARG_SMAC_ENABLE;
+
+#if RTE_VERSION_NUM(21, 11, 0, 0) <= RTE_VERSION
+ ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.src_addr);
+#else
ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.s_addr);
+#endif
}
else
{
@@ -1603,10 +1625,19 @@ int main(int argc, char * argv[])
}
case MR_CLI_ITEM_ETHER_DMAC:
{
+#if RTE_VERSION_NUM(21, 11, 0, 0) <= RTE_VERSION
+ if(string_to_mac(optarg,&ether_item->ether_hdr.dst_addr) == RT_SUCCESS)
+#else
if(string_to_mac(optarg,&ether_item->ether_hdr.d_addr) == RT_SUCCESS)
+#endif
+
{
ether_item->arg_flag |= MR_RULE_FLOW_ETHER_ARG_DMAC_ENABLE;
+#if RTE_VERSION_NUM(21, 11, 0, 0) <= RTE_VERSION
+ ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.dst_addr);
+#else
ether_format_addr(mac_addr, sizeof(mac_addr), &ether_item->ether_hdr.d_addr);
+#endif
}
else
{