On 7/1/16 8:04 AM, Jiri Pirko wrote:
@@ -327,6 +333,19 @@ mlxsw_sp_port_vport_find_by_fid(const struct mlxsw_sp_port 
*mlxsw_sp_port,
        return NULL;
 }

+static inline struct mlxsw_sp_rif *
+mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp,
+                        const struct net_device *dev)
+{
+       int i;
+
+       for (i = 0; i < MLXSW_SP_RIF_MAX; i++)
+               if (mlxsw_sp->rifs[i] && mlxsw_sp->rifs[i]->dev == dev)
+                       return mlxsw_sp->rifs[i];
+
+       return NULL;
+}
+

Why not add the rif to mlxsw_sp_port which is the priv data for a mlxsw dev?

Reply via email to