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

Commit 108438bc authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by Kalle Valo
Browse files

ath6kl: Define an initial vif structure and use it



vif specific information need to be moved from struct ath6kl.

Signed-off-by: default avatarVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent dd3751f7
Loading
Loading
Loading
Loading
+24 −17
Original line number Diff line number Diff line
@@ -2015,51 +2015,58 @@ int ath6kl_register_ieee80211_hw(struct ath6kl *ar)
	return 0;
}

static int ath6kl_init_if_data(struct ath6kl *ar, struct net_device *ndev)
static int ath6kl_init_if_data(struct ath6kl_vif *vif)
{
	ar->aggr_cntxt = aggr_init(ndev);
	struct ath6kl *ar = vif->ar;

	ar->aggr_cntxt = aggr_init(vif->ndev);
	if (!ar->aggr_cntxt) {
		ath6kl_err("failed to initialize aggr\n");
		return -ENOMEM;
	}

	setup_timer(&ar->disconnect_timer, disconnect_timer_handler,
		    (unsigned long) ndev);
		    (unsigned long) vif->ndev);

	return 0;
}

void ath6kl_deinit_if_data(struct ath6kl *ar, struct net_device *ndev)
void ath6kl_deinit_if_data(struct ath6kl_vif *vif)
{
	struct ath6kl *ar = vif->ar;

	aggr_module_destroy(ar->aggr_cntxt);

	ar->aggr_cntxt = NULL;

	if (test_bit(NETDEV_REGISTERED, &ar->flag)) {
		unregister_netdev(ndev);
		unregister_netdev(vif->ndev);
		clear_bit(NETDEV_REGISTERED, &ar->flag);
	}

	free_netdev(ndev);
	free_netdev(vif->ndev);
}

struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
					enum nl80211_iftype type)
{
	struct net_device *ndev;
	struct wireless_dev *wdev;
	struct ath6kl_vif *vif;

	ndev = alloc_netdev(sizeof(*wdev), "wlan%d", ether_setup);
	ndev = alloc_netdev(sizeof(*vif), "wlan%d", ether_setup);
	if (!ndev)
		return NULL;

	wdev = netdev_priv(ndev);
	ndev->ieee80211_ptr = wdev;
	wdev->wiphy = ar->wiphy;
	SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
	wdev->netdev = ndev;
	wdev->iftype = type;
	ar->wdev = wdev;
	vif = netdev_priv(ndev);
	ndev->ieee80211_ptr = &vif->wdev;
	vif->wdev.wiphy = ar->wiphy;
	vif->ar = ar;
	ar->vif = vif;
	vif->ndev = ndev;
	SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy));
	vif->wdev.netdev = ndev;
	vif->wdev.iftype = type;
	ar->wdev = &vif->wdev;
	ar->net_dev = ndev;

	init_netdev(ndev);
@@ -2067,7 +2074,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
	ath6kl_init_control_info(ar);

	/* TODO: Pass interface specific pointer instead of ar */
	if (ath6kl_init_if_data(ar, ndev))
	if (ath6kl_init_if_data(vif))
		goto err;

	if (register_netdev(ndev))
@@ -2081,7 +2088,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
	return ndev;

err:
	ath6kl_deinit_if_data(ar, ndev);
	ath6kl_deinit_if_data(vif);

	return NULL;
}
+9 −2
Original line number Diff line number Diff line
@@ -380,6 +380,12 @@ struct ath6kl_req_key {
	u8 key_len;
};

struct ath6kl_vif {
	struct wireless_dev wdev;
	struct net_device *ndev;
	struct ath6kl *ar;
};

/* Flag info */
#define WMI_ENABLED	0
#define WMI_READY	1
@@ -410,6 +416,7 @@ struct ath6kl {
	int total_tx_data_pend;
	struct htc_target *htc_target;
	void *hif_priv;
	struct ath6kl_vif *vif;
	spinlock_t lock;
	struct semaphore sem;
	int ssid_len;
@@ -543,7 +550,7 @@ struct ath6kl {

static inline void *ath6kl_priv(struct net_device *dev)
{
	return wdev_priv(dev->ieee80211_ptr);
	return ((struct ath6kl_vif *) netdev_priv(dev))->ar;
}

static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info
@@ -643,6 +650,6 @@ void ath6kl_wakeup_event(void *dev);
void ath6kl_target_failure(struct ath6kl *ar);

void ath6kl_init_control_info(struct ath6kl *ar);
void ath6kl_deinit_if_data(struct ath6kl *ar, struct net_device *ndev);
void ath6kl_deinit_if_data(struct ath6kl_vif *vif);
void ath6kl_core_free(struct ath6kl *ar);
#endif /* CORE_H */
+2 −2
Original line number Diff line number Diff line
@@ -1499,7 +1499,7 @@ err_rxbuf_cleanup:
err_cleanup_scatter:
	ath6kl_hif_cleanup_scatter(ar);
err_if_deinit:
	ath6kl_deinit_if_data(ar, ndev);
	ath6kl_deinit_if_data(netdev_priv(ndev));
	wiphy_unregister(ar->wiphy);
err_debug_init:
	ath6kl_debug_cleanup(ar);
@@ -1632,7 +1632,7 @@ void ath6kl_destroy(struct net_device *dev, unsigned int unregister)

	ath6kl_debug_cleanup(ar);

	ath6kl_deinit_if_data(ar, dev);
	ath6kl_deinit_if_data(netdev_priv(dev));

	kfree(ar->fw_board);
	kfree(ar->fw_otp);