mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 15:13:55 +08:00
mlx4: remove unnecessary variables and arguments
mlx4_qp_attach/detach_common() don't use hash variable, move it to find_entry() static find_entry() in mcg.c doesn't use steer argument Signed-off-by: Eugenia Emantayev <eugenia@mellanox.co.il> Reviewed-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
45b5136551
commit
deb8b3e849
@ -562,14 +562,14 @@ out_mutex:
|
|||||||
*/
|
*/
|
||||||
static int find_entry(struct mlx4_dev *dev, u8 port,
|
static int find_entry(struct mlx4_dev *dev, u8 port,
|
||||||
u8 *gid, enum mlx4_protocol prot,
|
u8 *gid, enum mlx4_protocol prot,
|
||||||
enum mlx4_steer_type steer,
|
|
||||||
struct mlx4_cmd_mailbox *mgm_mailbox,
|
struct mlx4_cmd_mailbox *mgm_mailbox,
|
||||||
u16 *hash, int *prev, int *index)
|
int *prev, int *index)
|
||||||
{
|
{
|
||||||
struct mlx4_cmd_mailbox *mailbox;
|
struct mlx4_cmd_mailbox *mailbox;
|
||||||
struct mlx4_mgm *mgm = mgm_mailbox->buf;
|
struct mlx4_mgm *mgm = mgm_mailbox->buf;
|
||||||
u8 *mgid;
|
u8 *mgid;
|
||||||
int err;
|
int err;
|
||||||
|
u16 hash;
|
||||||
u8 op_mod = (prot == MLX4_PROT_ETH) ?
|
u8 op_mod = (prot == MLX4_PROT_ETH) ?
|
||||||
!!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) : 0;
|
!!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) : 0;
|
||||||
|
|
||||||
@ -580,15 +580,15 @@ static int find_entry(struct mlx4_dev *dev, u8 port,
|
|||||||
|
|
||||||
memcpy(mgid, gid, 16);
|
memcpy(mgid, gid, 16);
|
||||||
|
|
||||||
err = mlx4_GID_HASH(dev, mailbox, hash, op_mod);
|
err = mlx4_GID_HASH(dev, mailbox, &hash, op_mod);
|
||||||
mlx4_free_cmd_mailbox(dev, mailbox);
|
mlx4_free_cmd_mailbox(dev, mailbox);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
mlx4_dbg(dev, "Hash for %pI6 is %04x\n", gid, *hash);
|
mlx4_dbg(dev, "Hash for %pI6 is %04x\n", gid, hash);
|
||||||
|
|
||||||
*index = *hash;
|
*index = hash;
|
||||||
*prev = -1;
|
*prev = -1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -597,7 +597,7 @@ static int find_entry(struct mlx4_dev *dev, u8 port,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (!(be32_to_cpu(mgm->members_count) & 0xffffff)) {
|
if (!(be32_to_cpu(mgm->members_count) & 0xffffff)) {
|
||||||
if (*index != *hash) {
|
if (*index != hash) {
|
||||||
mlx4_err(dev, "Found zero MGID in AMGM.\n");
|
mlx4_err(dev, "Found zero MGID in AMGM.\n");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
@ -624,7 +624,6 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
|||||||
struct mlx4_cmd_mailbox *mailbox;
|
struct mlx4_cmd_mailbox *mailbox;
|
||||||
struct mlx4_mgm *mgm;
|
struct mlx4_mgm *mgm;
|
||||||
u32 members_count;
|
u32 members_count;
|
||||||
u16 hash;
|
|
||||||
int index, prev;
|
int index, prev;
|
||||||
int link = 0;
|
int link = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -638,8 +637,8 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
|||||||
mgm = mailbox->buf;
|
mgm = mailbox->buf;
|
||||||
|
|
||||||
mutex_lock(&priv->mcg_table.mutex);
|
mutex_lock(&priv->mcg_table.mutex);
|
||||||
err = find_entry(dev, port, gid, prot, steer,
|
err = find_entry(dev, port, gid, prot,
|
||||||
mailbox, &hash, &prev, &index);
|
mailbox, &prev, &index);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -733,7 +732,6 @@ int mlx4_qp_detach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
|||||||
struct mlx4_cmd_mailbox *mailbox;
|
struct mlx4_cmd_mailbox *mailbox;
|
||||||
struct mlx4_mgm *mgm;
|
struct mlx4_mgm *mgm;
|
||||||
u32 members_count;
|
u32 members_count;
|
||||||
u16 hash;
|
|
||||||
int prev, index;
|
int prev, index;
|
||||||
int i, loc;
|
int i, loc;
|
||||||
int err;
|
int err;
|
||||||
@ -747,8 +745,8 @@ int mlx4_qp_detach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
|||||||
|
|
||||||
mutex_lock(&priv->mcg_table.mutex);
|
mutex_lock(&priv->mcg_table.mutex);
|
||||||
|
|
||||||
err = find_entry(dev, port, gid, prot, steer,
|
err = find_entry(dev, port, gid, prot,
|
||||||
mailbox, &hash, &prev, &index);
|
mailbox, &prev, &index);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user