Skip to contentSkip to conversation

Two more pasemi_mac patches for 2.6.26

PATCH In review Olof Johansson 3 participants 10 messages Mar 26, 2008 – Mar 29, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Two more pasemi_mac patches for 2.6.26

Hi Jeff,

The below two patches go on top of the previous patches that were acked by you but applied to pasemi.git for feed up through powerpc.git.

One is a couple of fixes for various corner cases in the jumbo support configuration. The second is addition of netpoll support, from Nate Case.

Review/ack would be appreciated, I'll feed them up the same path as the other changes.

-Olof

#1 lore raw

PATCH 1/2 pasemi_mac: Jumbo frame bugfixes

Fix a couple of corner cases around interface up/down when jumbo frames are configured. Resources weren't always freed and reallocated properly.

drivers/net/pasemi_mac.c +10 -2
index c50f0f4..abb1dc4 100644
@@ -404,6 +404,7 @@ static void pasemi_mac_free_csring(struct pasemi_mac_csring *csring)
 	pasemi_dma_free_flag(csring->events[1]);
 	pasemi_dma_free_ring(&csring->chan);
 	pasemi_dma_free_chan(&csring->chan);
+	pasemi_dma_free_fun(csring->fun);
 }
 
 static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
@@ -1150,7 +1151,10 @@ static int pasemi_mac_open(struct net_device *dev)
 	if (!mac->tx)
 		goto out_tx_ring;
 
-	if (dev->mtu > 1500) {
+	/* We might already have allocated rings in case mtu was changed
+	 * before interface was brought up.
+	 */
+	if (dev->mtu > 1500 && !mac->num_cs) {
 		pasemi_mac_setup_csrings(mac);
 		if (!mac->num_cs)
 			goto out_tx_ring;
@@ -1388,8 +1392,12 @@ static int pasemi_mac_close(struct net_device *dev)
 	free_irq(mac->tx->chan.irq, mac->tx);
 	free_irq(mac->rx->chan.irq, mac->rx);
 
-	for (i = 0; i < mac->num_cs; i++)
+	for (i = 0; i < mac->num_cs; i++) {
 		pasemi_mac_free_csring(mac->cs[i]);
+		mac->cs[i] = NULL;
+	}
+
+	mac->num_cs = 0;
 
 	/* Free resources */
 	pasemi_mac_free_rx_resources(mac);
#2 lore raw

PATCH 2/2 pasemi_mac: Netpoll support

In reply to Olof Johansson

Add netpoll support to allow use of netconsole.

drivers/net/pasemi_mac.c +23 -0
index abb1dc4..6030ffe 100644
@@ -1648,6 +1648,26 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
 	return pkts;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void pasemi_mac_netpoll(struct net_device *dev)
+{
+	const struct pasemi_mac *mac = netdev_priv(dev);
+
+	disable_irq(mac->tx->chan.irq);
+	pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx);
+	enable_irq(mac->tx->chan.irq);
+
+	disable_irq(mac->rx->chan.irq);
+	pasemi_mac_rx_intr(mac->rx->chan.irq, dev);
+	enable_irq(mac->rx->chan.irq);
+}
+#endif
+
 static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct pasemi_mac *mac = netdev_priv(dev);
@@ -1807,6 +1827,9 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dev->mtu = PE_DEF_MTU;
 	/* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
 	mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = pasemi_mac_netpoll;
+#endif
 
 	dev->change_mtu = pasemi_mac_change_mtu;
 	dev->ethtool_ops = &pasemi_mac_ethtool_ops;
#3 lore raw

Re: [PATCH 2/2] pasemi_mac: Netpoll support

Quoted 19 lines · Olof Johansson

Add netpoll support to allow use of netconsole.

drivers/net/pasemi_mac.c +6 -0
index abb1dc4..6030ffe 100644
@@ -1648,6 +1648,26 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
 	return pkts;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */

drivers/net/pasemi_mac.c static int pasemi_mac_poll(struct napi_struct *napi, int budget) · line 1666

Quoted 10 lines
drivers/net/pasemi_mac.c +10 -0
+static void pasemi_mac_netpoll(struct net_device *dev)
+{
+	const struct pasemi_mac *mac = netdev_priv(dev);
+
+	disable_irq(mac->tx->chan.irq);
+	pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx);
+	enable_irq(mac->tx->chan.irq);
+
+	disable_irq(mac->rx->chan.irq);
+	pasemi_mac_rx_intr(mac->rx->chan.irq, dev);

Shouldn't this actually be pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx)? Thanks,
Valentine.

Quoted 4 lines

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#4 lore raw

Re: [PATCH 2/2] pasemi_mac: Netpoll support

Quoted 7 lines · Valentine Barshak

drivers/net/pasemi_mac.c static int pasemi_mac_poll(struct napi_struct *napi, int budget) · line 1666

Quoted 5 lines
drivers/net/pasemi_mac.c +5 -0
+	pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx);
+	enable_irq(mac->tx->chan.irq);
+
+	disable_irq(mac->rx->chan.irq);
+	pasemi_mac_rx_intr(mac->rx->chan.irq, dev);

Shouldn't this actually be pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx)?

Yeah, it should. It used to take the netdev pointer instead. And the void * argument means I never got a compiler warning from it.

Thanks!

-Olof

#5 lore raw

PATCH v2 2/2 pasemi_mac: Netpoll support

In reply to Olof Johansson

Add netpoll support to allow use of netconsole.

---
Changed the interrupt handler arguments as found by Valentine. Will push through powerpc.git with Jeff's ACKs (that were already given).

-Olof

drivers/net/pasemi_mac.c +23 -0
index abb1dc4..965f2e4 100644
@@ -1648,6 +1648,26 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
 	return pkts;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void pasemi_mac_netpoll(struct net_device *dev)
+{
+	const struct pasemi_mac *mac = netdev_priv(dev);
+
+	disable_irq(mac->tx->chan.irq);
+	pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx);
+	enable_irq(mac->tx->chan.irq);
+
+	disable_irq(mac->rx->chan.irq);
+	pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx);
+	enable_irq(mac->rx->chan.irq);
+}
+#endif
+
 static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct pasemi_mac *mac = netdev_priv(dev);
@@ -1807,6 +1827,9 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dev->mtu = PE_DEF_MTU;
 	/* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
 	mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = pasemi_mac_netpoll;
+#endif
 
 	dev->change_mtu = pasemi_mac_change_mtu;
 	dev->ethtool_ops = &pasemi_mac_ethtool_ops;
#7 lore raw
In reply to Olof Johansson
Quoted 11 lines · Olof Johansson

Hi Jeff,

The below two patches go on top of the previous patches that were acked by you but applied to pasemi.git for feed up through powerpc.git.

One is a couple of fixes for various corner cases in the jumbo support configuration. The second is addition of netpoll support, from Nate Case.

Review/ack would be appreciated, I'll feed them up the same path as the other changes.

ACK 1-2, though I would consider closely patch #2, whether you need disable_irq() or spin_lock_irqsave() -- which is best for your specific driver + platform?

#8 lore raw
Quoted 10 lines · Jeff Garzik
Quoted 9 lines · Olof Johansson

Hi Jeff,

The below two patches go on top of the previous patches that were acked by you but applied to pasemi.git for feed up through powerpc.git.

One is a couple of fixes for various corner cases in the jumbo support configuration. The second is addition of netpoll support, from Nate Case.

Quoted 6 lines
Quoted 2 lines

Review/ack would be appreciated, I'll feed them up the same path as the other changes.

ACK 1-2, though I would consider closely patch #2, whether you need disable_irq() or spin_lock_irqsave() -- which is best for your specific driver + platform?

I'm tempted to leave the disable/enable_irq() in there. It's certainly heavier than doing cpu-side irq masking, but adding a spinlock to the common interrupt path seems worse to me. I didn't think we considered the polling to be a hot path anyway...

-Olof

#9 lore raw
Quoted 11 lines · Olof Johansson
Quoted 10 lines · Jeff Garzik
Quoted 9 lines · Olof Johansson

Hi Jeff,

The below two patches go on top of the previous patches that were acked by you but applied to pasemi.git for feed up through powerpc.git.

One is a couple of fixes for various corner cases in the jumbo support configuration. The second is addition of netpoll support, from Nate Case.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Review/ack would be appreciated, I'll feed them up the same path as the other changes.

ACK 1-2, though I would consider closely patch #2, whether you need disable_irq() or spin_lock_irqsave() -- which is best for your specific driver + platform?

I'm tempted to leave the disable/enable_irq() in there. It's certainly heavier than doing cpu-side irq masking, but adding a spinlock to the common interrupt path seems worse to me. I didn't think we considered the polling to be a hot path anyway...

Definitely not a hot path :)