Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: make coding style of PTP addresses consistent with core

Follow the style used in the core kernel (e.g.
include/linux/etherdevice.h and include/linux/in6.h) for the PTP IPv6
and Ethernet addresses. No functional changes.

Signed-off-by: Alex Austin <alex.austin@amd.com>
Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alex Austin and committed by
David S. Miller
487e1937 01b38de1

+14 -13
+14 -13
drivers/net/ethernet/sfc/ptp.c
··· 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. ··· 1302 1296 1303 1297 static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx, 1304 1298 struct list_head *filter_list, 1305 - struct in6_addr *addr, u16 port, 1299 + const struct in6_addr *addr, u16 port, 1306 1300 unsigned long expiry) 1307 1301 { 1308 1302 struct efx_filter_spec spec; ··· 1315 1309 static int efx_ptp_insert_eth_multicast_filter(struct efx_nic *efx) 1316 1310 { 1317 1311 struct efx_ptp_data *ptp = efx->ptp_data; 1318 - const u8 addr[ETH_ALEN] = PTP_ADDR_ETHER; 1319 1312 struct efx_filter_spec spec; 1320 1313 1321 1314 efx_ptp_init_filter(efx, &spec); 1322 - efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, addr); 1315 + efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, ptp_addr_ether); 1323 1316 spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE; 1324 1317 spec.ether_type = htons(ETH_P_1588); 1325 1318 return efx_ptp_insert_filter(efx, &ptp->rxfilters_mcast, &spec, 0); ··· 1351 1346 * PTP over IPv6 and Ethernet 1352 1347 */ 1353 1348 if (efx_ptp_use_mac_tx_timestamps(efx)) { 1354 - struct in6_addr ipv6_addr = {{PTP_ADDR_IPV6}}; 1355 - 1356 1349 rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast, 1357 - &ipv6_addr, PTP_EVENT_PORT, 0); 1350 + &ptp_addr_ipv6, PTP_EVENT_PORT, 0); 1358 1351 if (rc < 0) 1359 1352 goto fail; 1360 1353 1361 1354 rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast, 1362 - &ipv6_addr, PTP_GENERAL_PORT, 0); 1355 + &ptp_addr_ipv6, PTP_GENERAL_PORT, 0); 1363 1356 if (rc < 0) 1364 1357 goto fail; 1365 1358 ··· 1382 1379 ip_hdr(skb)->protocol == IPPROTO_UDP && 1383 1380 udp_hdr(skb)->source == htons(PTP_EVENT_PORT); 1384 1381 } else if (skb->protocol == htons(ETH_P_IPV6)) { 1385 - struct in6_addr mcast_addr = {{PTP_ADDR_IPV6}}; 1386 - 1387 - return !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &mcast_addr) && 1382 + return !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &ptp_addr_ipv6) && 1388 1383 ipv6_hdr(skb)->nexthdr == IPPROTO_UDP && 1389 1384 udp_hdr(skb)->source == htons(PTP_EVENT_PORT); 1390 1385 }