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
wangjie
OpenXG-RAN
Commits
ba776254
Commit
ba776254
authored
Jun 21, 2016
by
Sandeep Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
device specific eth headers - needs testing
parent
ad9411fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
+9
-10
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
+2
-1
targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
+3
-0
No files found.
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
View file @
ba776254
...
...
@@ -59,7 +59,6 @@ struct sockaddr_ll dest_addr[MAX_INST];
struct
sockaddr_ll
local_addr
[
MAX_INST
];
int
addr_len
[
MAX_INST
];
struct
ifreq
if_index
[
MAX_INST
];
struct
ether_header
eh
;
int
eth_socket_init_raw
(
openair0_device
*
device
)
{
...
...
@@ -121,11 +120,11 @@ int eth_socket_init_raw(openair0_device *device) {
}
/* Construct the Ethernet header */
ether_aton_r
(
local_mac
,
(
struct
ether_addr
*
)(
&
(
eh
.
ether_shost
)));
ether_aton_r
(
remote_mac
,
(
struct
ether_addr
*
)(
&
(
eh
.
ether_dhost
)));
eh
.
ether_type
=
htons
((
short
)
device
->
openair0_cfg
->
my_port
);
ether_aton_r
(
local_mac
,
(
struct
ether_addr
*
)(
&
(
e
th
->
e
h
.
ether_shost
)));
ether_aton_r
(
remote_mac
,
(
struct
ether_addr
*
)(
&
(
e
th
->
e
h
.
ether_dhost
)));
e
th
->
e
h
.
ether_type
=
htons
((
short
)
device
->
openair0_cfg
->
my_port
);
printf
(
"[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x
\n
"
,((
device
->
host_type
==
BBU_HOST
)
?
"BBU"
:
"RRH"
),
Mod_id
,
e
h
.
ether_shost
[
0
],
eh
.
ether_shost
[
1
],
eh
.
ether_shost
[
2
],
eh
.
ether_shost
[
3
],
eh
.
ether_shost
[
4
],
eh
.
ether_shost
[
5
]);
printf
(
"[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x
\n
"
,((
device
->
host_type
==
BBU_HOST
)
?
"BBU"
:
"RRH"
),
Mod_id
,
e
th
->
eh
.
ether_shost
[
0
],
eth
->
eh
.
ether_shost
[
1
],
eth
->
eh
.
ether_shost
[
2
],
eth
->
eh
.
ether_shost
[
3
],
eth
->
eh
.
ether_shost
[
4
],
eth
->
eh
.
ether_shost
[
5
]);
return
0
;
}
...
...
@@ -153,7 +152,7 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
openair0_timestamp
temp1
=
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
));
bytes_sent
=
0
;
memcpy
(
buff2
,(
void
*
)
&
eh
,
MAC_HEADER_SIZE_BYTES
);
memcpy
(
buff2
,(
void
*
)
&
e
th
->
e
h
,
MAC_HEADER_SIZE_BYTES
);
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
))
=
1
+
(
i
<<
1
);
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
))
=
timestamp
;
...
...
@@ -220,7 +219,7 @@ int trx_eth_write_raw_IF4(openair0_device *device, openair0_timestamp timestamp,
eth
->
tx_nsamps
=
nblocks
;
memcpy
(
buff
[
0
],
(
void
*
)
&
eh
,
MAC_HEADER_SIZE_BYTES
);
memcpy
(
buff
[
0
],
(
void
*
)
&
e
th
->
e
h
,
MAC_HEADER_SIZE_BYTES
);
bytes_sent
=
send
(
eth
->
sockfd
[
Mod_id
],
buff
[
0
],
...
...
@@ -365,7 +364,7 @@ int eth_set_dev_conf_raw(openair0_device *device) {
msg_len
=
MAC_HEADER_SIZE_BYTES
+
sizeof
(
openair0_config_t
);
memcpy
(
msg
,(
void
*
)
&
eh
,
MAC_HEADER_SIZE_BYTES
);
memcpy
(
msg
,(
void
*
)
&
e
th
->
e
h
,
MAC_HEADER_SIZE_BYTES
);
memcpy
((
msg
+
MAC_HEADER_SIZE_BYTES
),(
void
*
)
device
->
openair0_cfg
,
sizeof
(
openair0_config_t
));
if
(
send
(
eth
->
sockfd
[
Mod_id
],
...
...
@@ -401,10 +400,10 @@ int eth_get_dev_conf_raw(openair0_device *device) {
}
/* RRH stores the remote MAC address */
memcpy
(
eh
.
ether_dhost
,(
msg
+
ETH_ALEN
),
ETH_ALEN
);
memcpy
(
e
th
->
e
h
.
ether_dhost
,(
msg
+
ETH_ALEN
),
ETH_ALEN
);
//memcpy((void*)&device->openair0_cfg,(msg + MAC_HEADER_SIZE_BYTES), sizeof(openair0_config_t));
device
->
openair0_cfg
=
(
openair0_config_t
*
)(
msg
+
MAC_HEADER_SIZE_BYTES
);
printf
(
"[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x
\n
"
,((
device
->
host_type
==
BBU_HOST
)
?
"BBU"
:
"RRH"
),
Mod_id
,
e
h
.
ether_shost
[
0
],
eh
.
ether_shost
[
1
],
eh
.
ether_shost
[
2
],
eh
.
ether_shost
[
3
],
eh
.
ether_shost
[
4
],
eh
.
ether_shost
[
5
],
eh
.
ether_dhost
[
0
],
eh
.
ether_dhost
[
1
],
eh
.
ether_dhost
[
2
],
eh
.
ether_dhost
[
3
],
eh
.
ether_dhost
[
4
],
eh
.
ether_dhost
[
5
]);
printf
(
"[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x
\n
"
,((
device
->
host_type
==
BBU_HOST
)
?
"BBU"
:
"RRH"
),
Mod_id
,
e
th
->
eh
.
ether_shost
[
0
],
eth
->
eh
.
ether_shost
[
1
],
eth
->
eh
.
ether_shost
[
2
],
eth
->
eh
.
ether_shost
[
3
],
eth
->
eh
.
ether_shost
[
4
],
eth
->
eh
.
ether_shost
[
5
],
eth
->
eh
.
ether_dhost
[
0
],
eth
->
eh
.
ether_dhost
[
1
],
eth
->
eh
.
ether_dhost
[
2
],
eth
->
eh
.
ether_dhost
[
3
],
eth
->
eh
.
ether_dhost
[
4
],
eth
->
eh
.
ether_dhost
[
5
]);
return
0
;
}
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
View file @
ba776254
...
...
@@ -56,7 +56,6 @@
#define RX_FLAG 0
#include "if_defs.h"
#define MAC_HEADER_SIZE_BYTES (sizeof(struct ether_header))
#define APP_HEADER_SIZE_BYTES (sizeof(int32_t) + sizeof(openair0_timestamp))
/*!\brief opaque ethernet data structure */
...
...
@@ -114,6 +113,8 @@ typedef struct {
/*!\brief number of packets received */
uint64_t
rx_count
;
struct
ether_header
eh
;
}
eth_state_t
;
...
...
targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
View file @
ba776254
...
...
@@ -38,6 +38,8 @@
* \warning
*/
#include <netinet/ether.h>
// ETH transport preference modes
#define ETH_UDP_MODE 0
#define ETH_RAW_MODE 1
...
...
@@ -45,6 +47,7 @@
#define ETH_RAW_IF4_MODE 3
// Time domain RRH packet sizes
#define MAC_HEADER_SIZE_BYTES (sizeof(struct ether_header))
#define MAX_PACKET_SEQ_NUM(spp,spf) (spf/spp)
#define PAYLOAD_SIZE_BYTES(nsamps) (nsamps<<2)
#define UDP_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps))
...
...
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