diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 00:14:26 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 00:14:26 -0400 |
commit | d5b732b17ca2fc74f370bdba5aae6c804fac8c35 (patch) | |
tree | 4facc6d96116b032a3c1cb2ced9b2a3008e9216e /drivers/net/mlx4/icm.c | |
parent | eb6e8605ee5f5b4e116451bf01b3f35eac446dde (diff) | |
parent | 67a3e12b05e055c0415c556a315a3d3eb637e29e (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/net/mlx4/icm.c')
-rw-r--r-- | drivers/net/mlx4/icm.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c index 57288ca1395f..b07e4dee80aa 100644 --- a/drivers/net/mlx4/icm.c +++ b/drivers/net/mlx4/icm.c | |||
@@ -163,28 +163,30 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, | |||
163 | ret = mlx4_alloc_icm_pages(&chunk->mem[chunk->npages], | 163 | ret = mlx4_alloc_icm_pages(&chunk->mem[chunk->npages], |
164 | cur_order, gfp_mask); | 164 | cur_order, gfp_mask); |
165 | 165 | ||
166 | if (!ret) { | 166 | if (ret) { |
167 | ++chunk->npages; | 167 | if (--cur_order < 0) |
168 | 168 | goto fail; | |
169 | if (coherent) | 169 | else |
170 | ++chunk->nsg; | 170 | continue; |
171 | else if (chunk->npages == MLX4_ICM_CHUNK_LEN) { | 171 | } |
172 | chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, | ||
173 | chunk->npages, | ||
174 | PCI_DMA_BIDIRECTIONAL); | ||
175 | 172 | ||
176 | if (chunk->nsg <= 0) | 173 | ++chunk->npages; |
177 | goto fail; | ||
178 | 174 | ||
179 | chunk = NULL; | 175 | if (coherent) |
180 | } | 176 | ++chunk->nsg; |
177 | else if (chunk->npages == MLX4_ICM_CHUNK_LEN) { | ||
178 | chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, | ||
179 | chunk->npages, | ||
180 | PCI_DMA_BIDIRECTIONAL); | ||
181 | 181 | ||
182 | npages -= 1 << cur_order; | 182 | if (chunk->nsg <= 0) |
183 | } else { | ||
184 | --cur_order; | ||
185 | if (cur_order < 0) | ||
186 | goto fail; | 183 | goto fail; |
187 | } | 184 | } |
185 | |||
186 | if (chunk->npages == MLX4_ICM_CHUNK_LEN) | ||
187 | chunk = NULL; | ||
188 | |||
189 | npages -= 1 << cur_order; | ||
188 | } | 190 | } |
189 | 191 | ||
190 | if (!coherent && chunk) { | 192 | if (!coherent && chunk) { |