Skip to contentSkip to conversation

mac802154: several cleanups

PATCH In review Alexander Aring 4 participants 14 messages Jun 6, 2015 – Jun 7, 2015

Subsystems (6)
lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

cover mac802154: several cleanups

Hi,

this patch series contains various cleanups for mac802154 header. Also I cleanup a little bit the comments for several structs and flag definitions. This also prepares for handling a API documentation generation via docbook. The flags are enums now which is similar like mac80211 handling.

- Alex

Cc Stefan Schmidt <[email protected]>
Cc Varka Bhadram <[email protected]>
Cc Alan Ott <[email protected]>
Cc Lennert Buytenhek <[email protected]>

Alexander Aring (8):
mac802154: remove unneeded vif struct
mac802154: cleanup address filtering flags
mac802154: remove aack hw flag
mac802154: cleanup ieee802154 hardware flags
mac802154: remove unused hw_filt attribute
mac802154: rearrange attribute in ieee802154_hw
mac802154: add missing structure comments
mac802154: change pan_coord type to bool

 drivers/net/ieee802154/at86rf230.c |   3 +-
 drivers/net/ieee802154/atusb.c     |   2 +-
 drivers/net/ieee802154/cc2520.c    |   4 +-
 drivers/net/ieee802154/mrf24j40.c  |   3 +-
 include/net/mac802154.h            | 136 ++++++++++++++++++++++++-------------
 net/mac802154/ieee802154_i.h       |   2 -
 net/mac802154/iface.c              |   9 ++-
 net/mac802154/rx.c                 |   4 +-
 8 files changed, 97 insertions(+), 66 deletions(-)
Signature · 1 line
2.4.1
author maintainer
#1 lore raw

PATCH 1/8 mac802154: remove unneeded vif struct

This patch removes the virtual interface structure from sub if data struct, because it isn't used anywhere. This structure could be useful for give per interface information at softmac driver layer. Nevertheless there exist no use case currently and it contains the interface type information currently. This information is also stored inside wpan dev which is now used to check on the wpan dev interface type.

---
 drivers/net/ieee802154/at86rf230.c | 1 -
 drivers/net/ieee802154/cc2520.c    | 1 -
 include/net/mac802154.h            | 8 --------
 net/mac802154/ieee802154_i.h       | 2 --
 net/mac802154/iface.c              | 9 ++++-----
 net/mac802154/rx.c                 | 4 ++--
 6 files changed, 6 insertions(+), 19 deletions(-)
drivers/net/ieee802154/at86rf230.c +0 -1
index 2f25a5e..6e20e9c 100644
@@ -1602,7 +1602,6 @@ static int at86rf230_probe(struct spi_device *spi)
 	lp->spi = spi;
 	lp->slp_tr = slp_tr;
 	hw->parent = &spi->dev;
-	hw->vif_data_size = sizeof(*lp);
 	ieee802154_random_extended_addr(&hw->phy->perm_extended_addr);
 
 	lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
drivers/net/ieee802154/cc2520.c +0 -1
index 8141353..a8bafd6 100644
@@ -742,7 +742,6 @@ static int cc2520_register(struct cc2520_private *priv)
 	priv->hw->priv = priv;
 	priv->hw->parent = &priv->spi->dev;
 	priv->hw->extra_tx_headroom = 0;
-	priv->hw->vif_data_size = sizeof(*priv);
 	ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);
 
 	/* We do support only 2.4 Ghz */
include/net/mac802154.h +0 -8
index 9605c7f..80a9e60 100644
@@ -56,13 +56,6 @@ struct ieee802154_hw_addr_filt {
 	u8	pan_coord;
 };
 
-struct ieee802154_vif {
-	int type;
-
-	/* must be last */
-	u8 drv_priv[0] __aligned(sizeof(void *));
-};
-
 struct ieee802154_hw {
 	/* filled by the driver */
 	int	extra_tx_headroom;
@@ -73,7 +66,6 @@ struct ieee802154_hw {
 	struct	ieee802154_hw_addr_filt hw_filt;
 	void	*priv;
 	struct	wpan_phy *phy;
-	size_t vif_data_size;
 };
 
 /* Checksum is in hardware and is omitted from a packet
net/mac802154/ieee802154_i.h +0 -2
index eec668f..34755d5 100644
@@ -92,8 +92,6 @@ struct ieee802154_sub_if_data {
 	struct mutex sec_mtx;
 
 	struct mac802154_llsec sec;
-	/* must be last, dynamically sized area in this! */
-	struct ieee802154_vif vif;
 };
 
 #define MAC802154_CHAN_NONE		0xff /* No channel is assigned */
net/mac802154/iface.c +4 -5
index 6ac0239..3a67d35 100644
@@ -219,8 +219,8 @@ ieee802154_check_concurrent_iface(struct ieee802154_sub_if_data *sdata,
 			 * exist really an use case if we need to support
 			 * multiple node types at the same time.
 			 */
-			if (sdata->vif.type == NL802154_IFTYPE_NODE &&
-			    nsdata->vif.type == NL802154_IFTYPE_NODE)
+			if (wpan_dev->iftype == NL802154_IFTYPE_NODE &&
+			    nsdata->wpan_dev.iftype == NL802154_IFTYPE_NODE)
 				return -EBUSY;
 
 			/* check all phy mac sublayer settings are the same.
@@ -243,7 +243,7 @@ static int mac802154_wpan_open(struct net_device *dev)
 	struct ieee802154_local *local = sdata->local;
 	struct wpan_dev *wpan_dev = &sdata->wpan_dev;
 
-	rc = ieee802154_check_concurrent_iface(sdata, sdata->vif.type);
+	rc = ieee802154_check_concurrent_iface(sdata, wpan_dev->iftype);
 	if (rc < 0)
 		return rc;
 
@@ -467,7 +467,6 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
 	u8 tmp;
 
 	/* set some type-dependent values */
-	sdata->vif.type = type;
 	sdata->wpan_dev.iftype = type;
 
 	get_random_bytes(&tmp, sizeof(tmp));
@@ -523,7 +522,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
 
 	ASSERT_RTNL();
 
-	ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name,
+	ndev = alloc_netdev(sizeof(*sdata), name,
 			    name_assign_type, ieee802154_if_setup);
 	if (!ndev)
 		return ERR_PTR(-ENOMEM);
net/mac802154/rx.c +2 -2
index e0f1006..1bdf980 100644
@@ -202,7 +202,7 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local,
 	}
 
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
-		if (sdata->vif.type != NL802154_IFTYPE_NODE ||
+		if (sdata->wpan_dev.iftype != NL802154_IFTYPE_NODE ||
 		    !netif_running(sdata->dev))
 			continue;
 
@@ -227,7 +227,7 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
 	skb->protocol = htons(ETH_P_IEEE802154);
 
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
-		if (sdata->vif.type != NL802154_IFTYPE_MONITOR)
+		if (sdata->wpan_dev.iftype != NL802154_IFTYPE_MONITOR)
 			continue;
 
 		if (!ieee802154_sdata_running(sdata))
Signature · 1 line
2.4.1
Acked-by on v1 1/8
#2 lore raw

Re: [PATCH bluetooth-next 1/8] mac802154: remove unneeded vif struct

Hi,

Quoted 35 lines · Alexander Aring

This patch removes the virtual interface structure from sub if data struct, because it isn't used anywhere. This structure could be useful for give per interface information at softmac driver layer. Nevertheless there exist no use case currently and it contains the interface type information currently. This information is also stored inside wpan dev which is now used to check on the wpan dev interface type.

---
  drivers/net/ieee802154/at86rf230.c | 1 -
  drivers/net/ieee802154/cc2520.c    | 1 -
  include/net/mac802154.h            | 8 --------
  net/mac802154/ieee802154_i.h       | 2 --
  net/mac802154/iface.c              | 9 ++++-----
  net/mac802154/rx.c                 | 4 ++--
  6 files changed, 6 insertions(+), 19 deletions(-)
drivers/net/ieee802154/at86rf230.c +0 -1
index 2f25a5e..6e20e9c 100644
@@ -1602,7 +1602,6 @@ static int at86rf230_probe(struct spi_device *spi)
  	lp->spi = spi;
  	lp->slp_tr = slp_tr;
  	hw->parent = &spi->dev;
-	hw->vif_data_size = sizeof(*lp);
  	ieee802154_random_extended_addr(&hw->phy->perm_extended_addr);
 
  	lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
drivers/net/ieee802154/cc2520.c +0 -0
index 8141353..a8bafd6 100644

drivers/net/ieee802154/cc2520.c static int cc2520_register(struct cc2520_private *priv) · line 746

Quoted 6 lines
drivers/net/ieee802154/cc2520.c +0 -1
@@ -742,7 +742,6 @@ static int cc2520_register(struct cc2520_private *priv)
  	priv->hw->priv = priv;
  	priv->hw->parent = &priv->spi->dev;
  	priv->hw->extra_tx_headroom = 0;
-	priv->hw->vif_data_size = sizeof(*priv);
  	ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);
 

Thanks.

Signature · 1 line
Varka Bhadram.
author maintainer
#3 lore raw

PATCH 2/8 mac802154: cleanup address filtering flags

In reply to Alexander Aring

This patch changes the address filtering flags to enums and setting the flag values with the BIT macro. Additional this patch changes the commenting style for matching usual kernel style.

---
 include/net/mac802154.h | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)
include/net/mac802154.h +21 -10
index 80a9e60..845e4f8 100644
@@ -31,18 +31,29 @@
  */
 #define MAC802154_FRAME_HARD_HEADER_LEN		(2 + 1 + 20 + 14)
 
-/* The following flags are used to indicate changed address settings from
+/**
+ * enum ieee802154_hw_addr_filt_flags - hardware address filtering flags
+ *
+ * The following flags are used to indicate changed address settings from
  * the stack to the hardware.
+ *
+ * @IEEE802154_AFILT_SADDR_CHANGED: Indicates that the short address will be
+ *	change.
+ *
+ * @IEEE802154_AFILT_IEEEADDR_CHANGED: Indicates that the extended address
+ *	will be change.
+ *
+ * @IEEE802154_AFILT_PANID_CHANGED: Indicates that the pan id will be change.
+ *
+ * @IEEE802154_AFILT_PANC_CHANGED: Indicates that the address filter will
+ *	do frame address filtering as a pan coordinator.
  */
-
-/* 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
+enum ieee802154_hw_addr_filt_flags {
+	IEEE802154_AFILT_SADDR_CHANGED		= BIT(1),
+	IEEE802154_AFILT_IEEEADDR_CHANGED	= BIT(2),
+	IEEE802154_AFILT_PANID_CHANGED		= BIT(3),
+	IEEE802154_AFILT_PANC_CHANGED		= BIT(4),
+};
 
 struct ieee802154_hw_addr_filt {
 	__le16	pan_id;		/* Each independent PAN selects a unique
Signature · 1 line
2.4.1
author maintainer
#4 lore raw

PATCH 3/8 mac802154: remove aack hw flag

In reply to Alexander Aring

This patch removes the hardware auto acknowdledge flag which indicates that the transceiver supports this handling. This flag is never evaluated inside mac802154 and all transceivers should support this handling by default per hardware.

---
 drivers/net/ieee802154/at86rf230.c | 2 +-
 drivers/net/ieee802154/atusb.c     | 2 +-
 drivers/net/ieee802154/cc2520.c    | 3 +--
 drivers/net/ieee802154/mrf24j40.c  | 3 +--
 include/net/mac802154.h            | 2 --
 5 files changed, 4 insertions(+), 8 deletions(-)
drivers/net/ieee802154/at86rf230.c +1 -1
index 6e20e9c..1bf86d2 100644
@@ -1443,7 +1443,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
 		return -EINVAL;
 	}
 
-	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
+	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
 			IEEE802154_HW_CSMA_PARAMS |
 			IEEE802154_HW_FRAME_RETRIES | IEEE802154_HW_AFILT |
 			IEEE802154_HW_PROMISCUOUS;
drivers/net/ieee802154/atusb.c +1 -1
index 3d25678..80dfc72 100644
@@ -628,7 +628,7 @@ static int atusb_probe(struct usb_interface *interface,
 
 	hw->parent = &usb_dev->dev;
 	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
-		    IEEE802154_HW_AACK | IEEE802154_HW_PROMISCUOUS;
+		    IEEE802154_HW_PROMISCUOUS;
 
 	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER;
 
drivers/net/ieee802154/cc2520.c +1 -2
index a8bafd6..15f263c 100644
@@ -746,8 +746,7 @@ static int cc2520_register(struct cc2520_private *priv)
 
 	/* We do support only 2.4 Ghz */
 	priv->hw->phy->supported.channels[0] = 0x7FFF800;
-	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
-			  IEEE802154_HW_AFILT;
+	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AFILT;
 
 	priv->hw->phy->flags = WPAN_PHY_FLAG_TXPOWER;
 
drivers/net/ieee802154/mrf24j40.c +1 -2
index f2a1bd1..99c7676 100644
@@ -751,8 +751,7 @@ static int mrf24j40_probe(struct spi_device *spi)
 	devrec->hw->priv = devrec;
 	devrec->hw->parent = &devrec->spi->dev;
 	devrec->hw->phy->supported.channels[0] = CHANNEL_MASK;
-	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
-			    IEEE802154_HW_AFILT;
+	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AFILT;
 
 	dev_dbg(printdev(devrec), "registered mrf24j40\n");
 	ret = ieee802154_register_hw(devrec->hw);
include/net/mac802154.h +0 -2
index 845e4f8..a20ba28 100644
@@ -90,8 +90,6 @@ struct ieee802154_hw {
 
 /* Indicates that xmitter will add FCS on it's own. */
 #define IEEE802154_HW_TX_OMIT_CKSUM	0x00000001
-/* Indicates that receiver will autorespond with ACK frames. */
-#define IEEE802154_HW_AACK		0x00000002
 /* Indicates that transceiver will support listen before transmit. */
 #define IEEE802154_HW_LBT		0x00000004
 /* Indicates that transceiver will support csma (max_be, min_be, csma retries)
Signature · 1 line
2.4.1
Acked-by on v1 3/8
#5 lore raw

Re: [PATCH bluetooth-next 3/8] mac802154: remove aack hw flag

Hello.

Quoted 77 lines · Alexander Aring

This patch removes the hardware auto acknowdledge flag which indicates that the transceiver supports this handling. This flag is never evaluated inside mac802154 and all transceivers should support this handling by default per hardware.

---
  drivers/net/ieee802154/at86rf230.c | 2 +-
  drivers/net/ieee802154/atusb.c     | 2 +-
  drivers/net/ieee802154/cc2520.c    | 3 +--
  drivers/net/ieee802154/mrf24j40.c  | 3 +--
  include/net/mac802154.h            | 2 --
  5 files changed, 4 insertions(+), 8 deletions(-)
drivers/net/ieee802154/at86rf230.c +1 -1
index 6e20e9c..1bf86d2 100644
@@ -1443,7 +1443,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
  		return -EINVAL;
  	}
 
-	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
+	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
  			IEEE802154_HW_CSMA_PARAMS |
  			IEEE802154_HW_FRAME_RETRIES | IEEE802154_HW_AFILT |
  			IEEE802154_HW_PROMISCUOUS;
drivers/net/ieee802154/atusb.c +1 -1
index 3d25678..80dfc72 100644
@@ -628,7 +628,7 @@ static int atusb_probe(struct usb_interface *interface,
 
  	hw->parent = &usb_dev->dev;
  	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
-		    IEEE802154_HW_AACK | IEEE802154_HW_PROMISCUOUS;
+		    IEEE802154_HW_PROMISCUOUS;
 
  	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER;
 
drivers/net/ieee802154/cc2520.c +1 -2
index a8bafd6..15f263c 100644
@@ -746,8 +746,7 @@ static int cc2520_register(struct cc2520_private *priv)
 
  	/* We do support only 2.4 Ghz */
  	priv->hw->phy->supported.channels[0] = 0x7FFF800;
-	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
-			  IEEE802154_HW_AFILT;
+	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AFILT;
 
  	priv->hw->phy->flags = WPAN_PHY_FLAG_TXPOWER;
 
drivers/net/ieee802154/mrf24j40.c +1 -2
index f2a1bd1..99c7676 100644
@@ -751,8 +751,7 @@ static int mrf24j40_probe(struct spi_device *spi)
  	devrec->hw->priv = devrec;
  	devrec->hw->parent = &devrec->spi->dev;
  	devrec->hw->phy->supported.channels[0] = CHANNEL_MASK;
-	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
-			    IEEE802154_HW_AFILT;
+	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AFILT;
 
  	dev_dbg(printdev(devrec), "registered mrf24j40\n");
  	ret = ieee802154_register_hw(devrec->hw);
include/net/mac802154.h +0 -0
index 845e4f8..a20ba28 100644

include/net/mac802154.h struct ieee802154_hw { · line 95

Quoted 8 lines
include/net/mac802154.h +0 -2
@@ -90,8 +90,6 @@ struct ieee802154_hw {
 
  /* Indicates that xmitter will add FCS on it's own. */
  #define IEEE802154_HW_TX_OMIT_CKSUM	0x00000001
-/* Indicates that receiver will autorespond with ACK frames. */
-#define IEEE802154_HW_AACK		0x00000002
  /* Indicates that transceiver will support listen before transmit. */
  #define IEEE802154_HW_LBT		0x00000004
  /* Indicates that transceiver will support csma (max_be, min_be, csma retries)

For the atusb hunk:

regards
Stefan Schmidt

Acked-by on v1 3/8
#6 lore raw

Re: [PATCH bluetooth-next 3/8] mac802154: remove aack hw flag

In reply to Alexander Aring

Hi,

Quoted 49 lines · Alexander Aring

This patch removes the hardware auto acknowdledge flag which indicates that the transceiver supports this handling. This flag is never evaluated inside mac802154 and all transceivers should support this handling by default per hardware.

---
  drivers/net/ieee802154/at86rf230.c | 2 +-
  drivers/net/ieee802154/atusb.c     | 2 +-
  drivers/net/ieee802154/cc2520.c    | 3 +--
  drivers/net/ieee802154/mrf24j40.c  | 3 +--
  include/net/mac802154.h            | 2 --
  5 files changed, 4 insertions(+), 8 deletions(-)
drivers/net/ieee802154/at86rf230.c +1 -1
index 6e20e9c..1bf86d2 100644
@@ -1443,7 +1443,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
  		return -EINVAL;
  	}
 
-	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
+	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
  			IEEE802154_HW_CSMA_PARAMS |
  			IEEE802154_HW_FRAME_RETRIES | IEEE802154_HW_AFILT |
  			IEEE802154_HW_PROMISCUOUS;
drivers/net/ieee802154/atusb.c +1 -1
index 3d25678..80dfc72 100644
@@ -628,7 +628,7 @@ static int atusb_probe(struct usb_interface *interface,
 
  	hw->parent = &usb_dev->dev;
  	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
-		    IEEE802154_HW_AACK | IEEE802154_HW_PROMISCUOUS;
+		    IEEE802154_HW_PROMISCUOUS;
 
  	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER;
 
drivers/net/ieee802154/cc2520.c +0 -0
index a8bafd6..15f263c 100644

drivers/net/ieee802154/cc2520.c static int cc2520_register(struct cc2520_private *priv) · line 749

Quoted 6 lines
drivers/net/ieee802154/cc2520.c +1 -2
@@ -746,8 +746,7 @@ static int cc2520_register(struct cc2520_private *priv)
 
  	/* We do support only 2.4 Ghz */
  	priv->hw->phy->supported.channels[0] = 0x7FFF800;
-	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
-			  IEEE802154_HW_AFILT;
+	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AFILT;

Thanks.

Signature · 1 line
Varka Bhadram.
author maintainer
#7 lore raw

PATCH 4/8 mac802154: cleanup ieee802154 hardware flags

In reply to Alexander Aring

This patch changes the ieee802154 hardware flags to enums and setting the flag values with the BIT macro. Additional this patch changes the commenting style for matching usual kernel style.

---
 include/net/mac802154.h | 56 +++++++++++++++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 20 deletions(-)
include/net/mac802154.h +36 -20
index a20ba28..c21a700 100644
@@ -79,32 +79,48 @@ struct ieee802154_hw {
 	struct	wpan_phy *phy;
 };
 
-/* Checksum is in hardware and is omitted from a packet
+/**
+ * enum ieee802154_hw_flags - hardware flags
  *
- * These following flags are used to indicate hardware capabilities to
+ * These 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.
+ *
+ * @IEEE802154_HW_TX_OMIT_CKSUM: Indicates that xmitter will add FCS on it's
+ *	own.
+ *
+ * @IEEE802154_HW_LBT: Indicates that transceiver will support listen before
+ *	transmit.
+ *
+ * @IEEE802154_HW_CSMA_PARAMS: Indicates that transceiver will support csma
+ *	parameters (max_be, min_be, backoff exponents).
+ *
+ * @IEEE802154_HW_FRAME_RETRIES: Indicates that transceiver will support ARET
+ *	frame retries setting.
+ *
+ * @IEEE802154_HW_AFILT: Indicates that transceiver will support hardware
+ *	address filter setting.
+ *
+ * @IEEE802154_HW_PROMISCUOUS: Indicates that transceiver will support
+ *	promiscuous mode setting.
+ *
+ * @IEEE802154_HW_RX_OMIT_CKSUM: Indicates that receiver omits FCS.
+ *
+ * @IEEE802154_HW_RX_DROP_BAD_CKSUM: Indicates that receiver will not filter
+ *	frames with bad checksum.
  */
-
-/* Indicates that xmitter will add FCS on it's own. */
-#define IEEE802154_HW_TX_OMIT_CKSUM	0x00000001
-/* Indicates that transceiver will support listen before transmit. */
-#define IEEE802154_HW_LBT		0x00000004
-/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
- * settings. */
-#define IEEE802154_HW_CSMA_PARAMS	0x00000008
-/* Indicates that transceiver will support ARET frame retries setting. */
-#define IEEE802154_HW_FRAME_RETRIES	0x00000010
-/* Indicates that transceiver will support hardware address filter setting. */
-#define IEEE802154_HW_AFILT		0x00000020
-/* Indicates that transceiver will support promiscuous mode setting. */
-#define IEEE802154_HW_PROMISCUOUS	0x00000040
-/* Indicates that receiver omits FCS. */
-#define IEEE802154_HW_RX_OMIT_CKSUM	0x00000080
-/* Indicates that receiver will not filter frames with bad checksum. */
-#define IEEE802154_HW_RX_DROP_BAD_CKSUM	0x00000100
+enum ieee802154_hw_flags {
+	IEEE802154_HW_TX_OMIT_CKSUM	= BIT(1),
+	IEEE802154_HW_LBT		= BIT(2),
+	IEEE802154_HW_CSMA_PARAMS	= BIT(3),
+	IEEE802154_HW_FRAME_RETRIES	= BIT(4),
+	IEEE802154_HW_AFILT		= BIT(5),
+	IEEE802154_HW_PROMISCUOUS	= BIT(6),
+	IEEE802154_HW_RX_OMIT_CKSUM	= BIT(7),
+	IEEE802154_HW_RX_DROP_BAD_CKSUM	= BIT(8),
+};
 
 /* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
 #define IEEE802154_HW_OMIT_CKSUM	(IEEE802154_HW_TX_OMIT_CKSUM | \
Signature · 1 line
2.4.1
author maintainer
#8 lore raw

PATCH 5/8 mac802154: remove unused hw_filt attribute

In reply to Alexander Aring

This patch removed an attribute from ieee802154_hw structure which is never used inside kernel. Address information are stored inside wpan_dev nowadays.

---
 include/net/mac802154.h | 1 -
 1 file changed, 1 deletion(-)
include/net/mac802154.h +0 -1
index c21a700..61d4b80 100644
@@ -74,7 +74,6 @@ struct ieee802154_hw {
 	struct	device *parent;
 
 	/* filled by mac802154 core */
-	struct	ieee802154_hw_addr_filt hw_filt;
 	void	*priv;
 	struct	wpan_phy *phy;
 };
Signature · 1 line
2.4.1
author maintainer
#9 lore raw

PATCH 6/8 mac802154: rearrange attribute in ieee802154_hw

In reply to Alexander Aring

This patch removes the priv attribute in ieee802154_hw to the right section which is commented by attributes which needs to be filled by driver layer.

---
 include/net/mac802154.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mac802154.h +1 -1
index 61d4b80..d8e9e6f 100644
@@ -72,9 +72,9 @@ struct ieee802154_hw {
 	int	extra_tx_headroom;
 	u32	flags;
 	struct	device *parent;
+	void	*priv;
 
 	/* filled by mac802154 core */
-	void	*priv;
 	struct	wpan_phy *phy;
 };
 
Signature · 1 line
2.4.1
author maintainer
#10 lore raw

PATCH 7/8 mac802154: add missing structure comments

In reply to Alexander Aring

This patch add missing comments to internal mac802154 structures.

---
 include/net/mac802154.h | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
include/net/mac802154.h +28 -6
index d8e9e6f..095c9d0 100644
@@ -55,18 +55,40 @@ enum ieee802154_hw_addr_filt_flags {
 	IEEE802154_AFILT_PANC_CHANGED		= BIT(4),
 };
 
+/**
+ * struct ieee802154_hw_addr_filt - hardware address filtering settings
+ *
+ * @pan_id: pan_id which should be set to the hardware address filter.
+ *
+ * @short_addr: short_addr which should be set to the hardware address filter.
+ *
+ * @ieee_addr: extended address which should be set to the hardware address
+ *	filter.
+ *
+ * @pan_coord: boolean if hardware filtering should be operate as coordinator.
+ */
 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	pan_id;
 	__le16	short_addr;
 	__le64	ieee_addr;
 	u8	pan_coord;
 };
 
+/**
+ * struct ieee802154_hw - ieee802154 hardware
+ *
+ * @extra_tx_headroom: headroom to reserve in each transmit skb for use by the
+ *	driver (e.g. for transmit headers.)
+ *
+ * @flags: hardware flags, see &enum ieee802154_hw_flags
+ *
+ * @parent: parent device of the hardware.
+ *
+ * @priv: pointer to private area that was allocated for driver use along with
+ *	this structure.
+ *
+ * @phy: This points to the &struct wpan_phy allocated for this 802.15.4 PHY.
+ */
 struct ieee802154_hw {
 	/* filled by the driver */
 	int	extra_tx_headroom;
Signature · 1 line
2.4.1
author maintainer
#11 lore raw

PATCH 8/8 mac802154: change pan_coord type to bool

In reply to Alexander Aring

To indicate if it's a coordinator or not a bool is enough. There should no more values available which represent some other state.

---
 include/net/mac802154.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mac802154.h +1 -1
index 095c9d0..de1cdde 100644
@@ -71,7 +71,7 @@ struct ieee802154_hw_addr_filt {
 	__le16	pan_id;
 	__le16	short_addr;
 	__le64	ieee_addr;
-	u8	pan_coord;
+	bool	pan_coord;
 };
 
 /**
Signature · 1 line
2.4.1
Reviewed-by on the v1 series
#12 lore raw
In reply to Alexander Aring

Hi,

Quoted 25 lines · Alexander Aring

Hi,

this patch series contains various cleanups for mac802154 header. Also I cleanup a little bit the comments for several structs and flag definitions. This also prepares for handling a API documentation generation via docbook. The flags are enums now which is similar like mac80211 handling.

- Alex

Cc Stefan Schmidt <[email protected]>
Cc Varka Bhadram <[email protected]>
Cc Alan Ott <[email protected]>
Cc Lennert Buytenhek <[email protected]>

Alexander Aring (8):
mac802154: remove unneeded vif struct
mac802154: cleanup address filtering flags
mac802154: remove aack hw flag
mac802154: cleanup ieee802154 hardware flags
mac802154: remove unused hw_filt attribute
mac802154: rearrange attribute in ieee802154_hw
mac802154: add missing structure comments
mac802154: change pan_coord type to bool

Quoted 10 lines
  drivers/net/ieee802154/at86rf230.c |   3 +-
  drivers/net/ieee802154/atusb.c     |   2 +-
  drivers/net/ieee802154/cc2520.c    |   4 +-
  drivers/net/ieee802154/mrf24j40.c  |   3 +-
  include/net/mac802154.h            | 136 ++++++++++++++++++++++++-------------
  net/mac802154/ieee802154_i.h       |   2 -
  net/mac802154/iface.c              |   9 ++-
  net/mac802154/rx.c                 |   4 +-
  8 files changed, 97 insertions(+), 66 deletions(-)
Signature · 1 line
Varka Bhadram.
#13 lore raw
In reply to Alexander Aring

Hi Alex,

Quoted 23 lines

this patch series contains various cleanups for mac802154 header. Also I cleanup a little bit the comments for several structs and flag definitions. This also prepares for handling a API documentation generation via docbook. The flags are enums now which is similar like mac80211 handling.

- Alex

Cc Stefan Schmidt <[email protected]>
Cc Varka Bhadram <[email protected]>
Cc Alan Ott <[email protected]>
Cc Lennert Buytenhek <[email protected]>

Alexander Aring (8):
mac802154: remove unneeded vif struct
mac802154: cleanup address filtering flags
mac802154: remove aack hw flag
mac802154: cleanup ieee802154 hardware flags
mac802154: remove unused hw_filt attribute
mac802154: rearrange attribute in ieee802154_hw
mac802154: add missing structure comments
mac802154: change pan_coord type to bool

Quoted 9 lines
drivers/net/ieee802154/at86rf230.c |   3 +-
drivers/net/ieee802154/atusb.c     |   2 +-
drivers/net/ieee802154/cc2520.c    |   4 +-
drivers/net/ieee802154/mrf24j40.c  |   3 +-
include/net/mac802154.h            | 136 ++++++++++++++++++++++++-------------
net/mac802154/ieee802154_i.h       |   2 -
net/mac802154/iface.c              |   9 ++-
net/mac802154/rx.c                 |   4 +-
8 files changed, 97 insertions(+), 66 deletions(-)

all 8 patches have been applied to bluetooth-next tree.

Regards

Marcel