108
108
#define PTP_MIN_LENGTH 63
109
109
110
110
#define PTP_ADDR_IPV4 0xe0000181 /* 224.0.1.129 */
111
- #define PTP_ADDR_IPV6 {0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
112
- 0, 0x01, 0x81} /* ff0e::181 */
111
+
112
+ /* ff0e::181 */
113
+ static const struct in6_addr ptp_addr_ipv6 = { { {
114
+ 0xff , 0x0e , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x01 , 0x81 } } };
115
+
116
+ /* 01-1B-19-00-00-00 */
117
+ static const u8 ptp_addr_ether [ETH_ALEN ] __aligned (2 ) = {
118
+ 0x01 , 0x1b , 0x19 , 0x00 , 0x00 , 0x00 };
119
+
113
120
#define PTP_EVENT_PORT 319
114
121
#define PTP_GENERAL_PORT 320
115
- #define PTP_ADDR_ETHER {0x01, 0x1b, 0x19, 0, 0, 0} /* 01-1B-19-00-00-00 */
116
122
117
123
/* Annoyingly the format of the version numbers are different between
118
124
* versions 1 and 2 so it isn't possible to simply look for 1 or 2.
@@ -1296,7 +1302,7 @@ static int efx_ptp_insert_ipv4_filter(struct efx_nic *efx,
1296
1302
1297
1303
static int efx_ptp_insert_ipv6_filter (struct efx_nic * efx ,
1298
1304
struct list_head * filter_list ,
1299
- struct in6_addr * addr , u16 port ,
1305
+ const struct in6_addr * addr , u16 port ,
1300
1306
unsigned long expiry )
1301
1307
{
1302
1308
struct efx_filter_spec spec ;
@@ -1309,11 +1315,10 @@ static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx,
1309
1315
static int efx_ptp_insert_eth_multicast_filter (struct efx_nic * efx )
1310
1316
{
1311
1317
struct efx_ptp_data * ptp = efx -> ptp_data ;
1312
- const u8 addr [ETH_ALEN ] = PTP_ADDR_ETHER ;
1313
1318
struct efx_filter_spec spec ;
1314
1319
1315
1320
efx_ptp_init_filter (efx , & spec );
1316
- efx_filter_set_eth_local (& spec , EFX_FILTER_VID_UNSPEC , addr );
1321
+ efx_filter_set_eth_local (& spec , EFX_FILTER_VID_UNSPEC , ptp_addr_ether );
1317
1322
spec .match_flags |= EFX_FILTER_MATCH_ETHER_TYPE ;
1318
1323
spec .ether_type = htons (ETH_P_1588 );
1319
1324
return efx_ptp_insert_filter (efx , & ptp -> rxfilters_mcast , & spec , 0 );
@@ -1346,15 +1351,13 @@ static int efx_ptp_insert_multicast_filters(struct efx_nic *efx)
1346
1351
* PTP over IPv6 and Ethernet
1347
1352
*/
1348
1353
if (efx_ptp_use_mac_tx_timestamps (efx )) {
1349
- struct in6_addr ipv6_addr = {{PTP_ADDR_IPV6 }};
1350
-
1351
1354
rc = efx_ptp_insert_ipv6_filter (efx , & ptp -> rxfilters_mcast ,
1352
- & ipv6_addr , PTP_EVENT_PORT , 0 );
1355
+ & ptp_addr_ipv6 , PTP_EVENT_PORT , 0 );
1353
1356
if (rc < 0 )
1354
1357
goto fail ;
1355
1358
1356
1359
rc = efx_ptp_insert_ipv6_filter (efx , & ptp -> rxfilters_mcast ,
1357
- & ipv6_addr , PTP_GENERAL_PORT , 0 );
1360
+ & ptp_addr_ipv6 , PTP_GENERAL_PORT , 0 );
1358
1361
if (rc < 0 )
1359
1362
goto fail ;
1360
1363
@@ -1379,9 +1382,7 @@ static bool efx_ptp_valid_unicast_event_pkt(struct sk_buff *skb)
1379
1382
ip_hdr (skb )-> protocol == IPPROTO_UDP &&
1380
1383
udp_hdr (skb )-> source == htons (PTP_EVENT_PORT );
1381
1384
} else if (skb -> protocol == htons (ETH_P_IPV6 )) {
1382
- struct in6_addr mcast_addr = {{PTP_ADDR_IPV6 }};
1383
-
1384
- return !ipv6_addr_equal (& ipv6_hdr (skb )-> daddr , & mcast_addr ) &&
1385
+ return !ipv6_addr_equal (& ipv6_hdr (skb )-> daddr , & ptp_addr_ipv6 ) &&
1385
1386
ipv6_hdr (skb )-> nexthdr == IPPROTO_UDP &&
1386
1387
udp_hdr (skb )-> source == htons (PTP_EVENT_PORT );
1387
1388
}
0 commit comments