Commit 70c18375 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'gianfar-mq-polling'



Claudiu Manoil says:

====================
net: gianfar: Drop GFAR_MQ_POLLING support

Drop long time obsolete "per NAPI multi-queue" support in gianfar,
and related (and undocumented) device tree properties.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0e672f30 221e8c12
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -170,8 +170,6 @@ timer@41100 {
/include/ "pq3-etsec2-0.dtsi"
enet0: ethernet@b0000 {
	queue-group@b0000 {
		fsl,rx-bit-map = <0xff>;
		fsl,tx-bit-map = <0xff>;
		interrupts = <26 2 0 0 27 2 0 0 28 2 0 0>;
	};
};
@@ -179,8 +177,6 @@ enet0: ethernet@b0000 {
/include/ "pq3-etsec2-1.dtsi"
enet1: ethernet@b1000 {
	queue-group@b1000 {
		fsl,rx-bit-map = <0xff>;
		fsl,tx-bit-map = <0xff>;
		interrupts = <33 2 0 0 34 2 0 0 35 2 0 0>;
	};
};
+0 −4
Original line number Diff line number Diff line
@@ -190,8 +190,6 @@ crypto@30000 {
/include/ "pq3-etsec2-0.dtsi"
enet0: ethernet@b0000 {
	queue-group@b0000 {
		fsl,rx-bit-map = <0xff>;
		fsl,tx-bit-map = <0xff>;
		interrupts = <26 2 0 0 27 2 0 0 28 2 0 0>;
	};
};
@@ -199,8 +197,6 @@ enet0: ethernet@b0000 {
/include/ "pq3-etsec2-1.dtsi"
enet1: ethernet@b1000 {
	queue-group@b1000 {
		fsl,rx-bit-map = <0xff>;
		fsl,tx-bit-map = <0xff>;
		interrupts = <33 2 0 0 34 2 0 0 35 2 0 0>;
	};
};
+0 −4
Original line number Diff line number Diff line
@@ -171,8 +171,6 @@
	enet0: ethernet@b0000 {
		queue-group@b0000 {
			reg = <0x10000 0x1000>;
			fsl,rx-bit-map = <0xff>;
			fsl,tx-bit-map = <0xff>;
		};
	};

@@ -180,8 +178,6 @@
	enet1: ethernet@b1000 {
		queue-group@b1000 {
			reg = <0x11000 0x1000>;
			fsl,rx-bit-map = <0xff>;
			fsl,tx-bit-map = <0xff>;
		};
	};

+0 −21
Original line number Diff line number Diff line
@@ -172,29 +172,8 @@
/include/ "pq3-mpic-timer-B.dtsi"

/include/ "pq3-etsec2-0.dtsi"
	enet0: ethernet@b0000 {
		queue-group@b0000 {
			fsl,rx-bit-map = <0xff>;
			fsl,tx-bit-map = <0xff>;
		};
	};

/include/ "pq3-etsec2-1.dtsi"
	enet1: ethernet@b1000 {
		queue-group@b1000 {
			fsl,rx-bit-map = <0xff>;
			fsl,tx-bit-map = <0xff>;
		};
	};

/include/ "pq3-etsec2-2.dtsi"
	enet2: ethernet@b2000 {
		queue-group@b2000 {
			fsl,rx-bit-map = <0xff>;
			fsl,tx-bit-map = <0xff>;
		};

	};

	global-utilities@e0000 {
		compatible = "fsl,p1010-guts";
+11 −159
Original line number Diff line number Diff line
@@ -175,10 +175,7 @@ static void gfar_mac_rx_config(struct gfar_private *priv)
	if (priv->rx_filer_enable) {
		rctrl |= RCTRL_FILREN | RCTRL_PRSDEP_INIT;
		/* Program the RIR0 reg with the required distribution */
		if (priv->poll_mode == GFAR_SQ_POLLING)
		gfar_write(&regs->rir0, DEFAULT_2RXQ_RIR0);
		else /* GFAR_MQ_POLLING */
			gfar_write(&regs->rir0, DEFAULT_8RXQ_RIR0);
	}

	/* Restore PROMISC mode */
@@ -521,29 +518,9 @@ static int gfar_parse_group(struct device_node *np,
	grp->priv = priv;
	spin_lock_init(&grp->grplock);
	if (priv->mode == MQ_MG_MODE) {
		u32 rxq_mask, txq_mask;
		int ret;

		grp->rx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
		grp->tx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);

		ret = of_property_read_u32(np, "fsl,rx-bit-map", &rxq_mask);
		if (!ret) {
			grp->rx_bit_map = rxq_mask ?
			rxq_mask : (DEFAULT_MAPPING >> priv->num_grps);
		}

		ret = of_property_read_u32(np, "fsl,tx-bit-map", &txq_mask);
		if (!ret) {
			grp->tx_bit_map = txq_mask ?
			txq_mask : (DEFAULT_MAPPING >> priv->num_grps);
		}

		if (priv->poll_mode == GFAR_SQ_POLLING) {
		/* One Q per interrupt group: Q0 to G0, Q1 to G1 */
		grp->rx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
		grp->tx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
		}
	} else {
		grp->rx_bit_map = 0xFF;
		grp->tx_bit_map = 0xFF;
@@ -649,18 +626,15 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
	u32 stash_len = 0;
	u32 stash_idx = 0;
	unsigned int num_tx_qs, num_rx_qs;
	unsigned short mode, poll_mode;
	unsigned short mode;

	if (!np)
		return -ENODEV;

	if (of_device_is_compatible(np, "fsl,etsec2")) {
	if (of_device_is_compatible(np, "fsl,etsec2"))
		mode = MQ_MG_MODE;
		poll_mode = GFAR_SQ_POLLING;
	} else {
	else
		mode = SQ_SG_MODE;
		poll_mode = GFAR_SQ_POLLING;
	}

	if (mode == SQ_SG_MODE) {
		num_tx_qs = 1;
@@ -676,22 +650,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
			return -EINVAL;
		}

		if (poll_mode == GFAR_SQ_POLLING) {
		num_tx_qs = num_grps; /* one txq per int group */
		num_rx_qs = num_grps; /* one rxq per int group */
		} else { /* GFAR_MQ_POLLING */
			u32 tx_queues, rx_queues;
			int ret;

			/* parse the num of HW tx and rx queues */
			ret = of_property_read_u32(np, "fsl,num_tx_queues",
						   &tx_queues);
			num_tx_qs = ret ? 1 : tx_queues;

			ret = of_property_read_u32(np, "fsl,num_rx_queues",
						   &rx_queues);
			num_rx_qs = ret ? 1 : rx_queues;
		}
	}

	if (num_tx_qs > MAX_TX_QS) {
@@ -717,7 +677,6 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
	priv->ndev = dev;

	priv->mode = mode;
	priv->poll_mode = poll_mode;

	priv->num_tx_queues = num_tx_qs;
	netif_set_real_num_rx_queues(dev, num_rx_qs);
@@ -2691,106 +2650,6 @@ static int gfar_poll_tx_sq(struct napi_struct *napi, int budget)
	return 0;
}

static int gfar_poll_rx(struct napi_struct *napi, int budget)
{
	struct gfar_priv_grp *gfargrp =
		container_of(napi, struct gfar_priv_grp, napi_rx);
	struct gfar_private *priv = gfargrp->priv;
	struct gfar __iomem *regs = gfargrp->regs;
	struct gfar_priv_rx_q *rx_queue = NULL;
	int work_done = 0, work_done_per_q = 0;
	int i, budget_per_q = 0;
	unsigned long rstat_rxf;
	int num_act_queues;

	/* Clear IEVENT, so interrupts aren't called again
	 * because of the packets that have already arrived
	 */
	gfar_write(&regs->ievent, IEVENT_RX_MASK);

	rstat_rxf = gfar_read(&regs->rstat) & RSTAT_RXF_MASK;

	num_act_queues = bitmap_weight(&rstat_rxf, MAX_RX_QS);
	if (num_act_queues)
		budget_per_q = budget/num_act_queues;

	for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
		/* skip queue if not active */
		if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
			continue;

		rx_queue = priv->rx_queue[i];
		work_done_per_q =
			gfar_clean_rx_ring(rx_queue, budget_per_q);
		work_done += work_done_per_q;

		/* finished processing this queue */
		if (work_done_per_q < budget_per_q) {
			/* clear active queue hw indication */
			gfar_write(&regs->rstat,
				   RSTAT_CLEAR_RXF0 >> i);
			num_act_queues--;

			if (!num_act_queues)
				break;
		}
	}

	if (!num_act_queues) {
		u32 imask;
		napi_complete_done(napi, work_done);

		/* Clear the halt bit in RSTAT */
		gfar_write(&regs->rstat, gfargrp->rstat);

		spin_lock_irq(&gfargrp->grplock);
		imask = gfar_read(&regs->imask);
		imask |= IMASK_RX_DEFAULT;
		gfar_write(&regs->imask, imask);
		spin_unlock_irq(&gfargrp->grplock);
	}

	return work_done;
}

static int gfar_poll_tx(struct napi_struct *napi, int budget)
{
	struct gfar_priv_grp *gfargrp =
		container_of(napi, struct gfar_priv_grp, napi_tx);
	struct gfar_private *priv = gfargrp->priv;
	struct gfar __iomem *regs = gfargrp->regs;
	struct gfar_priv_tx_q *tx_queue = NULL;
	int has_tx_work = 0;
	int i;

	/* Clear IEVENT, so interrupts aren't called again
	 * because of the packets that have already arrived
	 */
	gfar_write(&regs->ievent, IEVENT_TX_MASK);

	for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
		tx_queue = priv->tx_queue[i];
		/* run Tx cleanup to completion */
		if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
			gfar_clean_tx_ring(tx_queue);
			has_tx_work = 1;
		}
	}

	if (!has_tx_work) {
		u32 imask;
		napi_complete(napi);

		spin_lock_irq(&gfargrp->grplock);
		imask = gfar_read(&regs->imask);
		imask |= IMASK_TX_DEFAULT;
		gfar_write(&regs->imask, imask);
		spin_unlock_irq(&gfargrp->grplock);
	}

	return 0;
}

/* GFAR error interrupt handler */
static irqreturn_t gfar_error(int irq, void *grp_id)
{
@@ -3348,17 +3207,10 @@ static int gfar_probe(struct platform_device *ofdev)

	/* Register for napi ...We are registering NAPI for each grp */
	for (i = 0; i < priv->num_grps; i++) {
		if (priv->poll_mode == GFAR_SQ_POLLING) {
		netif_napi_add(dev, &priv->gfargrp[i].napi_rx,
			       gfar_poll_rx_sq, GFAR_DEV_WEIGHT);
		netif_tx_napi_add(dev, &priv->gfargrp[i].napi_tx,
				  gfar_poll_tx_sq, 2);
		} else {
			netif_napi_add(dev, &priv->gfargrp[i].napi_rx,
				       gfar_poll_rx, GFAR_DEV_WEIGHT);
			netif_tx_napi_add(dev, &priv->gfargrp[i].napi_tx,
				       gfar_poll_tx, 2);
		}
	}

	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
Loading