Skip to content

Commit 5032de1

Browse files
committed
Merge: mlxsw: Update the driver to upstream v6.15
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6938 JIRA: https://issues.redhat.com/browse/RHEL-94569 Tested: Using mlxsw self-tests Depends: !6918 Signed-off-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents a87702e + 6d723d4 commit 5032de1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+656
-732
lines changed

drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000
1515
#define MLXFW_FSM_STATE_WAIT_ROUNDS \
1616
(MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS)
17-
#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))
1817

1918
static const int mlxfw_fsm_state_errno[] = {
2019
[MLXFW_FSM_STATE_ERR_ERROR] = -EIO,
@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,
229228
return err;
230229
}
231230

232-
comp_max_size = min_t(u32, comp_max_size, MLXFW_FSM_MAX_COMPONENT_SIZE);
233231
if (comp->data_size > comp_max_size) {
234232
MLXFW_ERR_MSG(mlxfw_dev, extack,
235233
"Component size is bigger than limit", -EINVAL);

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "reg.h"
3636
#include "resources.h"
3737
#include "../mlxfw/mlxfw.h"
38+
#include "txheader.h"
3839

3940
static LIST_HEAD(mlxsw_core_driver_list);
4041
static DEFINE_SPINLOCK(mlxsw_core_driver_list_lock);
@@ -677,7 +678,7 @@ struct mlxsw_reg_trans {
677678
struct list_head bulk_list;
678679
struct mlxsw_core *core;
679680
struct sk_buff *tx_skb;
680-
struct mlxsw_tx_info tx_info;
681+
struct mlxsw_txhdr_info txhdr_info;
681682
struct delayed_work timeout_dw;
682683
unsigned int retries;
683684
u64 tid;
@@ -737,12 +738,11 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
737738
if (!skb)
738739
return -ENOMEM;
739740

740-
trace_devlink_hwmsg(priv_to_devlink(mlxsw_core), false, 0,
741-
skb->data + mlxsw_core->driver->txhdr_len,
742-
skb->len - mlxsw_core->driver->txhdr_len);
741+
trace_devlink_hwmsg(priv_to_devlink(mlxsw_core), false, 0, skb->data,
742+
skb->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;
@@ -944,7 +944,7 @@ static struct sk_buff *mlxsw_emad_alloc(const struct mlxsw_core *mlxsw_core,
944944

945945
emad_len = (reg_len + sizeof(u32) + MLXSW_EMAD_ETH_HDR_LEN +
946946
(MLXSW_EMAD_OP_TLV_LEN + MLXSW_EMAD_END_TLV_LEN) *
947-
sizeof(u32) + mlxsw_core->driver->txhdr_len);
947+
sizeof(u32) + MLXSW_TXHDR_LEN);
948948
if (mlxsw_core->emad.enable_string_tlv)
949949
emad_len += MLXSW_EMAD_STRING_TLV_LEN * sizeof(u32);
950950
if (mlxsw_core->emad.enable_latency_tlv)
@@ -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,6 @@ 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);
999998

1000999
spin_lock_bh(&mlxsw_core->emad.trans_list_lock);
10011000
list_add_tail_rcu(&trans->list, &mlxsw_core->emad.trans_list);
@@ -2330,10 +2329,10 @@ bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
23302329
EXPORT_SYMBOL(mlxsw_core_skb_transmit_busy);
23312330

23322331
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
2333-
const struct mlxsw_tx_info *tx_info)
2332+
const struct mlxsw_txhdr_info *txhdr_info)
23342333
{
23352334
return mlxsw_core->bus->skb_transmit(mlxsw_core->bus_priv, skb,
2336-
tx_info);
2335+
txhdr_info);
23372336
}
23382337
EXPORT_SYMBOL(mlxsw_core_skb_transmit);
23392338

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ struct mlxsw_tx_info {
7272
bool is_emad;
7373
};
7474

75+
struct mlxsw_txhdr_info {
76+
struct mlxsw_tx_info tx_info;
77+
bool data;
78+
u16 max_fid; /* Used for PTP packets which are sent as data. */
79+
};
80+
7581
struct mlxsw_rx_md_info {
82+
struct napi_struct *napi;
7683
u32 cookie_index;
7784
u32 latency;
7885
u32 tx_congestion;
@@ -94,7 +101,7 @@ struct mlxsw_rx_md_info {
94101
bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
95102
const struct mlxsw_tx_info *tx_info);
96103
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
97-
const struct mlxsw_tx_info *tx_info);
104+
const struct mlxsw_txhdr_info *txhdr_info);
98105
void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core,
99106
struct sk_buff *skb, u16 local_port);
100107

@@ -425,8 +432,6 @@ struct mlxsw_driver {
425432
int (*trap_policer_counter_get)(struct mlxsw_core *mlxsw_core,
426433
const struct devlink_trap_policer *policer,
427434
u64 *p_drops);
428-
void (*txhdr_construct)(struct sk_buff *skb,
429-
const struct mlxsw_tx_info *tx_info);
430435
int (*resources_register)(struct mlxsw_core *mlxsw_core);
431436
int (*kvd_sizes_get)(struct mlxsw_core *mlxsw_core,
432437
const struct mlxsw_config_profile *profile,
@@ -439,7 +444,6 @@ struct mlxsw_driver {
439444
void (*ptp_transmitted)(struct mlxsw_core *mlxsw_core,
440445
struct sk_buff *skb, u16 local_port);
441446

442-
u8 txhdr_len;
443447
const struct mlxsw_config_profile *profile;
444448
bool sdq_supports_cqe_v2;
445449
};
@@ -486,7 +490,7 @@ struct mlxsw_bus {
486490
bool (*skb_transmit_busy)(void *bus_priv,
487491
const struct mlxsw_tx_info *tx_info);
488492
int (*skb_transmit)(void *bus_priv, struct sk_buff *skb,
489-
const struct mlxsw_tx_info *tx_info);
493+
const struct mlxsw_txhdr_info *txhdr_info);
490494
int (*cmd_exec)(void *bus_priv, u16 opcode, u8 opcode_mod,
491495
u32 in_mod, bool out_mbox_direct,
492496
char *in_mbox, size_t in_mbox_size,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static bool mlxsw_afk_blocks_check(struct mlxsw_afk *mlxsw_afk)
6767

6868
for (j = 0; j < block->instances_count; j++) {
6969
const struct mlxsw_afk_element_info *elinfo;
70-
struct mlxsw_afk_element_inst *elinst;
70+
const struct mlxsw_afk_element_inst *elinst;
7171

7272
elinst = &block->instances[j];
7373
elinfo = &mlxsw_afk_element_infos[elinst->element];
@@ -154,7 +154,7 @@ static void mlxsw_afk_picker_count_hits(struct mlxsw_afk *mlxsw_afk,
154154
const struct mlxsw_afk_block *block = &mlxsw_afk->blocks[i];
155155

156156
for (j = 0; j < block->instances_count; j++) {
157-
struct mlxsw_afk_element_inst *elinst;
157+
const struct mlxsw_afk_element_inst *elinst;
158158

159159
elinst = &block->instances[j];
160160
if (elinst->element == element) {
@@ -386,7 +386,7 @@ mlxsw_afk_block_elinst_get(const struct mlxsw_afk_block *block,
386386
int i;
387387

388388
for (i = 0; i < block->instances_count; i++) {
389-
struct mlxsw_afk_element_inst *elinst;
389+
const struct mlxsw_afk_element_inst *elinst;
390390

391391
elinst = &block->instances[i];
392392
if (elinst->element == element)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct mlxsw_afk_element_inst { /* element instance in actual block */
117117

118118
struct mlxsw_afk_block {
119119
u16 encoding; /* block ID */
120-
struct mlxsw_afk_element_inst *instances;
120+
const struct mlxsw_afk_element_inst *instances;
121121
unsigned int instances_count;
122122
bool high_entropy;
123123
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,7 @@ static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core,
14841484
vfree(types_info->data);
14851485
err_data_alloc:
14861486
kfree(types_info);
1487+
linecards->types_info = NULL;
14871488
return err;
14881489
}
14891490

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: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "cmd.h"
2222
#include "port.h"
2323
#include "resources.h"
24+
#include "txheader.h"
2425

2526
#define mlxsw_pci_write32(mlxsw_pci, reg, val) \
2627
iowrite32be(val, (mlxsw_pci)->hw_addr + (MLXSW_PCI_ ## reg))
@@ -737,6 +738,7 @@ static void mlxsw_pci_cqe_rdq_md_init(struct sk_buff *skb, const char *cqe)
737738
}
738739

739740
static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
741+
struct napi_struct *napi,
740742
struct mlxsw_pci_queue *q,
741743
u16 consumer_counter_limit,
742744
enum mlxsw_pci_cqe_v cqe_v, char *cqe)
@@ -807,6 +809,7 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
807809
}
808810

809811
mlxsw_pci_skb_cb_ts_set(mlxsw_pci, skb, cqe_v, cqe);
812+
mlxsw_skb_cb(skb)->rx_md_info.napi = napi;
810813

811814
mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info);
812815

@@ -869,7 +872,7 @@ static int mlxsw_pci_napi_poll_cq_rx(struct napi_struct *napi, int budget)
869872
continue;
870873
}
871874

872-
mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq,
875+
mlxsw_pci_cqe_rdq_handle(mlxsw_pci, napi, rdq,
873876
wqe_counter, q->u.cq.v, cqe);
874877

875878
if (++work_done == budget)
@@ -2093,6 +2096,39 @@ static void mlxsw_pci_fini(void *bus_priv)
20932096
mlxsw_pci_free_irq_vectors(mlxsw_pci);
20942097
}
20952098

2099+
static int mlxsw_pci_txhdr_construct(struct sk_buff *skb,
2100+
const struct mlxsw_txhdr_info *txhdr_info)
2101+
{
2102+
const struct mlxsw_tx_info tx_info = txhdr_info->tx_info;
2103+
char *txhdr;
2104+
2105+
if (skb_cow_head(skb, MLXSW_TXHDR_LEN))
2106+
return -ENOMEM;
2107+
2108+
txhdr = skb_push(skb, MLXSW_TXHDR_LEN);
2109+
memset(txhdr, 0, MLXSW_TXHDR_LEN);
2110+
2111+
mlxsw_tx_hdr_version_set(txhdr, MLXSW_TXHDR_VERSION_1);
2112+
mlxsw_tx_hdr_proto_set(txhdr, MLXSW_TXHDR_PROTO_ETH);
2113+
mlxsw_tx_hdr_swid_set(txhdr, 0);
2114+
2115+
if (unlikely(txhdr_info->data)) {
2116+
u16 fid = txhdr_info->max_fid + tx_info.local_port - 1;
2117+
2118+
mlxsw_tx_hdr_rx_is_router_set(txhdr, true);
2119+
mlxsw_tx_hdr_fid_valid_set(txhdr, true);
2120+
mlxsw_tx_hdr_fid_set(txhdr, fid);
2121+
mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_DATA);
2122+
} else {
2123+
mlxsw_tx_hdr_ctl_set(txhdr, MLXSW_TXHDR_ETH_CTL);
2124+
mlxsw_tx_hdr_control_tclass_set(txhdr, 1);
2125+
mlxsw_tx_hdr_port_mid_set(txhdr, tx_info.local_port);
2126+
mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_CONTROL);
2127+
}
2128+
2129+
return 0;
2130+
}
2131+
20962132
static struct mlxsw_pci_queue *
20972133
mlxsw_pci_sdq_pick(struct mlxsw_pci *mlxsw_pci,
20982134
const struct mlxsw_tx_info *tx_info)
@@ -2120,7 +2156,7 @@ static bool mlxsw_pci_skb_transmit_busy(void *bus_priv,
21202156
}
21212157

21222158
static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
2123-
const struct mlxsw_tx_info *tx_info)
2159+
const struct mlxsw_txhdr_info *txhdr_info)
21242160
{
21252161
struct mlxsw_pci *mlxsw_pci = bus_priv;
21262162
struct mlxsw_pci_queue *q;
@@ -2129,21 +2165,25 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
21292165
int i;
21302166
int err;
21312167

2168+
err = mlxsw_pci_txhdr_construct(skb, txhdr_info);
2169+
if (err)
2170+
return err;
2171+
21322172
if (skb_shinfo(skb)->nr_frags > MLXSW_PCI_WQE_SG_ENTRIES - 1) {
21332173
err = skb_linearize(skb);
21342174
if (err)
21352175
return err;
21362176
}
21372177

2138-
q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info);
2178+
q = mlxsw_pci_sdq_pick(mlxsw_pci, &txhdr_info->tx_info);
21392179
spin_lock_bh(&q->lock);
21402180
elem_info = mlxsw_pci_queue_elem_info_producer_get(q);
21412181
if (!elem_info) {
21422182
/* queue is full */
21432183
err = -EAGAIN;
21442184
goto unlock;
21452185
}
2146-
mlxsw_skb_cb(skb)->tx_info = *tx_info;
2186+
mlxsw_skb_cb(skb)->tx_info = txhdr_info->tx_info;
21472187
elem_info->sdq.skb = skb;
21482188

21492189
wqe = elem_info->elem;
@@ -2174,6 +2214,8 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
21742214
for (i++; i < MLXSW_PCI_WQE_SG_ENTRIES; i++)
21752215
mlxsw_pci_wqe_byte_count_set(wqe, i, 0);
21762216

2217+
mlxsw_pci_wqe_ipcs_set(wqe, skb->ip_summed == CHECKSUM_PARTIAL);
2218+
21772219
/* Everything is set up, ring producer doorbell to get HW going */
21782220
q->producer_counter++;
21792221
mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ MLXSW_ITEM32(pci, wqe, lp, 0x00, 30, 1);
9090
*/
9191
MLXSW_ITEM32(pci, wqe, type, 0x00, 23, 4);
9292

93+
/* pci_wqe_ipcs
94+
* Calculate IPv4 and TCP / UDP checksums.
95+
*/
96+
MLXSW_ITEM32(pci, wqe, ipcs, 0x00, 14, 1);
97+
9398
/* pci_wqe_byte_count
9499
* Size of i-th scatter/gather entry, 0 if entry is unused.
95100
*/

0 commit comments

Comments
 (0)