Commit 1a90b6e2 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: remove to_fr_ds from struct rx_pkt_attrib



to_fr_ds in struct rx_pkt_attrib stores the values of the to_ds and
from_ds bits of an incoming data frame. to_fr_ds is set by parsing the
frame control bytes and it's used only in validate_recv_data_frame.

Remove to_fr_ds from struct rx_pkt_attrib and use the ieee80211 helpers
to distinguish between the four different cases for to_ds, from_ds.

Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220403165438.357728-8-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d9290327
Loading
Loading
Loading
Loading
+10 −16
Original line number Diff line number Diff line
@@ -958,25 +958,22 @@ static int validate_recv_data_frame(struct adapter *adapter,

	memcpy(pattrib->bssid, pbssid, ETH_ALEN);

	switch (pattrib->to_fr_ds) {
	case 0:
		memcpy(pattrib->ra, pda, ETH_ALEN);
		memcpy(pattrib->ta, psa, ETH_ALEN);
		ret = sta2sta_data_frame(adapter, precv_frame, &psta);
		break;
	case 1:
	/* address4 is used only if both to_ds and from_ds are set */
	if (ieee80211_has_a4(hdr->frame_control))
		return _FAIL;

	if (ieee80211_has_fromds(hdr->frame_control)) {
		memcpy(pattrib->ra, pda, ETH_ALEN);
		memcpy(pattrib->ta, pbssid, ETH_ALEN);
		ret = ap2sta_data_frame(adapter, precv_frame, &psta);
		break;
	case 2:
	} else if (ieee80211_has_tods(hdr->frame_control)) {
		memcpy(pattrib->ra, pbssid, ETH_ALEN);
		memcpy(pattrib->ta, psa, ETH_ALEN);
		ret = sta2ap_data_frame(adapter, precv_frame, &psta);
		break;
	default:
		ret = _FAIL;
		break;
	} else {
		memcpy(pattrib->ra, pda, ETH_ALEN);
		memcpy(pattrib->ta, psa, ETH_ALEN);
		ret = sta2sta_data_frame(adapter, precv_frame, &psta);
	}

	if (ret == _FAIL || ret == RTW_RX_HANDLED)
@@ -1035,7 +1032,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv

	int retval = _FAIL;
	struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
	u8 *ptr = precv_frame->rx_data;
	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
	struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;

@@ -1048,8 +1044,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
	if ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_VERS)) != 0)
		return _FAIL;

	pattrib->to_fr_ds = get_tofr_ds(ptr);

	pattrib->frag_num = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
	pattrib->seq_num = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));

+0 −1
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ struct rx_pkt_attrib {
	u8	drvinfo_sz;
	u8	shift_sz;
	u8	hdrlen; /* the WLAN Header Len */
	u8	to_fr_ds;
	u8	amsdu;
	bool	qos;
	u8	priority;
+0 −2
Original line number Diff line number Diff line
@@ -152,8 +152,6 @@ enum WIFI_REG_DOMAIN {

#define GetFrDs(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)

#define get_tofr_ds(pframe)	((GetToDs(pframe) << 1) | GetFrDs(pframe))

#define SetMFrag(pbuf)	\
	*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)