Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193868
b: refs/heads/master
c: 47231f7
h: refs/heads/master
v: v3
  • Loading branch information
Sreenivasa Honnur authored and David S. Miller committed Mar 29, 2010
1 parent 41b07f3 commit 90ea2ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3363276f1c420b7de92169ddabd2bb88aa26a7d6
refs/heads/master: 47231f7fb49bed800dd806b4c32f881005d84de8
20 changes: 16 additions & 4 deletions trunk/drivers/net/vxge/vxge-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1914,20 +1914,32 @@ static inline void *vxge_os_dma_malloc(struct pci_dev *pdev,
gfp_t flags;
void *vaddr;
unsigned long misaligned = 0;
int realloc_flag = 0;
*p_dma_acch = *p_dmah = NULL;

if (in_interrupt())
flags = GFP_ATOMIC | GFP_DMA;
else
flags = GFP_KERNEL | GFP_DMA;

size += VXGE_CACHE_LINE_SIZE;

realloc:
vaddr = kmalloc((size), flags);
if (vaddr == NULL)
return vaddr;
misaligned = (unsigned long)VXGE_ALIGN(*((u64 *)&vaddr),
misaligned = (unsigned long)VXGE_ALIGN((unsigned long)vaddr,
VXGE_CACHE_LINE_SIZE);
if (realloc_flag)
goto out;

if (misaligned) {
/* misaligned, free current one and try allocating
* size + VXGE_CACHE_LINE_SIZE memory
*/
kfree((void *) vaddr);
size += VXGE_CACHE_LINE_SIZE;
realloc_flag = 1;
goto realloc;
}
out:
*(unsigned long *)p_dma_acch = misaligned;
vaddr = (void *)((u8 *)vaddr + misaligned);
return vaddr;
Expand Down

0 comments on commit 90ea2ae

Please sign in to comment.