mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
1. Move pkt_v4 and pkt_v6 into network_helpers and adjust the users. 2. Copy-paste spin_lock_thread into two tests that use it. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Andrey Ignatov <rdna@fb.com> Link: https://lore.kernel.org/bpf/20200508174611.228805-3-sdf@google.com
39 lines
845 B
C
39 lines
845 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NETWORK_HELPERS_H
|
|
#define __NETWORK_HELPERS_H
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
#include <linux/types.h>
|
|
typedef __u16 __sum16;
|
|
#include <linux/if_ether.h>
|
|
#include <linux/if_packet.h>
|
|
#include <linux/ip.h>
|
|
#include <linux/ipv6.h>
|
|
#include <netinet/tcp.h>
|
|
#include <bpf/bpf_endian.h>
|
|
|
|
#define MAGIC_VAL 0x1234
|
|
#define NUM_ITER 100000
|
|
#define VIP_NUM 5
|
|
#define MAGIC_BYTES 123
|
|
|
|
/* ipv4 test vector */
|
|
struct ipv4_packet {
|
|
struct ethhdr eth;
|
|
struct iphdr iph;
|
|
struct tcphdr tcp;
|
|
} __packed;
|
|
extern struct ipv4_packet pkt_v4;
|
|
|
|
/* ipv6 test vector */
|
|
struct ipv6_packet {
|
|
struct ethhdr eth;
|
|
struct ipv6hdr iph;
|
|
struct tcphdr tcp;
|
|
} __packed;
|
|
extern struct ipv6_packet pkt_v6;
|
|
|
|
int start_server(int family, int type);
|
|
int connect_to_fd(int family, int type, int server_fd);
|
|
|
|
#endif
|