Skip to content

Commit 3498566

Browse files
Amit Cohenkuba-moo
authored andcommitted
mlxsw: Add mlxsw_txhdr_info structure
mlxsw_tx_info structure is used to store information that is needed to process Tx completions when Tx time stamps are requested. A next patch will move Tx header handling from spectrum.c to pci.c. For that, some additional fields which are related to Tx should be passed to pci driver. As preparation, create an extended structure, called mlxsw_txhdr_info, and store mlxsw_tx_info inside. The new fields should not be added to mlxsw_tx_info structure as it is stored in the SKB control block which is of limited size. The next patch will extend the new structure with some fields which are needed in order to construct Tx header. Signed-off-by: Amit Cohen <amcohen@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Link: https://patch.msgid.link/93aed1961f046f79f46869bab37a3faa5027751d.1737044384.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 41c5d10 commit 3498566

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ struct mlxsw_reg_trans {
677677
struct list_head bulk_list;
678678
struct mlxsw_core *core;
679679
struct sk_buff *tx_skb;
680-
struct mlxsw_tx_info tx_info;
680+
struct mlxsw_txhdr_info txhdr_info;
681681
struct delayed_work timeout_dw;
682682
unsigned int retries;
683683
u64 tid;
@@ -742,7 +742,7 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
742742
skb->len - mlxsw_core->driver->txhdr_len);
743743

744744
atomic_set(&trans->active, 1);
745-
err = mlxsw_core_skb_transmit(mlxsw_core, skb, &trans->tx_info);
745+
err = mlxsw_core_skb_transmit(mlxsw_core, skb, &trans->txhdr_info);
746746
if (err) {
747747
dev_kfree_skb(skb);
748748
return err;
@@ -984,8 +984,8 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core,
984984
list_add_tail(&trans->bulk_list, bulk_list);
985985
trans->core = mlxsw_core;
986986
trans->tx_skb = skb;
987-
trans->tx_info.local_port = MLXSW_PORT_CPU_PORT;
988-
trans->tx_info.is_emad = true;
987+
trans->txhdr_info.tx_info.local_port = MLXSW_PORT_CPU_PORT;
988+
trans->txhdr_info.tx_info.is_emad = true;
989989
INIT_DELAYED_WORK(&trans->timeout_dw, mlxsw_emad_trans_timeout_work);
990990
trans->tid = tid;
991991
init_completion(&trans->completion);
@@ -995,7 +995,7 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core,
995995
trans->type = type;
996996

997997
mlxsw_emad_construct(mlxsw_core, skb, reg, payload, type, trans->tid);
998-
mlxsw_core->driver->txhdr_construct(skb, &trans->tx_info);
998+
mlxsw_core->driver->txhdr_construct(skb, &trans->txhdr_info.tx_info);
999999

10001000
spin_lock_bh(&mlxsw_core->emad.trans_list_lock);
10011001
list_add_tail_rcu(&trans->list, &mlxsw_core->emad.trans_list);
@@ -2330,10 +2330,10 @@ bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
23302330
EXPORT_SYMBOL(mlxsw_core_skb_transmit_busy);
23312331

23322332
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
2333-
const struct mlxsw_tx_info *tx_info)
2333+
const struct mlxsw_txhdr_info *txhdr_info)
23342334
{
23352335
return mlxsw_core->bus->skb_transmit(mlxsw_core->bus_priv, skb,
2336-
tx_info);
2336+
txhdr_info);
23372337
}
23382338
EXPORT_SYMBOL(mlxsw_core_skb_transmit);
23392339

drivers/net/ethernet/mellanox/mlxsw/core.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ struct mlxsw_tx_info {
7272
bool is_emad;
7373
};
7474

75+
struct mlxsw_txhdr_info {
76+
struct mlxsw_tx_info tx_info;
77+
};
78+
7579
struct mlxsw_rx_md_info {
7680
struct napi_struct *napi;
7781
u32 cookie_index;
@@ -95,7 +99,7 @@ struct mlxsw_rx_md_info {
9599
bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
96100
const struct mlxsw_tx_info *tx_info);
97101
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
98-
const struct mlxsw_tx_info *tx_info);
102+
const struct mlxsw_txhdr_info *txhdr_info);
99103
void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core,
100104
struct sk_buff *skb, u16 local_port);
101105

@@ -487,7 +491,7 @@ struct mlxsw_bus {
487491
bool (*skb_transmit_busy)(void *bus_priv,
488492
const struct mlxsw_tx_info *tx_info);
489493
int (*skb_transmit)(void *bus_priv, struct sk_buff *skb,
490-
const struct mlxsw_tx_info *tx_info);
494+
const struct mlxsw_txhdr_info *txhdr_info);
491495
int (*cmd_exec)(void *bus_priv, u16 opcode, u8 opcode_mod,
492496
u32 in_mod, bool out_mbox_direct,
493497
char *in_mbox, size_t in_mbox_size,

drivers/net/ethernet/mellanox/mlxsw/i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static bool mlxsw_i2c_skb_transmit_busy(void *bus_priv,
516516
}
517517

518518
static int mlxsw_i2c_skb_transmit(void *bus_priv, struct sk_buff *skb,
519-
const struct mlxsw_tx_info *tx_info)
519+
const struct mlxsw_txhdr_info *txhdr_info)
520520
{
521521
return 0;
522522
}

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ static bool mlxsw_pci_skb_transmit_busy(void *bus_priv,
21222122
}
21232123

21242124
static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
2125-
const struct mlxsw_tx_info *tx_info)
2125+
const struct mlxsw_txhdr_info *txhdr_info)
21262126
{
21272127
struct mlxsw_pci *mlxsw_pci = bus_priv;
21282128
struct mlxsw_pci_queue *q;
@@ -2137,15 +2137,15 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
21372137
return err;
21382138
}
21392139

2140-
q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info);
2140+
q = mlxsw_pci_sdq_pick(mlxsw_pci, &txhdr_info->tx_info);
21412141
spin_lock_bh(&q->lock);
21422142
elem_info = mlxsw_pci_queue_elem_info_producer_get(q);
21432143
if (!elem_info) {
21442144
/* queue is full */
21452145
err = -EAGAIN;
21462146
goto unlock;
21472147
}
2148-
mlxsw_skb_cb(skb)->tx_info = *tx_info;
2148+
mlxsw_skb_cb(skb)->tx_info = txhdr_info->tx_info;
21492149
elem_info->sdq.skb = skb;
21502150

21512151
wqe = elem_info->elem;

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,16 +721,16 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
721721
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
722722
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
723723
struct mlxsw_sp_port_pcpu_stats *pcpu_stats;
724-
const struct mlxsw_tx_info tx_info = {
725-
.local_port = mlxsw_sp_port->local_port,
726-
.is_emad = false,
724+
const struct mlxsw_txhdr_info txhdr_info = {
725+
.tx_info.local_port = mlxsw_sp_port->local_port,
726+
.tx_info.is_emad = false,
727727
};
728728
u64 len;
729729
int err;
730730

731731
memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb));
732732

733-
if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info))
733+
if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &txhdr_info.tx_info))
734734
return NETDEV_TX_BUSY;
735735

736736
if (eth_skb_pad(skb)) {
@@ -739,7 +739,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
739739
}
740740

741741
err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb,
742-
&tx_info);
742+
&txhdr_info.tx_info);
743743
if (err)
744744
return NETDEV_TX_OK;
745745

@@ -751,7 +751,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
751751
/* Due to a race we might fail here because of a full queue. In that
752752
* unlikely case we simply drop the packet.
753753
*/
754-
err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &tx_info);
754+
err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &txhdr_info);
755755

756756
if (!err) {
757757
pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats);

0 commit comments

Comments
 (0)