@@ -20,25 +20,25 @@ pub use control::*;
20
20
/// The frame filtering that the MAC should apply to
21
21
/// received Ethernet frames.
22
22
#[ derive( Debug , Clone ) ]
23
- pub enum FrameFilteringMode {
23
+ pub enum Filter {
24
24
/// No frame filtering on any frames.
25
25
Promiscuous ,
26
26
/// Perform frame filtering based on the provided
27
27
/// configuration.
28
- Filter ( FrameFiltering ) ,
28
+ Filter ( FilterConfig ) ,
29
29
}
30
30
31
- impl Default for FrameFilteringMode {
31
+ impl Default for Filter {
32
32
fn default ( ) -> Self {
33
33
Self :: Promiscuous
34
34
}
35
35
}
36
36
37
- impl FrameFilteringMode {
37
+ impl Filter {
38
38
pub ( crate ) fn configure ( & self , eth_mac : & ETHERNET_MAC ) {
39
39
match self {
40
- FrameFilteringMode :: Promiscuous => eth_mac. macffr . write ( |w| w. pm ( ) . set_bit ( ) ) ,
41
- FrameFilteringMode :: Filter ( config) => config. configure ( eth_mac) ,
40
+ Filter :: Promiscuous => eth_mac. macffr . write ( |w| w. pm ( ) . set_bit ( ) ) ,
41
+ Filter :: Filter ( config) => config. configure ( eth_mac) ,
42
42
}
43
43
}
44
44
}
@@ -49,7 +49,7 @@ impl FrameFilteringMode {
49
49
/// The total amount of [`MacAddressFilter`]s in this configuration object may
50
50
/// be at most 3.
51
51
#[ derive( Debug , Clone ) ]
52
- pub struct FrameFiltering {
52
+ pub struct FilterConfig {
53
53
/// The MAC address of this station. This address is always
54
54
/// used for Destination Address filtering.
55
55
pub base_address : Mac ,
@@ -59,18 +59,18 @@ pub struct FrameFiltering {
59
59
60
60
/// Frame filtering applied to frames based on
61
61
/// their destination address.
62
- pub destination_address_filter : DestinationAddressFiltering ,
62
+ pub destination_address_filter : DaFilter ,
63
63
64
64
/// Frame filtering applied to frames based on
65
65
/// their source address.
66
- pub source_address_filter : SourceAddressFiltering ,
66
+ pub source_address_filter : SaFilter ,
67
67
68
68
/// Frame filtering applied to frames based on
69
69
/// whether they have a multicast address or not.
70
- pub multicast_address_filter : MulticastAddressFiltering ,
70
+ pub multicast_address_filter : MulticastAddressFilter ,
71
71
72
72
/// Control frame filtering mode,
73
- pub control_filter : ControlFrameFiltering ,
73
+ pub control_filter : ControlFrameFilter ,
74
74
75
75
/// Hash table configuration.
76
76
pub hash_table_value : HashTableValue ,
@@ -89,7 +89,7 @@ pub struct FrameFiltering {
89
89
pub receive_all : bool ,
90
90
}
91
91
92
- impl FrameFiltering {
92
+ impl FilterConfig {
93
93
/// Create a new basic [`FrameFiltering`] that:
94
94
/// * Does not filter out frames destined for `station_addr` or an address
95
95
/// contained in `extra_address`.
@@ -115,24 +115,24 @@ impl FrameFiltering {
115
115
}
116
116
}
117
117
118
- FrameFiltering {
118
+ FilterConfig {
119
119
base_address : station_addr,
120
120
address_filters,
121
- destination_address_filter : DestinationAddressFiltering {
122
- perfect_filtering : PerfectDestinationAddressFilteringMode :: Normal ,
121
+ destination_address_filter : DaFilter {
122
+ perfect_filtering : PerfectDaFilterMode :: Normal ,
123
123
hash_table_filtering : false ,
124
124
} ,
125
- source_address_filter : SourceAddressFiltering :: Ignore ,
126
- multicast_address_filter : MulticastAddressFiltering :: PassAll ,
127
- control_filter : ControlFrameFiltering :: BlockAll ,
125
+ source_address_filter : SaFilter :: Ignore ,
126
+ multicast_address_filter : MulticastAddressFilter :: PassAll ,
127
+ control_filter : ControlFrameFilter :: BlockAll ,
128
128
hash_table_value : HashTableValue :: new ( ) ,
129
129
filter_broadcast : false ,
130
130
receive_all : false ,
131
131
}
132
132
}
133
133
134
134
fn configure ( & self , eth_mac : & ETHERNET_MAC ) {
135
- let FrameFiltering {
135
+ let FilterConfig {
136
136
base_address,
137
137
address_filters,
138
138
destination_address_filter,
@@ -152,28 +152,28 @@ impl FrameFiltering {
152
152
. write ( |w| w. maca0l ( ) . bits ( base_address. low ( ) ) ) ;
153
153
154
154
let daif = match & destination_address_filter. perfect_filtering {
155
- PerfectDestinationAddressFilteringMode :: Normal => false ,
156
- PerfectDestinationAddressFilteringMode :: Inverse => true ,
155
+ PerfectDaFilterMode :: Normal => false ,
156
+ PerfectDaFilterMode :: Inverse => true ,
157
157
} ;
158
158
let hu = destination_address_filter. hash_table_filtering ;
159
159
160
160
let ( saf, saif) = match & source_address_filter {
161
- SourceAddressFiltering :: Ignore => ( false , false ) ,
162
- SourceAddressFiltering :: Normal => ( true , false ) ,
163
- SourceAddressFiltering :: Inverse => ( true , true ) ,
161
+ SaFilter :: Ignore => ( false , false ) ,
162
+ SaFilter :: Normal => ( true , false ) ,
163
+ SaFilter :: Inverse => ( true , true ) ,
164
164
} ;
165
165
166
166
let ( pam, hm) = match & multicast_address_filter {
167
- MulticastAddressFiltering :: PassAll => ( true , false ) ,
168
- MulticastAddressFiltering :: DestinationAddressHash => ( false , true ) ,
169
- MulticastAddressFiltering :: DestinationAddress => ( false , false ) ,
167
+ MulticastAddressFilter :: PassAll => ( true , false ) ,
168
+ MulticastAddressFilter :: DestinationAddressHash => ( false , true ) ,
169
+ MulticastAddressFilter :: DestinationAddress => ( false , false ) ,
170
170
} ;
171
171
172
172
let pcf = match & control_filter {
173
- ControlFrameFiltering :: BlockAll => 0b00 ,
174
- ControlFrameFiltering :: NoPause => 0b01 ,
175
- ControlFrameFiltering :: AllowAll => 0b10 ,
176
- ControlFrameFiltering :: AddressFilter => 0b11 ,
173
+ ControlFrameFilter :: BlockAll => 0b00 ,
174
+ ControlFrameFilter :: NoPause => 0b01 ,
175
+ ControlFrameFilter :: AllowAll => 0b10 ,
176
+ ControlFrameFilter :: AddressFilter => 0b11 ,
177
177
} ;
178
178
179
179
macro_rules! next_addr_reg {
0 commit comments