<commit_before>/*	$OpenBSD: if_axenreg.h,v 1.4 2015/06/12 15:47:31 mpi Exp $	*/

/*
 * Copyright (c) 2013 <NAME> <<EMAIL>>. All right reserved.
 *
 */

/*
 * Definitions for the ASIX Electronics AX88179 to ethernet controller.
 */

#define AXEN_PHY_ID		0x0003
#define AXEN_MCAST_FILTER_SIZE	8
/* unit: KB */
#define AXEN_BUFSZ_LS		8
#define AXEN_BUFSZ_HS		16
#define AXEN_BUFSZ_SS		24

#define AXEN_REV_UA1		0
#define AXEN_REV_UA2		1


/* receive header */
/* 
 *                     +-multicast/broadcast
 *                     |    +-rx_ok
 *                     |    |     ++-----L3_type (1:ipv4, 0/2:ipv6)
 *        pkt_len(13)  |    |     ||+ ++-L4_type(0: icmp, 1: UDP, 4: TCP)
 * |765|43210 76543210|7654 3210 7654 3210|
 *  |+-Drop_err               |+-L4_err |+-L4_CSUM_ERR
 *  +--crc_err                +--L3_err +--L3_CSUM_ERR
 *
 * ex) pkt_hdr 0x00680820
 *      drop_err, crc_err: none
 *      pkt_length = 104 byte
 *      0x0820 = 0000 1000 0010 0000  => ipv4 icmp
 *
 * ex) pkt_hdr 0x004c8800
 *      drop_err, crc_err: none
 *      pkt_length = 76 byte
 *      0x8800 = 1000 1000 0000 0000 => ipv6 mcast icmp
 *
 *  [memo]
 *  0x0820: ipv4 icmp			0000 1000 0010 0000
 *  0x8820: ipv4 icmp (broadcast)	1000 1000 0010 0000
 *  0x0824: ipv4 udp (nping)		0000 1000 0010 0100
 *  0x0830: ipv4 tcp (ssh)		0000 1000 0011 0000
 *
 *  0x0800: ipv6 icmp			0000 1000 0000 0000
 *  0x8800: ipv6 icmp (multicast)	1000 1000 0000 0000
 *  0x8844: ipv6 UDP/MDNS mcast		1000 1000 0100 0100
 *  0x0850: ipv6 tcp (ssh)		0000 1000 0101 0000
 */

#define	AXEN_RXHDR_CRC_ERR	(1U << 31)
#define	AXEN_RXHDR_DROP_ERR	(1U << 30)
#define AXEN_RXHDR_MCAST	(1U << 15)
#define AXEN_RXHDR_RX_OK	(1U << 11)
#define	AXEN_RXHDR_L3_ERR	(1U << 9)
#define	AXEN_RXHDR_L4_ERR	(1U << 8)
#define AXEN_RXHDR_L3CSUM_ERR 	(1U << 1)
#define AXEN_RXHDR_L4CSUM_ERR	(1U << 0)

/* L4 packet type (3bit) */
#define AXEN_RXHDR_L4_TYPE_MASK	0x0000001c
#define AXEN_RXHDR_L4_TYPE_OFFSET	2
#define   AXEN_RXHDR_L4_TYPE_ICMP	0x0<commit_msg>fix recv packet header definiton<commit_after>/*	$OpenBSD: if_axenreg.h,v 1.5 2015/07/16 00:17:40 yuo Exp $	*/

/*
 * Copyright (c) 2013 <NAME> <<EMAIL>>. All right reserved.
 *
 */

/*
 * Definitions for the ASIX Electronics AX88179 to ethernet controller.
 */

#define AXEN_PHY_ID		0x0003
#define AXEN_MCAST_FILTER_SIZE	8
/* unit: KB */
#define AXEN_BUFSZ_LS		8
#define AXEN_BUFSZ_HS		16
#define AXEN_BUFSZ_SS		24

#define AXEN_REV_UA1		0
#define AXEN_REV_UA2		1

/* receive header */
/* 
 *                     +-multicast/broadcast
 *                     |    +-rx_ok
 *                     |    |     ++-----L3_type (1:ipv4, 0/2:ipv6)
 *        pkt_len(13)  |    |     ||+ ++-L4_type(0: icmp, 1: UDP, 4: TCP)
 * |765|43210 76543210|7654 3210 7654 3210|
 *  ||+-crc_err              |+-L4_err |+-L4_CSUM_ERR
 *  |+-mii_err               +--L3_err +--L3_CSUM_ERR
 *  +-drop_err
 *
 * ex) pkt_hdr 0x00680820
 *      drop_err, crc_err: none
 *      pkt_length = 104 byte
 *      0x0820 = 0000 1000 0010 0000  => ipv4 icmp
 *
 * ex) pkt_hdr 0x004c8800
 *      drop_err, crc_err: none
 *      pkt_length = 76 byte
 *      0x8800 = 1000 1000 0000 0000 => ipv6 mcast icmp
 *
 *  [memo]
 *  0x0820: ipv4 icmp			0000 1000 0010 0000
 *  0x8820: ipv4 icmp (broadcast)	1000 1000 0010 0000
 *  0x0824: ipv4 udp (nping)		0000 1000 0010 0100
 *  0x0830: ipv4 tcp (ssh)		0000 1000 0011 0000
 *
 *  0x0800: ipv6 icmp			0000 1000 0000 0000
 *  0x8800: ipv6 icmp (multicast)	1000 1000 0000 0000
 *  0x8844: ipv6 UDP/MDNS mcast		1000 1000 0100 0100
 *  0x0850: ipv6 tcp (ssh)		0000 1000 0101 0000
 */

#define	AXEN_RXHDR_DROP_ERR	(1U << 31)
#define AXEN_RXHDR_MII_ERR	(1U << 30)
#define	AXEN_RXHDR_CRC_ERR	(1U << 29)
#define AXEN_RXHDR_MCAST	(1U << 15)
#define AXEN_RXHDR_RX_OK	(1U << 11)
#define	AXEN_RXHDR_L3_ERR	(1U << 9)
#define	AXEN_RXHDR_L4_ERR	(1U << 8)
#define AXEN_RXHDR_L3CSUM_ERR 	(1U << 1)
#define AXEN_RXHDR_L4CSUM_ERR	(1U << 0)

/* L4 packet type (3bit) */
#define AXEN_RXHDR_L4_TYPE_MASK	0x0000001c
#define AXEN_RXHDR_L4_TYPE_OFFSET	2
#define   AXEN_RXHDR_L4_TYPE_ICMP	0x0
{'fraction_non_alphanumeric': 0.11563957770684999, 'fraction_numerical': 0.1824208200343727, 'mean_word_length': 2.768732654949121, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7516663', 'n_tokens_mistral': 2414, 'n_tokens_neox': 1867, 'n_words': 436}