aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-03-21 13:57:01 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-21 16:00:50 -0500
commitc3da14474063e71686039d961d14785a9c2971ae (patch)
treee98f5e56f94abb911cc61df12e026e626c651c7c /drivers/net/skge.c
parentcfc3ed796eda2c41fb20986d831ed56c0474279d (diff)
[PATCH] skge: check the allocation of ring buffer
The SysKonnect Genesis and Yukon chip sets have restrictions on the possible control block area. The memory needs to not cross 4 Gig boundary, and it needs to be 8 byte aligned. This patch checks and fails to bring the device up if region is unacceptable. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 4fc9333f0740..deca5066a447 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -727,7 +727,7 @@ static struct ethtool_ops skge_ethtool_ops = {
727 * Allocate ring elements and chain them together 727 * Allocate ring elements and chain them together
728 * One-to-one association of board descriptors with ring elements 728 * One-to-one association of board descriptors with ring elements
729 */ 729 */
730static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base) 730static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base)
731{ 731{
732 struct skge_tx_desc *d; 732 struct skge_tx_desc *d;
733 struct skge_element *e; 733 struct skge_element *e;
@@ -2168,6 +2168,14 @@ static int skge_up(struct net_device *dev)
2168 if (!skge->mem) 2168 if (!skge->mem)
2169 return -ENOMEM; 2169 return -ENOMEM;
2170 2170
2171 BUG_ON(skge->dma & 7);
2172
2173 if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) {
2174 printk(KERN_ERR PFX "pci_alloc_consistent region crosses 4G boundary\n");
2175 err = -EINVAL;
2176 goto free_pci_mem;
2177 }
2178
2171 memset(skge->mem, 0, skge->mem_size); 2179 memset(skge->mem, 0, skge->mem_size);
2172 2180
2173 if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma))) 2181 if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma)))