diff --git a/kernel/pf_ring.c b/kernel/pf_ring.c index f7e8a8911..8ab4ace8d 100644 --- a/kernel/pf_ring.c +++ b/kernel/pf_ring.c @@ -2229,10 +2229,16 @@ static int parse_raw_pkt(u_char *data, u_int32_t data_len, hdr->extended_hdr.parsed_pkt.eth_type = ntohs(eh->h_proto); + if (hdr->extended_hdr.parsed_pkt.eth_type == 0xd28b /* Arista 7280 */) { + struct ethhdr *dummy_eh = (struct ethhdr *) &data[sizeof(struct ethhdr)]; + displ += 14; + hdr->extended_hdr.parsed_pkt.eth_type = ntohs(dummy_eh->h_proto); + } + if(hdr->extended_hdr.parsed_pkt.eth_type == ETH_P_8021Q /* 802.1q (VLAN) */) { struct eth_vlan_hdr *vh; - hdr->extended_hdr.parsed_pkt.offset.vlan_offset = sizeof(struct ethhdr); + hdr->extended_hdr.parsed_pkt.offset.vlan_offset = displ; if (data_len < hdr->extended_hdr.parsed_pkt.offset.vlan_offset + sizeof(struct eth_vlan_hdr)) return(0); vh = (struct eth_vlan_hdr *) &data[hdr->extended_hdr.parsed_pkt.offset.vlan_offset]; hdr->extended_hdr.parsed_pkt.vlan_id = ntohs(vh->h_vlan_id) & VLAN_VID_MASK; diff --git a/userland/lib/libs/libpfring_ft_aarch64_dbg.a b/userland/lib/libs/libpfring_ft_aarch64_dbg.a deleted file mode 100644 index f21ca06c4..000000000 Binary files a/userland/lib/libs/libpfring_ft_aarch64_dbg.a and /dev/null differ diff --git a/userland/lib/libs/libpfring_ft_aarch64_dbg.so b/userland/lib/libs/libpfring_ft_aarch64_dbg.so deleted file mode 100755 index 345b26c54..000000000 Binary files a/userland/lib/libs/libpfring_ft_aarch64_dbg.so and /dev/null differ diff --git a/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.a b/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.a deleted file mode 100644 index fc854d897..000000000 Binary files a/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.a and /dev/null differ diff --git a/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.so b/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.so deleted file mode 100755 index 5d2340429..000000000 Binary files a/userland/lib/libs/libpfring_ft_aarch64_dbg_dl.so and /dev/null differ diff --git a/userland/lib/libs/libpfring_ft_x86_64.a b/userland/lib/libs/libpfring_ft_x86_64.a index 34bdfde2f..27b2f3888 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64.a and b/userland/lib/libs/libpfring_ft_x86_64.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64.so b/userland/lib/libs/libpfring_ft_x86_64.so index bc585b4ff..8ed350394 100755 Binary files a/userland/lib/libs/libpfring_ft_x86_64.so and b/userland/lib/libs/libpfring_ft_x86_64.so differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_core-avx2.a b/userland/lib/libs/libpfring_ft_x86_64_core-avx2.a index 68da065a9..0119789a2 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_core-avx2.a and b/userland/lib/libs/libpfring_ft_x86_64_core-avx2.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_core-avx2_dl.a b/userland/lib/libs/libpfring_ft_x86_64_core-avx2_dl.a index 99c7b26aa..0122e2900 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_core-avx2_dl.a and b/userland/lib/libs/libpfring_ft_x86_64_core-avx2_dl.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_corei7-avx.a b/userland/lib/libs/libpfring_ft_x86_64_corei7-avx.a index 922e31f7b..ed45a95d3 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_corei7-avx.a and b/userland/lib/libs/libpfring_ft_x86_64_corei7-avx.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_corei7-avx_dl.a b/userland/lib/libs/libpfring_ft_x86_64_corei7-avx_dl.a index 55385b1cf..74738c6c6 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_corei7-avx_dl.a and b/userland/lib/libs/libpfring_ft_x86_64_corei7-avx_dl.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_corei7.a b/userland/lib/libs/libpfring_ft_x86_64_corei7.a index 57dd8cf27..9d1f8a29d 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_corei7.a and b/userland/lib/libs/libpfring_ft_x86_64_corei7.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_corei7_dl.a b/userland/lib/libs/libpfring_ft_x86_64_corei7_dl.a index ef7384d55..d87a311bb 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_corei7_dl.a and b/userland/lib/libs/libpfring_ft_x86_64_corei7_dl.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_dl.a b/userland/lib/libs/libpfring_ft_x86_64_dl.a index eb637a0d8..49f76a387 100644 Binary files a/userland/lib/libs/libpfring_ft_x86_64_dl.a and b/userland/lib/libs/libpfring_ft_x86_64_dl.a differ diff --git a/userland/lib/libs/libpfring_ft_x86_64_dl.so b/userland/lib/libs/libpfring_ft_x86_64_dl.so index 3713cda69..3214cb65f 100755 Binary files a/userland/lib/libs/libpfring_ft_x86_64_dl.so and b/userland/lib/libs/libpfring_ft_x86_64_dl.so differ diff --git a/userland/lib/libs/libpfring_mlx_x86_64.a b/userland/lib/libs/libpfring_mlx_x86_64.a index 499825a0c..2dad199f2 100644 Binary files a/userland/lib/libs/libpfring_mlx_x86_64.a and b/userland/lib/libs/libpfring_mlx_x86_64.a differ diff --git a/userland/lib/libs/libpfring_mlx_x86_64.so b/userland/lib/libs/libpfring_mlx_x86_64.so index c6a0be076..4736db5b5 100755 Binary files a/userland/lib/libs/libpfring_mlx_x86_64.so and b/userland/lib/libs/libpfring_mlx_x86_64.so differ diff --git a/userland/lib/libs/libpfring_mlx_x86_64_core-avx2.a b/userland/lib/libs/libpfring_mlx_x86_64_core-avx2.a index e3dd08c39..d5f0f64dc 100644 Binary files a/userland/lib/libs/libpfring_mlx_x86_64_core-avx2.a and b/userland/lib/libs/libpfring_mlx_x86_64_core-avx2.a differ diff --git a/userland/lib/libs/libpfring_mlx_x86_64_corei7-avx.a b/userland/lib/libs/libpfring_mlx_x86_64_corei7-avx.a index 5e1c9668c..f79e4a17d 100644 Binary files a/userland/lib/libs/libpfring_mlx_x86_64_corei7-avx.a and b/userland/lib/libs/libpfring_mlx_x86_64_corei7-avx.a differ diff --git a/userland/lib/libs/libpfring_mlx_x86_64_corei7.a b/userland/lib/libs/libpfring_mlx_x86_64_corei7.a index 236151b46..59461be2f 100644 Binary files a/userland/lib/libs/libpfring_mlx_x86_64_corei7.a and b/userland/lib/libs/libpfring_mlx_x86_64_corei7.a differ diff --git a/userland/lib/libs/libpfring_nt_x86_64.a b/userland/lib/libs/libpfring_nt_x86_64.a index bec61f6df..4d6c3c844 100644 Binary files a/userland/lib/libs/libpfring_nt_x86_64.a and b/userland/lib/libs/libpfring_nt_x86_64.a differ diff --git a/userland/lib/libs/libpfring_nt_x86_64.so b/userland/lib/libs/libpfring_nt_x86_64.so index b43253f9c..ac76ab36a 100755 Binary files a/userland/lib/libs/libpfring_nt_x86_64.so and b/userland/lib/libs/libpfring_nt_x86_64.so differ diff --git a/userland/lib/libs/libpfring_nt_x86_64_core-avx2.a b/userland/lib/libs/libpfring_nt_x86_64_core-avx2.a index 120bd8234..1aa15e23c 100644 Binary files a/userland/lib/libs/libpfring_nt_x86_64_core-avx2.a and b/userland/lib/libs/libpfring_nt_x86_64_core-avx2.a differ diff --git a/userland/lib/libs/libpfring_nt_x86_64_corei7-avx.a b/userland/lib/libs/libpfring_nt_x86_64_corei7-avx.a index e11faa044..c6838250e 100644 Binary files a/userland/lib/libs/libpfring_nt_x86_64_corei7-avx.a and b/userland/lib/libs/libpfring_nt_x86_64_corei7-avx.a differ diff --git a/userland/lib/libs/libpfring_nt_x86_64_corei7.a b/userland/lib/libs/libpfring_nt_x86_64_corei7.a index d6d2ef47c..eababaaf1 100644 Binary files a/userland/lib/libs/libpfring_nt_x86_64_corei7.a and b/userland/lib/libs/libpfring_nt_x86_64_corei7.a differ diff --git a/userland/lib/libs/libpfring_zc_x86_64.a b/userland/lib/libs/libpfring_zc_x86_64.a index 88a2c8b49..e9cbcda90 100644 Binary files a/userland/lib/libs/libpfring_zc_x86_64.a and b/userland/lib/libs/libpfring_zc_x86_64.a differ diff --git a/userland/lib/libs/libpfring_zc_x86_64.so b/userland/lib/libs/libpfring_zc_x86_64.so index 45e9dc361..abf9e69ad 100755 Binary files a/userland/lib/libs/libpfring_zc_x86_64.so and b/userland/lib/libs/libpfring_zc_x86_64.so differ diff --git a/userland/lib/libs/libpfring_zc_x86_64_core-avx2.a b/userland/lib/libs/libpfring_zc_x86_64_core-avx2.a index c000ade15..66b0b1275 100644 Binary files a/userland/lib/libs/libpfring_zc_x86_64_core-avx2.a and b/userland/lib/libs/libpfring_zc_x86_64_core-avx2.a differ diff --git a/userland/lib/libs/libpfring_zc_x86_64_corei7-avx.a b/userland/lib/libs/libpfring_zc_x86_64_corei7-avx.a index 7c45609a5..805905975 100644 Binary files a/userland/lib/libs/libpfring_zc_x86_64_corei7-avx.a and b/userland/lib/libs/libpfring_zc_x86_64_corei7-avx.a differ diff --git a/userland/lib/libs/libpfring_zc_x86_64_corei7.a b/userland/lib/libs/libpfring_zc_x86_64_corei7.a index c76fc14e3..28d021355 100644 Binary files a/userland/lib/libs/libpfring_zc_x86_64_corei7.a and b/userland/lib/libs/libpfring_zc_x86_64_corei7.a differ diff --git a/userland/lib/pfring.h b/userland/lib/pfring.h index dfebeea04..9ddaa6c94 100644 --- a/userland/lib/pfring.h +++ b/userland/lib/pfring.h @@ -1322,7 +1322,7 @@ int pfring_handle_metawatch_hw_timestamp(u_char* buffer, struct pfring_pkthdr *h * @param ticks_ts The ticks will be placed here. * @return 0 on success, a negative number otherwise. */ -int pfring_read_arista_keyframe(u_char *buffer, u_int32_t buffer_len, u_int64_t *ns_ts, u_int32_t *ticks_ts); +int pfring_read_arista_7150_keyframe(u_char *buffer, u_int32_t buffer_len, u_int64_t *ns_ts, u_int32_t *ticks_ts); /** * Reads a ARISTA-formatted timestamp from an incoming packet and puts it into the timestamp variable. @@ -1331,7 +1331,7 @@ int pfring_read_arista_keyframe(u_char *buffer, u_int32_t buffer_len, u_int64_t * @param ns_ts If found the hardware timestamp will be placed here * @return The length of the ARISTA timestamp. */ -int pfring_read_arista_hw_timestamp(u_char *buffer, u_int32_t buffer_len, u_int64_t *ns_ts); +int pfring_read_arista_7150_hw_timestamp(u_char *buffer, u_int32_t buffer_len, u_int64_t *ns_ts); /** * Strip a ARISTA-formatted timestamp from an incoming packet. If the timestamp is found, the diff --git a/userland/lib/pfring_hw_timestamp.c b/userland/lib/pfring_hw_timestamp.c index 326c1fa51..08805e858 100644 --- a/userland/lib/pfring_hw_timestamp.c +++ b/userland/lib/pfring_hw_timestamp.c @@ -131,11 +131,11 @@ int pfring_handle_ixia_hw_timestamp(u_char* buffer, struct pfring_pkthdr *hdr) { /* ********************************* */ -static u_int64_t last_arista_keyframe_nsec = 0; -static u_int32_t last_arista_keyframe_ticks = 0; +static u_int64_t last_arista_7150_keyframe_nsec = 0; +static u_int32_t last_arista_7150_keyframe_ticks = 0; -int pfring_read_arista_keyframe(u_char *buffer, u_int32_t buffer_len, - u_int64_t *ns_ts, u_int32_t *ticks_ts) { +int pfring_read_arista_7150_keyframe(u_char *buffer, u_int32_t buffer_len, + u_int64_t *ns_ts, u_int32_t *ticks_ts) { struct arista_7150_keyframe_hw_ts *kf; u_char bcmac[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; struct ethhdr *eh = (struct ethhdr*) buffer; @@ -176,8 +176,8 @@ int pfring_read_arista_keyframe(u_char *buffer, u_int32_t buffer_len, ns = be64toh(kf->utc_nsec); t = ntohl(kf->asic_time.ticks); - last_arista_keyframe_nsec = ns; - last_arista_keyframe_ticks = t; + last_arista_7150_keyframe_nsec = ns; + last_arista_7150_keyframe_ticks = t; if (unlikely(debug_ts)) printf("[ARISTA][Key-Frame] Ticks: %u UTC: %ju.%ju\n", t, ns/1000000000, ns%1000000000); @@ -190,8 +190,8 @@ int pfring_read_arista_keyframe(u_char *buffer, u_int32_t buffer_len, /* ********************************* */ -int pfring_read_arista_hw_timestamp(u_char *buffer, - u_int32_t buffer_len, u_int64_t *ns_ts) { +int pfring_read_arista_7150_hw_timestamp(u_char *buffer, + u_int32_t buffer_len, u_int64_t *ns_ts) { struct arista_7150_pkt_hw_ts *fcsts; u_int32_t ticks; double delta_ticks = 0, delta_nsec; @@ -201,15 +201,15 @@ int pfring_read_arista_hw_timestamp(u_char *buffer, ticks = ntohl(fcsts->asic.ticks); - if (last_arista_keyframe_ticks) { - if (ticks >= last_arista_keyframe_ticks) - delta_ticks = ticks - last_arista_keyframe_ticks; + if (last_arista_7150_keyframe_ticks) { + if (ticks >= last_arista_7150_keyframe_ticks) + delta_ticks = ticks - last_arista_7150_keyframe_ticks; else delta_ticks = 0x7FFFFFFF; /* 31 bit ticks ts */ delta_nsec = delta_ticks * 2.857; /* Clock rate is 350Mhz - Tick length 20.0/7.0 */ - ns = last_arista_keyframe_nsec + delta_nsec; + ns = last_arista_7150_keyframe_nsec + delta_nsec; } if (unlikely(debug_ts)) @@ -222,6 +222,37 @@ int pfring_read_arista_hw_timestamp(u_char *buffer, /* ********************************* */ +int pfring_read_arista_7280_hw_timestamp(u_char *buffer, struct pfring_pkthdr *hdr) { + struct ethhdr *eh = (struct ethhdr *) buffer; + struct arista_7280_pkt_hw_ts *fcsts; + u_int16_t eth_type; + u_int64_t ns; + u_int32_t tv_sec, tv_nsec; + + eth_type = ntohs(eh->h_proto); + + if (eth_type != 0xd28b /* Arista 7280 */) + return -1; + + fcsts = (struct arista_7280_pkt_hw_ts *) &buffer[sizeof(struct ethhdr)]; + + tv_sec = ntohl(fcsts->ts.tv_sec); + tv_nsec = ntohl(fcsts->ts.tv_nsec); + + hdr->ts.tv_sec = tv_sec; + hdr->ts.tv_usec = tv_nsec/1000; + + ns = (((u_int64_t) tv_sec) * 1000000000) + tv_nsec; + hdr->extended_hdr.timestamp_ns = ns; + + if (unlikely(debug_ts)) + printf("[ARISTA][Packet] UTC: %u.%uns\n", tv_sec, tv_nsec); + + return 0; +} + +/* ********************************* */ + int pfring_handle_arista_hw_timestamp(u_char* buffer, struct pfring_pkthdr *hdr) { u_int64_t ns; u_int32_t ticks; @@ -229,12 +260,17 @@ int pfring_handle_arista_hw_timestamp(u_char* buffer, struct pfring_pkthdr *hdr) if(unlikely(hdr->caplen != hdr->len)) return -1; /* full packet only */ - if (pfring_read_arista_keyframe(buffer, hdr->len, &ns, &ticks) == 0) { + if (pfring_read_arista_7280_hw_timestamp(buffer, hdr) == 0) { + /* This is a 7280 timestamped packet */ + return 0; + + } else if (pfring_read_arista_7150_keyframe(buffer, hdr->len, &ns, &ticks) == 0) { /* This was a keyframe */ return 1; /* skip this packet */ + } else { - /* This is a packet, reading the timestamp */ - pfring_read_arista_hw_timestamp(buffer, hdr->len, &ns); + /* This is a 7150 timestamped packet, reading the timestamp */ + pfring_read_arista_7150_hw_timestamp(buffer, hdr->len, &ns); hdr->caplen = hdr->len = hdr->len - sizeof(struct arista_7150_pkt_hw_ts); hdr->ts.tv_sec = ns/1000000000; hdr->ts.tv_usec = (ns%1000000000)/1000; diff --git a/userland/lib/pfring_hw_timestamp.h b/userland/lib/pfring_hw_timestamp.h index 0ec19564f..ee209a478 100644 --- a/userland/lib/pfring_hw_timestamp.h +++ b/userland/lib/pfring_hw_timestamp.h @@ -65,6 +65,18 @@ struct arista_7150_pkt_hw_ts { /* *********************************************** */ +struct arista_7280_pkt_hw_ts { + u_int16_t subtype; + u_int16_t version; + struct { + u_int32_t tv_sec; + u_int32_t tv_nsec; + } ts; + u_int16_t h_proto; +} __attribute__((__packed__)); + +/* *********************************************** */ + #define VSS_APCON_TS_LEN sizeof(struct vss_apcon_hw_ts) struct vss_apcon_hw_ts { diff --git a/userland/lib/pfring_utils.c b/userland/lib/pfring_utils.c index 0876c6cd2..e3b1a7a67 100644 --- a/userland/lib/pfring_utils.c +++ b/userland/lib/pfring_utils.c @@ -228,8 +228,11 @@ static int __pfring_parse_tunneled_pkt(u_char *data, struct pfring_pkthdr *hdr, int pfring_parse_pkt(u_char *data, struct pfring_pkthdr *hdr, u_int8_t level /* L2..L4, 5 (tunnel) */, u_int8_t add_timestamp /* 0,1 */, u_int8_t add_hash /* 0,1 */) { struct ethhdr *eh = (struct ethhdr*) data; - u_int32_t data_len = hdr->caplen, displ = 0, ip_len; - u_int16_t analyzed = 0, fragment_offset = 0; + u_int32_t data_len = hdr->caplen; + u_int32_t displ = sizeof(struct ethhdr); + u_int32_t ip_len; + u_int16_t analyzed = 0; + u_int16_t fragment_offset = 0; hdr->extended_hdr.parsed_pkt.tunnel.tunnel_id = NO_TUNNEL_ID; @@ -248,13 +251,19 @@ int pfring_parse_pkt(u_char *data, struct pfring_pkthdr *hdr, u_int8_t level /* hdr->extended_hdr.parsed_pkt.offset.vlan_offset = 0; hdr->extended_hdr.parsed_pkt.vlan_id = 0; /* Any VLAN */ + if (hdr->extended_hdr.parsed_pkt.eth_type == 0xd28b /* Arista 7280 */) { + struct ethhdr *dummy_eh = (struct ethhdr *) &data[sizeof(struct ethhdr)]; + displ += 14; + hdr->extended_hdr.parsed_pkt.eth_type = ntohs(dummy_eh->h_proto); + } + #ifndef VLAN_VID_MASK #define VLAN_VID_MASK 0x0fff #endif if (hdr->extended_hdr.parsed_pkt.eth_type == 0x8100 /* 802.1q (VLAN) */) { struct eth_vlan_hdr *vh; - hdr->extended_hdr.parsed_pkt.offset.vlan_offset = sizeof(struct ethhdr); + hdr->extended_hdr.parsed_pkt.offset.vlan_offset = displ; vh = (struct eth_vlan_hdr *) &data[hdr->extended_hdr.parsed_pkt.offset.vlan_offset]; hdr->extended_hdr.parsed_pkt.vlan_id = ntohs(vh->h_vlan_id) & VLAN_VID_MASK /* 0x0fff */; hdr->extended_hdr.parsed_pkt.eth_type = ntohs(vh->h_proto); @@ -274,7 +283,7 @@ int pfring_parse_pkt(u_char *data, struct pfring_pkthdr *hdr, u_int8_t level /* } } - hdr->extended_hdr.parsed_pkt.offset.l3_offset = hdr->extended_hdr.parsed_pkt.offset.eth_offset + displ + sizeof(struct ethhdr); + hdr->extended_hdr.parsed_pkt.offset.l3_offset = hdr->extended_hdr.parsed_pkt.offset.eth_offset + displ; L3: