Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 05/12] mt76usb: remove mt76u_buf redundant fileds
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Remove mt76u_buf->{len, buf} fields and operate on corresponding
urb fields directly.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h |  2 -
 drivers/net/wireless/mediatek/mt76/usb.c  | 56 +++++++++++++----------
 2 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index ab93d7e94b36..4cb01502f5b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -91,8 +91,6 @@ struct mt76_tx_info {
 
 struct mt76u_buf {
 	struct urb *urb;
-	size_t len;
-	void *buf;
 	bool done;
 };
 
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 28552c622fee..8bb660e0d65a 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -315,7 +315,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
 	}
 
 	urb->num_sgs = max_t(int, i, urb->num_sgs);
-	buf->len = urb->num_sgs * sglen,
+	urb->transfer_buffer_length = urb->num_sgs * sglen,
 	sg_init_marker(urb->sg, urb->num_sgs);
 
 	return i ? : -ENOMEM;
@@ -328,8 +328,11 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
 	if (dev->usb.sg_en) {
 		return mt76u_fill_rx_sg(dev, buf, nsgs, gfp);
 	} else {
-		buf->buf = page_frag_alloc(&q->rx_page, q->buf_size, gfp);
-		return buf->buf ? 0 : -ENOMEM;
+		buf->urb->transfer_buffer_length =
+			SKB_WITH_OVERHEAD(q->buf_size);
+		buf->urb->transfer_buffer =
+			page_frag_alloc(&q->rx_page, q->buf_size, gfp);
+		return buf->urb->transfer_buffer ? 0 : -ENOMEM;
 	}
 }
 
@@ -338,8 +341,6 @@ mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf)
 {
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 
-	buf->len = SKB_WITH_OVERHEAD(q->buf_size);
-
 	buf->urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!buf->urb)
 		return -ENOMEM;
@@ -365,8 +366,8 @@ static void mt76u_buf_free(struct mt76u_buf *buf)
 	for (i = 0; i < urb->num_sgs; i++)
 		skb_free_frag(sg_virt(&urb->sg[i]));
 
-	if (buf->buf)
-		skb_free_frag(buf->buf);
+	if (urb->transfer_buffer)
+		skb_free_frag(urb->transfer_buffer);
 
 	usb_free_urb(buf->urb);
 }
@@ -377,7 +378,6 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
 		    void *context)
 {
 	struct usb_device *udev = to_usb_device(dev->dev);
-	u8 *data = buf->urb->num_sgs ? NULL : buf->buf;
 	unsigned int pipe;
 
 	if (dir == USB_DIR_IN)
@@ -385,8 +385,10 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
 	else
 		pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[index]);
 
-	usb_fill_bulk_urb(buf->urb, udev, pipe, data, buf->len,
-			  complete_fn, context);
+	buf->urb->dev = udev;
+	buf->urb->pipe = pipe;
+	buf->urb->complete = complete_fn;
+	buf->urb->context = context;
 }
 
 static inline struct mt76u_buf
@@ -426,8 +428,9 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct mt76u_buf *buf)
 {
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	struct urb *urb = buf->urb;
-	u8 *data = urb->num_sgs ? sg_virt(&urb->sg[0]) : buf->buf;
-	int data_len, len, nsgs = 1;
+	u8 *data = urb->num_sgs ? sg_virt(&urb->sg[0]) : urb->transfer_buffer;
+	int data_len = urb->num_sgs ? urb->sg[0].length : urb->actual_length;
+	int len, nsgs = 1;
 	struct sk_buff *skb;
 
 	if (!test_bit(MT76_STATE_INITIALIZED, &dev->state))
@@ -437,7 +440,6 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct mt76u_buf *buf)
 	if (len < 0)
 		return 0;
 
-	data_len = urb->num_sgs ? urb->sg[0].length : buf->len;
 	data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
 	if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
 		return 0;
@@ -701,15 +703,21 @@ static void mt76u_complete_tx(struct urb *urb)
 }
 
 static int
-mt76u_tx_build_sg(struct mt76_dev *dev, struct sk_buff *skb,
-		  struct urb *urb)
+mt76u_tx_setup_buffers(struct mt76_dev *dev, struct sk_buff *skb,
+		       struct urb *urb)
 {
-	if (!dev->usb.sg_en)
-		return 0;
+	urb->transfer_buffer_length = skb->len;
 
-	sg_init_table(urb->sg, MT_SG_MAX_SIZE);
-	urb->num_sgs = skb_to_sgvec(skb, urb->sg, 0, skb->len);
-	return urb->num_sgs;
+	if (!dev->usb.sg_en) {
+		urb->transfer_buffer = skb->data;
+		return 0;
+	} else {
+		sg_init_table(urb->sg, MT_SG_MAX_SIZE);
+		urb->num_sgs = skb_to_sgvec(skb, urb->sg, 0, skb->len);
+		if (urb->num_sgs == 0)
+			return -ENOMEM;
+		return urb->num_sgs;
+	}
 }
 
 static int
@@ -731,14 +739,12 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 		return err;
 
 	buf = &q->entry[idx].ubuf;
-	buf->buf = skb->data;
-	buf->len = skb->len;
-	buf->done = false;
-
-	err = mt76u_tx_build_sg(dev, skb, buf->urb);
+	err = mt76u_tx_setup_buffers(dev, skb, buf->urb);
 	if (err < 0)
 		return err;
 
+	buf->done = false;
+
 	mt76u_fill_bulk_urb(dev, USB_DIR_OUT, q2ep(q->hw_idx),
 			    buf, mt76u_complete_tx, buf);
 
-- 
2.20.1


^ permalink raw reply related

* [PATCH 06/12] mt76usb: move mt76u_buf->done to queue entry
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

mt76_queue_entry has alreay one bool variable, adding new one will
not increase it's size. Removing ->done filed from mt76u_buf will
allow to use urb directly in mt76usb code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h |  2 +-
 drivers/net/wireless/mediatek/mt76/usb.c  | 13 +++++--------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 4cb01502f5b1..508f21926025 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -91,7 +91,6 @@ struct mt76_tx_info {
 
 struct mt76u_buf {
 	struct urb *urb;
-	bool done;
 };
 
 struct mt76_queue_entry {
@@ -105,6 +104,7 @@ struct mt76_queue_entry {
 	};
 	enum mt76_txq_id qid;
 	bool schedule;
+	bool done;
 };
 
 struct mt76_queue_regs {
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 8bb660e0d65a..bea7379d572b 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -615,7 +615,6 @@ static void mt76u_tx_tasklet(unsigned long data)
 	struct mt76_dev *dev = (struct mt76_dev *)data;
 	struct mt76_queue_entry entry;
 	struct mt76_sw_queue *sq;
-	struct mt76u_buf *buf;
 	struct mt76_queue *q;
 	bool wake;
 	int i;
@@ -626,8 +625,7 @@ static void mt76u_tx_tasklet(unsigned long data)
 
 		spin_lock_bh(&q->lock);
 		while (true) {
-			buf = &q->entry[q->head].ubuf;
-			if (!buf->done || !q->queued)
+			if (!q->entry[q->head].done || !q->queued)
 				break;
 
 			if (q->entry[q->head].schedule) {
@@ -693,11 +691,11 @@ static void mt76u_tx_status_data(struct work_struct *work)
 static void mt76u_complete_tx(struct urb *urb)
 {
 	struct mt76_dev *dev = dev_get_drvdata(&urb->dev->dev);
-	struct mt76u_buf *buf = urb->context;
+	struct mt76_queue_entry *e = urb->context;
 
 	if (mt76u_urb_error(urb))
 		dev_err(dev->dev, "tx urb failed: %d\n", urb->status);
-	buf->done = true;
+	e->done = true;
 
 	tasklet_schedule(&dev->usb.tx_tasklet);
 }
@@ -738,15 +736,14 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 	if (err < 0)
 		return err;
 
+	q->entry[idx].done = false;
 	buf = &q->entry[idx].ubuf;
 	err = mt76u_tx_setup_buffers(dev, skb, buf->urb);
 	if (err < 0)
 		return err;
 
-	buf->done = false;
-
 	mt76u_fill_bulk_urb(dev, USB_DIR_OUT, q2ep(q->hw_idx),
-			    buf, mt76u_complete_tx, buf);
+			    buf, mt76u_complete_tx, &q->entry[idx]);
 
 	q->tail = (q->tail + 1) % q->ndesc;
 	q->entry[idx].skb = skb;
-- 
2.20.1


^ permalink raw reply related

* [PATCH 07/12] mt76usb: remove mt76u_buf and use urb directly
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Put urb pointer in mt76_queue_entry directly instead of mt76u_buf
structure.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h |   6 +-
 drivers/net/wireless/mediatek/mt76/usb.c  | 130 +++++++++++-----------
 2 files changed, 64 insertions(+), 72 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 508f21926025..efe338cc9829 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -89,10 +89,6 @@ struct mt76_tx_info {
 	u32 info;
 };
 
-struct mt76u_buf {
-	struct urb *urb;
-};
-
 struct mt76_queue_entry {
 	union {
 		void *buf;
@@ -100,7 +96,7 @@ struct mt76_queue_entry {
 	};
 	union {
 		struct mt76_txwi_cache *txwi;
-		struct mt76u_buf ubuf;
+		struct urb *urb;
 	};
 	enum mt76_txq_id qid;
 	bool schedule;
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index bea7379d572b..48bbb4e3db2f 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -283,12 +283,11 @@ mt76u_set_endpoints(struct usb_interface *intf,
 }
 
 static int
-mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
+mt76u_fill_rx_sg(struct mt76_dev *dev, struct urb *urb, int nsgs,
 		 gfp_t gfp)
 {
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	int sglen = SKB_WITH_OVERHEAD(q->buf_size);
-	struct urb *urb = buf->urb;
 
 	int i;
 
@@ -323,44 +322,43 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
 
 static int
 mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
-		struct mt76u_buf *buf, int nsgs, gfp_t gfp)
+		struct urb *urb, int nsgs, gfp_t gfp)
 {
 	if (dev->usb.sg_en) {
-		return mt76u_fill_rx_sg(dev, buf, nsgs, gfp);
+		return mt76u_fill_rx_sg(dev, urb, nsgs, gfp);
 	} else {
-		buf->urb->transfer_buffer_length =
-			SKB_WITH_OVERHEAD(q->buf_size);
-		buf->urb->transfer_buffer =
-			page_frag_alloc(&q->rx_page, q->buf_size, gfp);
-		return buf->urb->transfer_buffer ? 0 : -ENOMEM;
+		urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
+		urb->transfer_buffer = page_frag_alloc(&q->rx_page,
+						       q->buf_size, gfp);
+		return urb->transfer_buffer ? 0 : -ENOMEM;
 	}
 }
 
 static int
-mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf)
+mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 {
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
+	struct urb *urb;
 
-	buf->urb = usb_alloc_urb(0, GFP_KERNEL);
-	if (!buf->urb)
+	urb = usb_alloc_urb(0, GFP_KERNEL);
+	if (!urb)
 		return -ENOMEM;
+	e->urb = urb;
 
 	if (dev->usb.sg_en) {
-		buf->urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
-					    sizeof(*buf->urb->sg),
-					    GFP_KERNEL);
-		if (!buf->urb->sg)
+		urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
+				       sizeof(*urb->sg), GFP_KERNEL);
+		if (!urb->sg)
 			return -ENOMEM;
 
-		sg_init_table(buf->urb->sg, MT_SG_MAX_SIZE);
+		sg_init_table(urb->sg, MT_SG_MAX_SIZE);
 	}
 
-	return mt76u_refill_rx(dev, q, buf, MT_SG_MAX_SIZE, GFP_KERNEL);
+	return mt76u_refill_rx(dev, q, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
 }
 
-static void mt76u_buf_free(struct mt76u_buf *buf)
+static void mt76u_urb_free(struct urb *urb)
 {
-	struct urb *urb = buf->urb;
 	int i;
 
 	for (i = 0; i < urb->num_sgs; i++)
@@ -369,12 +367,12 @@ static void mt76u_buf_free(struct mt76u_buf *buf)
 	if (urb->transfer_buffer)
 		skb_free_frag(urb->transfer_buffer);
 
-	usb_free_urb(buf->urb);
+	usb_free_urb(urb);
 }
 
 static void
 mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
-		    struct mt76u_buf *buf, usb_complete_t complete_fn,
+		    struct urb *urb, usb_complete_t complete_fn,
 		    void *context)
 {
 	struct usb_device *udev = to_usb_device(dev->dev);
@@ -385,27 +383,27 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
 	else
 		pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[index]);
 
-	buf->urb->dev = udev;
-	buf->urb->pipe = pipe;
-	buf->urb->complete = complete_fn;
-	buf->urb->context = context;
+	urb->dev = udev;
+	urb->pipe = pipe;
+	urb->complete = complete_fn;
+	urb->context = context;
 }
 
-static inline struct mt76u_buf
-*mt76u_get_next_rx_entry(struct mt76_queue *q)
+static inline struct urb *
+mt76u_get_next_rx_entry(struct mt76_queue *q)
 {
-	struct mt76u_buf *buf = NULL;
+	struct urb *urb = NULL;
 	unsigned long flags;
 
 	spin_lock_irqsave(&q->lock, flags);
 	if (q->queued > 0) {
-		buf = &q->entry[q->head].ubuf;
+		urb = q->entry[q->head].urb;
 		q->head = (q->head + 1) % q->ndesc;
 		q->queued--;
 	}
 	spin_unlock_irqrestore(&q->lock, flags);
 
-	return buf;
+	return urb;
 }
 
 static int mt76u_get_rx_entry_len(u8 *data, u32 data_len)
@@ -424,10 +422,9 @@ static int mt76u_get_rx_entry_len(u8 *data, u32 data_len)
 }
 
 static int
-mt76u_process_rx_entry(struct mt76_dev *dev, struct mt76u_buf *buf)
+mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
 {
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
-	struct urb *urb = buf->urb;
 	u8 *data = urb->num_sgs ? sg_virt(&urb->sg[0]) : urb->transfer_buffer;
 	int data_len = urb->num_sgs ? urb->sg[0].length : urb->actual_length;
 	int len, nsgs = 1;
@@ -488,7 +485,7 @@ static void mt76u_complete_rx(struct urb *urb)
 	}
 
 	spin_lock_irqsave(&q->lock, flags);
-	if (WARN_ONCE(q->entry[q->tail].ubuf.urb != urb, "rx urb mismatch"))
+	if (WARN_ONCE(q->entry[q->tail].urb != urb, "rx urb mismatch"))
 		goto out;
 
 	q->tail = (q->tail + 1) % q->ndesc;
@@ -499,37 +496,37 @@ static void mt76u_complete_rx(struct urb *urb)
 }
 
 static int
-mt76u_submit_rx_buf(struct mt76_dev *dev, struct mt76u_buf *buf)
+mt76u_submit_rx_buf(struct mt76_dev *dev, struct urb *urb)
 {
-	mt76u_fill_bulk_urb(dev, USB_DIR_IN, MT_EP_IN_PKT_RX, buf,
+	mt76u_fill_bulk_urb(dev, USB_DIR_IN, MT_EP_IN_PKT_RX, urb,
 			    mt76u_complete_rx, dev);
-	trace_submit_urb(dev, buf->urb);
+	trace_submit_urb(dev, urb);
 
-	return usb_submit_urb(buf->urb, GFP_ATOMIC);
+	return usb_submit_urb(urb, GFP_ATOMIC);
 }
 
 static void mt76u_rx_tasklet(unsigned long data)
 {
 	struct mt76_dev *dev = (struct mt76_dev *)data;
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
-	struct mt76u_buf *buf;
+	struct urb *urb;
 	int err, count;
 
 	rcu_read_lock();
 
 	while (true) {
-		buf = mt76u_get_next_rx_entry(q);
-		if (!buf)
+		urb = mt76u_get_next_rx_entry(q);
+		if (!urb)
 			break;
 
-		count = mt76u_process_rx_entry(dev, buf);
+		count = mt76u_process_rx_entry(dev, urb);
 		if (count > 0) {
-			err = mt76u_refill_rx(dev, q, buf, count,
+			err = mt76u_refill_rx(dev, q, urb, count,
 					      GFP_ATOMIC);
 			if (err < 0)
 				break;
 		}
-		mt76u_submit_rx_buf(dev, buf);
+		mt76u_submit_rx_buf(dev, urb);
 	}
 	mt76_rx_poll_complete(dev, MT_RXQ_MAIN, NULL);
 
@@ -544,7 +541,7 @@ int mt76u_submit_rx_buffers(struct mt76_dev *dev)
 
 	spin_lock_irqsave(&q->lock, flags);
 	for (i = 0; i < q->ndesc; i++) {
-		err = mt76u_submit_rx_buf(dev, &q->entry[i].ubuf);
+		err = mt76u_submit_rx_buf(dev, q->entry[i].urb);
 		if (err < 0)
 			break;
 	}
@@ -576,7 +573,7 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
 	q->buf_size = dev->usb.sg_en ? MT_RX_BUF_SIZE : PAGE_SIZE;
 	q->ndesc = MT_NUM_RX_ENTRIES;
 	for (i = 0; i < q->ndesc; i++) {
-		err = mt76u_buf_alloc(dev, &q->entry[i].ubuf);
+		err = mt76u_urb_alloc(dev, &q->entry[i]);
 		if (err < 0)
 			return err;
 	}
@@ -591,7 +588,7 @@ static void mt76u_free_rx(struct mt76_dev *dev)
 	int i;
 
 	for (i = 0; i < q->ndesc; i++)
-		mt76u_buf_free(&q->entry[i].ubuf);
+		mt76u_urb_free(q->entry[i].urb);
 
 	if (!q->rx_page.va)
 		return;
@@ -607,7 +604,7 @@ static void mt76u_stop_rx(struct mt76_dev *dev)
 	int i;
 
 	for (i = 0; i < q->ndesc; i++)
-		usb_kill_urb(q->entry[i].ubuf.urb);
+		usb_kill_urb(q->entry[i].urb);
 }
 
 static void mt76u_tx_tasklet(unsigned long data)
@@ -724,7 +721,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 		   struct ieee80211_sta *sta)
 {
 	struct mt76_queue *q = dev->q_tx[qid].q;
-	struct mt76u_buf *buf;
+	struct urb *urb;
 	u16 idx = q->tail;
 	int err;
 
@@ -737,13 +734,13 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 		return err;
 
 	q->entry[idx].done = false;
-	buf = &q->entry[idx].ubuf;
-	err = mt76u_tx_setup_buffers(dev, skb, buf->urb);
+	urb = q->entry[idx].urb;
+	err = mt76u_tx_setup_buffers(dev, skb, urb);
 	if (err < 0)
 		return err;
 
 	mt76u_fill_bulk_urb(dev, USB_DIR_OUT, q2ep(q->hw_idx),
-			    buf, mt76u_complete_tx, &q->entry[idx]);
+			    urb, mt76u_complete_tx, &q->entry[idx]);
 
 	q->tail = (q->tail + 1) % q->ndesc;
 	q->entry[idx].skb = skb;
@@ -754,14 +751,14 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 
 static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
 {
-	struct mt76u_buf *buf;
+	struct urb *urb;
 	int err;
 
 	while (q->first != q->tail) {
-		buf = &q->entry[q->first].ubuf;
+		urb = q->entry[q->first].urb;
 
-		trace_submit_urb(dev, buf->urb);
-		err = usb_submit_urb(buf->urb, GFP_ATOMIC);
+		trace_submit_urb(dev, urb);
+		err = usb_submit_urb(urb, GFP_ATOMIC);
 		if (err < 0) {
 			if (err == -ENODEV)
 				set_bit(MT76_REMOVED, &dev->state);
@@ -776,7 +773,7 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
 
 static int mt76u_alloc_tx(struct mt76_dev *dev)
 {
-	struct mt76u_buf *buf;
+	struct urb *urb;
 	struct mt76_queue *q;
 	int i, j;
 
@@ -804,19 +801,18 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
 
 		q->ndesc = MT_NUM_TX_ENTRIES;
 		for (j = 0; j < q->ndesc; j++) {
-			buf = &q->entry[j].ubuf;
-
-			buf->urb = usb_alloc_urb(0, GFP_KERNEL);
-			if (!buf->urb)
+			urb = usb_alloc_urb(0, GFP_KERNEL);
+			if (!urb)
 				return -ENOMEM;
+			q->entry[j].urb = urb;
 
 			if (!dev->usb.sg_en)
 				continue;
 
-			buf->urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
-						    sizeof(struct scatterlist),
-						    GFP_KERNEL);
-			if (!buf->urb->sg)
+			urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
+					       sizeof(struct scatterlist),
+					       GFP_KERNEL);
+			if (!urb->sg)
 				return -ENOMEM;
 		}
 	}
@@ -831,7 +827,7 @@ static void mt76u_free_tx(struct mt76_dev *dev)
 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
 		q = dev->q_tx[i].q;
 		for (j = 0; j < q->ndesc; j++)
-			usb_free_urb(q->entry[j].ubuf.urb);
+			usb_free_urb(q->entry[j].urb);
 	}
 }
 
@@ -843,7 +839,7 @@ static void mt76u_stop_tx(struct mt76_dev *dev)
 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
 		q = dev->q_tx[i].q;
 		for (j = 0; j < q->ndesc; j++)
-			usb_kill_urb(q->entry[j].ubuf.urb);
+			usb_kill_urb(q->entry[j].urb);
 	}
 }
 
-- 
2.20.1


^ permalink raw reply related

* [PATCH 08/12] mt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Get the RX queue inside mt76u_refill_rx. This will allow to reuse
mt76u_urb_alloc for TX allocations.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 48bbb4e3db2f..10507a26d598 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -283,12 +283,10 @@ mt76u_set_endpoints(struct usb_interface *intf,
 }
 
 static int
-mt76u_fill_rx_sg(struct mt76_dev *dev, struct urb *urb, int nsgs,
-		 gfp_t gfp)
+mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
+		 int nsgs, gfp_t gfp)
 {
-	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	int sglen = SKB_WITH_OVERHEAD(q->buf_size);
-
 	int i;
 
 	for (i = 0; i < nsgs; i++) {
@@ -321,11 +319,12 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct urb *urb, int nsgs,
 }
 
 static int
-mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
-		struct urb *urb, int nsgs, gfp_t gfp)
+mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
 {
+	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
+
 	if (dev->usb.sg_en) {
-		return mt76u_fill_rx_sg(dev, urb, nsgs, gfp);
+		return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
 	} else {
 		urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
 		urb->transfer_buffer = page_frag_alloc(&q->rx_page,
@@ -337,7 +336,6 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
 static int
 mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 {
-	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	struct urb *urb;
 
 	urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -354,7 +352,7 @@ mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 		sg_init_table(urb->sg, MT_SG_MAX_SIZE);
 	}
 
-	return mt76u_refill_rx(dev, q, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
+	return mt76u_refill_rx(dev, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
 }
 
 static void mt76u_urb_free(struct urb *urb)
@@ -521,8 +519,7 @@ static void mt76u_rx_tasklet(unsigned long data)
 
 		count = mt76u_process_rx_entry(dev, urb);
 		if (count > 0) {
-			err = mt76u_refill_rx(dev, q, urb, count,
-					      GFP_ATOMIC);
+			err = mt76u_refill_rx(dev, urb, count, GFP_ATOMIC);
 			if (err < 0)
 				break;
 		}
-- 
2.20.1


^ permalink raw reply related

* [PATCH 09/12] mt76usb: resue mt76u_urb_alloc for tx
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Add new rx_urb_alloc routine and reuse common urb_alloc for tx
allocations.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 35 ++++++++++++------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 10507a26d598..7cefa4fe8251 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -352,7 +352,19 @@ mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 		sg_init_table(urb->sg, MT_SG_MAX_SIZE);
 	}
 
-	return mt76u_refill_rx(dev, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
+	return 0;
+}
+
+static int
+mt76u_rx_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
+{
+	int err;
+
+	err = mt76u_urb_alloc(dev, e);
+	if (err)
+		return err;
+
+	return mt76u_refill_rx(dev, e->urb, MT_SG_MAX_SIZE, GFP_KERNEL);
 }
 
 static void mt76u_urb_free(struct urb *urb)
@@ -570,7 +582,7 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
 	q->buf_size = dev->usb.sg_en ? MT_RX_BUF_SIZE : PAGE_SIZE;
 	q->ndesc = MT_NUM_RX_ENTRIES;
 	for (i = 0; i < q->ndesc; i++) {
-		err = mt76u_urb_alloc(dev, &q->entry[i]);
+		err = mt76u_rx_urb_alloc(dev, &q->entry[i]);
 		if (err < 0)
 			return err;
 	}
@@ -770,9 +782,8 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
 
 static int mt76u_alloc_tx(struct mt76_dev *dev)
 {
-	struct urb *urb;
 	struct mt76_queue *q;
-	int i, j;
+	int i, j, err;
 
 	for (i = 0; i <= MT_TXQ_PSD; i++) {
 		INIT_LIST_HEAD(&dev->q_tx[i].swq);
@@ -798,19 +809,9 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
 
 		q->ndesc = MT_NUM_TX_ENTRIES;
 		for (j = 0; j < q->ndesc; j++) {
-			urb = usb_alloc_urb(0, GFP_KERNEL);
-			if (!urb)
-				return -ENOMEM;
-			q->entry[j].urb = urb;
-
-			if (!dev->usb.sg_en)
-				continue;
-
-			urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
-					       sizeof(struct scatterlist),
-					       GFP_KERNEL);
-			if (!urb->sg)
-				return -ENOMEM;
+			err = mt76u_urb_alloc(dev, &q->entry[j]);
+			if (err < 0)
+				return err;
 		}
 	}
 	return 0;
-- 
2.20.1


^ permalink raw reply related

* [PATCH 10/12] mt76usb: remove unneded sg_init_table
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

We already allocate with GFP_ZERO and sg marker is set later for
both RX and TX.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 7cefa4fe8251..0ae69c2fedaf 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -348,8 +348,6 @@ mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 				       sizeof(*urb->sg), GFP_KERNEL);
 		if (!urb->sg)
 			return -ENOMEM;
-
-		sg_init_table(urb->sg, MT_SG_MAX_SIZE);
 	}
 
 	return 0;
-- 
2.20.1


^ permalink raw reply related

* [PATCH 11/12] mt76usb: allocate urb and sg as linear data
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Alloc sg table at the end of urb structure. This will increase
cache usage.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 0ae69c2fedaf..a80d6abee748 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -336,19 +336,19 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
 static int
 mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
 {
-	struct urb *urb;
+	unsigned int size = sizeof(struct urb);
+
+	if (dev->usb.sg_en)
+		size += MT_SG_MAX_SIZE * sizeof(struct scatterlist);
 
-	urb = usb_alloc_urb(0, GFP_KERNEL);
-	if (!urb)
+	e->urb = kzalloc(size, GFP_KERNEL);
+	if (!e->urb)
 		return -ENOMEM;
-	e->urb = urb;
 
-	if (dev->usb.sg_en) {
-		urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
-				       sizeof(*urb->sg), GFP_KERNEL);
-		if (!urb->sg)
-			return -ENOMEM;
-	}
+	usb_init_urb(e->urb);
+
+	if (dev->usb.sg_en)
+		e->urb->sg = (struct scatterlist *)(e->urb + 1);
 
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related

* [PATCH 12/12] mt76usb: remove queue variable from rx_tasklet
From: Stanislaw Gruszka @ 2019-03-21 15:25 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

Since now only mt76u_get_next_rx_entry use queue argument move
it to this function.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index a80d6abee748..a3acc070063a 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -398,8 +398,9 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
 }
 
 static inline struct urb *
-mt76u_get_next_rx_entry(struct mt76_queue *q)
+mt76u_get_next_rx_entry(struct mt76_dev *dev)
 {
+	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	struct urb *urb = NULL;
 	unsigned long flags;
 
@@ -516,14 +517,13 @@ mt76u_submit_rx_buf(struct mt76_dev *dev, struct urb *urb)
 static void mt76u_rx_tasklet(unsigned long data)
 {
 	struct mt76_dev *dev = (struct mt76_dev *)data;
-	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	struct urb *urb;
 	int err, count;
 
 	rcu_read_lock();
 
 	while (true) {
-		urb = mt76u_get_next_rx_entry(q);
+		urb = mt76u_get_next_rx_entry(dev);
 		if (!urb)
 			break;
 
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH 12/14] qtnfmac: fix debugfs entries for multiple cards on the same host
From: Sergey Matyukevich @ 2019-03-21 15:46 UTC (permalink / raw)
  To: Arend Van Spriel
  Cc: Kalle Valo, linux-wireless@vger.kernel.org, Igor Mitsyanko
In-Reply-To: <5d1012ab-9c4e-3c14-05b6-f76e6fde2951@broadcom.com>

> > > > > Fix creation of debugfs entries for qtnfmac wireless card: use separate
> > > > > directories for different wireless cards. This commit enables support
> > > > > for multiple qtnfmac wireless cards on the same PCIe host.
> > > > > 
> > > > > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> > > > > ---
> > > > >   drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
> > > > >   1 file changed, 5 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > index b561b75e4433..56fc6d49c121 100644
> > > > > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
> > > > > 
> > > > >   int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> > > > >   {
> > > > > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
> > > > > +     char card_id[64];
> > > > >        int ret;
> > > > > 
> > > > >        bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
> > > > > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> > > > >        if (ret) {
> > > > >                pr_err("failed to attach core\n");
> > > > >        } else {
> > > > > -             qtnf_debugfs_init(bus, DRV_NAME);
> > > > > +             snprintf(card_id, sizeof(card_id), "%s:%s",
> > > > > +                      DRV_NAME, pci_name(priv->pdev));
> > > > 
> > > > Can you give an example for the path?
> > > > 
> > > 
> > > For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
> > 
> > TBH not really fond of that. What about
> > "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
> > something like that.


Hello Arend,

> In brcmfmac we used to have it like that, but I changed it to use wiphy
> debugfs, ie. /sys/kernel/debug/ieee80211/phyX/.

Yes, I saw the patches for brcmfmac. In fact, looking at those patches
we figured out that we have a problem before we started testing
two cards in one pcie host :)

But /sys/kernel/debug/eee80211/phyX approach does not fit well for our
use-case. We may have up to 3 phy-s for single card, but counters
exported via debugfs are for pcie device as a whole.

Thanks,
Sergey

^ permalink raw reply

* Re: Ath10k on XPS 9380 regularly disconnects
From: Kalle Valo @ 2019-03-21 17:05 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: Anthony Wong, linux-wireless, ath10k
In-Reply-To: <042C2903-585B-47BA-8657-8819D225EEA8@canonical.com>

+ ath10k list
- netdev & linux-kernel

Kai-Heng Feng <kai.heng.feng@canonical.com> writes:

> There’s an issue that ath10k disconnects at regular basis [1], on
> Linux kernel 4.18.
>
> Unfortunately I can’t reproduce the issue on XPS 9380 at my hand.
>
> Is there already a fix in upstream kernel?

I'm not aware of any fixes related to this. Is this a regression? In
other words, is there a known version of ath10k or firmware which didn't
have this problem?

> [1] https://bugs.launchpad.net/bugs/1818881

Relevant information from dmesg:

[   19.346810] ath10k_pci 0000:02:00.0: qca6174 hw3.2 target 0x05030000 chip_id 0x00340aff sub 1a56:143a
[   19.346812] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 1 tracing 1 dfs 0 testmode 0
[   19.347136] ath10k_pci 0000:02:00.0: firmware ver WLAN.RM.4.4.1-00132-QCARMSWP-1 api 6 features wowlan,ignore-otp,mfp crc32 79f4db86

[...]

[77451.338339] WARNING: CPU: 4 PID: 0 at /build/linux-hwe-9KJ07q/linux-hwe-4.18.0/drivers/net/wireless/ath/ath10k/htt_rx.c:46 ath10k_htt_rx_pop_paddr.isra.29+0xd9/0xf0 [ath10k_core]

[...]

[81254.857667] WARNING: CPU: 1 PID: 0 at /build/linux-hwe-9KJ07q/linux-hwe-4.18.0/drivers/net/wireless/ath/ath10k/htt_rx.c:46 ath10k_htt_rx_pop_paddr.isra.29+0xd9/0xf0 [ath10k_core]

[...]

[81390.186167] WARNING: CPU: 2 PID: 0 at /build/linux-hwe-9KJ07q/linux-hwe-4.18.0/drivers/net/wireless/ath/ath10k/htt_rx.c:46 ath10k_htt_rx_pop_paddr.isra.29+0xd9/0xf0 [ath10k_core]

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH 12/14] qtnfmac: fix debugfs entries for multiple cards on the same host
From: Kalle Valo @ 2019-03-21 17:06 UTC (permalink / raw)
  To: Arend Van Spriel
  Cc: Sergey Matyukevich, linux-wireless@vger.kernel.org,
	Igor Mitsyanko
In-Reply-To: <5d1012ab-9c4e-3c14-05b6-f76e6fde2951@broadcom.com>

Arend Van Spriel <arend.vanspriel@broadcom.com> writes:

> On 3/21/2019 8:35 AM, Kalle Valo wrote:
>> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:
>>
>>>>> Fix creation of debugfs entries for qtnfmac wireless card: use separate
>>>>> directories for different wireless cards. This commit enables support
>>>>> for multiple qtnfmac wireless cards on the same PCIe host.
>>>>>
>>>>> Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>>>>> ---
>>>>>   drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>>>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> index b561b75e4433..56fc6d49c121 100644
>>>>> --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>>>>>
>>>>>   int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>>   {
>>>>> +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>>>>> +     char card_id[64];
>>>>>        int ret;
>>>>>
>>>>>        bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>>>>> @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>>        if (ret) {
>>>>>                pr_err("failed to attach core\n");
>>>>>        } else {
>>>>> -             qtnf_debugfs_init(bus, DRV_NAME);
>>>>> +             snprintf(card_id, sizeof(card_id), "%s:%s",
>>>>> +                      DRV_NAME, pci_name(priv->pdev));
>>>>
>>>> Can you give an example for the path?
>>>>
>>>
>>> For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
>>
>> TBH not really fond of that. What about
>> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
>> something like that.
>
> In brcmfmac we used to have it like that, but I changed it to use
> wiphy debugfs, ie. /sys/kernel/debug/ieee80211/phyX/.

Yeah, that's much better.

-- 
Kalle Valo

^ permalink raw reply

* panic from iwl_mvm_vif_dbgfs_register with 5.0
From: Laura Abbott @ 2019-03-21 18:19 UTC (permalink / raw)
  To: Johannes Berg, Emmanuel Grumbach, Luca Coelho
  Cc: Intel Linux Wireless, linux-wireless, netdev,
	Linux Kernel Mailing List

Hi,

Fedora got a bug report of a panic with kernels > 5.0:

Mar 20 10:52:38 kernel: BUG: unable to handle kernel NULL pointer dereference at 0000000000000043
Mar 20 10:52:38 kernel: #PF error: [normal kernel read fault]
Mar 20 10:52:38 kernel: PGD 80000003de1d7067 P4D 80000003de1d7067 PUD 3de1db067 PMD 0
Mar 20 10:52:38 kernel: Oops: 0000 [#1] SMP PTI
Mar 20 10:52:38 kernel: CPU: 0 PID: 2071 Comm: hostapd Not tainted 5.1.0-0.rc0.git9.1.fc31.x86_64 #1
Mar 20 10:52:38 kernel: Hardware name: LENOVO 10A8S08P00/SHARKBAY, BIOS FBKT56AUS 11/18/2013
Mar 20 10:52:38 kernel: RIP: 0010:dentry_name+0x9e/0x210
Mar 20 10:52:38 kernel: Code: 6b ff 5a 85 c0 74 0d 80 3d 73 60 e2 00 00 0f 84 04 01 00 00 45 85 ff 0f 8e 5d 01 00 00 31 ff eb 09 48 83 c7 01 41 39 ff 7e 2f <48> 8b 43 50 48 89 da 89 fe 48 89 c3 48 8b 42 60 48 89 04 fc 48 39
Mar 20 10:52:38 kernel: RSP: 0018:ffffa78d82f07920 EFLAGS: 00010246
Mar 20 10:52:38 kernel: RAX: 0000000000000001 RBX: fffffffffffffff3 RCX: 00000000f20b42fd
Mar 20 10:52:38 kernel: RDX: ffffffffa8ac3b70 RSI: ffff98e572c28d60 RDI: 0000000000000000
Mar 20 10:52:38 kernel: RBP: ffffa78d82f07a75 R08: 00000033dcd044f0 R09: 0000000000000000
Mar 20 10:52:38 kernel: R10: 0000000000000001 R11: 0000000000000002 R12: ffff0a00ffffff05
Mar 20 10:52:38 kernel: R13: ffffffffffffffff R14: ffffa78d82f07ad0 R15: 0000000000000003
Mar 20 10:52:38 kernel: FS:  00007f8b47f4c740(0000) GS:ffff98e58e600000(0000) knlGS:0000000000000000
Mar 20 10:52:38 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 20 10:52:38 kernel: CR2: 0000000000000043 CR3: 00000003de26e005 CR4: 00000000001606f0
Mar 20 10:52:38 kernel: Call Trace:
Mar 20 10:52:38 kernel:  ? __lock_acquire+0x252/0x1060
Mar 20 10:52:38 kernel:  pointer+0x14e/0x370
Mar 20 10:52:38 kernel:  vsnprintf+0x1ff/0x520
Mar 20 10:52:38 kernel:  snprintf+0x49/0x60
Mar 20 10:52:38 kernel:  ? __debugfs_create_file+0x3a/0x130
Mar 20 10:52:38 kernel:  iwl_mvm_vif_dbgfs_register+0x231/0x310 [iwlmvm]
Mar 20 10:52:38 kernel:  ? iwl_mvm_find_free_sta_id+0x87/0x100 [iwlmvm]
Mar 20 10:52:38 kernel:  iwl_mvm_mac_add_interface+0x221/0x2a0 [iwlmvm]
Mar 20 10:52:38 kernel:  drv_add_interface+0x77/0x230 [mac80211]
Mar 20 10:52:38 kernel:  ieee80211_do_open+0x13e/0x910 [mac80211]
Mar 20 10:52:38 kernel:  ? ieee80211_check_concurrent_iface+0x151/0x1c0 [mac80211]
Mar 20 10:52:38 kernel:  __dev_open+0xd4/0x170
Mar 20 10:52:38 kernel:  __dev_change_flags+0x1a7/0x200
Mar 20 10:52:38 kernel:  dev_change_flags+0x21/0x60
Mar 20 10:52:38 kernel:  devinet_ioctl+0x644/0x7c0
Mar 20 10:52:38 kernel:  inet_ioctl+0x15a/0x220
Mar 20 10:52:38 kernel:  ? avc_has_extended_perms+0x252/0x5c0
Mar 20 10:52:38 kernel:  sock_do_ioctl+0x47/0x140
Mar 20 10:52:38 kernel:  sock_ioctl+0x1c5/0x360
Mar 20 10:52:38 kernel:  do_vfs_ioctl+0x408/0x750
Mar 20 10:52:38 kernel:  ksys_ioctl+0x5e/0x90
Mar 20 10:52:38 kernel:  __x64_sys_ioctl+0x16/0x20
Mar 20 10:52:38 kernel:  do_syscall_64+0x5c/0xa0
Mar 20 10:52:38 kernel:  entry_SYSCALL_64_after_hwframe+0x49/0xbe
Mar 20 10:52:38 kernel: RIP: 0033:0x7f8b4808709b
Mar 20 10:52:38 kernel: Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
Mar 20 10:52:38 kernel: RSP: 002b:00007ffd44090bb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
Mar 20 10:52:38 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8b4808709b
Mar 20 10:52:38 kernel: RDX: 00007ffd44090bc0 RSI: 0000000000008914 RDI: 0000000000000008
Mar 20 10:52:38 kernel: RBP: 0000000000000008 R08: 00007ffd44090bcf R09: 0000000000000007
Mar 20 10:52:38 kernel: R10: 00000000014920b0 R11: 0000000000000246 R12: 00007ffd44090bc0
Mar 20 10:52:38 kernel: R13: 0000000001490d90 R14: 0000000000000001 R15: 0000000000000000
Mar 20 10:52:38 kernel: Modules linked in: ebtable_filter ebtables ip6table_filter ip6_tables bridge stp llc nf_nat_ftp nf_conntrack_ftp nf_nat_tftp nf_conntrack_tftp xt_pkttype xt_state xt_conntrack xt_nat iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c nf_log_ipv4 nf_log_common xt_dscp xt_multiport xt_LOG xt_set xt_length xt_mark iptable_mangle ip_set_hash_net ip_set_bitmap_port ip_set_hash_ip ip_set_hash_netport ip_set nfnetlink sunrpc vfat fat mei_wdt mei_hdcp intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp arc4 kvm_intel kvm irqbypass iwlmvm mac80211 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel intel_cstate intel_uncore intel_rapl_perf iTCO_wdt snd_hda_codec_realtek iTCO_vendor_support snd_hda_codec_generic snd_hda_codec_hdmi ledtrig_audio iwlwifi snd_hda_intel joydev snd_hda_codec wmi_bmof snd_hda_core snd_hwdep snd_seq cfg80211 i2c_i801 snd_seq_device snd_pcm rfkill snd_timer snd soundcore mei_me pcc_cpufreq lpc_ich mei raid1 i915 crc32c_intel i2c_algo_bit
Mar 20 10:52:38 kernel:  drm_kms_helper drm ums_realtek uas r8169 usb_storage e1000e wmi video
Mar 20 10:52:38 kernel: CR2: 0000000000000043
Mar 20 10:52:38 kernel: ---[ end trace c15be4d5bdbb1004 ]---

This particular trace is from f261c4e529dac5608a604d3dd3ae1cd2adf23c89 snapshot but it
was reported on a 5.0.x stable series as well. This looks like the snprintf
from iwl_mvm_vif_dbgfs_register but I can give full line information if it's useful.

Thanks,
Laura

^ permalink raw reply

* [PATCH] mt76: tx: check return value of tx_queue_skb in mt76_tx
From: Lorenzo Bianconi @ 2019-03-21 21:51 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, lorenzo.bianconi, sgruszka
In-Reply-To: <cover.1553204966.git.lorenzo@kernel.org>

Do not kick the queue if tx_queue_skb fails in mt76_tx

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/tx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index 60bbb6561d8f..833c414cea83 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -258,8 +258,8 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	int err, qid = skb_get_queue_mapping(skb);
 	struct mt76_queue *q;
-	int qid = skb_get_queue_mapping(skb);
 
 	if (WARN_ON(qid >= MT_TXQ_PSD)) {
 		qid = MT_TXQ_BE;
@@ -286,7 +286,10 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 	q = dev->q_tx[qid].q;
 
 	spin_lock_bh(&q->lock);
-	dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid, sta);
+	err = dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid, sta);
+	if (err < 0)
+		goto out;
+
 	dev->queue_ops->kick(dev, q);
 
 	if (q->queued > q->ndesc - 8 && !q->stopped) {
@@ -294,6 +297,7 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 		q->stopped = true;
 	}
 
+out:
 	spin_unlock_bh(&q->lock);
 }
 EXPORT_SYMBOL_GPL(mt76_tx);
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] ath9k: Check for errors when reading SREV register
From: Tim Schumacher @ 2019-03-22  1:47 UTC (permalink / raw)
  To: Kalle Valo
  Cc: QCA ath9k Development, David S. Miller, linux-wireless, netdev,
	linux-kernel
In-Reply-To: <87va0cpmt4.fsf@codeaurora.org>

On 21.03.19 11:02, Kalle Valo wrote:
> Tim Schumacher <timschumi@gmx.de> writes:
>
>> Right now, if an error is encountered during the SREV register
>> read (i.e. an EIO in ath9k_regread()), that error code gets
>> passed all the way to __ath9k_hw_init(), where it is visible
>> during the "Chip rev not supported" message.
>>
>>     ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
>>     ath: phy2: Mac Chip Rev 0x0f.3 is not supported by this driver
>>     ath: phy2: Unable to initialize hardware; initialization status: -95
>>     ath: phy2: Unable to initialize hardware; initialization status: -95
>>     ath9k_htc: Failed to initialize the device
>>
>> Check for -EIO explicitly in ath9k_hw_read_revisions() and return
>> a boolean based on the success of the operation. Check for that in
>> __ath9k_hw_init() and abort with a more debugging-friendly message
>> if reading the revisions wasn't successful.
>>
>>     ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
>>     ath: phy2: Failed to read SREV register
>>     ath: phy2: Could not read hardware revision
>>     ath: phy2: Unable to initialize hardware; initialization status: -95
>>     ath: phy2: Unable to initialize hardware; initialization status: -95
>>     ath9k_htc: Failed to initialize the device
>>
>> This helps when debugging by directly showing the first point of
>> failure and it could prevent possible errors if a 0x0f.3 revision
>> is ever supported.
>>
>> Signed-off-by: Tim Schumacher <timschumi@gmx.de>
>
> [...]
>
>> -	val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
>> +	srev = REG_READ(ah, AR_SREV);
>> +
>> +	if (srev == -EIO) {
>> +		ath_err(ath9k_hw_common(ah),
>> +			"Failed to read SREV register");
>> +		return false;
>> +	}
>
> I really don't like how the error handling is implemented in REG_READ().
> If the register has value 0xfffffffb (= -EIO ==-5) won't this interpret
> that as an error?
>

If the register had that value, it would indeed report an error. However
(at least if I read the current code and the data sheet correctly), to make
use of the higher 24 bits of the register, the "small"/old version of the
SREV_ID (i.e. the rightmost 8 bit) need to be set to 0xFF. Therefore, a
register read of 0xfffffffb should never happen in this register.

But the error handling is indeed a bit weird. Making the return value a pure
status indicator and saving the value from the register by passing a
reference would probably be the best solution to fixing this up.

^ permalink raw reply

* Re: [PATCH] ath9k: Check for errors when reading SREV register
From: Kalle Valo @ 2019-03-22  8:37 UTC (permalink / raw)
  To: Tim Schumacher
  Cc: QCA ath9k Development, David S. Miller, linux-wireless, netdev,
	linux-kernel
In-Reply-To: <95ca6443-a3ad-1eda-db6a-c684cc358fc9@gmx.de>

Tim Schumacher <timschumi@gmx.de> writes:

> On 21.03.19 11:02, Kalle Valo wrote:
>> Tim Schumacher <timschumi@gmx.de> writes:
>>
>>> -	val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
>>> +	srev = REG_READ(ah, AR_SREV);
>>> +
>>> +	if (srev == -EIO) {
>>> +		ath_err(ath9k_hw_common(ah),
>>> +			"Failed to read SREV register");
>>> +		return false;
>>> +	}
>>
>> I really don't like how the error handling is implemented in REG_READ().
>> If the register has value 0xfffffffb (= -EIO ==-5) won't this interpret
>> that as an error?
>>
>
> If the register had that value, it would indeed report an error. However
> (at least if I read the current code and the data sheet correctly), to make
> use of the higher 24 bits of the register, the "small"/old version of the
> SREV_ID (i.e. the rightmost 8 bit) need to be set to 0xFF. Therefore, a
> register read of 0xfffffffb should never happen in this register.

Good, thanks for checking.

> But the error handling is indeed a bit weird. Making the return value a pure
> status indicator and saving the value from the register by passing a
> reference would probably be the best solution to fixing this up.

Yeah, that would be so much better. But that can fixed in another patch,
no need to do that here.

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH 12/14] qtnfmac: fix debugfs entries for multiple cards on the same host
From: Kalle Valo @ 2019-03-22  8:44 UTC (permalink / raw)
  To: Sergey Matyukevich; +Cc: linux-wireless@vger.kernel.org, Igor Mitsyanko
In-Reply-To: <20190321082600.smb64hxdn2lpiqd5@bars>

Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:

> Hello Kalle,
>
>> >> > Fix creation of debugfs entries for qtnfmac wireless card: use separate
>> >> > directories for different wireless cards. This commit enables support
>> >> > for multiple qtnfmac wireless cards on the same PCIe host.
>> >> >
>> >> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>> >> > ---
>> >> >  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>> >> >  1 file changed, 5 insertions(+), 1 deletion(-)
>> >> >
>> >> > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > index b561b75e4433..56fc6d49c121 100644
>> >> > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>> >> >
>> >> >  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >> >  {
>> >> > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>> >> > +     char card_id[64];
>> >> >       int ret;
>> >> >
>> >> >       bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>> >> > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >> >       if (ret) {
>> >> >               pr_err("failed to attach core\n");
>> >> >       } else {
>> >> > -             qtnf_debugfs_init(bus, DRV_NAME);
>> >> > +             snprintf(card_id, sizeof(card_id), "%s:%s",
>> >> > +                      DRV_NAME, pci_name(priv->pdev));
>> >>
>> >> Can you give an example for the path?
>> >>
>> >
>> > For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
>> 
>> TBH not really fond of that. What about
>> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
>> something like that.
>> 
>> And please add an example path to the commit log.
>
> Ok, will be fixed and resubmitted in v2.

Thanks.

> Or, alternatively, if the other patches are ok for you,
> feel free to drop the questionable ones and apply all
> the others. I will rework the rejected pieces and
> resubmit them, adding more pending fixes.

A good point, that's easier. So I have dropped patch 12.

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH 03/12] mt76usb: change mt76u_fill_rx_sg arguments
From: Lorenzo Bianconi @ 2019-03-22 10:10 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless
In-Reply-To: <20190321152537.19105-4-sgruszka@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1805 bytes --]

> We do not need to pass len and sglen to the function.
> Additionally pass gfp to control allocation context.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
> index 3f21599d52de..56e7a2ca8930 100644
> --- a/drivers/net/wireless/mediatek/mt76/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/usb.c
> @@ -285,11 +285,13 @@ mt76u_set_endpoints(struct usb_interface *intf,
>  }
>  
>  static int
> -mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
> -		 int nsgs, int len, int sglen)
> +mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
> +		 gfp_t gfp)
>  {
>  	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
> +	int sglen = SKB_WITH_OVERHEAD(q->buf_size);
>  	struct urb *urb = buf->urb;
> +

please drop newline here

>  	int i;
>  
>  	for (i = 0; i < nsgs; i++) {
> @@ -297,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
>  		void *data;
>  		int offset;
>  
> -		data = page_frag_alloc(&q->rx_page, len, GFP_ATOMIC);
> +		data = page_frag_alloc(&q->rx_page, q->buf_size, gfp);
>  		if (!data)
>  			break;
>  
> @@ -326,8 +328,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
>  		struct mt76u_buf *buf, int nsgs, gfp_t gfp)
>  {
>  	if (dev->usb.sg_en) {
> -		return mt76u_fill_rx_sg(dev, buf, nsgs, q->buf_size,
> -					SKB_WITH_OVERHEAD(q->buf_size));
> +		return mt76u_fill_rx_sg(dev, buf, nsgs, gfp);
>  	} else {
>  		buf->buf = page_frag_alloc(&q->rx_page, q->buf_size, gfp);
>  		return buf->buf ? 0 : -ENOMEM;
> -- 
> 2.20.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* pull-request: iwlwifi-fixes 2019-03-22
From: Luca Coelho @ 2019-03-22 10:58 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, linuxwifi, david.e.box, joe.konno

[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]

Hi Kalle,

This is the first batch of fixes for v5.1.  More details about the
contents in the tag description.

I have sent this out before and kbuildbot reported success.

Please let me know if there are any issues.

Cheers,
Luca.


The following changes since commit 7dfc45e6282a7662279d168cc1219929456f8750:

  mt76x02: do not enable RTS/CTS by default (2019-03-19 17:37:25 +0200)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git tags/iwlwifi-for-kalle-2019-03-22

for you to fetch changes up to 972d8e1377795556024e948357e82532890f2f7d:

  iwlwifi: add new 0x2723/0x2080 card for 22000 (2019-03-22 12:49:05 +0200)

----------------------------------------------------------------
First batch of iwlwifi fixes intended for v5.1

* add some new PCI IDs (plus a struct name change they depend on);
* fix crypto with new devices, namely 22560 and above;
* a bunch of fixes (and a dependency) for the new debugging infra;

----------------------------------------------------------------
Ihab Zhaika (2):
      iwlwifi: rename structs to fit the new names
      iwlwifi: add new 0x2723/0x2080 card for 22000

Johannes Berg (1):
      iwlwifi: mvm: fix TX crypto on 22560+ devices

Shahar S Matityahu (4):
      iwlwifi: add sync_nmi to trans ops
      iwlwifi: dbg_ini: in case of region dump failure set memory to 0
      iwlwifi: dbg_ini: fix bad dump size calculation
      iwlwifi: use sync nmi in case of init flow failure

 drivers/net/wireless/intel/iwlwifi/cfg/22000.c     | 12 ++++++------
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c        | 34 ++++++++--------------------------
 drivers/net/wireless/intel/iwlwifi/fw/init.c       |  1 -
 drivers/net/wireless/intel/iwlwifi/iwl-config.h    |  2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h     | 12 ++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 64 +++++++++++++++-------------------------------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h       |  1 -
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c       | 41 ++---------------------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h       |  7 ++-----
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c      | 13 +++++++------
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c    |  7 ++++---
 drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c  |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c       |  2 +-
 14 files changed, 54 insertions(+), 146 deletions(-)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 00/12] mt76usb: some cleanups and optimizations
From: Lorenzo Bianconi @ 2019-03-22 11:02 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless
In-Reply-To: <20190321152537.19105-1-sgruszka@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]

> Significant change is remove mt76u_buf and use urb directly
> and allocate urb and sg as linear data for better cache usage.
> Other that that, set consist only of some minor cleanups.
> 
> RFC -> v1:
> - introduce mt76u_tx_setup_buffers
> - calculate data_len differently
> - fix *usb->sg bug on intermediate patches
> - use (struct scatterlist *)(e->urb + 1) trick
> 
> Rebased on latest tree and 
> [PATCH v2 00/12] mt76x02: AP support for USB with PS
> https://lore.kernel.org/linux-wireless/1552991867-5087-1-git-send-email-sgruszka@redhat.com/
>   
> Not rebased on
> [PATCH 1/6] mt76: use mac80211 txq scheduling
> https://lore.kernel.org/linux-wireless/20190316204242.73560-1-nbd@nbd.name/
> It easer to rebase '[PATCH 5/6] mt76: move tx tasklet to struct mt76_dev'
> from that set of top of my 2 pending sets. 

LGTM

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> 
> Stanislaw Gruszka (12):
>   mt76usb: change mt76u_submit_buf
>   mt76: remove rx_page_lock
>   mt76usb: change mt76u_fill_rx_sg arguments
>   mt76usb: use usb_dev private data
>   mt76usb: remove mt76u_buf redundant fileds
>   mt76usb: move mt76u_buf->done to queue entry
>   mt76usb: remove mt76u_buf and use urb directly
>   mt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc
>   mt76usb: resue mt76u_urb_alloc for tx
>   mt76usb: remove unneded sg_init_table
>   mt76usb: allocate urb and sg as linear data
>   mt76usb: remove queue variable from rx_tasklet
> 
>  drivers/net/wireless/mediatek/mt76/mt76.h     |  15 +-
>  .../net/wireless/mediatek/mt76/mt76x0/usb.c   |   2 +-
>  .../net/wireless/mediatek/mt76/mt76x2/usb.c   |   4 +-
>  drivers/net/wireless/mediatek/mt76/usb.c      | 243 ++++++++----------
>  4 files changed, 118 insertions(+), 146 deletions(-)
> 
> -- 
> 2.20.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* pull-request: iwlwifi-next 2019-02-22
From: Luca Coelho @ 2019-03-22 12:16 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, linuxwifi, david.e.box, joe.konno

[-- Attachment #1: Type: text/plain, Size: 5257 bytes --]

Hi Kalle,

This is the first batch of patches intended for v5.2.  This includes
the last two patchsets I sent.  Usual development work.  More details
about the contents in the tag description.

I have sent this out before and kbuildbot reported success.

Please let me know if there are any issues.

Cheers,
Luca.


The following changes since commit 501faf710230b67e470b314868110357cf3a554d:

  Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2019-02-28 11:50:40 +0200)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2019-03-22

for you to fetch changes up to fe63f21b20df1adaab90c1839d36ee7c6e4b6ac0:

  iwlwifi: dbg_ini: align to FW api version 1 (2019-03-22 12:59:42 +0200)

----------------------------------------------------------------
First batch of patches intended for v5.2

* Send NO_DATA events so they can be captured in radiotap;
* Some channel-switch changes;
* Support for multiple BSSID;
* Continued work and bugfixes for the new debugging infra;
* Support for some new FW API versions;
* Some work to support new hardware;
* General bugfixes;
* Other cleanups;

----------------------------------------------------------------
Ilan Peer (1):
      iwlwifi: mvm: Support new format of SCAN_OFFLOAD_PROFILES_QUERY_RSP

Johannes Berg (3):
      iwlwifi: mvm: report all NO_DATA events to mac80211
      iwlwifi: mvm: enable HT/VHT IBSS
      iwlwifi: pcie: switch to correct RBD/CD layout for 22560

Luca Coelho (1):
      iwlwifi: remove unnecessary goto out in iwl_parse_nvm_mcc_info()

Mordechay Goodstein (1):
      iwlwifi: mvm: set max amsdu for TLC offload

Sara Sharon (7):
      iwlwifi: mvm: report delayed beacon count to FW
      iwlwifi: mvm: implement CSA abort
      iwlwifi: mvm: track CSA beacons
      iwlwifi: mvm: notify FW on quiet mode in CSA
      iwlwifi: mvm: disconnect in case of bad channel switch parameters
      iwlwifi: mvm: track changes in beacon count during channel switch
      iwlwifi: mvm: support multiple BSSID

Shahar S Matityahu (5):
      iwlwifi: dbg: use dump mask for tx command dumping length
      iwlwifi: mvm: use dump worker during restart instead of sync dump
      iwlwifi: dbg: add DRAM monitor support for AX210 device family
      iwlwifi: dbg_ini: separate between ini and legacy dump flows
      iwlwifi: dbg_ini: align to FW api version 1

Shaul Triebitz (4):
      iwlwifi: mvm: be more forgiving if num of channels is too big
      iwlwifi: add support for 6-7 GHz channels
      iwlwifi: support new NVM response API
      iwlwifi: for AX210 device support radio GF4

YueHaibing (1):
      iwlwifi: Use struct_size() in kzalloc

 drivers/net/wireless/intel/iwlwifi/cfg/22000.c      |   9 +++++
 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
 drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h |  39 ++++++++++++++++---
 drivers/net/wireless/intel/iwlwifi/fw/api/rx.h      |  67 +--------------------------------
 drivers/net/wireless/intel/iwlwifi/fw/api/scan.h    |  54 ++++++++++++++++++++++++--
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c         | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------
 drivers/net/wireless/intel/iwlwifi/fw/dbg.h         |  17 ++++-----
 drivers/net/wireless/intel/iwlwifi/fw/error-dump.h  |   6 ++-
 drivers/net/wireless/intel/iwlwifi/fw/file.h        |   9 +++++
 drivers/net/wireless/intel/iwlwifi/fw/runtime.h     |   1 +
 drivers/net/wireless/intel/iwlwifi/iwl-config.h     |   5 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h        |   5 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c    |  10 ++++-
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c  | 139 +++++++++++++++++++++++++++++++++++++++----------------------------
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h       |   6 +++
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h      |   1 -
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c         |  90 ++++++++++++++++++++++++++++++++++++--------
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c    |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c   |   7 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h        |  24 ++++--------
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c        |   8 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c      |  44 ++++++++++++++++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c       |  31 +++++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c       |  25 ++++++++-----
 drivers/net/wireless/intel/iwlwifi/mvm/time-event.c |   5 ++-
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h  |  30 ++++-----------
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c        |  13 ++-----
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c     |  38 +++++++++++++------
 29 files changed, 807 insertions(+), 446 deletions(-)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 03/12] mt76usb: change mt76u_fill_rx_sg arguments
From: Stanislaw Gruszka @ 2019-03-22 12:45 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: Felix Fietkau, linux-wireless
In-Reply-To: <20190322101038.GA22889@localhost.localdomain>

On Fri, Mar 22, 2019 at 11:10:40AM +0100, Lorenzo Bianconi wrote:
> > We do not need to pass len and sglen to the function.
> > Additionally pass gfp to control allocation context.
> > 
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > ---
> >  drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
> > index 3f21599d52de..56e7a2ca8930 100644
> > --- a/drivers/net/wireless/mediatek/mt76/usb.c
> > +++ b/drivers/net/wireless/mediatek/mt76/usb.c
> > @@ -285,11 +285,13 @@ mt76u_set_endpoints(struct usb_interface *intf,
> >  }
> >  
> >  static int
> > -mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
> > -		 int nsgs, int len, int sglen)
> > +mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
> > +		 gfp_t gfp)
> >  {
> >  	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
> > +	int sglen = SKB_WITH_OVERHEAD(q->buf_size);
> >  	struct urb *urb = buf->urb;
> > +
> 
> please drop newline here

Not sure where it came from, but is already removed on patch 8.

Stanislaw

^ permalink raw reply

* [PATCH 0/3] iwlwifi: fixes intended for 5.1 2019-03-22
From: Luca Coelho @ 2019-03-22 12:47 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Luca Coelho

From: Luca Coelho <luciano.coelho@intel.com>

Hi,

This is the second patchset with fixes for 5.1.

The changes are:

* fix for a potential deadlock in the TX path;
* a fix for offloaded rate-control;
* support new PCI HW IDs which use a new FW;

As usual, I'm pushing this to a pending branch, for kbuild bot, and
will send a pull-request later.

Please review.

Cheers,
Luca.


Johannes Berg (2):
  iwlwifi: mvm: avoid possible deadlock in TX path
  iwlwifi: mvm: update offloaded rate control on changes

Luca Coelho (1):
  iwlwifi: add support for quz firmwares

 drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 18 ++++++++++++++++--
 .../net/wireless/intel/iwlwifi/iwl-config.h    |  1 +
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h   |  1 +
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c  |  7 +++++++
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   |  2 ++
 .../net/wireless/intel/iwlwifi/pcie/trans.c    |  4 ++++
 6 files changed, 31 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply

* [PATCH 1/3] iwlwifi: mvm: avoid possible deadlock in TX path
From: Luca Coelho @ 2019-03-22 12:47 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Johannes Berg, Luca Coelho
In-Reply-To: <20190322124744.17924-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

iwl_mvm_tx_mpdu() may run from iwl_mvm_add_new_dqa_stream_wk(), where
soft-IRQs aren't disabled. In this case, it may hold the station lock
and be interrupted by a soft-IRQ that also wants to acquire said lock,
leading to a deadlock.

Fix it by disabling soft-IRQs in iwl_mvm_add_new_dqa_stream_wk().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index db26f0041a81..98d123dd7177 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1399,7 +1399,9 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
 
 		iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid);
 		list_del_init(&mvmtxq->list);
+		local_bh_disable();
 		iwl_mvm_mac_itxq_xmit(mvm->hw, txq);
+		local_bh_enable();
 	}
 
 	mutex_unlock(&mvm->mutex);
-- 
2.20.1


^ permalink raw reply related

* [PATCH 2/3] iwlwifi: mvm: update offloaded rate control on changes
From: Luca Coelho @ 2019-03-22 12:47 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Johannes Berg, Luca Coelho
In-Reply-To: <20190322124744.17924-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

With offloaded rate control, if the station parameters (rates, NSS,
bandwidth) change (sta_rc_update method), call iwl_mvm_rs_rate_init()
to propagate those change to the firmware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index eeaeb8475666..6a3b11dd2edf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3258,6 +3258,13 @@ static void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw,
 				  struct ieee80211_sta *sta, u32 changed)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+
+	if (changed & (IEEE80211_RC_BW_CHANGED |
+		       IEEE80211_RC_SUPP_RATES_CHANGED |
+		       IEEE80211_RC_NSS_CHANGED))
+		iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
+				     true);
 
 	if (vif->type == NL80211_IFTYPE_STATION &&
 	    changed & IEEE80211_RC_NSS_CHANGED)
-- 
2.20.1


^ permalink raw reply related

* [PATCH 3/3] iwlwifi: add support for quz firmwares
From: Luca Coelho @ 2019-03-22 12:47 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Luca Coelho
In-Reply-To: <20190322124744.17924-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

Add a new configuration with a new firmware name for quz devices.
And, since these devices have the same PCI device and subsystem IDs,
we need to add some code to switch from a normal qu firmware to the
quz firmware.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 18 ++++++++++++++++--
 .../net/wireless/intel/iwlwifi/iwl-config.h    |  1 +
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h   |  1 +
 .../net/wireless/intel/iwlwifi/pcie/trans.c    |  4 ++++
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
index d5c29298ae3e..eb6defb6d0cd 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
@@ -82,6 +82,7 @@
 #define IWL_22000_HR_A0_FW_PRE		"iwlwifi-QuQnj-a0-hr-a0-"
 #define IWL_22000_SU_Z0_FW_PRE		"iwlwifi-su-z0-"
 #define IWL_QU_B_JF_B_FW_PRE		"iwlwifi-Qu-b0-jf-b0-"
+#define IWL_QUZ_A_HR_B_FW_PRE		"iwlwifi-QuZ-a0-hr-b0-"
 #define IWL_QNJ_B_JF_B_FW_PRE		"iwlwifi-QuQnj-b0-jf-b0-"
 #define IWL_CC_A_FW_PRE			"iwlwifi-cc-a0-"
 #define IWL_22000_SO_A_JF_B_FW_PRE	"iwlwifi-so-a0-jf-b0-"
@@ -105,8 +106,8 @@
 	IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
 #define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \
 	IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode"
-#define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
-	IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
+#define IWL_QUZ_A_HR_B_MODULE_FIRMWARE(api) \
+	IWL_QUZ_A_HR_B_FW_PRE __stringify(api) ".ucode"
 #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
 	IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
 #define IWL_QNJ_B_JF_B_MODULE_FIRMWARE(api)		\
@@ -235,6 +236,18 @@ const struct iwl_cfg iwl_ax101_cfg_qu_hr = {
 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
 };
 
+const struct iwl_cfg iwl_ax101_cfg_quz_hr = {
+	.name = "Intel(R) Wi-Fi 6 AX101",
+	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
+	IWL_DEVICE_22500,
+	/*
+	 * This device doesn't support receiving BlockAck with a large bitmap
+	 * so we need to restrict the size of transmitted aggregation to the
+	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
+	 */
+	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
+};
+
 const struct iwl_cfg iwl_ax200_cfg_cc = {
 	.name = "Intel(R) Wi-Fi 6 AX200 160MHz",
 	.fw_name_pre = IWL_CC_A_FW_PRE,
@@ -444,6 +457,7 @@ MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
+MODULE_FIRMWARE(IWL_QUZ_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_QNJ_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index c91b537fa7ff..93070848280a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -549,6 +549,7 @@ extern const struct iwl_cfg iwl22000_2ac_cfg_hr;
 extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb;
 extern const struct iwl_cfg iwl22000_2ac_cfg_jf;
 extern const struct iwl_cfg iwl_ax101_cfg_qu_hr;
+extern const struct iwl_cfg iwl_ax101_cfg_quz_hr;
 extern const struct iwl_cfg iwl22000_2ax_cfg_hr;
 extern const struct iwl_cfg iwl_ax200_cfg_cc;
 extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index aea6d03e545a..e539bc94eff7 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -327,6 +327,7 @@ enum {
 #define CSR_HW_REV_TYPE_NONE		(0x00001F0)
 #define CSR_HW_REV_TYPE_QNJ		(0x0000360)
 #define CSR_HW_REV_TYPE_QNJ_B0		(0x0000364)
+#define CSR_HW_REV_TYPE_QUZ		(0x0000354)
 #define CSR_HW_REV_TYPE_HR_CDB		(0x0000340)
 #define CSR_HW_REV_TYPE_SO		(0x0000370)
 #define CSR_HW_REV_TYPE_TY		(0x0000420)
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 1d6f3053f233..79c1dc05f948 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -3543,6 +3543,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
 		}
 	} else if (cfg == &iwl_ax101_cfg_qu_hr) {
 		if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
+		    CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
+		    trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) {
+			trans->cfg = &iwl22000_2ax_cfg_qnj_hr_b0;
+		} else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
 		    CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) {
 			trans->cfg = &iwl_ax101_cfg_qu_hr;
 		} else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
-- 
2.20.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox