Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae531b94 authored by Phoebe Buckheister's avatar Phoebe Buckheister Committed by David S. Miller
Browse files

ieee802154: use ieee802154_addr instead of *_sa variants



Change all internal uses of ieee802154_addr_sa to ieee802154_addr,
except for those instances that communicate directly with userspace.

Signed-off-by: default avatarPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e6278d92
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static u8 fake_get_dsn(const struct net_device *dev)
 *       802.15.4-2006 document.
 */
static int fake_assoc_req(struct net_device *dev,
		struct ieee802154_addr_sa *addr, u8 channel, u8 page, u8 cap)
		struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap)
{
	struct wpan_phy *phy = fake_to_phy(dev);

@@ -149,7 +149,7 @@ static int fake_assoc_req(struct net_device *dev,
 *       802.15.4-2006 document.
 */
static int fake_assoc_resp(struct net_device *dev,
		struct ieee802154_addr_sa *addr, __le16 short_addr, u8 status)
		struct ieee802154_addr *addr, __le16 short_addr, u8 status)
{
	return 0;
}
@@ -167,7 +167,7 @@ static int fake_assoc_resp(struct net_device *dev,
 *       document, with the reason described in 7.3.3.2.
 */
static int fake_disassoc_req(struct net_device *dev,
		struct ieee802154_addr_sa *addr, u8 reason)
		struct ieee802154_addr *addr, u8 reason)
{
	return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS);
}
@@ -192,7 +192,7 @@ static int fake_disassoc_req(struct net_device *dev,
 * document, with 7.3.8 describing coordinator realignment.
 */
static int fake_start_req(struct net_device *dev,
			  struct ieee802154_addr_sa *addr, u8 channel, u8 page,
			  struct ieee802154_addr *addr, u8 channel, u8 page,
			  u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
			  u8 coord_realign)
{
+6 −6
Original line number Diff line number Diff line
@@ -200,11 +200,11 @@ struct ieee802154_frag_info {
 */
struct ieee802154_mac_cb {
	u8 lqi;
	struct ieee802154_addr_sa sa;
	struct ieee802154_addr_sa da;
	u8 flags;
	u8 seq;
	struct ieee802154_frag_info frag_info;
	struct ieee802154_addr source;
	struct ieee802154_addr dest;
};

static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
@@ -248,16 +248,16 @@ struct ieee802154_mlme_ops {
	/* The following fields are optional (can be NULL). */

	int (*assoc_req)(struct net_device *dev,
			struct ieee802154_addr_sa *addr,
			struct ieee802154_addr *addr,
			u8 channel, u8 page, u8 cap);
	int (*assoc_resp)(struct net_device *dev,
			struct ieee802154_addr_sa *addr,
			struct ieee802154_addr *addr,
			__le16 short_addr, u8 status);
	int (*disassoc_req)(struct net_device *dev,
			struct ieee802154_addr_sa *addr,
			struct ieee802154_addr *addr,
			u8 reason);
	int (*start_req)(struct net_device *dev,
			struct ieee802154_addr_sa *addr,
			struct ieee802154_addr *addr,
			u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
			u8 pan_coord, u8 blx, u8 coord_realign);
	int (*scan_req)(struct net_device *dev,
+3 −3
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#define IEEE802154_NL_H

struct net_device;
struct ieee802154_addr_sa;
struct ieee802154_addr;

/**
 * ieee802154_nl_assoc_indic - Notify userland of an association request.
@@ -37,7 +37,7 @@ struct ieee802154_addr_sa;
 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
 */
int ieee802154_nl_assoc_indic(struct net_device *dev,
		struct ieee802154_addr_sa *addr, u8 cap);
		struct ieee802154_addr *addr, u8 cap);

/**
 * ieee802154_nl_assoc_confirm - Notify userland of association.
@@ -65,7 +65,7 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev,
 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
 */
int ieee802154_nl_disassoc_indic(struct net_device *dev,
		struct ieee802154_addr_sa *addr, u8 reason);
		struct ieee802154_addr *addr, u8 reason);

/**
 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
+26 −12
Original line number Diff line number Diff line
@@ -168,10 +168,11 @@ static int lowpan_give_skb_to_devices(struct sk_buff *skb,
	return stat;
}

static int process_data(struct sk_buff *skb)
static int process_data(struct sk_buff *skb, const struct ieee802154_hdr *hdr)
{
	u8 iphc0, iphc1;
	const struct ieee802154_addr_sa *_saddr, *_daddr;
	struct ieee802154_addr_sa sa, da;
	void *sap, *dap;

	raw_dump_table(__func__, "raw skb data dump", skb->data, skb->len);
	/* at least two bytes will be used for the encoding */
@@ -184,12 +185,21 @@ static int process_data(struct sk_buff *skb)
	if (lowpan_fetch_skb_u8(skb, &iphc1))
		goto drop;

	_saddr = &mac_cb(skb)->sa;
	_daddr = &mac_cb(skb)->da;
	ieee802154_addr_to_sa(&sa, &hdr->source);
	ieee802154_addr_to_sa(&da, &hdr->dest);

	return lowpan_process_data(skb, skb->dev, (u8 *)_saddr->hwaddr,
				_saddr->addr_type, IEEE802154_ADDR_LEN,
				(u8 *)_daddr->hwaddr, _daddr->addr_type,
	if (sa.addr_type == IEEE802154_ADDR_SHORT)
		sap = &sa.short_addr;
	else
		sap = &sa.hwaddr;

	if (da.addr_type == IEEE802154_ADDR_SHORT)
		dap = &da.short_addr;
	else
		dap = &da.hwaddr;

	return lowpan_process_data(skb, skb->dev, sap, sa.addr_type,
				   IEEE802154_ADDR_LEN, dap, da.addr_type,
				   IEEE802154_ADDR_LEN, iphc0, iphc1,
				   lowpan_give_skb_to_devices);

@@ -438,6 +448,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
	struct packet_type *pt, struct net_device *orig_dev)
{
	struct sk_buff *local_skb;
	struct ieee802154_hdr hdr;
	int ret;

	if (!netif_running(dev))
@@ -446,6 +457,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
	if (dev->type != ARPHRD_IEEE802154)
		goto drop_skb;

	if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
		goto drop_skb;

	local_skb = skb_clone(skb, GFP_ATOMIC);
	if (!local_skb)
		goto drop_skb;
@@ -466,14 +480,14 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
	} else {
		switch (skb->data[0] & 0xe0) {
		case LOWPAN_DISPATCH_IPHC:	/* ipv6 datagram */
			ret = process_data(local_skb);
			ret = process_data(local_skb, &hdr);
			if (ret == NET_RX_DROP)
				goto drop;
			break;
		case LOWPAN_DISPATCH_FRAG1:	/* first fragment header */
			ret = lowpan_frag_rcv(local_skb, LOWPAN_DISPATCH_FRAG1);
			if (ret == 1) {
				ret = process_data(local_skb);
				ret = process_data(local_skb, &hdr);
				if (ret == NET_RX_DROP)
					goto drop;
			}
@@ -481,7 +495,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
		case LOWPAN_DISPATCH_FRAGN:	/* next fragments headers */
			ret = lowpan_frag_rcv(local_skb, LOWPAN_DISPATCH_FRAGN);
			if (ret == 1) {
				ret = process_data(local_skb);
				ret = process_data(local_skb, &hdr);
				if (ret == NET_RX_DROP)
					goto drop;
			}
+1 −1
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,

	if (saddr) {
		saddr->family = AF_IEEE802154;
		saddr->addr = mac_cb(skb)->sa;
		ieee802154_addr_to_sa(&saddr->addr, &mac_cb(skb)->source);
		*addr_len = sizeof(*saddr);
	}

Loading