Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UPF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UPF
Commits
d31c5ab9
Commit
d31c5ab9
authored
Mar 18, 2021
by
wangyongshou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support multiple gnb multiple gtpu tunnel
parent
07fb5a3d
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
435 additions
and
140 deletions
+435
-140
src/vppe/src/plugins/dpdk/device/dpdk.h
src/vppe/src/plugins/dpdk/device/dpdk.h
+7
-0
src/vppe/src/plugins/dpdk/device/init.c
src/vppe/src/plugins/dpdk/device/init.c
+29
-0
src/vppe/src/plugins/gtpu/gtpu.c
src/vppe/src/plugins/gtpu/gtpu.c
+51
-0
src/vppe/src/plugins/upf/upf.c
src/vppe/src/plugins/upf/upf.c
+3
-6
src/vppe/src/plugins/upf/upf_api.c
src/vppe/src/plugins/upf/upf_api.c
+153
-90
src/vppe/src/plugins/upf/upf_gtpu_encap.c
src/vppe/src/plugins/upf/upf_gtpu_encap.c
+71
-20
src/vppe/src/vlib/cli.c
src/vppe/src/vlib/cli.c
+0
-0
src/vppe/src/vlib/main.c
src/vppe/src/vlib/main.c
+6
-1
src/vppe/src/vlib/main.h
src/vppe/src/vlib/main.h
+44
-3
src/vppe/src/vlib/unix/main.c
src/vppe/src/vlib/unix/main.c
+42
-1
src/vppe/src/vnet/ip/ip4_forward.c
src/vppe/src/vnet/ip/ip4_forward.c
+3
-5
src/vppe/src/vpp/vnet/main.c
src/vppe/src/vpp/vnet/main.c
+1
-0
src/vppe/startup_debug.conf
src/vppe/startup_debug.conf
+25
-14
No files found.
src/vppe/src/plugins/dpdk/device/dpdk.h
View file @
d31c5ab9
...
@@ -251,7 +251,12 @@ typedef struct
...
@@ -251,7 +251,12 @@ typedef struct
typedef
struct
typedef
struct
{
{
vlib_pci_addr_t
pci_addr
;
vlib_pci_addr_t
pci_addr
;
u8
*
name
;
u8
*
name
;
u8
*
ipaddr
;
u8
netmask
;
u8
*
gateway
;
u8
is_blacklisted
;
u8
is_blacklisted
;
u8
vlan_strip_offload
;
u8
vlan_strip_offload
;
#define DPDK_DEVICE_VLAN_STRIP_DEFAULT 0
#define DPDK_DEVICE_VLAN_STRIP_DEFAULT 0
...
@@ -265,6 +270,8 @@ typedef struct
...
@@ -265,6 +270,8 @@ typedef struct
u8
tso
;
u8
tso
;
u8
*
devargs
;
u8
*
devargs
;
#define DPDK_DEVICE_TSO_DEFAULT 0
#define DPDK_DEVICE_TSO_DEFAULT 0
#define DPDK_DEVICE_TSO_OFF 1
#define DPDK_DEVICE_TSO_OFF 1
#define DPDK_DEVICE_TSO_ON 2
#define DPDK_DEVICE_TSO_ON 2
...
...
src/vppe/src/plugins/dpdk/device/init.c
View file @
d31c5ab9
...
@@ -45,6 +45,9 @@
...
@@ -45,6 +45,9 @@
dpdk_main_t
dpdk_main
;
dpdk_main_t
dpdk_main
;
dpdk_config_main_t
dpdk_config_main
;
dpdk_config_main_t
dpdk_config_main
;
extern
upf_if_info_t
*
if_info
;
#define LINK_STATE_ELOGS 0
#define LINK_STATE_ELOGS 0
/* Port configuration, mildly modified Intel app values */
/* Port configuration, mildly modified Intel app values */
...
@@ -1061,6 +1064,12 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
...
@@ -1061,6 +1064,12 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
else
if
(
unformat
(
input
,
"num-tx-desc %u"
,
&
devconf
->
num_tx_desc
))
else
if
(
unformat
(
input
,
"num-tx-desc %u"
,
&
devconf
->
num_tx_desc
))
;
;
else
if
(
unformat
(
input
,
"name %s"
,
&
devconf
->
name
))
else
if
(
unformat
(
input
,
"name %s"
,
&
devconf
->
name
))
;
else
if
(
unformat
(
input
,
"ipaddr %s"
,
&
devconf
->
ipaddr
))
;
else
if
(
unformat
(
input
,
"gateway %s"
,
&
devconf
->
gateway
))
;
else
if
(
unformat
(
input
,
"netmask %u"
,
&
devconf
->
netmask
))
;
;
else
if
(
unformat
(
input
,
"workers %U"
,
unformat_bitmap_list
,
else
if
(
unformat
(
input
,
"workers %U"
,
unformat_bitmap_list
,
&
devconf
->
workers
))
&
devconf
->
workers
))
...
@@ -1095,6 +1104,26 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
...
@@ -1095,6 +1104,26 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
}
}
}
}
//add it int 20200310
const
char
*
devconf_name
=
(
const
char
*
)
devconf
->
name
;
if
(
devconf_name
)
{
if
(
!
strcmp
(
"if_n3"
,
devconf_name
))
{
if_info
->
if_n3
.
name
=
devconf
->
name
;
if_info
->
if_n3
.
ipaddr
=
devconf
->
ipaddr
;
if_info
->
if_n3
.
gateway
=
devconf
->
gateway
;
if_info
->
if_n3
.
netmask
=
devconf
->
netmask
;
}
else
if
(
!
strcmp
(
"if_n6"
,
devconf_name
))
{
if_info
->
if_n6
.
name
=
devconf
->
name
;
if_info
->
if_n6
.
ipaddr
=
devconf
->
ipaddr
;
if_info
->
if_n6
.
gateway
=
devconf
->
gateway
;
if_info
->
if_n6
.
netmask
=
devconf
->
netmask
;
}
}
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
...
src/vppe/src/plugins/gtpu/gtpu.c
View file @
d31c5ab9
...
@@ -33,6 +33,12 @@
...
@@ -33,6 +33,12 @@
#include <gtpu/gtpu.h>
#include <gtpu/gtpu.h>
#include <vnet/flow/flow.h>
#include <vnet/flow/flow.h>
#include <vppinfra/error.h>
#include <vlib/unix/unix.h>
#include <arpa/inet.h>
unix_main_t
*
um
=
&
unix_main
;
gtpu_main_t
gtpu_main
;
gtpu_main_t
gtpu_main
;
/* *INDENT-OFF* */
/* *INDENT-OFF* */
...
@@ -347,6 +353,21 @@ mcast_shared_remove (ip46_address_t * dst)
...
@@ -347,6 +353,21 @@ mcast_shared_remove (ip46_address_t * dst)
hash_unset_mem_free
(
&
gtpu_main
.
mcast_shared
,
dst
);
hash_unset_mem_free
(
&
gtpu_main
.
mcast_shared
,
dst
);
}
}
void
test_upf_ip4_to_str
(
u32
ip4addr
,
char
*
str
,
const
u16
buf_len
)
{
u32
addr1_1
=
ip4addr
>>
24
;
// 提取第一部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_2
=
ip4addr
>>
24
;
// 提取第二部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_3
=
ip4addr
>>
24
;
// 提取第三部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_4
=
ip4addr
>>
24
;
// 提取第四部分IP地址
snprintf
(
str
,
buf_len
,
"%u.%u.%u.%u"
,
addr1_1
,
addr1_2
,
addr1_3
,
addr1_4
);
}
int
vnet_gtpu_add_del_tunnel
int
vnet_gtpu_add_del_tunnel
(
vnet_gtpu_add_del_tunnel_args_t
*
a
,
u32
*
sw_if_indexp
)
(
vnet_gtpu_add_del_tunnel_args_t
*
a
,
u32
*
sw_if_indexp
)
{
{
...
@@ -487,6 +508,16 @@ int vnet_gtpu_add_del_tunnel
...
@@ -487,6 +508,16 @@ int vnet_gtpu_add_del_tunnel
//add it in 20201030, for upf gtpu encap;
//add it in 20201030, for upf gtpu encap;
hi
->
dpoi_index
=
t
->
next_dpo
.
dpoi_index
;
hi
->
dpoi_index
=
t
->
next_dpo
.
dpoi_index
;
hi
->
dpoi_next_node
=
t
->
next_dpo
.
dpoi_next_node
;
hi
->
dpoi_next_node
=
t
->
next_dpo
.
dpoi_next_node
;
char
local
[
1024
]
=
{
0
};
char
remote
[
1024
]
=
{
0
};
test_upf_ip4_to_str
(
clib_net_to_host_u32
(
t
->
src
.
ip4
.
data_u32
),
local
,
1024
);
test_upf_ip4_to_str
(
clib_net_to_host_u32
(
t
->
dst
.
ip4
.
data_u32
),
remote
,
1024
);
clib_upf_debug
(
um
->
log_fd
,
"create gtpu tunnel, local:%s, remote:%s, dpoi_index:%u,dpoi_next_node:%u, hi:%p
\n
"
,
local
,
remote
,
hi
->
dpoi_index
,
hi
->
dpoi_next_node
,
hi
);
}
}
else
else
{
{
...
@@ -815,6 +846,7 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
...
@@ -815,6 +846,7 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
foreach_copy_field
;
foreach_copy_field
;
#undef _
#undef _
rv
=
vnet_gtpu_add_del_tunnel
(
a
,
&
tunnel_sw_if_index
);
rv
=
vnet_gtpu_add_del_tunnel
(
a
,
&
tunnel_sw_if_index
);
switch
(
rv
)
switch
(
rv
)
...
@@ -839,6 +871,25 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
...
@@ -839,6 +871,25 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
goto
done
;
goto
done
;
}
}
//add it in 20210312
{
u8
*
tt
=
NULL
,
*
ss
=
NULL
;
vnet_sw_interface_t
*
si
;
vnet_main_t
*
vnm
=
vnet_get_main
();
si
=
vnet_get_sw_interface_or_null
(
vnm
,
tunnel_sw_if_index
);
if
(
NULL
==
si
)
{
//return format (ss, "DELETED");
}
ss
=
format
(
tt
,
"%U"
,
format_vnet_sw_interface_name
,
vnm
,
si
);
memset
(
input
->
buffer
,
0
,
strlen
((
const
char
*
)(
input
->
buffer
)));
strncpy
((
char
*
)
input
->
buffer
,
(
char
*
)
ss
,
strlen
((
const
char
*
)
ss
));
input
->
index
=
strlen
((
const
char
*
)
ss
);
}
done:
done:
unformat_free
(
line_input
);
unformat_free
(
line_input
);
...
...
src/vppe/src/plugins/upf/upf.c
View file @
d31c5ab9
...
@@ -57,11 +57,8 @@ static fib_source_t upf_fib_source;
...
@@ -57,11 +57,8 @@ static fib_source_t upf_fib_source;
#define EXT_NUM_MAX 10
#define EXT_NUM_MAX 10
#define PEERS_NUM_MAX 32
#define PEERS_NUM_MAX 32
//extern gtpu4_header_dl_t *gtpu4_header_dl ;
extern
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
;
extern
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
;
extern
upf_if_info_t
*
if_info
;
int
int
vnet_upf_upip_add_del
(
ip4_address_t
*
ip4
,
ip6_address_t
*
ip6
,
vnet_upf_upip_add_del
(
ip4_address_t
*
ip4
,
ip6_address_t
*
ip6
,
...
@@ -339,8 +336,8 @@ upf_init (vlib_main_t * vm)
...
@@ -339,8 +336,8 @@ upf_init (vlib_main_t * vm)
}
}
}
}
}
}
//add it in 20200311
pool_alloc_aligned
(
if_info
,
1
,
CLIB_CACHE_LINE_BYTES
);
//add it in 20201026
//add it in 20201026
pool_alloc_aligned
(
sm
->
peers
,
PEERS_NUM_MAX
,
CLIB_CACHE_LINE_BYTES
);
pool_alloc_aligned
(
sm
->
peers
,
PEERS_NUM_MAX
,
CLIB_CACHE_LINE_BYTES
);
...
...
src/vppe/src/plugins/upf/upf_api.c
View file @
d31c5ab9
This diff is collapsed.
Click to expand it.
src/vppe/src/plugins/upf/upf_gtpu_encap.c
View file @
d31c5ab9
...
@@ -170,6 +170,21 @@ upf_gtpu_end_marker (u32 fib_index, u32 dpoi_index, u8 * rewrite, int is_ip4)
...
@@ -170,6 +170,21 @@ upf_gtpu_end_marker (u32 fib_index, u32 dpoi_index, u8 * rewrite, int is_ip4)
#define foreach_fixed_header6_offset \
#define foreach_fixed_header6_offset \
_(0) _(1) _(2) _(3) _(4) _(5) _(6)
_(0) _(1) _(2) _(3) _(4) _(5) _(6)
always_inline
void
test_encap_upf_ip4_to_str
(
u32
ip4addr
,
char
*
str
,
const
u16
buf_len
)
{
u32
addr1_1
=
ip4addr
>>
24
;
// 提取第一部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_2
=
ip4addr
>>
24
;
// 提取第二部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_3
=
ip4addr
>>
24
;
// 提取第三部分IP地址
ip4addr
=
ip4addr
<<
8
;
u32
addr1_4
=
ip4addr
>>
24
;
// 提取第四部分IP地址
snprintf
(
str
,
buf_len
,
"%u.%u.%u.%u"
,
addr1_1
,
addr1_2
,
addr1_3
,
addr1_4
);
}
always_inline
uword
always_inline
uword
upf_encap_inline
(
vlib_main_t
*
vm
,
upf_encap_inline
(
vlib_main_t
*
vm
,
vlib_node_runtime_t
*
node
,
vlib_node_runtime_t
*
node
,
...
@@ -651,6 +666,30 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -651,6 +666,30 @@ upf_encap_inline (vlib_main_t * vm,
b0
=
vlib_get_buffer
(
vm
,
bi0
);
b0
=
vlib_get_buffer
(
vm
,
bi0
);
ip4_header_t
*
ip4_1
=
vlib_buffer_get_current
(
b0
);
#if 0
if(ip4_1)
{
//debug
struct in_addr addr;
addr.s_addr = ip4_1->dst_address.as_u32;
clib_upf_debug(um->log_fd,"ueip:%s",inet_ntoa(addr));
}
#endif
gtpu4_header_dl_t
*
gtpu_dl
=
bupt_lookup_dl_gtpu4_header_by_ueip
(
ip4_1
->
dst_address
.
as_u32
);
if
(
PREDICT_FALSE
(
!
gtpu_dl
))
{
clib_upf_debug
(
um
->
log_fd
,
"gtpu dl is not found"
);
next0
=
UPF_ENCAP_NEXT_DROP
;
goto
trace00
;
}
upf_buffer_opaque
(
b0
)
->
gtpu
.
session_index
=
gtpu_dl
->
sess_idx
;
upf_buffer_opaque
(
b0
)
->
gtpu
.
pdr_idx
=
gtpu_dl
->
pdr_idx
;
flow_hash0
=
vnet_l2_compute_flow_hash
(
b0
);
flow_hash0
=
vnet_l2_compute_flow_hash
(
b0
);
/* Get next node index and adj index from tunnel next_dpo */
/* Get next node index and adj index from tunnel next_dpo */
...
@@ -669,30 +708,37 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -669,30 +708,37 @@ upf_encap_inline (vlib_main_t * vm,
next0
=
UPF_ENCAP_NEXT_DROP
;
next0
=
UPF_ENCAP_NEXT_DROP
;
goto
trace00
;
goto
trace00
;
}
}
pdr0
->
far_id
=
gtpu_dl
->
far_id
;
//clib_upf_debug(um->log_fd,"s0:%p, sess_idx:%u, pdr_idx:%u, pdr0->far_id:%u",
//s0, gtpu_dl->sess_idx, gtpu_dl->pdr_idx, pdr0->far_id);
/* TODO: this should be optimized */
/* TODO: this should be optimized */
//pdr0 = r0->pdr + upf_buffer_opaque (b0)->gtpu.pdr_idx;
//pdr0 = r0->pdr + upf_buffer_opaque (b0)->gtpu.pdr_idx;
//far0 = pfcp_get_far_by_id (r0, pdr0->far_id);
//far0 = pfcp_get_far_by_id (r0, pdr0->far_id);
//for find far,wait time; When you create a session in the update later, do optimization
//for find far,wait time; When you create a session in the update later, do optimization
//At present, you can find far if you query once
//At present, you can find far if you query once
int
j
=
0
;
int
j
=
0
;
for
(;
j
<
UPF_FAR_MAX
;
j
++
)
for
(;
j
<
UPF_FAR_MAX
;
j
++
)
{
{
far0
=
r0
->
far
+
j
;
far0
=
r0
->
far
+
j
;
if
(
pdr0
->
far_id
==
far0
->
id
)
if
(
pdr0
->
far_id
==
far0
->
id
)
{
//clib_upf_debug(um->log_fd, "find far id:%u", far0->id);
break
;
break
;
}
}
}
//not found
//not found
if
(
PREDICT_TRUE
(
j
==
UPF_FAR_MAX
))
if
(
PREDICT_TRUE
(
j
==
UPF_FAR_MAX
))
{
{
clib_upf_debug
(
um
->
log_fd
,
"far is not found"
);
clib_upf_debug
(
um
->
log_fd
,
"far is not found"
);
next0
=
UPF_ENCAP_NEXT_DROP
;
next0
=
UPF_ENCAP_NEXT_DROP
;
goto
trace00
;
goto
trace00
;
}
}
/* Note: change to always set next0 if it may be set to drop */
/* Note: change to always set next0 if it may be set to drop */
//next0 = peer0->next_dpo.dpoi_next_node;
//next0 = peer0->next_dpo.dpoi_next_node;
//vnet_buffer (b0)->ip.adj_index[VLIB_TX] = peer0->next_dpo.dpoi_index;
//vnet_buffer (b0)->ip.adj_index[VLIB_TX] = peer0->next_dpo.dpoi_index;
...
@@ -700,6 +746,7 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -700,6 +746,7 @@ upf_encap_inline (vlib_main_t * vm,
/* Get next node index and adj index from tunnel next_dpo */
/* Get next node index and adj index from tunnel next_dpo */
u32
sw_if_index0
=
vnet_buffer
(
b0
)
->
sw_if_index
[
VLIB_TX
];
u32
sw_if_index0
=
vnet_buffer
(
b0
)
->
sw_if_index
[
VLIB_TX
];
hi0
=
vnet_get_sup_hw_interface
(
vnm
,
sw_if_index0
);
hi0
=
vnet_get_sup_hw_interface
(
vnm
,
sw_if_index0
);
vnet_buffer
(
b0
)
->
ip
.
adj_index
[
VLIB_TX
]
=
hi0
->
dpoi_index
;
vnet_buffer
(
b0
)
->
ip
.
adj_index
[
VLIB_TX
]
=
hi0
->
dpoi_index
;
//UPF_ENCAP_NEXT_IP4_LOAD_BAlANCE
//UPF_ENCAP_NEXT_IP4_LOAD_BAlANCE
...
@@ -707,6 +754,7 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -707,6 +754,7 @@ upf_encap_inline (vlib_main_t * vm,
//vnet_buffer(b0)->sw_if_index[VLIB_TX] = 0x03;
//vnet_buffer(b0)->sw_if_index[VLIB_TX] = 0x03;
next0
=
hi0
->
dpoi_next_node
;
next0
=
hi0
->
dpoi_next_node
;
#if 0
#if 0
//later, do optimization
//later, do optimization
if(PREDICT_FALSE ((upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT) != 0))
if(PREDICT_FALSE ((upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT) != 0))
...
@@ -717,7 +765,7 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -717,7 +765,7 @@ upf_encap_inline (vlib_main_t * vm,
#endif
#endif
/* Apply the rewrite string. $$$$ vnet_rewrite? */
/* Apply the rewrite string. $$$$ vnet_rewrite? */
if
(
PREDICT_FALSE
(
!
(
far0
->
forward
.
rewrite
)))
if
(
PREDICT_FALSE
(
!
(
far0
->
forward
.
rewrite
)))
{
{
next0
=
UPF_ENCAP_NEXT_DROP
;
next0
=
UPF_ENCAP_NEXT_DROP
;
clib_upf_debug
(
um
->
log_fd
,
"rewrite is NULL"
);
clib_upf_debug
(
um
->
log_fd
,
"rewrite is NULL"
);
...
@@ -750,7 +798,6 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -750,7 +798,6 @@ upf_encap_inline (vlib_main_t * vm,
ip4_0
->
checksum
=
ip_csum_fold
(
sum0
);
ip4_0
->
checksum
=
ip_csum_fold
(
sum0
);
ip4_0
->
length
=
new_l0
;
ip4_0
->
length
=
new_l0
;
//clib_upf_debug(um->log_fd,"ip4_0 new_l0:0x%x,length:0x%x", clib_net_to_host_u16(new_l0),clib_net_to_host_u16(ip4_0->length));
/* Fix UDP length and set source port */
/* Fix UDP length and set source port */
udp0
=
(
udp_header_t
*
)
(
ip4_0
+
1
);
udp0
=
(
udp_header_t
*
)
(
ip4_0
+
1
);
...
@@ -760,7 +807,6 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -760,7 +807,6 @@ upf_encap_inline (vlib_main_t * vm,
sizeof
(
*
ip4_0
));
sizeof
(
*
ip4_0
));
udp0
->
length
=
new_l0
;
udp0
->
length
=
new_l0
;
//clib_upf_debug(um->log_fd,"udp0 new_l0:0x%x, length:0x%x", clib_net_to_host_u16(new_l0),clib_net_to_host_u16(udp0->length));
//udp0->src_port = flow_hash0;
//udp0->src_port = flow_hash0;
udp0
->
src_port
=
clib_host_to_net_u16
(
GTPU4_SRC_PORT
);
udp0
->
src_port
=
clib_host_to_net_u16
(
GTPU4_SRC_PORT
);
...
@@ -777,14 +823,19 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -777,14 +823,19 @@ upf_encap_inline (vlib_main_t * vm,
gtpu0
->
teid
=
clib_host_to_net_u32
(
upf_buffer_opaque
(
b0
)
->
gtpu
.
teid
);
gtpu0
->
teid
=
clib_host_to_net_u32
(
upf_buffer_opaque
(
b0
)
->
gtpu
.
teid
);
//show trace
//show trace
far0
->
forward
.
outer_header_creation
.
teid
=
upf_buffer_opaque
(
b0
)
->
gtpu
.
teid
;
//far0->forward.outer_header_creation.teid = clib_net_to_host_u32(gtpu0->teid)
;
//unix_main_t *um = &unix_main;
#if 0
struct
in_addr
addrDst
;
//test
addrDst
.
s_addr
=
clib_net_to_host_u32
(
ip4_0
->
dst_address
.
as_u32
);
char local[1024] = {0};
clib_upf_debug
(
um
->
log_fd
,
"dst ueip:%s ,ip4_0->length:%u,udp0->length:%u,gtpu0->length:%u"
,
char remote[1024] = {0};
inet_ntoa
(
addrDst
),
clib_net_to_host_u16
(
ip4_0
->
length
),
clib_net_to_host_u16
(
udp0
->
length
),
clib_net_to_host_u16
(
gtpu0
->
length
));
test_encap_upf_ip4_to_str(clib_net_to_host_u32(ip4_0->src_address.data_u32), local, 1024);
test_encap_upf_ip4_to_str(clib_net_to_host_u32(ip4_0->dst_address.data_u32), remote, 1024);
clib_upf_debug(um->log_fd,"local:%s, remote:%s, dpoi_index:%u,dpoi_next_node:%u,far0:%p\n",
local, remote, hi0->dpoi_index, hi0->dpoi_next_node, far0);
#endif
}
}
else
/* ip6 path */
else
/* ip6 path */
...
@@ -841,16 +892,16 @@ upf_encap_inline (vlib_main_t * vm,
...
@@ -841,16 +892,16 @@ upf_encap_inline (vlib_main_t * vm,
upf_encap_trace_t
*
tr
=
upf_encap_trace_t
*
tr
=
vlib_add_trace
(
vm
,
node
,
b0
,
sizeof
(
*
tr
));
vlib_add_trace
(
vm
,
node
,
b0
,
sizeof
(
*
tr
));
tr
->
session_index
=
s0
-
gtm
->
sessions
;
tr
->
session_index
=
s0
-
gtm
->
sessions
;
tr
->
teid
=
far0
->
forward
.
outer_header_creation
.
teid
;
//
tr->teid = far0->forward.outer_header_creation.teid;
}
}
if
(
PREDICT_TRUE
(
next0
==
UPF_ENCAP_NEXT_DROP
))
if
(
PREDICT_TRUE
(
next0
==
UPF_ENCAP_NEXT_DROP
))
{
{
if
(
ip4_0
)
if
(
ip4_0
)
{
{
struct
in_addr
addrDst
;
//
struct in_addr addrDst;
addrDst
.
s_addr
=
ip4_0
->
dst_address
.
as_u32
;
//
addrDst.s_addr = ip4_0->dst_address.as_u32;
clib_upf_debug
(
um
->
log_fd
,
"dst ueip:%s is drop"
,
inet_ntoa
(
addrDst
));
//
clib_upf_debug(um->log_fd,"dst ueip:%s is drop",inet_ntoa(addrDst));
}
}
//clib_upf_debug(um->log_fd,"dst ueip is drop");
//clib_upf_debug(um->log_fd,"dst ueip is drop");
...
...
src/vppe/src/vlib/cli.c
100644 → 100755
View file @
d31c5ab9
File mode changed from 100644 to 100755
src/vppe/src/vlib/main.c
View file @
d31c5ab9
...
@@ -46,6 +46,10 @@
...
@@ -46,6 +46,10 @@
#include <vlib/unix/unix.h>
#include <vlib/unix/unix.h>
#include <vlib/unix/cj.h>
#include <vlib/unix/cj.h>
extern
upf_if_info_t
*
if_info
;
CJ_GLOBAL_LOG_PROTOTYPE
;
CJ_GLOBAL_LOG_PROTOTYPE
;
/* Actually allocate a few extra slots of vector data to support
/* Actually allocate a few extra slots of vector data to support
...
@@ -1753,6 +1757,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
...
@@ -1753,6 +1757,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
/* Start all processes. */
/* Start all processes. */
if
(
is_main
)
if
(
is_main
)
{
{
uword
i
;
uword
i
;
/*
/*
...
...
src/vppe/src/vlib/main.h
View file @
d31c5ab9
...
@@ -90,6 +90,9 @@ typedef struct gtpu4_header_dl_t{
...
@@ -90,6 +90,9 @@ typedef struct gtpu4_header_dl_t{
u16
cur_ext_num
;
u16
cur_ext_num
;
gtpu4_ext_header_dl_t
*
ext_dl
;
gtpu4_ext_header_dl_t
*
ext_dl
;
u32
sess_idx
;
u32
pdr_idx
;
u32
far_id
;
u32
dl_teid
;
u32
dl_teid
;
u32
gnb_ip
;
u32
gnb_ip
;
u16
port
;
//gtpu tunnel port
u16
port
;
//gtpu tunnel port
...
@@ -104,6 +107,44 @@ typedef struct bupt_ueip_dl_gtpu4_header_t
...
@@ -104,6 +107,44 @@ typedef struct bupt_ueip_dl_gtpu4_header_t
extern
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
;
extern
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
;
typedef
struct
upf_if_n3_info
{
//* Required for pool_get_aligned */
CLIB_CACHE_LINE_ALIGN_MARK
(
cacheline0
);
u8
*
name
;
u8
*
ipaddr
;
u8
netmask
;
u8
*
gateway
;
u8
*
gtpu_tunnel
;
}
upf_if_n3_info_t
;
typedef
struct
upf_if_n6_info
{
//* Required for pool_get_aligned */
CLIB_CACHE_LINE_ALIGN_MARK
(
cacheline0
);
u8
*
name
;
u8
*
ipaddr
;
u8
netmask
;
u8
*
gateway
;
u8
*
ip_route
;
}
upf_if_n6_info_t
;
typedef
struct
upf_if_info
{
//* Required for pool_get_aligned */
CLIB_CACHE_LINE_ALIGN_MARK
(
cacheline0
);
upf_if_n3_info_t
if_n3
;
upf_if_n6_info_t
if_n6
;
}
upf_if_info_t
;
extern
upf_if_info_t
*
if_info
;
typedef
struct
typedef
struct
{
{
/* Trace RX pkts */
/* Trace RX pkts */
...
...
src/vppe/src/vlib/unix/main.c
View file @
d31c5ab9
...
@@ -290,6 +290,7 @@ static uword
...
@@ -290,6 +290,7 @@ static uword
startup_config_process
(
vlib_main_t
*
vm
,
startup_config_process
(
vlib_main_t
*
vm
,
vlib_node_runtime_t
*
rt
,
vlib_frame_t
*
f
)
vlib_node_runtime_t
*
rt
,
vlib_frame_t
*
f
)
{
{
unix_main_t
*
um
=
&
unix_main
;
unix_main_t
*
um
=
&
unix_main
;
u8
*
buf
=
0
;
u8
*
buf
=
0
;
uword
l
,
n
=
1
;
uword
l
,
n
=
1
;
...
@@ -363,6 +364,7 @@ startup_config_process (vlib_main_t * vm,
...
@@ -363,6 +364,7 @@ startup_config_process (vlib_main_t * vm,
vec_free
(
lv
);
vec_free
(
lv
);
}
}
if
(
vec_len
(
buf
))
if
(
vec_len
(
buf
))
{
{
unformat_init_vector
(
&
sub_input
,
buf
);
unformat_init_vector
(
&
sub_input
,
buf
);
...
@@ -372,6 +374,45 @@ startup_config_process (vlib_main_t * vm,
...
@@ -372,6 +374,45 @@ startup_config_process (vlib_main_t * vm,
}
}
close
(
fd
);
close
(
fd
);
}
}
else
{
//add it to inif config in 20210311
{
#define BUF_LEN 1024
#define IF_UP_IPADDR "set interface state %s up\nset interface ip address %s %s/%d\n\n"
u8
*
buf
=
NULL
;
char
cmd
[
BUF_LEN
]
=
{
0
};
char
if_cmd
[
BUF_LEN
]
=
{
0
};
strcat
(
if_cmd
,
IF_UP_IPADDR
);
strcat
(
if_cmd
,
IF_UP_IPADDR
);
strcat
(
if_cmd
,
"ip route add 0.0.0.0/0 via %s %s
\n\n
"
);
vec_resize
(
buf
,
BUF_LEN
);
snprintf
(
cmd
,
BUF_LEN
,
if_cmd
,
if_info
->
if_n3
.
name
,
if_info
->
if_n3
.
name
,
if_info
->
if_n3
.
ipaddr
,
if_info
->
if_n3
.
netmask
,
if_info
->
if_n6
.
name
,
if_info
->
if_n6
.
name
,
if_info
->
if_n6
.
ipaddr
,
if_info
->
if_n6
.
netmask
,
if_info
->
if_n6
.
name
,
if_info
->
if_n6
.
gateway
);
vec_copy
(
buf
,
cmd
);
clib_upf_debug
(
um
->
log_fd
,
"
\n\n
***** Startup Config *****
\n\n
%s
\n
***** End Startup Config *****
\n\n
"
,
cmd
);
if
(
vec_len
(
buf
))
{
unformat_input_t
sub_input
;
unformat_init_vector
(
&
sub_input
,
buf
);
vlib_cli_input
(
vm
,
&
sub_input
,
0
,
0
);
/* frees buf for us */
unformat_free
(
&
sub_input
);
}
}
}
return
0
;
return
0
;
}
}
...
...
src/vppe/src/vnet/ip/ip4_forward.c
View file @
d31c5ab9
...
@@ -2704,7 +2704,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
...
@@ -2704,7 +2704,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
gtpu0
->
ver_flags
=
gtpu_dl
->
ver_flags
;
gtpu0
->
ver_flags
=
gtpu_dl
->
ver_flags
;
gtpu0
->
type
=
gtpu_dl
->
type
;
gtpu0
->
type
=
gtpu_dl
->
type
;
gtpu0
->
teid
=
gtpu_dl
->
dl_teid
;
gtpu0
->
teid
=
gtpu_dl
->
dl_teid
;
//gtpu0->length
ip0
->
checksum
=
ip4_header_checksum
(
ip0
);
ip0
->
checksum
=
ip4_header_checksum
(
ip0
);
}
}
...
@@ -2739,7 +2738,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
...
@@ -2739,7 +2738,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
clib_memcpy_fast
(
gtpu4_ext_body
+
pos
+
1
,
&
gtpu_dl
->
ext_dl
->
pad
,
sizeof
(
gtpu_dl
->
ext_dl
->
pad
));
clib_memcpy_fast
(
gtpu4_ext_body
+
pos
+
1
,
&
gtpu_dl
->
ext_dl
->
pad
,
sizeof
(
gtpu_dl
->
ext_dl
->
pad
));
clib_memcpy_fast
(
gtpu4_ext_body
+
pos
+
3
,
&
gtpu_dl
->
ext_dl
->
type
,
sizeof
(
gtpu_dl
->
ext_dl
->
type
));
clib_memcpy_fast
(
gtpu4_ext_body
+
pos
+
3
,
&
gtpu_dl
->
ext_dl
->
type
,
sizeof
(
gtpu_dl
->
ext_dl
->
type
));
}
}
new_gtpu_header_len
+=
ext_all_len
;
new_gtpu_header_len
+=
ext_all_len
;
}
}
...
...
src/vppe/src/vpp/vnet/main.c
View file @
d31c5ab9
...
@@ -101,6 +101,7 @@ char *vlib_default_runtime_dir = "vpp";
...
@@ -101,6 +101,7 @@ char *vlib_default_runtime_dir = "vpp";
//add-it in 20200628
//add-it in 20200628
u8
is_upf
=
1
;
u8
is_upf
=
1
;
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
=
NULL
;
bupt_ueip_dl_gtpu4_header_t
*
bupt_ueip_dl_gtpu4_header
=
NULL
;
upf_if_info_t
*
if_info
=
NULL
;
int
int
main
(
int
argc
,
char
*
argv
[])
main
(
int
argc
,
char
*
argv
[])
...
...
src/vppe/startup_debug.conf
View file @
d31c5ab9
...
@@ -5,7 +5,8 @@ unix {
...
@@ -5,7 +5,8 @@ unix {
interactive
interactive
gid
vpp
gid
vpp
cli
-
listen
/
run
/
vpp
/
cli
.
sock
cli
-
listen
/
run
/
vpp
/
cli
.
sock
exec
./
config_system
.
sh
#exec ./config_system.sh
logsize
100
logsize
100
}
}
...
@@ -31,9 +32,8 @@ statseg {
...
@@ -31,9 +32,8 @@ statseg {
}
}
cpu
{
cpu
{
main
-
core
6
main
-
core
13
corelist
-
workers
14
corelist
-
workers
7
scheduler
-
policy
fifo
scheduler
-
policy
fifo
scheduler
-
priority
50
scheduler
-
priority
50
...
@@ -47,17 +47,25 @@ dpdk {
...
@@ -47,17 +47,25 @@ dpdk {
dev
default
{
dev
default
{
num
-
rx
-
queues
1
num
-
rx
-
queues
1
}
}
dev
0000
:
0
6
:
00
.
1
dev
0000
:
0
2
:
04
.
0
{
{
name
if_n3
name
if_n3
num
-
rx
-
queues
2
num
-
rx
-
queues
2
num
-
tx
-
queues
2
num
-
tx
-
queues
1
ipaddr
192
.
168
.
10
.
40
netmask
24
gateway
192
.
168
.
10
.
100
}
}
dev
0000
:
0
6
:
00
.
0
dev
0000
:
0
2
:
05
.
0
{
{
name
if_n6
name
if_n6
num
-
rx
-
queues
1
num
-
rx
-
queues
1
ipaddr
192
.
168
.
20
.
10
netmask
24
gateway
192
.
168
.
20
.
11
}
}
uio
-
driver
vfio
-
pci
uio
-
driver
vfio
-
pci
...
@@ -65,10 +73,13 @@ dpdk {
...
@@ -65,10 +73,13 @@ dpdk {
socket
-
mem
2048
,
2048
socket
-
mem
2048
,
2048
no
-
tx
-
checksum
-
offload
no
-
tx
-
checksum
-
offload
}
}
heapsize
2
G
heapsize
2
G
plugins
{
plugins
{
path
./
build
-
root
/
install
-
vpp_debug
-
native
/
vpp
/
lib
/
vpp_plugins
path
./
build
-
root
/
install
-
vpp_debug
-
native
/
vpp
/
lib
/
vpp_plugins
plugin
default
{
enable
}
plugin
default
{
enable
}
plugin
dpdk_plugin
.
so
{
enable
}
plugin
dpdk_plugin
.
so
{
enable
}
plugin
gtpu_plugin
.
so
{
enable
}
plugin
gtpu_plugin
.
so
{
enable
}
plugin
upf_plugin
.
so
{
enable
}
plugin
upf_plugin
.
so
{
enable
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment