From: Roland Dreier <rdreier@cisco.com>
To: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: jeff@garzik.org, netdev@vger.kernel.org,
Liran Liss <liranl@mellanox.co.il>,
tziporet@mellanox.co.il
Subject: Re: [PATCH RFC 01/10] mlx4_en: Include file
Date: Tue, 15 Jul 2008 12:25:34 -0700 [thread overview]
Message-ID: <adaod4zdk5t.fsf@cisco.com> (raw)
In-Reply-To: <487B6569.5000806@mellanox.co.il> (Yevgeny Petrilin's message of "Mon, 14 Jul 2008 17:40:41 +0300")
> +enum mlx4_en_access_flags {
> + MLX4_EN_ACCESS_LOCAL_WRITE = 1,
> + MLX4_EN_ACCESS_REMOTE_WRITE = (1<<1),
> + MLX4_EN_ACCESS_REMOTE_READ = (1<<2),
> + MLX4_EN_ACCESS_REMOTE_ATOMIC = (1<<3),
> + MLX4_EN_ACCESS_MW_BIND = (1<<4)
> +};
>
> +static u32 convert_access(int acc)
> +{
> + return (acc & MLX4_EN_ACCESS_REMOTE_ATOMIC ? MLX4_PERM_ATOMIC : 0) |
> + (acc & MLX4_EN_ACCESS_REMOTE_WRITE ? MLX4_PERM_REMOTE_WRITE : 0) |
> + (acc & MLX4_EN_ACCESS_REMOTE_READ ? MLX4_PERM_REMOTE_READ : 0) |
> + (acc & MLX4_EN_ACCESS_LOCAL_WRITE ? MLX4_PERM_LOCAL_WRITE : 0) |
> + MLX4_PERM_LOCAL_READ;
> +}
> +
> +int mlx4_en_get_dma_mr(struct mlx4_en_dev *mdev, int acc)
> +{
> + int err;
> +
> + err = mlx4_mr_alloc(mdev->dev, mdev->priv_pdn, 0, ~0ull,
> + convert_access(acc), 0, 0, &mdev->mr);
> + if (err)
> + return err;
> +
> + err = mlx4_mr_enable(mdev->dev, &mdev->mr);
> + if (err)
> + goto err_mr;
> +
> + return 0;
> +
> +err_mr:
> + mlx4_mr_free(mdev->dev, &mdev->mr);
> + return err;
> +}
I don't think you need all this access permission stuff, given that you
only have a single call to mlx4_en_get_dma_mr():
> + if (mlx4_en_get_dma_mr(mdev, MLX4_EN_ACCESS_LOCAL_WRITE)) {
and it seems really really unlikely that you would ever add any
remote permissions etc.
- R.
next prev parent reply other threads:[~2008-07-15 19:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 14:40 [PATCH RFC 01/10] mlx4_en: Include file Yevgeny Petrilin
2008-07-14 16:17 ` Ben Hutchings
2008-07-15 13:46 ` Ben Hutchings
2008-07-15 19:14 ` Roland Dreier
2008-07-15 19:23 ` Roland Dreier
2008-07-15 19:25 ` Roland Dreier [this message]
2008-07-15 19:27 ` Roland Dreier
2008-07-15 19:29 ` Roland Dreier
2008-07-15 19:30 ` Roland Dreier
2008-07-16 15:17 ` Yevgeny Petrilin
-- strict thread matches above, loose matches on Subject: below --
2008-07-14 14:44 [Patch " Yevgeny Petrilin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adaod4zdk5t.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=jeff@garzik.org \
--cc=liranl@mellanox.co.il \
--cc=netdev@vger.kernel.org \
--cc=tziporet@mellanox.co.il \
--cc=yevgenyp@mellanox.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.