Skip to content

Commit c131efb

Browse files
tgupdate: merge t/selftests-bpf-Add-bpf_bkup-scheduler into t/selftests-bpf-Add-bpf_bkup-test base
2 parents 68632c5 + ddb4dd3 commit c131efb

File tree

39 files changed

+488
-233
lines changed

39 files changed

+488
-233
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,16 +795,20 @@ static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf)
795795

796796
static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
797797
{
798-
struct pci_dev *dev;
799798
struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid);
799+
struct pci_dev *dev;
800+
bool pending;
800801

801802
if (!vf)
802803
return false;
803804

804805
dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn);
805-
if (dev)
806-
return bnx2x_is_pcie_pending(dev);
807-
return false;
806+
if (!dev)
807+
return false;
808+
pending = bnx2x_is_pcie_pending(dev);
809+
pci_dev_put(dev);
810+
811+
return pending;
808812
}
809813

810814
int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid)

drivers/net/ethernet/engleder/tsnep_main.c

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,27 @@ static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget)
542542
return (budget != 0);
543543
}
544544

545+
static bool tsnep_tx_pending(struct tsnep_tx *tx)
546+
{
547+
unsigned long flags;
548+
struct tsnep_tx_entry *entry;
549+
bool pending = false;
550+
551+
spin_lock_irqsave(&tx->lock, flags);
552+
553+
if (tx->read != tx->write) {
554+
entry = &tx->entry[tx->read];
555+
if ((__le32_to_cpu(entry->desc_wb->properties) &
556+
TSNEP_TX_DESC_OWNER_MASK) ==
557+
(entry->properties & TSNEP_TX_DESC_OWNER_MASK))
558+
pending = true;
559+
}
560+
561+
spin_unlock_irqrestore(&tx->lock, flags);
562+
563+
return pending;
564+
}
565+
545566
static int tsnep_tx_open(struct tsnep_adapter *adapter, void __iomem *addr,
546567
int queue_index, struct tsnep_tx *tx)
547568
{
@@ -821,6 +842,19 @@ static int tsnep_rx_poll(struct tsnep_rx *rx, struct napi_struct *napi,
821842
return done;
822843
}
823844

845+
static bool tsnep_rx_pending(struct tsnep_rx *rx)
846+
{
847+
struct tsnep_rx_entry *entry;
848+
849+
entry = &rx->entry[rx->read];
850+
if ((__le32_to_cpu(entry->desc_wb->properties) &
851+
TSNEP_DESC_OWNER_COUNTER_MASK) ==
852+
(entry->properties & TSNEP_DESC_OWNER_COUNTER_MASK))
853+
return true;
854+
855+
return false;
856+
}
857+
824858
static int tsnep_rx_open(struct tsnep_adapter *adapter, void __iomem *addr,
825859
int queue_index, struct tsnep_rx *rx)
826860
{
@@ -866,6 +900,17 @@ static void tsnep_rx_close(struct tsnep_rx *rx)
866900
tsnep_rx_ring_cleanup(rx);
867901
}
868902

903+
static bool tsnep_pending(struct tsnep_queue *queue)
904+
{
905+
if (queue->tx && tsnep_tx_pending(queue->tx))
906+
return true;
907+
908+
if (queue->rx && tsnep_rx_pending(queue->rx))
909+
return true;
910+
911+
return false;
912+
}
913+
869914
static int tsnep_poll(struct napi_struct *napi, int budget)
870915
{
871916
struct tsnep_queue *queue = container_of(napi, struct tsnep_queue,
@@ -886,9 +931,19 @@ static int tsnep_poll(struct napi_struct *napi, int budget)
886931
if (!complete)
887932
return budget;
888933

889-
if (likely(napi_complete_done(napi, done)))
934+
if (likely(napi_complete_done(napi, done))) {
890935
tsnep_enable_irq(queue->adapter, queue->irq_mask);
891936

937+
/* reschedule if work is already pending, prevent rotten packets
938+
* which are transmitted or received after polling but before
939+
* interrupt enable
940+
*/
941+
if (tsnep_pending(queue)) {
942+
tsnep_disable_irq(queue->adapter, queue->irq_mask);
943+
napi_schedule(napi);
944+
}
945+
}
946+
892947
return min(done, budget - 1);
893948
}
894949

drivers/net/ethernet/marvell/octeontx2/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ config OCTEONTX2_PF
3232
tristate "Marvell OcteonTX2 NIC Physical Function driver"
3333
select OCTEONTX2_MBOX
3434
select NET_DEVLINK
35-
depends on MACSEC || !MACSEC
3635
depends on (64BIT && COMPILE_TEST) || ARM64
3736
select DIMLIB
3837
depends on PCI

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,8 +2506,10 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
25062506
data + NET_SKB_PAD + eth->ip_align,
25072507
ring->buf_size, DMA_FROM_DEVICE);
25082508
if (unlikely(dma_mapping_error(eth->dma_dev,
2509-
dma_addr)))
2509+
dma_addr))) {
2510+
skb_free_frag(data);
25102511
return -ENOMEM;
2512+
}
25112513
}
25122514
rxd->rxd1 = (unsigned int)dma_addr;
25132515
ring->data[i] = data;
@@ -4420,13 +4422,13 @@ static int mtk_probe(struct platform_device *pdev)
44204422
eth->soc->offload_version, i);
44214423
if (!eth->ppe[i]) {
44224424
err = -ENOMEM;
4423-
goto err_free_dev;
4425+
goto err_deinit_ppe;
44244426
}
44254427
}
44264428

44274429
err = mtk_eth_offload_init(eth);
44284430
if (err)
4429-
goto err_free_dev;
4431+
goto err_deinit_ppe;
44304432
}
44314433

44324434
for (i = 0; i < MTK_MAX_DEVS; i++) {
@@ -4436,7 +4438,7 @@ static int mtk_probe(struct platform_device *pdev)
44364438
err = register_netdev(eth->netdev[i]);
44374439
if (err) {
44384440
dev_err(eth->dev, "error bringing up device\n");
4439-
goto err_deinit_mdio;
4441+
goto err_deinit_ppe;
44404442
} else
44414443
netif_info(eth, probe, eth->netdev[i],
44424444
"mediatek frame engine at 0x%08lx, irq %d\n",
@@ -4454,7 +4456,8 @@ static int mtk_probe(struct platform_device *pdev)
44544456

44554457
return 0;
44564458

4457-
err_deinit_mdio:
4459+
err_deinit_ppe:
4460+
mtk_ppe_deinit(eth);
44584461
mtk_mdio_cleanup(eth);
44594462
err_free_dev:
44604463
mtk_free_dev(eth);

drivers/net/ethernet/mediatek/mtk_ppe.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,19 +757,34 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
757757
MTK_PPE_ENTRIES * soc->foe_entry_size,
758758
&ppe->foe_phys, GFP_KERNEL);
759759
if (!foe)
760-
return NULL;
760+
goto err_free_l2_flows;
761761

762762
ppe->foe_table = foe;
763763

764764
foe_flow_size = (MTK_PPE_ENTRIES / soc->hash_offset) *
765765
sizeof(*ppe->foe_flow);
766766
ppe->foe_flow = devm_kzalloc(dev, foe_flow_size, GFP_KERNEL);
767767
if (!ppe->foe_flow)
768-
return NULL;
768+
goto err_free_l2_flows;
769769

770770
mtk_ppe_debugfs_init(ppe, index);
771771

772772
return ppe;
773+
774+
err_free_l2_flows:
775+
rhashtable_destroy(&ppe->l2_flows);
776+
return NULL;
777+
}
778+
779+
void mtk_ppe_deinit(struct mtk_eth *eth)
780+
{
781+
int i;
782+
783+
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) {
784+
if (!eth->ppe[i])
785+
return;
786+
rhashtable_destroy(&eth->ppe[i]->l2_flows);
787+
}
773788
}
774789

775790
static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)

drivers/net/ethernet/mediatek/mtk_ppe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ struct mtk_ppe {
306306

307307
struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
308308
int version, int index);
309+
void mtk_ppe_deinit(struct mtk_eth *eth);
309310
void mtk_ppe_start(struct mtk_ppe *ppe);
310311
int mtk_ppe_stop(struct mtk_ppe *ppe);
311312

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "mlx5_core.h"
4646
#include "lib/eq.h"
4747
#include "lib/tout.h"
48+
#define CREATE_TRACE_POINTS
49+
#include "diag/cmd_tracepoint.h"
4850

4951
enum {
5052
CMD_IF_REV = 5,
@@ -785,27 +787,14 @@ EXPORT_SYMBOL(mlx5_cmd_out_err);
785787
static void cmd_status_print(struct mlx5_core_dev *dev, void *in, void *out)
786788
{
787789
u16 opcode, op_mod;
788-
u32 syndrome;
789-
u8 status;
790790
u16 uid;
791-
int err;
792-
793-
syndrome = MLX5_GET(mbox_out, out, syndrome);
794-
status = MLX5_GET(mbox_out, out, status);
795791

796792
opcode = MLX5_GET(mbox_in, in, opcode);
797793
op_mod = MLX5_GET(mbox_in, in, op_mod);
798794
uid = MLX5_GET(mbox_in, in, uid);
799795

800-
err = cmd_status_to_err(status);
801-
802796
if (!uid && opcode != MLX5_CMD_OP_DESTROY_MKEY)
803797
mlx5_cmd_out_err(dev, opcode, op_mod, out);
804-
else
805-
mlx5_core_dbg(dev,
806-
"%s(0x%x) op_mod(0x%x) uid(%d) failed, status %s(0x%x), syndrome (0x%x), err(%d)\n",
807-
mlx5_command_str(opcode), opcode, op_mod, uid,
808-
cmd_status_str(status), status, syndrome, err);
809798
}
810799

811800
int mlx5_cmd_check(struct mlx5_core_dev *dev, int err, void *in, void *out)
@@ -1016,14 +1005,14 @@ static void cmd_work_handler(struct work_struct *work)
10161005
cmd_ent_get(ent);
10171006
set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
10181007

1008+
cmd_ent_get(ent); /* for the _real_ FW event on completion */
10191009
/* Skip sending command to fw if internal error */
10201010
if (mlx5_cmd_is_down(dev) || !opcode_allowed(&dev->cmd, ent->op)) {
10211011
ent->ret = -ENXIO;
10221012
mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true);
10231013
return;
10241014
}
10251015

1026-
cmd_ent_get(ent); /* for the _real_ FW event on completion */
10271016
/* ring doorbell after the descriptor is valid */
10281017
mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx);
10291018
wmb();
@@ -1672,8 +1661,8 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force
16721661
cmd_ent_put(ent); /* timeout work was canceled */
16731662

16741663
if (!forced || /* Real FW completion */
1675-
pci_channel_offline(dev->pdev) || /* FW is inaccessible */
1676-
dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
1664+
mlx5_cmd_is_down(dev) || /* No real FW completion is expected */
1665+
!opcode_allowed(cmd, ent->op))
16771666
cmd_ent_put(ent);
16781667

16791668
ent->ts2 = ktime_get_ns();
@@ -1892,6 +1881,16 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
18921881
return err;
18931882
}
18941883

1884+
static void mlx5_cmd_err_trace(struct mlx5_core_dev *dev, u16 opcode, u16 op_mod, void *out)
1885+
{
1886+
u32 syndrome = MLX5_GET(mbox_out, out, syndrome);
1887+
u8 status = MLX5_GET(mbox_out, out, status);
1888+
1889+
trace_mlx5_cmd(mlx5_command_str(opcode), opcode, op_mod,
1890+
cmd_status_str(status), status, syndrome,
1891+
cmd_status_to_err(status));
1892+
}
1893+
18951894
static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
18961895
u32 syndrome, int err)
18971896
{
@@ -1914,16 +1913,18 @@ static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
19141913
}
19151914

19161915
/* preserve -EREMOTEIO for outbox.status != OK, otherwise return err as is */
1917-
static int cmd_status_err(struct mlx5_core_dev *dev, int err, u16 opcode, void *out)
1916+
static int cmd_status_err(struct mlx5_core_dev *dev, int err, u16 opcode, u16 op_mod, void *out)
19181917
{
19191918
u32 syndrome = MLX5_GET(mbox_out, out, syndrome);
19201919
u8 status = MLX5_GET(mbox_out, out, status);
19211920

19221921
if (err == -EREMOTEIO) /* -EREMOTEIO is preserved */
19231922
err = -EIO;
19241923

1925-
if (!err && status != MLX5_CMD_STAT_OK)
1924+
if (!err && status != MLX5_CMD_STAT_OK) {
19261925
err = -EREMOTEIO;
1926+
mlx5_cmd_err_trace(dev, opcode, op_mod, out);
1927+
}
19271928

19281929
cmd_status_log(dev, opcode, status, syndrome, err);
19291930
return err;
@@ -1951,9 +1952,9 @@ int mlx5_cmd_do(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int
19511952
{
19521953
int err = cmd_exec(dev, in, in_size, out, out_size, NULL, NULL, false);
19531954
u16 opcode = MLX5_GET(mbox_in, in, opcode);
1955+
u16 op_mod = MLX5_GET(mbox_in, in, op_mod);
19541956

1955-
err = cmd_status_err(dev, err, opcode, out);
1956-
return err;
1957+
return cmd_status_err(dev, err, opcode, op_mod, out);
19571958
}
19581959
EXPORT_SYMBOL(mlx5_cmd_do);
19591960

@@ -1997,8 +1998,9 @@ int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
19971998
{
19981999
int err = cmd_exec(dev, in, in_size, out, out_size, NULL, NULL, true);
19992000
u16 opcode = MLX5_GET(mbox_in, in, opcode);
2001+
u16 op_mod = MLX5_GET(mbox_in, in, op_mod);
20002002

2001-
err = cmd_status_err(dev, err, opcode, out);
2003+
err = cmd_status_err(dev, err, opcode, op_mod, out);
20022004
return mlx5_cmd_check(dev, err, in, out);
20032005
}
20042006
EXPORT_SYMBOL(mlx5_cmd_exec_polling);
@@ -2034,7 +2036,7 @@ static void mlx5_cmd_exec_cb_handler(int status, void *_work)
20342036
struct mlx5_async_ctx *ctx;
20352037

20362038
ctx = work->ctx;
2037-
status = cmd_status_err(ctx->dev, status, work->opcode, work->out);
2039+
status = cmd_status_err(ctx->dev, status, work->opcode, work->op_mod, work->out);
20382040
work->user_callback(status, work);
20392041
if (atomic_dec_and_test(&ctx->num_inflight))
20402042
complete(&ctx->inflight_done);
@@ -2049,6 +2051,7 @@ int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
20492051
work->ctx = ctx;
20502052
work->user_callback = callback;
20512053
work->opcode = MLX5_GET(mbox_in, in, opcode);
2054+
work->op_mod = MLX5_GET(mbox_in, in, op_mod);
20522055
work->out = out;
20532056
if (WARN_ON(!atomic_inc_not_zero(&ctx->num_inflight)))
20542057
return -EIO;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2+
/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
3+
4+
#undef TRACE_SYSTEM
5+
#define TRACE_SYSTEM mlx5
6+
7+
#if !defined(_MLX5_CMD_TP_H_) || defined(TRACE_HEADER_MULTI_READ)
8+
#define _MLX5_CMD_TP_H_
9+
10+
#include <linux/tracepoint.h>
11+
#include <linux/trace_seq.h>
12+
13+
TRACE_EVENT(mlx5_cmd,
14+
TP_PROTO(const char *command_str, u16 opcode, u16 op_mod,
15+
const char *status_str, u8 status, u32 syndrome, int err),
16+
TP_ARGS(command_str, opcode, op_mod, status_str, status, syndrome, err),
17+
TP_STRUCT__entry(__string(command_str, command_str)
18+
__field(u16, opcode)
19+
__field(u16, op_mod)
20+
__string(status_str, status_str)
21+
__field(u8, status)
22+
__field(u32, syndrome)
23+
__field(int, err)
24+
),
25+
TP_fast_assign(__assign_str(command_str, command_str);
26+
__entry->opcode = opcode;
27+
__entry->op_mod = op_mod;
28+
__assign_str(status_str, status_str);
29+
__entry->status = status;
30+
__entry->syndrome = syndrome;
31+
__entry->err = err;
32+
),
33+
TP_printk("%s(0x%x) op_mod(0x%x) failed, status %s(0x%x), syndrome (0x%x), err(%d)",
34+
__get_str(command_str), __entry->opcode, __entry->op_mod,
35+
__get_str(status_str), __entry->status, __entry->syndrome,
36+
__entry->err)
37+
);
38+
39+
#endif /* _MLX5_CMD_TP_H_ */
40+
41+
#undef TRACE_INCLUDE_PATH
42+
#define TRACE_INCLUDE_PATH ./diag
43+
#undef TRACE_INCLUDE_FILE
44+
#define TRACE_INCLUDE_FILE cmd_tracepoint
45+
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)