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

Commit 429d90d2 authored by Avinash Patil's avatar Avinash Patil Committed by John W. Linville
Browse files

mwifiex: add cfg80211 tdls_oper handler support



This patch adds cfg80211 handler tdls_oper handler support to
mwifiex. Upon enable link, driver sets status as TDLS status as
setup complete and also sets AMSDU size, AMPDU params for direct
link. Upon disable link, driver issues command to FW to delete
this link in FW.

Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5f2caaf3
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -2669,6 +2669,54 @@ mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
	return ret;
}

static int
mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
			   u8 *peer, enum nl80211_tdls_operation action)
{
	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);

	if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) ||
	    !(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP))
		return -ENOTSUPP;

	/* make sure we are in station mode and connected */
	if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected))
		return -ENOTSUPP;

	dev_dbg(priv->adapter->dev,
		"TDLS peer=%pM, oper=%d\n", peer, action);

	switch (action) {
	case NL80211_TDLS_ENABLE_LINK:
		action = MWIFIEX_TDLS_ENABLE_LINK;
		break;
	case NL80211_TDLS_DISABLE_LINK:
		action = MWIFIEX_TDLS_DISABLE_LINK;
		break;
	case NL80211_TDLS_TEARDOWN:
		/* shouldn't happen!*/
		dev_warn(priv->adapter->dev,
			 "tdls_oper: teardown from driver not supported\n");
		return -EINVAL;
	case NL80211_TDLS_SETUP:
		/* shouldn't happen!*/
		dev_warn(priv->adapter->dev,
			 "tdls_oper: setup from driver not supported\n");
		return -EINVAL;
	case NL80211_TDLS_DISCOVERY_REQ:
		/* shouldn't happen!*/
		dev_warn(priv->adapter->dev,
			 "tdls_oper: discovery from driver not supported\n");
		return -EINVAL;
	default:
		dev_err(priv->adapter->dev,
			"tdls_oper: operation not supported\n");
		return -ENOTSUPP;
	}

	return mwifiex_tdls_oper(priv, peer, action);
}

/* station cfg80211 operations */
static struct cfg80211_ops mwifiex_cfg80211_ops = {
	.add_virtual_intf = mwifiex_add_virtual_intf,
@@ -2705,6 +2753,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
#endif
	.set_coalesce = mwifiex_cfg80211_set_coalesce,
	.tdls_mgmt = mwifiex_cfg80211_tdls_mgmt,
	.tdls_oper = mwifiex_cfg80211_tdls_oper,
};

#ifdef CONFIG_PM
+14 −0
Original line number Diff line number Diff line
@@ -80,6 +80,11 @@
#define MWIFIEX_BRIDGED_PKTS_THR_HIGH      1024
#define MWIFIEX_BRIDGED_PKTS_THR_LOW        128

#define MWIFIEX_TDLS_DISABLE_LINK             0x00
#define MWIFIEX_TDLS_ENABLE_LINK              0x01
#define MWIFIEX_TDLS_CREATE_LINK              0x02
#define MWIFIEX_TDLS_CONFIG_LINK              0x03

enum mwifiex_bss_type {
	MWIFIEX_BSS_TYPE_STA = 0,
	MWIFIEX_BSS_TYPE_UAP = 1,
@@ -101,6 +106,15 @@ enum mwifiex_tdls_status {
	TDLS_LINK_TEARDOWN,
};

enum mwifiex_tdls_error_code {
	TDLS_ERR_NO_ERROR = 0,
	TDLS_ERR_INTERNAL_ERROR,
	TDLS_ERR_MAX_LINKS_EST,
	TDLS_ERR_LINK_EXISTS,
	TDLS_ERR_LINK_NONEXISTENT,
	TDLS_ERR_PEER_STA_UNREACHABLE = 25,
};

#define BSS_ROLE_BIT_MASK    BIT(0)

#define GET_BSS_ROLE(priv)   ((priv)->bss_role & BSS_ROLE_BIT_MASK)
+12 −0
Original line number Diff line number Diff line
@@ -316,6 +316,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
#define HostCmd_CMD_MGMT_FRAME_REG                    0x010c
#define HostCmd_CMD_REMAIN_ON_CHAN                    0x010d
#define HostCmd_CMD_11AC_CFG			      0x0112
#define HostCmd_CMD_TDLS_OPER                         0x0122

#define PROTOCOL_NO_SECURITY        0x01
#define PROTOCOL_STATIC_WEP         0x02
@@ -486,6 +487,10 @@ enum P2P_MODES {
#define MWIFIEX_CRITERIA_UNICAST	BIT(1)
#define MWIFIEX_CRITERIA_MULTICAST	BIT(3)

#define ACT_TDLS_DELETE            0x00
#define ACT_TDLS_CREATE            0x01
#define ACT_TDLS_CONFIG            0x02

struct mwifiex_ie_types_header {
	__le16 type;
	__le16 len;
@@ -1066,6 +1071,12 @@ struct host_cmd_ds_rf_ant_siso {
	__le16 ant_mode;
};

struct host_cmd_ds_tdls_oper {
	__le16 tdls_action;
	__le16 reason;
	u8 peer_mac[ETH_ALEN];
} __packed;

struct mwifiex_fixed_bcn_param {
	__le64 timestamp;
	__le16 beacon_period;
@@ -1726,6 +1737,7 @@ struct host_cmd_ds_command {
		struct host_cmd_ds_sta_deauth sta_deauth;
		struct host_cmd_11ac_vht_cfg vht_cfg;
		struct host_cmd_ds_coalesce_cfg coalesce_cfg;
		struct host_cmd_ds_tdls_oper tdls_oper;
	} params;
} __packed;

+12 −0
Original line number Diff line number Diff line
@@ -435,4 +435,16 @@ struct mwifiex_ds_coalesce_cfg {
	struct mwifiex_coalesce_rule rule[MWIFIEX_COALESCE_MAX_RULES];
};

struct mwifiex_ds_tdls_oper {
	u16 tdls_action;
	u8 peer_mac[ETH_ALEN];
	u16 capability;
	u8 qos_info;
	u8 *ext_capab;
	u8 ext_capab_len;
	u8 *supp_rates;
	u8 supp_rates_len;
	u8 *ht_capab;
};

#endif /* !_MWIFIEX_IOCTL_H_ */
+2 −0
Original line number Diff line number Diff line
@@ -617,6 +617,7 @@ struct mwifiex_sta_node {
	u8 ampdu_sta[MAX_NUM_TID];
	u16 rx_seq[MAX_NUM_TID];
	u16 max_amsdu;
	u8 tdls_status;
	struct mwifiex_tdls_capab tdls_cap;
};

@@ -1209,6 +1210,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv,
				 size_t extra_ies_len);
void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
				       u8 *buf, int len);
int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action);

#ifdef CONFIG_DEBUG_FS
void mwifiex_debugfs_init(void);
Loading