[PATCH 06/16] staging: rtl8192e: Replace struct rtllib_hdr_3addr in structs of rtllib.h

From: Philipp Hortmann
Date: Fri Sep 15 2023 - 12:08:14 EST


Replace struct rtllib_hdr_3addr with struct ieee80211_hdr_3addr to avoid
proprietary struct in structs of rtllib.h.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx>
---
drivers/staging/rtl8192e/rtllib.h | 24 +++++++----------------
drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
drivers/staging/rtl8192e/rtllib_softmac.c | 18 ++++++++---------
3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index c13268ad6b56..55f96f446f9e 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -685,16 +685,6 @@ struct rtllib_hdr {
u8 payload[];
} __packed;

-struct rtllib_hdr_3addr {
- __le16 frame_ctl;
- __le16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 addr3[ETH_ALEN];
- __le16 seq_ctl;
- u8 payload[];
-} __packed;
-
struct rtllib_hdr_4addr {
__le16 frame_ctl;
__le16 duration_id;
@@ -736,7 +726,7 @@ struct rtllib_info_element {
} __packed;

struct rtllib_authentication {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
__le16 algorithm;
__le16 transaction;
__le16 status;
@@ -745,23 +735,23 @@ struct rtllib_authentication {
} __packed;

struct rtllib_disauth {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
__le16 reason;
} __packed;

struct rtllib_disassoc {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
__le16 reason;
} __packed;

struct rtllib_probe_request {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
/* SSID, supported rates */
struct rtllib_info_element info_element[];
} __packed;

struct rtllib_probe_response {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
u32 time_stamp[2];
__le16 beacon_interval;
__le16 capability;
@@ -775,7 +765,7 @@ struct rtllib_probe_response {
#define rtllib_beacon rtllib_probe_response

struct rtllib_assoc_request_frame {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
__le16 capability;
__le16 listen_interval;
/* SSID, supported rates, RSN */
@@ -783,7 +773,7 @@ struct rtllib_assoc_request_frame {
} __packed;

struct rtllib_assoc_response_frame {
- struct rtllib_hdr_3addr header;
+ struct ieee80211_hdr_3addr header;
__le16 capability;
__le16 status;
__le16 aid;
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index dddd38bbc648..0c2135431f5b 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2483,7 +2483,7 @@ static inline void rtllib_process_probe_response(
short renew;
struct rtllib_network *network = kzalloc(sizeof(struct rtllib_network),
GFP_ATOMIC);
- __le16 frame_ctl = beacon->header.frame_ctl;
+ __le16 frame_ctl = beacon->header.frame_control;

if (!network)
return;
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index e3b15fa0edcb..3c61b6f4f69f 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -331,7 +331,7 @@ static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee)
skb_reserve(skb, ieee->tx_headroom);

req = skb_put(skb, sizeof(struct rtllib_probe_request));
- req->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_PROBE_REQ);
+ req->header.frame_control = cpu_to_le16(RTLLIB_STYPE_PROBE_REQ);
req->header.duration_id = 0;

eth_broadcast_addr(req->header.addr1);
@@ -739,9 +739,9 @@ rtllib_authentication_req(struct rtllib_network *beacon,

auth = skb_put(skb, sizeof(struct rtllib_authentication));

- auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH);
+ auth->header.frame_control = cpu_to_le16(RTLLIB_STYPE_AUTH);
if (challengelen)
- auth->header.frame_ctl |= cpu_to_le16(RTLLIB_FCTL_WEP);
+ auth->header.frame_control |= cpu_to_le16(RTLLIB_FCTL_WEP);

auth->header.duration_id = cpu_to_le16(0x013a);
ether_addr_copy(auth->header.addr1, beacon->bssid);
@@ -860,7 +860,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee,
if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);

- beacon_buf->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_PROBE_RESP);
+ beacon_buf->header.frame_control = cpu_to_le16(RTLLIB_STYPE_PROBE_RESP);
beacon_buf->info_element[0].id = MFIE_TYPE_SSID;
beacon_buf->info_element[0].len = ssid_len;

@@ -1076,7 +1076,7 @@ rtllib_association_req(struct rtllib_network *beacon,

hdr = skb_put(skb, sizeof(struct rtllib_assoc_request_frame) + 2);

- hdr->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_ASSOC_REQ);
+ hdr->header.frame_control = cpu_to_le16(RTLLIB_STYPE_ASSOC_REQ);
hdr->header.duration_id = cpu_to_le16(37);
ether_addr_copy(hdr->header.addr1, beacon->bssid);
ether_addr_copy(hdr->header.addr2, ieee->dev->dev_addr);
@@ -2488,7 +2488,7 @@ static struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee)
return NULL;

b = (struct rtllib_probe_response *)skb->data;
- b->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_BEACON);
+ b->header.frame_control = cpu_to_le16(RTLLIB_STYPE_BEACON);

return skb;
}
@@ -2503,7 +2503,7 @@ struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee)
return NULL;

b = (struct rtllib_probe_response *)skb->data;
- b->header.seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
+ b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4);

if (ieee->seq_ctrl[0] == 0xFFF)
ieee->seq_ctrl[0] = 0;
@@ -2730,7 +2730,7 @@ rtllib_disauth_skb(struct rtllib_network *beacon,
skb_reserve(skb, ieee->tx_headroom);

disauth = skb_put(skb, sizeof(struct rtllib_disauth));
- disauth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DEAUTH);
+ disauth->header.frame_control = cpu_to_le16(RTLLIB_STYPE_DEAUTH);
disauth->header.duration_id = 0;

ether_addr_copy(disauth->header.addr1, beacon->bssid);
@@ -2757,7 +2757,7 @@ rtllib_disassociate_skb(struct rtllib_network *beacon,
skb_reserve(skb, ieee->tx_headroom);

disass = skb_put(skb, sizeof(struct rtllib_disassoc));
- disass->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DISASSOC);
+ disass->header.frame_control = cpu_to_le16(RTLLIB_STYPE_DISASSOC);
disass->header.duration_id = 0;

ether_addr_copy(disass->header.addr1, beacon->bssid);
--
2.42.0