mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 21:14:44 +08:00
mlxsw: core: Add support for using SKB control buffer
The SKB control buffer is useful (and used) for bookkeeping of information related to that SKB. Add helpers so that the mlxsw driver(s) can safely use the buffer as well. The structure is currently empty, individual users will add members to it as necessary. Note that SKB allocation functions already clear the buffer, so the cleanup is only necessary when ndo_start_xmit is called. Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
aed4b57211
commit
d7cd206dbf
@ -418,4 +418,13 @@ enum mlxsw_devlink_param_id {
|
||||
MLXSW_DEVLINK_PARAM_ID_ACL_REGION_REHASH_INTERVAL,
|
||||
};
|
||||
|
||||
struct mlxsw_skb_cb {
|
||||
};
|
||||
|
||||
static inline struct mlxsw_skb_cb *mlxsw_skb_cb(struct sk_buff *skb)
|
||||
{
|
||||
BUILD_BUG_ON(sizeof(mlxsw_skb_cb) > sizeof(skb->cb));
|
||||
return (struct mlxsw_skb_cb *) skb->cb;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -790,6 +790,8 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
|
||||
u64 len;
|
||||
int err;
|
||||
|
||||
memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb));
|
||||
|
||||
if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info))
|
||||
return NETDEV_TX_BUSY;
|
||||
|
||||
|
@ -299,6 +299,8 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,
|
||||
u64 len;
|
||||
int err;
|
||||
|
||||
memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb));
|
||||
|
||||
if (mlxsw_core_skb_transmit_busy(mlxsw_sx->core, &tx_info))
|
||||
return NETDEV_TX_BUSY;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user