Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
lizhongxiao
OpenXG-RAN
Commits
415fcc68
Commit
415fcc68
authored
Oct 11, 2018
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable MAC for OIP interfaces
parent
ea717fc0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
12 deletions
+55
-12
openair2/NETWORK_DRIVER/UE_IP/common.c
openair2/NETWORK_DRIVER/UE_IP/common.c
+14
-2
openair2/NETWORK_DRIVER/UE_IP/device.c
openair2/NETWORK_DRIVER/UE_IP/device.c
+40
-10
openair2/NETWORK_DRIVER/UE_IP/local.h
openair2/NETWORK_DRIVER/UE_IP/local.h
+1
-0
No files found.
openair2/NETWORK_DRIVER/UE_IP/common.c
View file @
415fcc68
...
@@ -279,6 +279,7 @@ ue_ip_common_ip2wireless(
...
@@ -279,6 +279,7 @@ ue_ip_common_ip2wireless(
if
(
skb_pP
->
mark
)
{
if
(
skb_pP
->
mark
)
{
pdcph
.
rb_id
=
skb_pP
->
mark
;
pdcph
.
rb_id
=
skb_pP
->
mark
;
printk
(
"[UE_IP_DRV_PROSE] skb_pP->mark %d
\n
"
,
skb_pP
->
mark
);
}
else
{
}
else
{
pdcph
.
rb_id
=
UE_IP_DEFAULT_RAB_ID
;
pdcph
.
rb_id
=
UE_IP_DEFAULT_RAB_ID
;
}
}
...
@@ -305,11 +306,22 @@ ue_ip_common_ip2wireless(
...
@@ -305,11 +306,22 @@ ue_ip_common_ip2wireless(
printk
(
"[UE_IP_DRV][%s] Dest %d.%d.%d.%d
\n
"
,
__FUNCTION__
,
dst_addr
[
0
],
dst_addr
[
1
],
dst_addr
[
2
],
dst_addr
[
3
]);
printk
(
"[UE_IP_DRV][%s] Dest %d.%d.%d.%d
\n
"
,
__FUNCTION__
,
dst_addr
[
0
],
dst_addr
[
1
],
dst_addr
[
2
],
dst_addr
[
3
]);
}
}
//get source/destination MAC addresses
struct
ethhdr
*
mh
=
eth_hdr
(
skb_pP
);
#ifdef OAI_DRV_DEBUG_SEND
printk
(
"[UE_IP_DRV] source MAC %x.%x.%x.%x.%x.%x
\n
"
,
mh
->
h_source
[
0
],
mh
->
h_source
[
1
],
mh
->
h_source
[
2
],
mh
->
h_source
[
3
],
mh
->
h_source
[
4
],
mh
->
h_source
[
5
]);
printk
(
"[UE_IP_DRV] dest MAC %x.%x.%x.%x.%x.%x
\n
"
,
mh
->
h_dest
[
0
],
mh
->
h_dest
[
1
],
mh
->
h_dest
[
2
],
mh
->
h_dest
[
3
],
mh
->
h_dest
[
4
],
mh
->
h_dest
[
5
]);
#endif
//assign source/destL2Id from the 4 lower bytes of MAC addresses
pdcph
.
sourceL2Id
=
((
uint8_t
)
mh
->
h_source
[
5
]
&
0x000000FF
)
|
(((
uint8_t
)
mh
->
h_source
[
4
]
<<
8
)
&
0x0000FF00
)
|
(((
uint8_t
)
mh
->
h_source
[
3
]
<<
16
)
&
0x00FF0000
)
|
(((
uint8_t
)
mh
->
h_source
[
2
]
<<
24
)
&
0xFF000000
);
pdcph
.
destinationL2Id
=
((
uint8_t
)
mh
->
h_dest
[
5
]
&
0x000000FF
)
|
(((
uint8_t
)
mh
->
h_dest
[
4
]
<<
8
)
&
0x0000FF00
)
|
(((
uint8_t
)
mh
->
h_dest
[
3
]
<<
16
)
&
0x00FF0000
)
|
(((
uint8_t
)
mh
->
h_dest
[
2
]
<<
24
)
&
0xFF000000
);
//get Ipv4 address and pass to PCDP header
//get Ipv4 address and pass to PCDP header
//pdcph.sourceL2Id = ntohl( ((struct iphdr *)&skb_pP->data[hard_header_len])->saddr) & 0x00FFFFFF;
//pdcph.destinationL2Id = ntohl( ((struct iphdr *)&skb_pP->data[hard_header_len])->daddr) & 0x00FFFFFF;
printk
(
"[UE_IP_DRV] source Id: 0x%08x
\n
"
,
pdcph
.
sourceL2Id
);
printk
(
"[UE_IP_DRV] source Id: 0x%08x
\n
"
,
pdcph
.
sourceL2Id
);
printk
(
"[UE_IP_DRV] destinationL2Id Id: 0x%08x
\n
"
,
pdcph
.
destinationL2Id
);
printk
(
"[UE_IP_DRV] destinationL2Id Id: 0x%08x
\n
"
,
pdcph
.
destinationL2Id
);
pdcph
.
sourceL2Id
=
ntohl
(
((
struct
iphdr
*
)
&
skb_pP
->
data
[
hard_header_len
])
->
saddr
)
&
0x00FFFFFF
;
pdcph
.
destinationL2Id
=
ntohl
(
((
struct
iphdr
*
)
&
skb_pP
->
data
[
hard_header_len
])
->
daddr
)
&
0x00FFFFFF
;
break
;
break
;
default:
default:
...
...
openair2/NETWORK_DRIVER/UE_IP/device.c
View file @
415fcc68
...
@@ -99,21 +99,44 @@ void *ue_ip_interrupt(void)
...
@@ -99,21 +99,44 @@ void *ue_ip_interrupt(void)
}
}
#endif //NETLINK
#endif //NETLINK
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
void
ue_ip_timer
(
struct
timer_list
*
t
)
#else
void
ue_ip_timer
(
unsigned
long
dataP
)
void
ue_ip_timer
(
unsigned
long
dataP
)
#endif
{
{
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
ue_ip_priv_t
*
priv_p
=
(
ue_ip_priv_t
*
)
dataP
;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
ue_ip_priv_t
*
priv_p
=
from_timer
(
priv_p
,
t
,
timer
);
#else
ue_ip_priv_t
*
priv_p
=
(
ue_ip_priv_t
*
)
dataP
;
#endif
spin_lock
(
&
priv_p
->
lock
);
spin_lock
(
&
priv_p
->
lock
);
(
priv_p
->
timer
).
function
=
ue_ip_timer
;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
(
priv_p
->
timer
).
expires
=
jiffies
+
UE_IP_TIMER_TICK
;
mod_timer
(
&
priv_p
->
timer
,
jiffies
+
UE_IP_TIMER_TICK
);
(
priv_p
->
timer
).
data
=
dataP
;
#else
(
priv_p
->
timer
).
function
=
ue_ip_timer
;
(
priv_p
->
timer
).
expires
=
jiffies
+
UE_IP_TIMER_TICK
;
(
priv_p
->
timer
).
data
=
dataP
;
add_timer
(
&
priv_p
->
timer
);
add_timer
(
&
priv_p
->
timer
);
#endif
spin_unlock
(
&
priv_p
->
lock
);
spin_unlock
(
&
priv_p
->
lock
);
return
;
return
;
// add_timer(&gpriv->timer);
// add_timer(&gpriv->timer);
// spin_unlock(&gpriv->lock);
// spin_unlock(&gpriv->lock);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Called by ifconfig when the device is activated by ifconfig
// Called by ifconfig when the device is activated by ifconfig
int
ue_ip_open
(
struct
net_device
*
dev_pP
)
int
ue_ip_open
(
struct
net_device
*
dev_pP
)
...
@@ -137,15 +160,21 @@ int ue_ip_open(struct net_device *dev_pP)
...
@@ -137,15 +160,21 @@ int ue_ip_open(struct net_device *dev_pP)
netif_wake_queue
(
dev_pP
);
netif_wake_queue
(
dev_pP
);
}
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
timer_setup
(
&
(
priv_p
->
timer
),
ue_ip_timer
,
0
);
(
priv_p
->
timer
).
expires
=
jiffies
+
UE_IP_TIMER_TICK
;
#else
init_timer
(
&
priv_p
->
timer
);
init_timer
(
&
priv_p
->
timer
);
(
priv_p
->
timer
).
expires
=
jiffies
+
UE_IP_TIMER_TICK
;
(
priv_p
->
timer
).
expires
=
jiffies
+
UE_IP_TIMER_TICK
;
(
priv_p
->
timer
).
data
=
(
unsigned
long
)
priv_p
;
(
priv_p
->
timer
).
data
=
(
unsigned
long
)
priv_p
;
(
priv_p
->
timer
).
function
=
ue_ip_timer
;
(
priv_p
->
timer
).
function
=
ue_ip_timer
;
#endif
//add_timer(&priv_p->timer);
//add_timer(&priv_p->timer);
printk
(
"[UE_IP_DRV][%s] name = %s
\n
"
,
__FUNCTION__
,
dev_pP
->
name
);
printk
(
"[UE_IP_DRV][%s] name = %s
\n
"
,
__FUNCTION__
,
dev_pP
->
name
);
return
0
;
return
0
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Called by ifconfig when the device is desactivated
// Called by ifconfig when the device is desactivated
...
@@ -236,7 +265,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
...
@@ -236,7 +265,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
// End debug information
// End debug information
netif_stop_queue
(
dev_pP
);
netif_stop_queue
(
dev_pP
);
#if
LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
#if
(LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update
(
dev_pP
);
netif_trans_update
(
dev_pP
);
#else
#else
dev_pP
->
trans_start
=
jiffies
;
dev_pP
->
trans_start
=
jiffies
;
...
@@ -275,9 +304,9 @@ struct net_device_stats *ue_ip_get_stats(struct net_device *dev_pP)
...
@@ -275,9 +304,9 @@ struct net_device_stats *ue_ip_get_stats(struct net_device *dev_pP)
int
ue_ip_set_mac_address
(
struct
net_device
*
dev_pP
,
void
*
mac_pP
)
int
ue_ip_set_mac_address
(
struct
net_device
*
dev_pP
,
void
*
mac_pP
)
{
{
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
struct sockaddr *addr = mac_pP;
struct
sockaddr
*
addr
=
mac_pP
;
printk
(
"[UE_IP_DRV][%s] CHANGE MAC ADDRESS UNSUPPORTED
\n
"
,
__FUNCTION__
);
printk
(
"[UE_IP_DRV][%s] CHANGE MAC ADDRESS UNSUPPORTED
\n
"
,
__FUNCTION__
);
//
memcpy(dev_pP->dev_addr, addr->sa_data, dev_pP->addr_len);
memcpy
(
dev_pP
->
dev_addr
,
addr
->
sa_data
,
dev_pP
->
addr_len
);
return
0
;
return
0
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
...
@@ -312,7 +341,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
...
@@ -312,7 +341,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
printk
(
"[UE_IP_DRV][%s] begin
\n
"
,
__FUNCTION__
);
printk
(
"[UE_IP_DRV][%s] begin
\n
"
,
__FUNCTION__
);
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
(
priv_p
->
stats
).
tx_errors
++
;
(
priv_p
->
stats
).
tx_errors
++
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) ||
RHEL_RELEASE_CODE >= 1796
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) ||
(defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update
(
dev_pP
);
netif_trans_update
(
dev_pP
);
#else
#else
dev_pP
->
trans_start
=
jiffies
;
dev_pP
->
trans_start
=
jiffies
;
...
@@ -348,11 +377,13 @@ void ue_ip_init(struct net_device *dev_pP)
...
@@ -348,11 +377,13 @@ void ue_ip_init(struct net_device *dev_pP)
memset
(
priv_p
,
0
,
sizeof
(
ue_ip_priv_t
));
memset
(
priv_p
,
0
,
sizeof
(
ue_ip_priv_t
));
spin_lock_init
(
&
priv_p
->
lock
);
spin_lock_init
(
&
priv_p
->
lock
);
dev_pP
->
netdev_ops
=
&
ue_ip_netdev_ops
;
dev_pP
->
netdev_ops
=
&
ue_ip_netdev_ops
;
dev_pP
->
hard_header_len
=
0
;
/*
dev_pP->hard_header_len = 0;
dev_pP->addr_len = UE_IP_ADDR_LEN;
dev_pP->addr_len = UE_IP_ADDR_LEN;
dev_pP->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
dev_pP->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
dev_pP->tx_queue_len = UE_IP_TX_QUEUE_LEN;
dev_pP->tx_queue_len = UE_IP_TX_QUEUE_LEN;
dev_pP->mtu = UE_IP_MTU;
dev_pP->mtu = UE_IP_MTU;
*/
ether_setup
(
dev_pP
);
}
else
{
}
else
{
printk
(
"[UE_IP_DRV][%s] ERROR, Device is NULL!!
\n
"
,
__FUNCTION__
);
printk
(
"[UE_IP_DRV][%s] ERROR, Device is NULL!!
\n
"
,
__FUNCTION__
);
return
;
return
;
...
@@ -365,7 +396,6 @@ int init_module (void)
...
@@ -365,7 +396,6 @@ int init_module (void)
int
err
,
inst
;
int
err
,
inst
;
char
devicename
[
100
];
char
devicename
[
100
];
// Initialize parameters shared with RRC
// Initialize parameters shared with RRC
printk
(
"[UE_IP_DRV][%s] Starting OAI IP driver"
,
__FUNCTION__
);
printk
(
"[UE_IP_DRV][%s] Starting OAI IP driver"
,
__FUNCTION__
);
...
...
openair2/NETWORK_DRIVER/UE_IP/local.h
View file @
415fcc68
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#include "constant.h"
#include "constant.h"
#include "platform_types.h"
#include "platform_types.h"
#include "sap.h"
#include "sap.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
typedef
struct
ue_ip_priv_s
{
typedef
struct
ue_ip_priv_s
{
...
...
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