mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
mlxsw: Pass mlxsw_core as a param of mlxsw_core_skb_transmit*
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>
This commit is contained in:
parent
932762b69a
commit
307c2431ab
4 changed files with 9 additions and 19 deletions
|
@ -381,7 +381,7 @@ static int __mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
|
||||||
|
|
||||||
mlxsw_core->emad.trans_active = true;
|
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) {
|
if (err) {
|
||||||
dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n",
|
dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n",
|
||||||
mlxsw_core->emad.tid);
|
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);
|
EXPORT_SYMBOL(mlxsw_core_bus_device_unregister);
|
||||||
|
|
||||||
static struct mlxsw_core *__mlxsw_core_get(void *driver_priv)
|
bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
|
||||||
{
|
|
||||||
return container_of(driver_priv, struct mlxsw_core, driver_priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mlxsw_core_skb_transmit_busy(void *driver_priv,
|
|
||||||
const struct mlxsw_tx_info *tx_info)
|
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,
|
return mlxsw_core->bus->skb_transmit_busy(mlxsw_core->bus_priv,
|
||||||
tx_info);
|
tx_info);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlxsw_core_skb_transmit_busy);
|
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)
|
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,
|
return mlxsw_core->bus->skb_transmit(mlxsw_core->bus_priv, skb,
|
||||||
tx_info);
|
tx_info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,10 +75,9 @@ struct mlxsw_tx_info {
|
||||||
bool is_emad;
|
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);
|
const struct mlxsw_tx_info *tx_info);
|
||||||
|
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
|
||||||
int mlxsw_core_skb_transmit(void *driver_priv, struct sk_buff *skb,
|
|
||||||
const struct mlxsw_tx_info *tx_info);
|
const struct mlxsw_tx_info *tx_info);
|
||||||
|
|
||||||
struct mlxsw_rx_listener {
|
struct mlxsw_rx_listener {
|
||||||
|
|
|
@ -390,7 +390,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
|
||||||
u64 len;
|
u64 len;
|
||||||
int err;
|
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;
|
return NETDEV_TX_BUSY;
|
||||||
|
|
||||||
if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) {
|
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
|
/* Due to a race we might fail here because of a full queue. In that
|
||||||
* unlikely case we simply drop the packet.
|
* 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) {
|
if (!err) {
|
||||||
pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats);
|
pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats);
|
||||||
|
|
|
@ -302,7 +302,7 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,
|
||||||
u64 len;
|
u64 len;
|
||||||
int err;
|
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;
|
return NETDEV_TX_BUSY;
|
||||||
|
|
||||||
if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) {
|
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
|
/* Due to a race we might fail here because of a full queue. In that
|
||||||
* unlikely case we simply drop the packet.
|
* 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) {
|
if (!err) {
|
||||||
pcpu_stats = this_cpu_ptr(mlxsw_sx_port->pcpu_stats);
|
pcpu_stats = this_cpu_ptr(mlxsw_sx_port->pcpu_stats);
|
||||||
|
|
Loading…
Reference in a new issue