mlxsw: Pass mlxsw_core as a param of mlxsw_core_skb_transmit*
authorJiri Pirko <jiri@mellanox.com>
Fri, 8 Apr 2016 17:11:22 +0000 (19:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Apr 2016 19:38:42 +0000 (15:38 -0400)
Instead of passing around driver priv, pass struct mlxsw_core *
directly.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/switchx2.c

index 004fb8b..39161fb 100644 (file)
@@ -381,7 +381,7 @@ static int __mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
 
        mlxsw_core->emad.trans_active = true;
 
-       err = mlxsw_core_skb_transmit(mlxsw_core->driver_priv, skb, tx_info);
+       err = mlxsw_core_skb_transmit(mlxsw_core, skb, tx_info);
        if (err) {
                dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n",
                        mlxsw_core->emad.tid);
@@ -929,26 +929,17 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core)
 }
 EXPORT_SYMBOL(mlxsw_core_bus_device_unregister);
 
-static struct mlxsw_core *__mlxsw_core_get(void *driver_priv)
-{
-       return container_of(driver_priv, struct mlxsw_core, driver_priv);
-}
-
-bool mlxsw_core_skb_transmit_busy(void *driver_priv,
+bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
                                  const struct mlxsw_tx_info *tx_info)
 {
-       struct mlxsw_core *mlxsw_core = __mlxsw_core_get(driver_priv);
-
        return mlxsw_core->bus->skb_transmit_busy(mlxsw_core->bus_priv,
                                                  tx_info);
 }
 EXPORT_SYMBOL(mlxsw_core_skb_transmit_busy);
 
-int mlxsw_core_skb_transmit(void *driver_priv, struct sk_buff *skb,
+int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
                            const struct mlxsw_tx_info *tx_info)
 {
-       struct mlxsw_core *mlxsw_core = __mlxsw_core_get(driver_priv);
-
        return mlxsw_core->bus->skb_transmit(mlxsw_core->bus_priv, skb,
                                             tx_info);
 }
index 06631a0..0454212 100644 (file)
@@ -75,10 +75,9 @@ struct mlxsw_tx_info {
        bool is_emad;
 };
 
-bool mlxsw_core_skb_transmit_busy(void *driver_priv,
+bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
                                  const struct mlxsw_tx_info *tx_info);
-
-int mlxsw_core_skb_transmit(void *driver_priv, struct sk_buff *skb,
+int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
                            const struct mlxsw_tx_info *tx_info);
 
 struct mlxsw_rx_listener {
index 3216f2b..8abe1a6 100644 (file)
@@ -390,7 +390,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
        u64 len;
        int err;
 
-       if (mlxsw_core_skb_transmit_busy(mlxsw_sp, &tx_info))
+       if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info))
                return NETDEV_TX_BUSY;
 
        if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) {
@@ -414,7 +414,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
        /* Due to a race we might fail here because of a full queue. In that
         * unlikely case we simply drop the packet.
         */
-       err = mlxsw_core_skb_transmit(mlxsw_sp, skb, &tx_info);
+       err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &tx_info);
 
        if (!err) {
                pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats);
index 2417f09..2518c84 100644 (file)
@@ -302,7 +302,7 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,
        u64 len;
        int err;
 
-       if (mlxsw_core_skb_transmit_busy(mlxsw_sx, &tx_info))
+       if (mlxsw_core_skb_transmit_busy(mlxsw_sx->core, &tx_info))
                return NETDEV_TX_BUSY;
 
        if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) {
@@ -320,7 +320,7 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,
        /* Due to a race we might fail here because of a full queue. In that
         * unlikely case we simply drop the packet.
         */
-       err = mlxsw_core_skb_transmit(mlxsw_sx, skb, &tx_info);
+       err = mlxsw_core_skb_transmit(mlxsw_sx->core, skb, &tx_info);
 
        if (!err) {
                pcpu_stats = this_cpu_ptr(mlxsw_sx_port->pcpu_stats);