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

Commit ac41ab9b authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Ian Maund
Browse files

wil6210: coding style fixes



- parentheses, indentation, typos
- seq_puts() instead of seq_printf() with single argument
- sizeof(var) vs. sizeof(type)

Change-Id: Iff94f2bbb623c213879e35747008b4b017f1476e
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Git-commit: 8fe596274d08b12126b90c5b1092286f66ce6d65
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git


Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent 3e22edf1
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -296,6 +296,7 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
	n = min(request->n_channels, 4U);
	n = min(request->n_channels, 4U);
	for (i = 0; i < n; i++) {
	for (i = 0; i < n; i++) {
		int ch = request->channels[i]->hw_value;
		int ch = request->channels[i]->hw_value;

		if (ch == 0) {
		if (ch == 0) {
			wil_err(wil,
			wil_err(wil,
				"Scan requested for unknown frequency %dMhz\n",
				"Scan requested for unknown frequency %dMhz\n",
@@ -713,7 +714,6 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
	if (rc)
	if (rc)
		goto out;
		goto out;



	netif_carrier_on(ndev);
	netif_carrier_on(ndev);


out:
out:
@@ -804,7 +804,7 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev)
	int rc = 0;
	int rc = 0;
	struct wireless_dev *wdev;
	struct wireless_dev *wdev;


	wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
	wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
	if (!wdev)
	if (!wdev)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);


+34 −19
Original line number Original line Diff line number Diff line
@@ -61,20 +61,22 @@ static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil,
	if (x)
	if (x)
		seq_printf(s, "0x%08x\n", ioread32(x));
		seq_printf(s, "0x%08x\n", ioread32(x));
	else
	else
		seq_printf(s, "???\n");
		seq_puts(s, "???\n");


	if (vring->va && (vring->size < 1025)) {
	if (vring->va && (vring->size < 1025)) {
		uint i;
		uint i;

		for (i = 0; i < vring->size; i++) {
		for (i = 0; i < vring->size; i++) {
			volatile struct vring_tx_desc *d = &vring->va[i].tx;
			volatile struct vring_tx_desc *d = &vring->va[i].tx;

			if ((i % 64) == 0 && (i != 0))
			if ((i % 64) == 0 && (i != 0))
				seq_printf(s, "\n");
				seq_puts(s, "\n");
			seq_printf(s, "%c", (d->dma.status & BIT(0)) ?
			seq_printf(s, "%c", (d->dma.status & BIT(0)) ?
					_s : (vring->ctx[i].skb ? _h : 'h'));
					_s : (vring->ctx[i].skb ? _h : 'h'));
		}
		}
		seq_printf(s, "\n");
		seq_puts(s, "\n");
	}
	}
	seq_printf(s, "}\n");
	seq_puts(s, "}\n");
}
}


static int wil_vring_debugfs_show(struct seq_file *s, void *data)
static int wil_vring_debugfs_show(struct seq_file *s, void *data)
@@ -85,7 +87,7 @@ static int wil_vring_debugfs_show(struct seq_file *s, void *data)
	wil_print_vring(s, wil, "rx", &wil->vring_rx, 'S', '_');
	wil_print_vring(s, wil, "rx", &wil->vring_rx, 'S', '_');


	for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
	for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
		struct vring *vring = &(wil->vring_tx[i]);
		struct vring *vring = &wil->vring_tx[i];
		struct vring_tx_data *txdata = &wil->vring_tx_data[i];
		struct vring_tx_data *txdata = &wil->vring_tx_data[i];


		if (vring->va) {
		if (vring->va) {
@@ -163,7 +165,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
	if (!wmi_addr(wil, r.base) ||
	if (!wmi_addr(wil, r.base) ||
	    !wmi_addr(wil, r.tail) ||
	    !wmi_addr(wil, r.tail) ||
	    !wmi_addr(wil, r.head)) {
	    !wmi_addr(wil, r.head)) {
		seq_printf(s, "  ??? pointers are garbage?\n");
		seq_puts(s, "  ??? pointers are garbage?\n");
		goto out;
		goto out;
	}
	}


@@ -182,6 +184,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
			   le32_to_cpu(d.addr));
			   le32_to_cpu(d.addr));
		if (0 == wmi_read_hdr(wil, d.addr, &hdr)) {
		if (0 == wmi_read_hdr(wil, d.addr, &hdr)) {
			u16 len = le16_to_cpu(hdr.len);
			u16 len = le16_to_cpu(hdr.len);

			seq_printf(s, " -> %04x %04x %04x %02x\n",
			seq_printf(s, " -> %04x %04x %04x %02x\n",
				   le16_to_cpu(hdr.seq), len,
				   le16_to_cpu(hdr.seq), len,
				   le16_to_cpu(hdr.type), hdr.flags);
				   le16_to_cpu(hdr.type), hdr.flags);
@@ -199,6 +202,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
				wil_memcpy_fromio_32(databuf, src, len);
				wil_memcpy_fromio_32(databuf, src, len);
				while (n < len) {
				while (n < len) {
					int l = min(len - n, 16);
					int l = min(len - n, 16);

					hex_dump_to_buffer(databuf + n, l,
					hex_dump_to_buffer(databuf + n, l,
							   16, 1, printbuf,
							   16, 1, printbuf,
							   sizeof(printbuf),
							   sizeof(printbuf),
@@ -208,11 +212,11 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
				}
				}
			}
			}
		} else {
		} else {
			seq_printf(s, "\n");
			seq_puts(s, "\n");
		}
		}
	}
	}
 out:
 out:
	seq_printf(s, "}\n");
	seq_puts(s, "}\n");
}
}


static int wil_mbox_debugfs_show(struct seq_file *s, void *data)
static int wil_mbox_debugfs_show(struct seq_file *s, void *data)
@@ -271,11 +275,13 @@ static int wil_debugfs_ulong_set(void *data, u64 val)
	*(ulong *)data = val;
	*(ulong *)data = val;
	return 0;
	return 0;
}
}

static int wil_debugfs_ulong_get(void *data, u64 *val)
static int wil_debugfs_ulong_get(void *data, u64 *val)
{
{
	*val = *(ulong *)data;
	*val = *(ulong *)data;
	return 0;
	return 0;
}
}

DEFINE_SIMPLE_ATTRIBUTE(wil_fops_ulong, wil_debugfs_ulong_get,
DEFINE_SIMPLE_ATTRIBUTE(wil_fops_ulong, wil_debugfs_ulong_get,
			wil_debugfs_ulong_set, "%llu\n");
			wil_debugfs_ulong_set, "%llu\n");


@@ -339,6 +345,7 @@ static const struct dbg_off isr_off[] = {
	{"IMC",		  S_IWUSR, offsetof(struct RGF_ICR, IMC), doff_io32},
	{"IMC",		  S_IWUSR, offsetof(struct RGF_ICR, IMC), doff_io32},
	{},
	{},
};
};

static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil,
static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil,
				      const char *name,
				      const char *name,
				      struct dentry *parent, u32 off)
				      struct dentry *parent, u32 off)
@@ -474,6 +481,7 @@ struct dentry *wil_debugfs_create_ioblob(const char *name,
{
{
	return debugfs_create_file(name, mode, parent, blob, &fops_ioblob);
	return debugfs_create_file(name, mode, parent, blob, &fops_ioblob);
}
}

/*---reset---*/
/*---reset---*/
static ssize_t wil_write_file_reset(struct file *file, const char __user *buf,
static ssize_t wil_write_file_reset(struct file *file, const char __user *buf,
				    size_t len, loff_t *ppos)
				    size_t len, loff_t *ppos)
@@ -499,6 +507,7 @@ static const struct file_operations fops_reset = {
	.write = wil_write_file_reset,
	.write = wil_write_file_reset,
	.open  = simple_open,
	.open  = simple_open,
};
};

/*---write channel 1..4 to rxon for it, 0 to rxoff---*/
/*---write channel 1..4 to rxon for it, 0 to rxoff---*/
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
				   size_t len, loff_t *ppos)
				   size_t len, loff_t *ppos)
@@ -509,6 +518,7 @@ static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
	bool on;
	bool on;


	char *kbuf = kmalloc(len + 1, GFP_KERNEL);
	char *kbuf = kmalloc(len + 1, GFP_KERNEL);

	if (!kbuf)
	if (!kbuf)
		return -ENOMEM;
		return -ENOMEM;
	if (copy_from_user(kbuf, buf, len)) {
	if (copy_from_user(kbuf, buf, len)) {
@@ -545,6 +555,7 @@ static const struct file_operations fops_rxon = {
	.write = wil_write_file_rxon,
	.write = wil_write_file_rxon,
	.open  = simple_open,
	.open  = simple_open,
};
};

/*---tx_mgmt---*/
/*---tx_mgmt---*/
/* Write mgmt frame to this file to send it */
/* Write mgmt frame to this file to send it */
static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
@@ -554,8 +565,8 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
	struct wiphy *wiphy = wil_to_wiphy(wil);
	struct wiphy *wiphy = wil_to_wiphy(wil);
	struct wireless_dev *wdev = wil_to_wdev(wil);
	struct wireless_dev *wdev = wil_to_wdev(wil);
	int rc;
	int rc;

	void *frame = kmalloc(len, GFP_KERNEL);
	void *frame = kmalloc(len, GFP_KERNEL);

	if (!frame)
	if (!frame)
		return -ENOMEM;
		return -ENOMEM;


@@ -621,8 +632,10 @@ static void wil_seq_hexdump(struct seq_file *s, void *p, int len,
{
{
	char printbuf[16 * 3 + 2];
	char printbuf[16 * 3 + 2];
	int i = 0;
	int i = 0;

	while (i < len) {
	while (i < len) {
		int l = min(len - i, 16);
		int l = min(len - i, 16);

		hex_dump_to_buffer(p + i, l, 16, 1, printbuf,
		hex_dump_to_buffer(p + i, l, 16, 1, printbuf,
				   sizeof(printbuf), false);
				   sizeof(printbuf), false);
		seq_printf(s, "%s%s\n", prefix, printbuf);
		seq_printf(s, "%s%s\n", prefix, printbuf);
@@ -660,10 +673,8 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
	struct wil6210_priv *wil = s->private;
	struct wil6210_priv *wil = s->private;
	struct vring *vring;
	struct vring *vring;
	bool tx = (dbg_vring_index < WIL6210_MAX_TX_RINGS);
	bool tx = (dbg_vring_index < WIL6210_MAX_TX_RINGS);
	if (tx)

		vring = &(wil->vring_tx[dbg_vring_index]);
	vring = tx ? &wil->vring_tx[dbg_vring_index] : &wil->vring_rx;
	else
		vring = &wil->vring_rx;


	if (!vring->va) {
	if (!vring->va) {
		if (tx)
		if (tx)
@@ -678,7 +689,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
		 * only field used, .dma.length, is the same
		 * only field used, .dma.length, is the same
		 */
		 */
		volatile struct vring_tx_desc *d =
		volatile struct vring_tx_desc *d =
				&(vring->va[dbg_txdesc_index].tx);
				&vring->va[dbg_txdesc_index].tx;
		volatile u32 *u = (volatile u32 *)d;
		volatile u32 *u = (volatile u32 *)d;
		struct sk_buff *skb = vring->ctx[dbg_txdesc_index].skb;
		struct sk_buff *skb = vring->ctx[dbg_txdesc_index].skb;


@@ -698,7 +709,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
			wil_seq_print_skb(s, skb);
			wil_seq_print_skb(s, skb);
			kfree_skb(skb);
			kfree_skb(skb);
		}
		}
		seq_printf(s, "}\n");
		seq_puts(s, "}\n");
	} else {
	} else {
		if (tx)
		if (tx)
			seq_printf(s, "[%2d] TxDesc index (%d) >= size (%d)\n",
			seq_printf(s, "[%2d] TxDesc index (%d) >= size (%d)\n",
@@ -812,6 +823,7 @@ static const struct file_operations fops_bf = {
	.read		= seq_read,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.llseek		= seq_lseek,
};
};

/*---------SSID------------*/
/*---------SSID------------*/
static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf,
static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf,
				  size_t count, loff_t *ppos)
				  size_t count, loff_t *ppos)
@@ -874,10 +886,10 @@ static int wil_temp_debugfs_show(struct seq_file *s, void *data)
{
{
	struct wil6210_priv *wil = s->private;
	struct wil6210_priv *wil = s->private;
	u32 t_m, t_r;
	u32 t_m, t_r;

	int rc = wmi_get_temperature(wil, &t_m, &t_r);
	int rc = wmi_get_temperature(wil, &t_m, &t_r);

	if (rc) {
	if (rc) {
		seq_printf(s, "Failed\n");
		seq_puts(s, "Failed\n");
		return 0;
		return 0;
	}
	}


@@ -933,6 +945,7 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data)
	for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
	for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
		struct wil_sta_info *p = &wil->sta[i];
		struct wil_sta_info *p = &wil->sta[i];
		char *status = "unknown";
		char *status = "unknown";

		switch (p->status) {
		switch (p->status) {
		case wil_sta_unused:
		case wil_sta_unused:
			status = "unused   ";
			status = "unused   ";
@@ -993,7 +1006,6 @@ static int wil_info_debugfs_show(struct seq_file *s, void *data)
	rxf_old = rxf;
	rxf_old = rxf;
	txf_old = txf;
	txf_old = txf;



#define CHECK_QSTATE(x) (state & BIT(__QUEUE_STATE_ ## x)) ? \
#define CHECK_QSTATE(x) (state & BIT(__QUEUE_STATE_ ## x)) ? \
	" " __stringify(x) : ""
	" " __stringify(x) : ""


@@ -1028,6 +1040,7 @@ static void wil_print_rxtid(struct seq_file *s, struct wil_tid_ampdu_rx *r)
{
{
	int i;
	int i;
	u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size;
	u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size;

	seq_printf(s, "0x%03x [", r->head_seq_num);
	seq_printf(s, "0x%03x [", r->head_seq_num);
	for (i = 0; i < r->buf_size; i++) {
	for (i = 0; i < r->buf_size; i++) {
		if (i == index)
		if (i == index)
@@ -1046,6 +1059,7 @@ static int wil_sta_debugfs_show(struct seq_file *s, void *data)
	for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
	for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
		struct wil_sta_info *p = &wil->sta[i];
		struct wil_sta_info *p = &wil->sta[i];
		char *status = "unknown";
		char *status = "unknown";

		switch (p->status) {
		switch (p->status) {
		case wil_sta_unused:
		case wil_sta_unused:
			status = "unused   ";
			status = "unused   ";
@@ -1063,6 +1077,7 @@ static int wil_sta_debugfs_show(struct seq_file *s, void *data)
		if (p->status == wil_sta_connected) {
		if (p->status == wil_sta_connected) {
			for (tid = 0; tid < WIL_STA_TID_NUM; tid++) {
			for (tid = 0; tid < WIL_STA_TID_NUM; tid++) {
				struct wil_tid_ampdu_rx *r = p->tid_rx[tid];
				struct wil_tid_ampdu_rx *r = p->tid_rx[tid];

				if (r) {
				if (r) {
					seq_printf(s, "[%2d] ", tid);
					seq_printf(s, "[%2d] ", tid);
					wil_print_rxtid(s, r);
					wil_print_rxtid(s, r);
+4 −3
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, int cid)
	struct net_device *ndev = wil_to_ndev(wil);
	struct net_device *ndev = wil_to_ndev(wil);
	struct wireless_dev *wdev = wil->wdev;
	struct wireless_dev *wdev = wil->wdev;
	struct wil_sta_info *sta = &wil->sta[cid];
	struct wil_sta_info *sta = &wil->sta[cid];

	wil_dbg_misc(wil, "%s(CID %d, status %d)\n", __func__, cid,
	wil_dbg_misc(wil, "%s(CID %d, status %d)\n", __func__, cid,
		     sta->status);
		     sta->status);


@@ -227,6 +228,7 @@ static void wil_fw_error_worker(struct work_struct *work)
static int wil_find_free_vring(struct wil6210_priv *wil)
static int wil_find_free_vring(struct wil6210_priv *wil)
{
{
	int i;
	int i;

	for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) {
	for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) {
		if (!wil->vring_tx[i].va)
		if (!wil->vring_tx[i].va)
			return i;
			return i;
@@ -391,7 +393,6 @@ static int wil_target_reset(struct wil6210_priv *wil)
			W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8));
			W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8));
			W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000);
			W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000);
		}
		}

	}
	}


	/* TODO: check order here!!! Erez code is different */
	/* TODO: check order here!!! Erez code is different */
@@ -436,6 +437,7 @@ static int wil_wait_for_fw_ready(struct wil6210_priv *wil)
{
{
	ulong to = msecs_to_jiffies(1000);
	ulong to = msecs_to_jiffies(1000);
	ulong left = wait_for_completion_timeout(&wil->wmi_ready, to);
	ulong left = wait_for_completion_timeout(&wil->wmi_ready, to);

	if (0 == left) {
	if (0 == left) {
		wil_err(wil, "Firmware not ready\n");
		wil_err(wil, "Firmware not ready\n");
		return -ETIME;
		return -ETIME;
@@ -461,9 +463,8 @@ int wil_reset(struct wil6210_priv *wil)
	wil6210_disconnect(wil, NULL);
	wil6210_disconnect(wil, NULL);


	wil->status = 0; /* prevent NAPI from being scheduled */
	wil->status = 0; /* prevent NAPI from being scheduled */
	if (test_bit(wil_status_napi_en, &wil->status)) {
	if (test_bit(wil_status_napi_en, &wil->status))
		napi_synchronize(&wil->napi_rx);
		napi_synchronize(&wil->napi_rx);
	}


	if (wil->scan_request) {
	if (wil->scan_request) {
		wil_dbg_misc(wil, "Abort scan_request 0x%p\n",
		wil_dbg_misc(wil, "Abort scan_request 0x%p\n",
+1 −0
Original line number Original line Diff line number Diff line
@@ -183,6 +183,7 @@ struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil,
						int size, u16 ssn)
						int size, u16 ssn)
{
{
	struct wil_tid_ampdu_rx *r = kzalloc(sizeof(*r), GFP_KERNEL);
	struct wil_tid_ampdu_rx *r = kzalloc(sizeof(*r), GFP_KERNEL);

	if (!r)
	if (!r)
		return NULL;
		return NULL;


+24 −19
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@ static inline int wil_vring_is_full(struct vring *vring)
{
{
	return wil_vring_next_tail(vring) == vring->swhead;
	return wil_vring_next_tail(vring) == vring->swhead;
}
}

/*
/*
 * Available space in Tx Vring
 * Available space in Tx Vring
 */
 */
@@ -110,7 +111,8 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
	 * we can use any
	 * we can use any
	 */
	 */
	for (i = 0; i < vring->size; i++) {
	for (i = 0; i < vring->size; i++) {
		volatile struct vring_tx_desc *_d = &(vring->va[i].tx);
		volatile struct vring_tx_desc *_d = &vring->va[i].tx;

		_d->dma.status = TX_DMA_STATUS_DU;
		_d->dma.status = TX_DMA_STATUS_DU;
	}
	}


@@ -125,6 +127,7 @@ static void wil_txdesc_unmap(struct device *dev, struct vring_tx_desc *d,
{
{
	dma_addr_t pa = wil_desc_addr(&d->dma.addr);
	dma_addr_t pa = wil_desc_addr(&d->dma.addr);
	u16 dmalen = le16_to_cpu(d->dma.length);
	u16 dmalen = le16_to_cpu(d->dma.length);

	switch (ctx->mapped_as) {
	switch (ctx->mapped_as) {
	case wil_mapped_as_single:
	case wil_mapped_as_single:
		dma_unmap_single(dev, pa, dmalen, DMA_TO_DEVICE);
		dma_unmap_single(dev, pa, dmalen, DMA_TO_DEVICE);
@@ -203,11 +206,12 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
	struct device *dev = wil_to_dev(wil);
	struct device *dev = wil_to_dev(wil);
	unsigned int sz = RX_BUF_LEN;
	unsigned int sz = RX_BUF_LEN;
	struct vring_rx_desc dd, *d = &dd;
	struct vring_rx_desc dd, *d = &dd;
	volatile struct vring_rx_desc *_d = &(vring->va[i].rx);
	volatile struct vring_rx_desc *_d = &vring->va[i].rx;
	dma_addr_t pa;
	dma_addr_t pa;


	/* TODO align */
	/* TODO align */
	struct sk_buff *skb = dev_alloc_skb(sz + headroom);
	struct sk_buff *skb = dev_alloc_skb(sz + headroom);

	if (unlikely(!skb))
	if (unlikely(!skb))
		return -ENOMEM;
		return -ENOMEM;


@@ -286,9 +290,11 @@ static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,
			 */
			 */
			int len = min_t(int, 8 + sizeof(phy_data),
			int len = min_t(int, 8 + sizeof(phy_data),
					wil_rxdesc_phy_length(d));
					wil_rxdesc_phy_length(d));

			if (len > 8) {
			if (len > 8) {
				void *p = skb_tail_pointer(skb);
				void *p = skb_tail_pointer(skb);
				void *pa = PTR_ALIGN(p, 8);
				void *pa = PTR_ALIGN(p, 8);

				if (skb_tailroom(skb) >= len + (pa - p)) {
				if (skb_tailroom(skb) >= len + (pa - p)) {
					phy_length = len - 8;
					phy_length = len - 8;
					memcpy(phy_data, pa, phy_length);
					memcpy(phy_data, pa, phy_length);
@@ -384,13 +390,12 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
	int cid;
	int cid;
	struct wil_net_stats *stats;
	struct wil_net_stats *stats;



	BUILD_BUG_ON(sizeof(struct vring_rx_desc) > sizeof(skb->cb));
	BUILD_BUG_ON(sizeof(struct vring_rx_desc) > sizeof(skb->cb));


	if (wil_vring_is_empty(vring))
	if (wil_vring_is_empty(vring))
		return NULL;
		return NULL;


	_d = &(vring->va[vring->swhead].rx);
	_d = &vring->va[vring->swhead].rx;
	if (!(_d->dma.status & RX_DMA_STATUS_DU)) {
	if (!(_d->dma.status & RX_DMA_STATUS_DU)) {
		/* it is not error, we just reached end of Rx done area */
		/* it is not error, we just reached end of Rx done area */
		return NULL;
		return NULL;
@@ -544,7 +549,7 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
			[GRO_NORMAL]		= "GRO_NORMAL",
			[GRO_NORMAL]		= "GRO_NORMAL",
			[GRO_DROP]		= "GRO_DROP",
			[GRO_DROP]		= "GRO_DROP",
		};
		};
		wil_dbg_txrx(wil, "Rx complete %d bytes => %s,\n",
		wil_dbg_txrx(wil, "Rx complete %d bytes => %s\n",
			     len, gro_res_str[rc]);
			     len, gro_res_str[rc]);
	}
	}
}
}
@@ -585,7 +590,6 @@ void wil_rx_handle(struct wil6210_priv *wil, int *quota)
			else
			else
				wil_netif_rx_any(skb, ndev);
				wil_netif_rx_any(skb, ndev);
		}
		}

	}
	}
	wil_rx_refill(wil, v->size);
	wil_rx_refill(wil, v->size);
}
}
@@ -733,6 +737,7 @@ static struct vring *wil_find_tx_vring(struct wil6210_priv *wil,
	for (i = 0; i < ARRAY_SIZE(wil->vring2cid_tid); i++) {
	for (i = 0; i < ARRAY_SIZE(wil->vring2cid_tid); i++) {
		if (wil->vring2cid_tid[i][0] == cid) {
		if (wil->vring2cid_tid[i][0] == cid) {
			struct vring *v = &wil->vring_tx[i];
			struct vring *v = &wil->vring_tx[i];

			wil_dbg_txrx(wil, "%s(%pM) -> [%d]\n",
			wil_dbg_txrx(wil, "%s(%pM) -> [%d]\n",
				     __func__, eth->h_dest, i);
				     __func__, eth->h_dest, i);
			if (v->va) {
			if (v->va) {
@@ -752,6 +757,7 @@ static void wil_set_da_for_vring(struct wil6210_priv *wil,
{
{
	struct ethhdr *eth = (void *)skb->data;
	struct ethhdr *eth = (void *)skb->data;
	int cid = wil->vring2cid_tid[vring_index][0];
	int cid = wil->vring2cid_tid[vring_index][0];

	memcpy(eth->h_dest, wil->sta[cid].addr, ETH_ALEN);
	memcpy(eth->h_dest, wil->sta[cid].addr, ETH_ALEN);
}
}


@@ -914,10 +920,9 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
			1 + nr_frags);
			1 + nr_frags);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	_d = &(vring->va[i].tx);
	_d = &vring->va[i].tx;


	pa = dma_map_single(dev, skb->data,
	pa = dma_map_single(dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE);
			skb_headlen(skb), DMA_TO_DEVICE);


	wil_dbg_txrx(wil, "Tx skb %d bytes 0x%p -> %pad\n", skb_headlen(skb),
	wil_dbg_txrx(wil, "Tx skb %d bytes 0x%p -> %pad\n", skb_headlen(skb),
		     skb->data, &pa);
		     skb->data, &pa);
@@ -946,8 +951,9 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
		const struct skb_frag_struct *frag =
		const struct skb_frag_struct *frag =
				&skb_shinfo(skb)->frags[f];
				&skb_shinfo(skb)->frags[f];
		int len = skb_frag_size(frag);
		int len = skb_frag_size(frag);

		i = (swhead + f + 1) % vring->size;
		i = (swhead + f + 1) % vring->size;
		_d = &(vring->va[i].tx);
		_d = &vring->va[i].tx;
		pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
		pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
				      DMA_TO_DEVICE);
				      DMA_TO_DEVICE);
		if (unlikely(dma_mapping_error(dev, pa)))
		if (unlikely(dma_mapping_error(dev, pa)))
@@ -994,7 +1000,7 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,


		i = (swhead + f) % vring->size;
		i = (swhead + f) % vring->size;
		ctx = &vring->ctx[i];
		ctx = &vring->ctx[i];
		_d = &(vring->va[i].tx);
		_d = &vring->va[i].tx;
		*d = *_d;
		*d = *_d;
		_d->dma.status = TX_DMA_STATUS_DU;
		_d->dma.status = TX_DMA_STATUS_DU;
		wil_txdesc_unmap(dev, d, ctx);
		wil_txdesc_unmap(dev, d, ctx);
@@ -1008,7 +1014,6 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
	return -EINVAL;
	return -EINVAL;
}
}



netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
{
	struct wil6210_priv *wil = ndev_to_wil(ndev);
	struct wil6210_priv *wil = ndev_to_wil(ndev);
@@ -1036,15 +1041,15 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
	pr_once_fw = false;
	pr_once_fw = false;


	/* find vring */
	/* find vring */
	if (is_unicast_ether_addr(eth->h_dest)) {
	if (is_unicast_ether_addr(eth->h_dest))
		vring = wil_find_tx_vring(wil, skb);
		vring = wil_find_tx_vring(wil, skb);
	} else {
	else
		vring = wil_tx_bcast(wil, skb);
		vring = wil_tx_bcast(wil, skb);
	}
	if (!vring) {
	if (!vring) {
		wil_dbg_txrx(wil, "No Tx VRING found for %pM\n", eth->h_dest);
		wil_dbg_txrx(wil, "No Tx VRING found for %pM\n", eth->h_dest);
		goto drop;
		goto drop;
	}
	}

	/* set up vring entry */
	/* set up vring entry */
	rc = wil_tx_vring(wil, vring, skb);
	rc = wil_tx_vring(wil, vring, skb);


Loading