Skip to content

Commit

Permalink
mt76: remove mt76_queue dependency from tx_prepare_skb function pointer
Browse files Browse the repository at this point in the history
Remove mt76_queue dependency from tx_prepare_skb function pointer and
rely on mt76_tx_qid instead. This is a preliminary patch to introduce
mt76_sw_queue support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
LorenzoBianconi authored and nbd168 committed Mar 12, 2019
1 parent e97a209 commit ddd98f8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dma.c
Expand Up @@ -301,7 +301,7 @@ int mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
skb->prev = skb->next = NULL;
dma_sync_single_for_cpu(dev->dev, t->dma_addr, sizeof(t->txwi),
DMA_TO_DEVICE);
ret = dev->drv->tx_prepare_skb(dev, &t->txwi, skb, q, wcid, sta,
ret = dev->drv->tx_prepare_skb(dev, &t->txwi, skb, qid, wcid, sta,
&tx_info);
dma_sync_single_for_device(dev->dev, t->dma_addr, sizeof(t->txwi),
DMA_TO_DEVICE);
Expand Down
2 changes: 1 addition & 1 deletion mt76.h
Expand Up @@ -288,7 +288,7 @@ struct mt76_driver_ops {
void (*update_survey)(struct mt76_dev *dev);

int (*tx_prepare_skb)(struct mt76_dev *dev, void *txwi_ptr,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid,
struct ieee80211_sta *sta, u32 *tx_info);

Expand Down
11 changes: 6 additions & 5 deletions mt7603/mac.c
Expand Up @@ -820,14 +820,15 @@ int mt7603_wtbl_set_key(struct mt7603_dev *dev, int wcid,

static int
mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
int pid, struct ieee80211_key_conf *key)
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_tx_rate *rate = &info->control.rates[0];
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_vif *vif = info->control.vif;
struct mt76_queue *q = &dev->mt76.q_tx[qid];
struct mt7603_vif *mvif;
int wlan_idx;
int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
Expand All @@ -841,7 +842,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
if (vif) {
mvif = (struct mt7603_vif *)vif->drv_priv;
vif_idx = mvif->idx;
if (vif_idx && q >= &dev->mt76.q_tx[MT_TXQ_BEACON])
if (vif_idx && qid >= MT_TXQ_BEACON)
vif_idx += 0x10;
}

Expand Down Expand Up @@ -915,7 +916,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
}

/* use maximum tx count for beacons and buffered multicast */
if (q >= &dev->mt76.q_tx[MT_TXQ_BEACON])
if (qid >= MT_TXQ_BEACON)
tx_count = 0x1f;

val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, tx_count) |
Expand All @@ -936,7 +937,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
}

int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info)
{
Expand Down Expand Up @@ -968,7 +969,7 @@ int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
spin_unlock_bh(&dev->mt76.lock);
}

mt7603_mac_write_txwi(dev, txwi_ptr, skb, q, wcid, sta, pid, key);
mt7603_mac_write_txwi(dev, txwi_ptr, skb, qid, wcid, sta, pid, key);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion mt7603/mt7603.h
Expand Up @@ -224,7 +224,7 @@ void mt7603_wtbl_set_smps(struct mt7603_dev *dev, struct mt7603_sta *sta,
void mt7603_filter_tx(struct mt7603_dev *dev, int idx, bool abort);

int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info);

Expand Down
2 changes: 1 addition & 1 deletion mt76x02.h
Expand Up @@ -173,7 +173,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance);
void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct sk_buff *skb);
int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info);
void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
Expand Down
4 changes: 2 additions & 2 deletions mt76x02_txrx.c
Expand Up @@ -147,7 +147,7 @@ bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update)
EXPORT_SYMBOL_GPL(mt76x02_tx_status_data);

int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info)
{
Expand All @@ -157,7 +157,7 @@ int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
int pid;
int ret;

if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128)
if (qid == MT_TXQ_PSD && wcid && wcid->idx < 128)
mt76x02_mac_wcid_set_drop(dev, wcid->idx, false);

mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, skb->len);
Expand Down
2 changes: 1 addition & 1 deletion mt76x02_usb.h
Expand Up @@ -26,7 +26,7 @@ int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data,

int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags);
int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info);
void mt76x02u_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
Expand Down
7 changes: 3 additions & 4 deletions mt76x02_usb_core.c
Expand Up @@ -72,16 +72,15 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
}

int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
struct sk_buff *skb, struct mt76_queue *q,
struct sk_buff *skb, enum mt76_txq_id qid,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
u32 *tx_info)
{
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
int pid, len = skb->len, ep = q2ep(mdev->q_tx[qid].hw_idx);
struct mt76x02_txwi *txwi;
enum mt76_qsel qsel;
int len = skb->len;
u32 flags;
int pid;

mt76x02_insert_hdr_pad(skb);

Expand All @@ -92,7 +91,7 @@ int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
pid = mt76_tx_status_skb_add(mdev, wcid, skb);
txwi->pktid = pid;

if (pid >= MT_PACKET_ID_FIRST || q2ep(q->hw_idx) == MT_EP_OUT_HCCA)
if (pid >= MT_PACKET_ID_FIRST || ep == MT_EP_OUT_HCCA)
qsel = MT_QSEL_MGMT;
else
qsel = MT_QSEL_EDCA;
Expand Down
2 changes: 1 addition & 1 deletion usb.c
Expand Up @@ -739,7 +739,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
return -ENOSPC;

skb->prev = skb->next = NULL;
err = dev->drv->tx_prepare_skb(dev, NULL, skb, q, wcid, sta, NULL);
err = dev->drv->tx_prepare_skb(dev, NULL, skb, qid, wcid, sta, NULL);
if (err < 0)
return err;

Expand Down

0 comments on commit ddd98f8

Please sign in to comment.