Commit 466495b1 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: move mt76x02_tx_complete in mt76x02-lib module



Move mt76x02_tx_complete mt76x02-lib module in order to
be reused by mt76x0 drivers for irq unification.

Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 3e2342ed
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -714,3 +714,32 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
	}
}
EXPORT_SYMBOL_GPL(mt76x02_mac_poll_tx_status);

static void
mt76x02_mac_queue_txdone(struct mt76x02_dev *dev, struct sk_buff *skb,
			 void *txwi_ptr)
{
	struct mt76x02_tx_info *txi = mt76x02_skb_tx_info(skb);
	struct mt76x02_txwi *txwi = txwi_ptr;

	mt76x02_mac_poll_tx_status(dev, false);

	txi->tries = 0;
	txi->jiffies = jiffies;
	txi->wcid = txwi->wcid;
	txi->pktid = txwi->pktid;
	trace_mac_txdone_add(dev, txwi->wcid, txwi->pktid);
	mt76x02_tx_complete(&dev->mt76, skb);
}

void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
			     struct mt76_queue_entry *e, bool flush)
{
	struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);

	if (e->txwi)
		mt76x02_mac_queue_txdone(dev, e->skb, &e->txwi->txwi);
	else
		dev_kfree_skb_any(e->skb);
}
EXPORT_SYMBOL_GPL(mt76x02_tx_complete_skb);
+19 −0
Original line number Diff line number Diff line
@@ -42,6 +42,15 @@ struct mt76x02_vif {
	struct mt76_wcid group_wcid;
};

struct mt76x02_tx_info {
	unsigned long jiffies;
	u8 tries;

	u8 wcid;
	u8 pktid;
	u8 retry;
};

DECLARE_EWMA(signal, 10, 8);

struct mt76x02_sta {
@@ -181,6 +190,14 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
	return false;
}

static inline struct mt76x02_tx_info *
mt76x02_skb_tx_info(struct sk_buff *skb)
{
	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

	return (void *)info->status.status_driver_data;
}

void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq);
enum mt76x02_cipher_type
mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data);
@@ -206,4 +223,6 @@ void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi,
			    struct sk_buff *skb, struct mt76_wcid *wcid,
			    struct ieee80211_sta *sta, int len);
void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
			     struct mt76_queue_entry *e, bool flush);
#endif
+22 −0
Original line number Diff line number Diff line
@@ -46,6 +46,28 @@ DECLARE_EVENT_CLASS(dev_evt,
	TP_printk(DEV_PR_FMT, DEV_PR_ARG)
);

DECLARE_EVENT_CLASS(dev_txid_evt,
	TP_PROTO(struct mt76x02_dev *dev, u8 wcid, u8 pktid),
	TP_ARGS(dev, wcid, pktid),
	TP_STRUCT__entry(
		DEV_ENTRY
		TXID_ENTRY
	),
	TP_fast_assign(
		DEV_ASSIGN;
		TXID_ASSIGN;
	),
	TP_printk(
		DEV_PR_FMT TXID_PR_FMT,
		DEV_PR_ARG, TXID_PR_ARG
	)
);

DEFINE_EVENT(dev_txid_evt, mac_txdone_add,
	TP_PROTO(struct mt76x02_dev *dev, u8 wcid, u8 pktid),
	TP_ARGS(dev, wcid, pktid)
);

DEFINE_EVENT(dev_evt, mac_txstat_poll,
	TP_PROTO(struct mt76x02_dev *dev),
	TP_ARGS(dev)
+0 −17
Original line number Diff line number Diff line
@@ -23,23 +23,6 @@ struct mt76x02_dev;
struct mt76x2_sta;
struct mt76x02_vif;

struct mt76x2_tx_info {
	unsigned long jiffies;
	u8 tries;

	u8 wcid;
	u8 pktid;
	u8 retry;
};

static inline struct mt76x2_tx_info *
mt76x2_skb_tx_info(struct sk_buff *skb)
{
	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

	return (void *) info->status.status_driver_data;
}

int mt76x2_mac_start(struct mt76x02_dev *dev);
void mt76x2_mac_stop(struct mt76x02_dev *dev, bool force);
void mt76x2_mac_resume(struct mt76x02_dev *dev);
+0 −2
Original line number Diff line number Diff line
@@ -86,8 +86,6 @@ void mt76x2_dma_cleanup(struct mt76x02_dev *dev);

void mt76x2_cleanup(struct mt76x02_dev *dev);

void mt76x2_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
			    struct mt76_queue_entry *e, bool flush);
void mt76x2_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val);

void mt76x2_pre_tbtt_tasklet(unsigned long arg);
Loading