Commit 22b330b6 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ionic-struct-cleanups'



Shannon Nelson says:

====================
ionic: struct cleanups

This patchset has a few changes for better cacheline use,
to cleanup a page handling API, and to streamline the
Adminq/Notifyq queue handling.  Lastly, we also have a couple
of fixes pointed out by the friendly kernel test robot.

v2: dropped change to irq coalesce default
    fixed Neel's attributions to Co-developed-by
    dropped the unnecessary new call to dma_sync_single_for_cpu()
    added 2 patches from kernel test robot results
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d3dfc362 2aaa05a1
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -64,9 +64,6 @@ struct ionic_admin_ctx {
	union ionic_adminq_comp comp;
};

int ionic_napi(struct napi_struct *napi, int budget, ionic_cq_cb cb,
	       ionic_cq_done_cb done_cb, void *done_arg);

int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
int ionic_set_dma_mask(struct ionic *ionic);
+3 −30
Original line number Diff line number Diff line
@@ -467,9 +467,7 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
		  struct ionic_intr_info *intr,
		  unsigned int num_descs, size_t desc_size)
{
	struct ionic_cq_info *cur;
	unsigned int ring_size;
	unsigned int i;

	if (desc_size == 0 || !is_power_of_2(num_descs))
		return -EINVAL;
@@ -485,19 +483,6 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
	cq->tail_idx = 0;
	cq->done_color = 1;

	cur = cq->info;

	for (i = 0; i < num_descs; i++) {
		if (i + 1 == num_descs) {
			cur->next = cq->info;
			cur->last = true;
		} else {
			cur->next = cur + 1;
		}
		cur->index = i;
		cur++;
	}

	return 0;
}

@@ -551,9 +536,7 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
		 unsigned int num_descs, size_t desc_size,
		 size_t sg_desc_size, unsigned int pid)
{
	struct ionic_desc_info *cur;
	unsigned int ring_size;
	unsigned int i;

	if (desc_size == 0 || !is_power_of_2(num_descs))
		return -EINVAL;
@@ -574,18 +557,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,

	snprintf(q->name, sizeof(q->name), "L%d-%s%u", lif->index, name, index);

	cur = q->info;

	for (i = 0; i < num_descs; i++) {
		if (i + 1 == num_descs)
			cur->next = q->info;
		else
			cur->next = cur + 1;
		cur->index = i;
		cur->left = num_descs - i;
		cur++;
	}

	return 0;
}

@@ -652,6 +623,7 @@ void ionic_q_service(struct ionic_queue *q, struct ionic_cq_info *cq_info,
	struct ionic_desc_info *desc_info;
	ionic_desc_cb cb;
	void *cb_arg;
	u16 index;

	/* check for empty queue */
	if (q->tail_idx == q->head_idx)
@@ -665,6 +637,7 @@ void ionic_q_service(struct ionic_queue *q, struct ionic_cq_info *cq_info,

	do {
		desc_info = &q->info[q->tail_idx];
		index = q->tail_idx;
		q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1);

		cb = desc_info->cb;
@@ -675,5 +648,5 @@ void ionic_q_service(struct ionic_queue *q, struct ionic_cq_info *cq_info,

		if (cb)
			cb(q, desc_info, cq_info, cb_arg);
	} while (desc_info->index != stop_index);
	} while (index != stop_index);
}
+9 −15
Original line number Diff line number Diff line
@@ -156,9 +156,6 @@ struct ionic_cq_info {
		struct ionic_admin_comp *admincq;
		struct ionic_notifyq_event *notifyq;
	};
	struct ionic_cq_info *next;
	unsigned int index;
	bool last;
};

struct ionic_queue;
@@ -186,9 +183,6 @@ struct ionic_desc_info {
		struct ionic_txq_sg_desc *txq_sg_desc;
		struct ionic_rxq_sg_desc *rxq_sgl_desc;
	};
	struct ionic_desc_info *next;
	unsigned int index;
	unsigned int left;
	unsigned int npages;
	struct ionic_page_info pages[IONIC_RX_MAX_SG_ELEMS + 1];
	ionic_desc_cb cb;
@@ -199,16 +193,17 @@ struct ionic_desc_info {

struct ionic_queue {
	struct device *dev;
	u64 dbell_count;
	u64 drop;
	u64 stop;
	u64 wake;
	struct ionic_lif *lif;
	struct ionic_desc_info *info;
	struct ionic_dev *idev;
	u16 head_idx;
	u16 tail_idx;
	unsigned int index;
	unsigned int num_descs;
	u64 dbell_count;
	u64 stop;
	u64 wake;
	u64 drop;
	struct ionic_dev *idev;
	unsigned int type;
	unsigned int hw_index;
	unsigned int hw_type;
@@ -226,7 +221,6 @@ struct ionic_queue {
	};
	dma_addr_t base_pa;
	dma_addr_t sg_base_pa;
	unsigned int num_descs;
	unsigned int desc_size;
	unsigned int sg_desc_size;
	unsigned int pid;
@@ -246,8 +240,6 @@ struct ionic_intr_info {
};

struct ionic_cq {
	void *base;
	dma_addr_t base_pa;
	struct ionic_lif *lif;
	struct ionic_cq_info *info;
	struct ionic_queue *bound_q;
@@ -255,8 +247,10 @@ struct ionic_cq {
	u16 tail_idx;
	bool done_color;
	unsigned int num_descs;
	u64 compl_count;
	unsigned int desc_size;
	u64 compl_count;
	void *base;
	dma_addr_t base_pa;
};

struct ionic;
+2 −2
Original line number Diff line number Diff line
@@ -298,8 +298,8 @@ static void ionic_get_pauseparam(struct net_device *netdev,

	pause_type = lif->ionic->idev.port_info->config.pause_type;
	if (pause_type) {
		pause->rx_pause = pause_type & IONIC_PAUSE_F_RX ? 1 : 0;
		pause->tx_pause = pause_type & IONIC_PAUSE_F_TX ? 1 : 0;
		pause->rx_pause = (pause_type & IONIC_PAUSE_F_RX) ? 1 : 0;
		pause->tx_pause = (pause_type & IONIC_PAUSE_F_TX) ? 1 : 0;
	}
}

+25 −19
Original line number Diff line number Diff line
@@ -800,21 +800,6 @@ static bool ionic_notifyq_service(struct ionic_cq *cq,
	return true;
}

static int ionic_notifyq_clean(struct ionic_lif *lif, int budget)
{
	struct ionic_dev *idev = &lif->ionic->idev;
	struct ionic_cq *cq = &lif->notifyqcq->cq;
	u32 work_done;

	work_done = ionic_cq_service(cq, budget, ionic_notifyq_service,
				     NULL, NULL);
	if (work_done)
		ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index,
				   work_done, IONIC_INTR_CRED_RESET_COALESCE);

	return work_done;
}

static bool ionic_adminq_service(struct ionic_cq *cq,
				 struct ionic_cq_info *cq_info)
{
@@ -830,15 +815,36 @@ static bool ionic_adminq_service(struct ionic_cq *cq,

static int ionic_adminq_napi(struct napi_struct *napi, int budget)
{
	struct ionic_intr_info *intr = napi_to_cq(napi)->bound_intr;
	struct ionic_lif *lif = napi_to_cq(napi)->lif;
	struct ionic_dev *idev = &lif->ionic->idev;
	unsigned int flags = 0;
	int n_work = 0;
	int a_work = 0;
	int work_done;

	if (lif->notifyqcq && lif->notifyqcq->flags & IONIC_QCQ_F_INITED)
		n_work = ionic_cq_service(&lif->notifyqcq->cq, budget,
					  ionic_notifyq_service, NULL, NULL);

	if (likely(lif->notifyqcq && lif->notifyqcq->flags & IONIC_QCQ_F_INITED))
		n_work = ionic_notifyq_clean(lif, budget);
	a_work = ionic_napi(napi, budget, ionic_adminq_service, NULL, NULL);
	if (lif->adminqcq && lif->adminqcq->flags & IONIC_QCQ_F_INITED)
		a_work = ionic_cq_service(&lif->adminqcq->cq, budget,
					  ionic_adminq_service, NULL, NULL);

	work_done = max(n_work, a_work);
	if (work_done < budget && napi_complete_done(napi, work_done)) {
		flags |= IONIC_INTR_CRED_UNMASK;
		DEBUG_STATS_INTR_REARM(intr);
	}

	return max(n_work, a_work);
	if (work_done || flags) {
		flags |= IONIC_INTR_CRED_RESET_COALESCE;
		ionic_intr_credits(idev->intr_ctrl,
				   intr->index,
				   n_work + a_work, flags);
	}

	return work_done;
}

void ionic_get_stats64(struct net_device *netdev,
Loading