Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
33fcb1c0
Commit
33fcb1c0
authored
Feb 16, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pfilter: patch filter rules at run time for VLAN number
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
a444be3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
ep_pfilter.c
dev/ep_pfilter.c
+20
-2
Makefile
tools/Makefile
+1
-2
pfilter-builder.c
tools/pfilter-builder.c
+2
-2
No files found.
dev/ep_pfilter.c
View file @
33fcb1c0
...
...
@@ -43,7 +43,7 @@ void pfilter_init_default(void)
uint32_t
*
vend
=
_binary_rules_pfilter_bin_end
;
uint8_t
mac
[
6
];
char
buf
[
20
];
uint32_t
m
,
*
v
;
uint32_t
m
,
*
v
,
*
v_vlan
=
NULL
;
uint64_t
cmd_word
;
int
i
;
static
int
inited
;
...
...
@@ -91,9 +91,21 @@ void pfilter_init_default(void)
pfilter_verbose
(
"fixing MAC adress in rule: use %s
\n
"
,
format_mac
(
buf
,
mac
));
/* If this is the VLAN rule-set, patch the vlan number too */
for
(
v
=
vini
+
1
;
v
<
vend
;
v
+=
2
)
{
if
(((
*
v
>>
13
)
&
0xffff
)
==
0x0aaa
&&
((
*
v
>>
7
)
&
0x1f
)
==
7
)
{
pfilter_verbose
(
"fixing VLAN number in rule: use %i
\n
"
,
wrc_vlan_number
);
v_vlan
=
v
;
*
v
&=
~
(
0xffff
<<
13
);
*
v
|=
wrc_vlan_number
<<
13
;
}
}
EP
->
PFCR0
=
0
;
// disable pfilter
for
(
i
=
0
;
v
<
vend
;
v
+=
2
,
i
++
)
{
for
(
i
=
0
,
v
=
vini
+
1
;
v
<
vend
;
v
+=
2
,
i
++
)
{
uint32_t
cr0
,
cr1
;
cmd_word
=
v
[
0
]
|
((
uint64_t
)
v
[
1
]
<<
32
);
...
...
@@ -109,5 +121,11 @@ void pfilter_init_default(void)
EP
->
PFCR0
=
cr0
;
}
/* Restore the 0xaaa vlan number, so we can re-patch next time */
if
(
v_vlan
)
{
*
v_vlan
&=
~
(
0xffff
<<
13
);
*
v_vlan
|=
0x0aaa
<<
13
;
}
EP
->
PFCR0
=
EP_PFCR0_ENABLE
;
}
tools/Makefile
View file @
33fcb1c0
EB
?=
no
SDBFS
?=
no
CFLAGS
=
-Wall
-ggdb
-I
../include
\
-include
../include/generated/autoconf.h
CFLAGS
=
-Wall
-ggdb
-I
../include
LDFLAGS
=
-lutil
ALL
=
genraminit genramvhd genrammif wrpc-uart-sw
ALL
+=
wrpc-w1-read wrpc-w1-write
...
...
tools/pfilter-builder.c
View file @
33fcb1c0
...
...
@@ -461,8 +461,8 @@ void pfilter_init_vlan(char *fname)
pfilter_cmp
(
6
,
0x8100
,
0xffff
,
MOV
,
R_TMP
);
pfilter_logic2
(
R_DROP
,
R_TMP
,
NOT
,
R_ZERO
);
/* Compare with our vlan */
pfilter_cmp
(
7
,
CONFIG_VLAN_NR
,
0x0fff
,
MOV
,
FRAME_OUR_VLAN
);
/* Compare with our vlan
(fake number 0xaaa)
*/
pfilter_cmp
(
7
,
0x0aaa
,
0x0fff
,
MOV
,
FRAME_OUR_VLAN
);
/* Identify some Ethertypes used later. */
pfilter_cmp
(
8
,
0x88f7
,
0xffff
,
MOV
,
FRAME_TYPE_PTP2
);
...
...
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