<commit_before>/*
 * IEEE802.15.4-2003 specification
 *
 * Copyright (C) 2007-2012 Siemens AG
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef NET_MAC802154_H
#define NET_MAC802154_H

#include <net/af_ieee802154.h>
#include <linux/skbuff.h>

/* General MAC frame format:
 *  2 bytes: Frame Control
 *  1 byte:  Sequence Number
 * 20 bytes: Addressing fields
 * 14 bytes: Auxiliary Security Header
 */
#define MAC802154_FRAME_HARD_HEADER_LEN		(2 + 1 + 20 + 14)

/* The following flags are used to indicate changed address settings from
 * the stack to the hardware.
 */

/* indicates that the Short Address changed */
#define IEEE802154_AFILT_SADDR_CHANGED		0x00000001
/* indicates that the IEEE Address changed */
#define IEEE802154_AFILT_IEEEADDR_CHANGED	0x00000002
/* indicates that the PAN ID changed */
#define IEEE802154_AFILT_PANID_CHANGED		0x00000004
/* indicates that PAN Coordinator status changed */
#define IEEE802154_AFILT_PANC_CHANGED		0x00000008

struct ieee802154_hw_addr_filt {
	__le16	pan_id;		/* Each independent PAN selects a unique
				 * identifier. This PAN id allows communication
				 * between devices within a network using short
				 * addresses and enables transmissions between
				 * devices across independent networks.
				 */
	__le16	short_addr;
	__le64	ieee_addr;
	u8	pan_coord;
};

struct ieee802154_hw {
	/* filled by the driver */
	int	extra_tx_headroom;
	u32	flags;
	struct	device *parent;

	/* filled by mac802154 core */
	struct	ieee802154_hw_addr_filt hw_filt;
	void	*priv;
	struct	wpan_phy *phy;
};

/* Checksum is in hardware and is omitted from a packet
 *
 * These following flags are used to indicate hardware capabilities to
 * the stack. Generally, flags here should have their meaning
 * done in a way that the simplest hardware doesn't need setting
 * any particular flags. There are some exceptions to this rule,
 * however, so you are advised to review these flags carefully.
 */

/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
#define	IEEE802154_HW_OMIT_CKSUM	0x00000001
/* Indicates that receiver will autorespond with ACK frames. */
#define	IEEE802154_HW_AACK		0x00000002
/* Indicates that transceiver will support transmit power setting. */
#define	IEEE802154_HW_TXPOWER		0x00000004
/* Indicates that transceiver will support listen before transmit. */
#define	IEEE802154_HW_LBT		0x00000008
/* Indicates that transceiver will support cca mode setting. */
#define	IEEE802154_HW_CCA_MODE		0x00000010
/* Indicates that transceiver will support cca ed level setting. */
#define	IEEE802154_HW_CCA_ED_LEVEL	0x00000020
/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
 * settings. */
#define	IEEE802154_HW_CSMA_PARAMS	0x00000040
/* Indicates that transceiver will support ARET frame retries setting. */
#define	IEEE802154_HW_FRAME_RETRIES	0x00000080

/* This groups the most common CSMA support fields into one. */
#define IEEE802154_HW_CSMA		(IEEE802154_HW_CCA_MODE | \
					 IEEE802154_HW_CCA_ED_LEVEL | \
					 IEEE802154_HW_CSMA_PARAMS | \
					 IEEE802154_HW_FRAME_RETRIES)

/* struct ieee802154_ops - callbacks from mac802154 to the driver
 *
 * This structure contains various callbacks that the driver may
 * handle or, in some cases, must handle, for example to transmit
 * a frame.
 *
 * start: Handler that 802.15.4 module calls for device initialization.
 *	  This function is called before the first interface is attached.
 *
 * stop:  Handler that 802.15.4 module calls for device cleanup.
 *	  This function is called after the last interface is removed.
 *
 * xmit_sync:
 *	  Handler that 802.15.4 module calls for each transmitted frame.
 *	  skb cntains the buffer starting from the IEEE 802.15.4 header.<commit_msg>mac802154: remove tab after define<commit_after>/*
 * IEEE802.15.4-2003 specification
 *
 * Copyright (C) 2007-2012 Siemens AG
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef NET_MAC802154_H
#define NET_MAC802154_H

#include <net/af_ieee802154.h>
#include <linux/skbuff.h>

/* General MAC frame format:
 *  2 bytes: Frame Control
 *  1 byte:  Sequence Number
 * 20 bytes: Addressing fields
 * 14 bytes: Auxiliary Security Header
 */
#define MAC802154_FRAME_HARD_HEADER_LEN		(2 + 1 + 20 + 14)

/* The following flags are used to indicate changed address settings from
 * the stack to the hardware.
 */

/* indicates that the Short Address changed */
#define IEEE802154_AFILT_SADDR_CHANGED		0x00000001
/* indicates that the IEEE Address changed */
#define IEEE802154_AFILT_IEEEADDR_CHANGED	0x00000002
/* indicates that the PAN ID changed */
#define IEEE802154_AFILT_PANID_CHANGED		0x00000004
/* indicates that PAN Coordinator status changed */
#define IEEE802154_AFILT_PANC_CHANGED		0x00000008

struct ieee802154_hw_addr_filt {
	__le16	pan_id;		/* Each independent PAN selects a unique
				 * identifier. This PAN id allows communication
				 * between devices within a network using short
				 * addresses and enables transmissions between
				 * devices across independent networks.
				 */
	__le16	short_addr;
	__le64	ieee_addr;
	u8	pan_coord;
};

struct ieee802154_hw {
	/* filled by the driver */
	int	extra_tx_headroom;
	u32	flags;
	struct	device *parent;

	/* filled by mac802154 core */
	struct	ieee802154_hw_addr_filt hw_filt;
	void	*priv;
	struct	wpan_phy *phy;
};

/* Checksum is in hardware and is omitted from a packet
 *
 * These following flags are used to indicate hardware capabilities to
 * the stack. Generally, flags here should have their meaning
 * done in a way that the simplest hardware doesn't need setting
 * any particular flags. There are some exceptions to this rule,
 * however, so you are advised to review these flags carefully.
 */

/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
#define IEEE802154_HW_OMIT_CKSUM	0x00000001
/* Indicates that receiver will autorespond with ACK frames. */
#define IEEE802154_HW_AACK		0x00000002
/* Indicates that transceiver will support transmit power setting. */
#define IEEE802154_HW_TXPOWER		0x00000004
/* Indicates that transceiver will support listen before transmit. */
#define IEEE802154_HW_LBT		0x00000008
/* Indicates that transceiver will support cca mode setting. */
#define IEEE802154_HW_CCA_MODE		0x00000010
/* Indicates that transceiver will support cca ed level setting. */
#define IEEE802154_HW_CCA_ED_LEVEL	0x00000020
/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
 * settings. */
#define IEEE802154_HW_CSMA_PARAMS	0x00000040
/* Indicates that transceiver will support ARET frame retries setting. */
#define IEEE802154_HW_FRAME_RETRIES	0x00000080

/* This groups the most common CSMA support fields into one. */
#define IEEE802154_HW_CSMA		(IEEE802154_HW_CCA_MODE | \
					 IEEE802154_HW_CCA_ED_LEVEL | \
					 IEEE802154_HW_CSMA_PARAMS | \
					 IEEE802154_HW_FRAME_RETRIES)

/* struct ieee802154_ops - callbacks from mac802154 to the driver
 *
 * This structure contains various callbacks that the driver may
 * handle or, in some cases, must handle, for example to transmit
 * a frame.
 *
 * start: Handler that 802.15.4 module calls for device initialization.
 *	  This function is called before the first interface is attached.
 *
 * stop:  Handler that 802.15.4 module calls for device cleanup.
 *	  This function is called after the last interface is removed.
 *
 * xmit_sync:
 *	  Handler that 802.15.4 module calls for each transmitted frame.
 *	  skb cntains the buffer starting from the IEEE 802.15.4 header.
{'fraction_non_alphanumeric': 0.06022358456545258, 'fraction_numerical': 0.08101935328765476, 'mean_word_length': 4.164494103041589, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 16, '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': '3358946', 'n_tokens_mistral': 3085, 'n_tokens_neox': 2470, 'n_words': 979}