[ofa-general][PATCH] mlx4_core: Multi Protocol support

Roland Dreier rdreier at cisco.com
Wed Apr 16 12:00:33 PDT 2008


 > t mlx4_qp_to_ready(struct mlx4_dev *dev,
 >      	     struct mlx4_mtt *mtt,
 >      	     struct mlx4_qp_context *context,
 >      	     struct mlx4_qp *qp,
 >      	     enum mlx4_qp_state *qp_state)

I don't see any callers of this function?

 > 
 > +#define STATE_ARR_SIZE 4
 > +	int err = 0;
 > +	int i;
 > +	enum mlx4_qp_state states[STATE_ARR_SIZE] = {
 > +		MLX4_QP_STATE_RST,
 > +		MLX4_QP_STATE_INIT,
 > +		MLX4_QP_STATE_RTR,
 > +		MLX4_QP_STATE_RTS
 > +	};
 > +
 > +	for (i = 0; i < STATE_ARR_SIZE - 1; i++) {

I think it's more idiomatic to write this as:

	enum mlx4_qp_state states[] = {
		MLX4_QP_STATE_RST,
		MLX4_QP_STATE_INIT,
		MLX4_QP_STATE_RTR,
		MLX4_QP_STATE_RTS
	};

	for (i = 0; i < ARRAY_SIZE(states) - 1; i++) {

 > +		context->flags |= cpu_to_be32(states[i+1] << 28);

Do you really want the |= here?  INIT == 1, RTR == 2, so on the
transition from INIT to RTR the value will be 1|2, ie 3.



More information about the general mailing list