summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_qbman/fsl_usdpaa.c
diff options
context:
space:
mode:
authorRoy Pledge <Roy.Pledge@freescale.com>2013-08-13 15:25:33 (GMT)
committerZhenhua Luo <zhenhua.luo@freescale.com>2013-08-26 07:47:32 (GMT)
commit77b906e591b171f06d505c39e0651779a9c75bea (patch)
tree755bac307d96fa4bc92ff2a4c09e7225624e0e06 /drivers/staging/fsl_qbman/fsl_usdpaa.c
parentadbc4a23b8b75801076ff366f709186e2a0a07a8 (diff)
downloadlinux-fsl-qoriq-77b906e591b171f06d505c39e0651779a9c75bea.tar.xz
Add API to allocate specific portals based on index. This allows an application to get back the exact portal it was previously using by specifing the portals index value.
Signed-off-by: Roy Pledge <Roy.Pledge@freescale.com> Change-Id: I8233816f0519731eb65b3671d68a01266eee42dd Reviewed-on: http://git.am.freescale.net:8181/4002 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Ladouceur Jeffrey-R11498 <Jeffrey.Ladouceur@freescale.com> Reviewed-by: Wang Haiying-R54964 <Haiying.Wang@freescale.com> Reviewed-by: Rivera Jose-B46482 <Jose.G.Rivera@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_qbman/fsl_usdpaa.c')
-rw-r--r--drivers/staging/fsl_qbman/fsl_usdpaa.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c
index 0167b7b..aebbc15 100644
--- a/drivers/staging/fsl_qbman/fsl_usdpaa.c
+++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c
@@ -1047,7 +1047,8 @@ static long ioctl_portal_map(struct file *fp, struct ctx *ctx,
return -ENOMEM;
memcpy(&mapping->user, arg, sizeof(mapping->user));
if (mapping->user.type == usdpaa_portal_qman) {
- mapping->qportal = qm_get_unused_portal();
+ mapping->qportal =
+ qm_get_unused_portal_idx(mapping->user.index);
if (!mapping->qportal) {
ret = -ENODEV;
goto err_get_portal;
@@ -1055,13 +1056,16 @@ static long ioctl_portal_map(struct file *fp, struct ctx *ctx,
mapping->phys = &mapping->qportal->addr_phys[0];
mapping->user.channel = mapping->qportal->public_cfg.channel;
mapping->user.pools = mapping->qportal->public_cfg.pools;
+ mapping->user.index = mapping->qportal->public_cfg.index;
} else if (mapping->user.type == usdpaa_portal_bman) {
- mapping->bportal = bm_get_unused_portal();
+ mapping->bportal =
+ bm_get_unused_portal_idx(mapping->user.index);
if (!mapping->bportal) {
ret = -ENODEV;
goto err_get_portal;
}
mapping->phys = &mapping->bportal->addr_phys[0];
+ mapping->user.index = mapping->bportal->public_cfg.index;
} else {
ret = -EINVAL;
goto err_copy_from_user;
@@ -1255,11 +1259,13 @@ static long usdpaa_ioctl_compat(struct file *fp, unsigned int cmd,
if (copy_from_user(&input, a, sizeof(input)))
return -EFAULT;
converted.type = input.type;
+ converted.index = input.index;
ret = ioctl_portal_map(fp, ctx, &converted);
input.addr.cinh = ptr_to_compat(converted.addr.cinh);
input.addr.cena = ptr_to_compat(converted.addr.cena);
input.channel = converted.channel;
input.pools = converted.pools;
+ input.index = converted.index;
if (copy_to_user(a, &input, sizeof(input)))
return -EFAULT;
return ret;