[Cbe-oss-dev] [PS3] Make gelic_net work as a module

Ben Collins ben.collins at ubuntu.com
Sat Mar 31 02:26:21 EST 2007


Originally I had moved gelic_irq_status to struct gelic_net_card, since
as a module, the static global didn't play well when used with __pa().

Since the upgrade to 1.6 firmware in the ps3, it started causing issues
again, seen as a tx desc status of 0x02.

I've now made gelic_irq_status a pointer (still in struct
gelic_net_card), allocated with GFP_DMA, and that seems to have resolved
the issue again.

Signed-off-by: Ben Collins <bcollins at ubuntu.com>

--- linux-ps3/drivers/net/gelic_net.c	2007-03-29 17:07:27.000000000 -0400
+++ linux-source-2.6.20-2.6.20/drivers/net/gelic_net.c	2007-03-30 11:58:24.000000000 -0400
@@ -197,6 +197,7 @@
 	struct gelic_net_descr *tx_top, *rx_top;
 
 	struct gelic_net_descr descr[0];
+	uint64_t *gelic_irq_status;
 };
 
 static int ps3_gelic_param = 1; /* vlan desc support */
@@ -205,7 +206,6 @@
 #endif
 
 struct gelic_net_card *gcard;
-static uint64_t gelic_irq_status;
 
 static int dmac_status = 0;
 
@@ -993,7 +993,7 @@
 		}
 		if (!count) {
 			printk("lv1_net_start_txdma failed, status=%ld %016lx\n",\
-				status, gelic_irq_status);
+				status, *card->gelic_irq_status);
 		}
 	}
 }
@@ -1285,7 +1285,7 @@
 	unsigned long flags;
 	uint64_t status;
 
-	status = gelic_irq_status;
+	status = *card->gelic_irq_status;
 	rmb();
 	status0 = (uint32_t)(status >> 32);
 	status1 = (uint32_t)(status & 0xffffffff);
@@ -1764,6 +1764,12 @@
 	if (!netdev)
 		return NULL;
 
+	card->gelic_irq_status = kzalloc(sizeof(*gelic_irq_status), GFP_DMA);
+	if (!card->gelic_irq_status) {
+		free_netdev(card->netdev);
+		return NULL;
+	}
+
 	card = netdev_priv(netdev);
 	card->netdev = netdev;
 	INIT_WORK(&card->tx_timeout_task, gelic_net_tx_timeout_task);
@@ -1792,7 +1798,7 @@
 	card->dev = dev;
 
 	/* setup status indicator */
-	lpar = ps3_mm_phys_to_lpar(__pa(&gelic_irq_status));
+	lpar = ps3_mm_phys_to_lpar(__pa(card->gelic_irq_status));
 	status = lv1_net_set_interrupt_status_indicator(
 						card->dev->did.bus_id,
 						card->dev->did.dev_id,
@@ -1811,6 +1817,7 @@
 	return 0;
 
 error:
+	kfree(card->gelic_irq_status);
 	free_netdev(card->netdev);
 	return error;
 }
@@ -1832,6 +1839,7 @@
 		   atomic_read(&card->tx_timeout_task_counter) == 0);
 
 	unregister_netdev(netdev);
+	kfree(card->gelic_irq_status);
 	free_netdev(netdev);
 
 	return 0;


-- 
Ubuntu:    http://www.ubuntu.com/
Linux1394: http://www.linux1394.org/




More information about the cbe-oss-dev mailing list