Re: [for-next 01/11] net/mlx5: E-Switch, Refactor vport representors initialization

2 messages, 2 authors, 2017-12-20 · open the first message on its own page

Re: [for-next 01/11] net/mlx5: E-Switch, Refactor vport representors initialization

From: David Miller <hidden>
Date: 2017-12-20 17:57:34

From: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date: Tue, 19 Dec 2017 12:33:30 -0800
quoted hunk
+int esw_offloads_init_reps(struct mlx5_eswitch *esw)
+{
+	struct mlx5_core_dev *dev = esw->dev;
+	struct mlx5_esw_offload *offloads;
+	struct mlx5_eswitch_rep *rep;
+	int total_vfs = MLX5_TOTAL_VPORTS(dev);
+	u8 hw_id[ETH_ALEN];
+	int vport;
Reverse christmas-tree please.
quoted hunk
+	esw->offloads.vport_reps =
+		kcalloc(total_vfs, sizeof(struct mlx5_eswitch_rep),
+			GFP_KERNEL);
That looks really unpleasant:

	x = kcalloc(y,
		    z, GFP_KERNEL);

would look so much nicer.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [for-next 01/11] net/mlx5: E-Switch, Refactor vport representors initialization

From: Mark Bloch <hidden>
Date: 2017-12-20 19:22:03


On 20/12/2017 19:57, David Miller wrote:
From: Saeed Mahameed <redacted>
Date: Tue, 19 Dec 2017 12:33:30 -0800
quoted
+int esw_offloads_init_reps(struct mlx5_eswitch *esw)
+{
+	struct mlx5_core_dev *dev = esw->dev;
+	struct mlx5_esw_offload *offloads;
+	struct mlx5_eswitch_rep *rep;
+	int total_vfs = MLX5_TOTAL_VPORTS(dev);
+	u8 hw_id[ETH_ALEN];
+	int vport;
Reverse christmas-tree please.
we need dev for  MLX5_TOTAL_VPORTS, so we can't have proper reverse christms-tree,
I'll just remove the initialization of total_vfs and do it after the declarations,
and switch between total_vfs and hw_id. 
quoted
+	esw->offloads.vport_reps =
+		kcalloc(total_vfs, sizeof(struct mlx5_eswitch_rep),
+			GFP_KERNEL);
That looks really unpleasant:

	x = kcalloc(y,
		    z, GFP_KERNEL);

would look so much nicer.
No problem.

Thanks,
Mark.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help