@@ -1319,6 +1319,11 @@ s! {
1319
1319
pub propagation: crate :: __u64,
1320
1320
pub userns_fd: crate :: __u64,
1321
1321
}
1322
+
1323
+ // is __be16 __bitwise __u16
1324
+ pub struct __c_anonymous___be16 {
1325
+ __priv: [ crate :: __u8; 2 ] ,
1326
+ }
1322
1327
}
1323
1328
1324
1329
cfg_if ! {
@@ -1784,6 +1789,16 @@ s_no_extra_traits! {
1784
1789
pub request: xsk_tx_metadata_request,
1785
1790
pub completion: xsk_tx_metadata_completion,
1786
1791
}
1792
+
1793
+ // linux/if_ether.h
1794
+
1795
+ #[ cfg( not( target_arch = "loongarch64" ) ) ]
1796
+ #[ repr( C , align( 1 ) ) ]
1797
+ pub struct ethhdr {
1798
+ pub h_dest: [ c_uchar; crate :: ETH_ALEN as usize ] ,
1799
+ pub h_source: [ c_uchar; crate :: ETH_ALEN as usize ] ,
1800
+ pub h_proto: __c_anonymous___be16,
1801
+ }
1787
1802
}
1788
1803
1789
1804
cfg_if ! {
@@ -2211,6 +2226,34 @@ cfg_if! {
2211
2226
. finish( )
2212
2227
}
2213
2228
}
2229
+
2230
+ #[ cfg( not( target_arch = "loongarch64" ) ) ]
2231
+ impl Eq for ethhdr { }
2232
+
2233
+ #[ cfg( not( target_arch = "loongarch64" ) ) ]
2234
+ impl PartialEq for ethhdr {
2235
+ fn eq( & self , other: & ethhdr) -> bool {
2236
+ self . h_dest
2237
+ . iter( )
2238
+ . zip( other. h_dest. iter( ) )
2239
+ . all( |( a, b) | a == b)
2240
+ && self
2241
+ . h_source
2242
+ . iter( )
2243
+ . zip( other. h_source. iter( ) )
2244
+ . all( |( a, b) | a == b)
2245
+ }
2246
+ }
2247
+
2248
+ #[ cfg( not( target_arch = "loongarch64" ) ) ]
2249
+ impl fmt:: Debug for ethhdr {
2250
+ fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
2251
+ f. debug_struct( "ethhdr" )
2252
+ . field( "h_dest" , & self . h_dest)
2253
+ . field( "h_source" , & self . h_source)
2254
+ . finish( )
2255
+ }
2256
+ }
2214
2257
}
2215
2258
}
2216
2259
0 commit comments