Commit 487e1937 authored by Alex Austin's avatar Alex Austin Committed by David S. Miller

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: default avatarAlex Austin <alex.austin@amd.com>
Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 01b38de1
...@@ -108,11 +108,17 @@ ...@@ -108,11 +108,17 @@
#define PTP_MIN_LENGTH 63 #define PTP_MIN_LENGTH 63
#define PTP_ADDR_IPV4 0xe0000181 /* 224.0.1.129 */ #define PTP_ADDR_IPV4 0xe0000181 /* 224.0.1.129 */
#define PTP_ADDR_IPV6 {0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0x01, 0x81} /* ff0e::181 */ /* ff0e::181 */
static const struct in6_addr ptp_addr_ipv6 = { { {
0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x81 } } };
/* 01-1B-19-00-00-00 */
static const u8 ptp_addr_ether[ETH_ALEN] __aligned(2) = {
0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 };
#define PTP_EVENT_PORT 319 #define PTP_EVENT_PORT 319
#define PTP_GENERAL_PORT 320 #define PTP_GENERAL_PORT 320
#define PTP_ADDR_ETHER {0x01, 0x1b, 0x19, 0, 0, 0} /* 01-1B-19-00-00-00 */
/* Annoyingly the format of the version numbers are different between /* Annoyingly the format of the version numbers are different between
* versions 1 and 2 so it isn't possible to simply look for 1 or 2. * 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,7 +1302,7 @@ static int efx_ptp_insert_ipv4_filter(struct efx_nic *efx,
static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx, static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx,
struct list_head *filter_list, struct list_head *filter_list,
struct in6_addr *addr, u16 port, const struct in6_addr *addr, u16 port,
unsigned long expiry) unsigned long expiry)
{ {
struct efx_filter_spec spec; struct efx_filter_spec spec;
...@@ -1309,11 +1315,10 @@ static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx, ...@@ -1309,11 +1315,10 @@ static int efx_ptp_insert_ipv6_filter(struct efx_nic *efx,
static int efx_ptp_insert_eth_multicast_filter(struct efx_nic *efx) static int efx_ptp_insert_eth_multicast_filter(struct efx_nic *efx)
{ {
struct efx_ptp_data *ptp = efx->ptp_data; struct efx_ptp_data *ptp = efx->ptp_data;
const u8 addr[ETH_ALEN] = PTP_ADDR_ETHER;
struct efx_filter_spec spec; struct efx_filter_spec spec;
efx_ptp_init_filter(efx, &spec); efx_ptp_init_filter(efx, &spec);
efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, addr); efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, ptp_addr_ether);
spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE; spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE;
spec.ether_type = htons(ETH_P_1588); spec.ether_type = htons(ETH_P_1588);
return efx_ptp_insert_filter(efx, &ptp->rxfilters_mcast, &spec, 0); 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,15 +1351,13 @@ static int efx_ptp_insert_multicast_filters(struct efx_nic *efx)
* PTP over IPv6 and Ethernet * PTP over IPv6 and Ethernet
*/ */
if (efx_ptp_use_mac_tx_timestamps(efx)) { if (efx_ptp_use_mac_tx_timestamps(efx)) {
struct in6_addr ipv6_addr = {{PTP_ADDR_IPV6}};
rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast, rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast,
&ipv6_addr, PTP_EVENT_PORT, 0); &ptp_addr_ipv6, PTP_EVENT_PORT, 0);
if (rc < 0) if (rc < 0)
goto fail; goto fail;
rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast, rc = efx_ptp_insert_ipv6_filter(efx, &ptp->rxfilters_mcast,
&ipv6_addr, PTP_GENERAL_PORT, 0); &ptp_addr_ipv6, PTP_GENERAL_PORT, 0);
if (rc < 0) if (rc < 0)
goto fail; goto fail;
...@@ -1379,9 +1382,7 @@ static bool efx_ptp_valid_unicast_event_pkt(struct sk_buff *skb) ...@@ -1379,9 +1382,7 @@ static bool efx_ptp_valid_unicast_event_pkt(struct sk_buff *skb)
ip_hdr(skb)->protocol == IPPROTO_UDP && ip_hdr(skb)->protocol == IPPROTO_UDP &&
udp_hdr(skb)->source == htons(PTP_EVENT_PORT); udp_hdr(skb)->source == htons(PTP_EVENT_PORT);
} else if (skb->protocol == htons(ETH_P_IPV6)) { } else if (skb->protocol == htons(ETH_P_IPV6)) {
struct in6_addr mcast_addr = {{PTP_ADDR_IPV6}}; return !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &ptp_addr_ipv6) &&
return !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &mcast_addr) &&
ipv6_hdr(skb)->nexthdr == IPPROTO_UDP && ipv6_hdr(skb)->nexthdr == IPPROTO_UDP &&
udp_hdr(skb)->source == htons(PTP_EVENT_PORT); udp_hdr(skb)->source == htons(PTP_EVENT_PORT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment