Skip to content

Commit a63bb86

Browse files
committed
Remove virtual service sync isolation rules
1 parent 1930621 commit a63bb86

File tree

10 files changed

+78
-153
lines changed

10 files changed

+78
-153
lines changed

include/dp_virtsvc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ void dp_virtsvc_free(void);
105105

106106
size_t dp_virtsvc_get_count(void);
107107

108-
int dp_install_virtsvc_sync_isolation_rules(uint16_t port_id);
109108
uint16_t dp_create_virtsvc_async_isolation_rules(uint16_t port_id,
110109
struct rte_flow_template_table *template_table);
111110
void dp_destroy_virtsvc_async_isolation_rules(uint16_t port_id);

include/rte_flow/dp_rte_flow_init.h

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#ifndef __INCLUDE_DP_RTE_FLOW_ISOLATION_H__
5+
#define __INCLUDE_DP_RTE_FLOW_ISOLATION_H__
6+
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
#include <stdint.h>
12+
13+
int dp_install_isolated_mode(uint16_t port_id);
14+
15+
#ifdef __cplusplus
16+
}
17+
#endif
18+
19+
#endif

src/dp_port.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "rte_flow/dp_rte_async_flow_template.h"
2121
#include "rte_flow/dp_rte_flow.h"
2222
#include "rte_flow/dp_rte_flow_capture.h"
23-
#include "rte_flow/dp_rte_flow_init.h"
23+
#include "rte_flow/dp_rte_flow_isolation.h"
2424

2525
#define DP_PORT_INIT_PF true
2626
#define DP_PORT_INIT_VF false
@@ -425,18 +425,6 @@ void dp_ports_free(void)
425425
}
426426

427427

428-
static int dp_port_install_sync_isolated_mode(uint16_t port_id)
429-
{
430-
DPS_LOG_INFO("Init isolation flow rules");
431-
if (DP_FAILED(dp_install_isolated_mode_ipip(port_id)))
432-
return DP_ERROR;
433-
#ifdef ENABLE_VIRTSVC
434-
return dp_install_virtsvc_sync_isolation_rules(port_id);
435-
#else
436-
return DP_OK;
437-
#endif
438-
}
439-
440428
static int dp_port_bind_port_hairpins(const struct dp_port *port)
441429
{
442430
// two pf port's hairpins are bound when processing the second port
@@ -562,9 +550,11 @@ static int dp_init_port(struct dp_port *port)
562550
if (DP_FAILED(dp_port_create_default_pf_async_templates(port))
563551
|| DP_FAILED(dp_port_install_async_isolated_mode(port)))
564552
return DP_ERROR;
565-
} else
566-
if (DP_FAILED(dp_port_install_sync_isolated_mode(port->port_id)))
553+
} else {
554+
DPS_LOG_INFO("Init isolation flow rules");
555+
if (DP_FAILED(dp_install_isolated_mode(port->port_id)))
567556
return DP_ERROR;
557+
}
568558
}
569559

570560
if (dp_conf_is_offload_enabled()) {

src/dp_virtsvc.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "dp_log.h"
1414
#include "dp_multi_path.h"
1515
#include "dp_util.h"
16-
#include "rte_flow/dp_rte_flow_init.h"
1716
#include "rte_flow/dp_rte_async_flow.h"
1817
#include "rte_flow/dp_rte_async_flow_isolation.h"
1918

@@ -224,23 +223,6 @@ size_t dp_virtsvc_get_count(void)
224223
}
225224

226225

227-
int dp_install_virtsvc_sync_isolation_rules(uint16_t port_id)
228-
{
229-
int ret;
230-
231-
DP_FOREACH_VIRTSVC(&dp_virtservices, service) {
232-
ret = dp_install_isolated_mode_virtsvc(port_id,
233-
service->proto,
234-
&service->service_addr,
235-
service->service_port);
236-
if (DP_FAILED(ret)) {
237-
DPS_LOG_ERR("Cannot create isolation rule", DP_LOG_VIRTSVC(service), DP_LOG_RET(ret));
238-
return DP_ERROR;
239-
}
240-
}
241-
return DP_OK;
242-
}
243-
244226
uint16_t dp_create_virtsvc_async_isolation_rules(uint16_t port_id,
245227
struct rte_flow_template_table *template_table)
246228
{

src/meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ dp_sources = [
3232
'nodes/rx_periodic_node.c',
3333
'nodes/snat_node.c',
3434
'nodes/tx_node.c',
35-
'rte_flow/dp_rte_flow.c',
36-
'rte_flow/dp_rte_flow_capture.c',
37-
'rte_flow/dp_rte_flow_init.c',
38-
'rte_flow/dp_rte_flow_traffic_forward.c',
3935
'rte_flow/dp_rte_async_flow.c',
4036
'rte_flow/dp_rte_async_flow_isolation.c',
4137
'rte_flow/dp_rte_async_flow_template.c',
38+
'rte_flow/dp_rte_flow.c',
39+
'rte_flow/dp_rte_flow_capture.c',
40+
'rte_flow/dp_rte_flow_isolation.c',
41+
'rte_flow/dp_rte_flow_traffic_forward.c',
4242
'dp_argparse.c',
4343
'dp_cntrack.c',
4444
'dp_conf.c',

src/monitoring/dp_event.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "dp_log.h"
99
#include "dp_port.h"
1010
#include "monitoring/dp_monitoring.h"
11-
#include "rte_flow/dp_rte_flow_init.h"
1211

1312

1413
static int dp_send_event_msg(const struct dp_event_msg *msg)

src/monitoring/dp_graphtrace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "dpdk_layer.h"
1313
#include "monitoring/dp_graphtrace_shared.h"
1414
#include "monitoring/dp_pcap.h"
15-
#include "rte_flow/dp_rte_flow_init.h"
1615
#include "rte_flow/dp_rte_flow.h"
1716
#include "monitoring/dp_event.h"
1817

src/rte_flow/dp_rte_flow_init.c

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#include "rte_flow/dp_rte_flow_isolation.h"
5+
6+
#include "dp_error.h"
7+
#include "dp_log.h"
8+
#include "rte_flow/dp_rte_flow_helpers.h"
9+
#include "dp_conf.h"
10+
#include "monitoring/dp_monitoring.h"
11+
12+
static const struct rte_flow_attr dp_flow_attr_prio_ingress = {
13+
.group = 0,
14+
.priority = 1,
15+
.ingress = 1,
16+
.egress = 0,
17+
.transfer = 0,
18+
};
19+
20+
21+
int dp_install_isolated_mode(uint16_t port_id)
22+
{
23+
struct rte_flow_item_eth eth_spec; // #1
24+
struct rte_flow_item_ipv6 ipv6_spec; // #2
25+
struct rte_flow_item pattern[3]; // + end
26+
int pattern_cnt = 0;
27+
struct rte_flow_action_queue queue_action; // #1
28+
struct rte_flow_action action[2]; // + end
29+
int action_cnt = 0;
30+
union dp_ipv6 ul_addr6;
31+
32+
ul_addr6._ul.prefix = dp_conf_get_underlay_ip()->_prefix;
33+
ul_addr6._ul.kernel = htons(DP_UNDERLAY_KERNEL_BYTES);
34+
35+
// create match pattern: IP in IPv6 tunnel packets
36+
dp_set_eth_flow_item(&pattern[pattern_cnt++], &eth_spec, htons(RTE_ETHER_TYPE_IPV6));
37+
dp_set_ipv6_dst_pfx68_flow_item(&pattern[pattern_cnt++], &ipv6_spec, &ul_addr6);
38+
dp_set_end_flow_item(&pattern[pattern_cnt++]);
39+
40+
// create flow action: allow packets to enter dp-service packet queue
41+
dp_set_redirect_queue_action(&action[action_cnt++], &queue_action, 0);
42+
dp_set_end_action(&action[action_cnt++]);
43+
44+
if (!dp_install_rte_flow(port_id, &dp_flow_attr_prio_ingress, pattern, action))
45+
return DP_ERROR;
46+
47+
DPS_LOG_DEBUG("Installed IPIP isolation flow rule", DP_LOG_PORTID(port_id));
48+
return DP_OK;
49+
}
50+

0 commit comments

Comments
 (0)