Skip to content

Commit cba9ffd

Browse files
committed
Merge tag 'net-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski: "Including fixes from CAN, netfilter, wireguard and IPsec. I'd like to highlight [ lowlight? - Linus ] Florian W stepping down as a netfilter maintainer due to constant stream of bug reports. Not sure what we can do but IIUC this is not the first such case. Current release - regressions: - rxrpc: fix use of page_frag_alloc_align(), it changed semantics and we added a new caller in a different subtree - xfrm: allow UDP encapsulation only in offload modes Current release - new code bugs: - tcp: fix refcnt handling in __inet_hash_connect() - Revert "net: Re-use and set mono_delivery_time bit for userspace tstamp packets", conflicted with some expectations in BPF uAPI Previous releases - regressions: - ipv4: raw: fix sending packets from raw sockets via IPsec tunnels - devlink: fix devlink's parallel command processing - veth: do not manipulate GRO when using XDP - esp: fix bad handling of pages from page_pool Previous releases - always broken: - report RCU QS for busy network kthreads (with Paul McK's blessing) - tcp/rds: fix use-after-free on netns with kernel TCP reqsk - virt: vmxnet3: fix missing reserved tailroom with XDP Misc: - couple of build fixes for Documentation" * tag 'net-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (59 commits) selftests: forwarding: Fix ping failure due to short timeout MAINTAINERS: step down as netfilter maintainer netfilter: nf_tables: Fix a memory leak in nf_tables_updchain net: dsa: mt7530: fix handling of all link-local frames net: dsa: mt7530: fix link-local frames that ingress vlan filtering ports bpf: report RCU QS in cpumap kthread net: report RCU QS on threaded NAPI repolling rcu: add a helper to report consolidated flavor QS ionic: update documentation for XDP support lib/bitmap: Fix bitmap_scatter() and bitmap_gather() kernel doc netfilter: nf_tables: do not compare internal table flags on updates netfilter: nft_set_pipapo: release elements in clone only from destroy path octeontx2-af: Use separate handlers for interrupts octeontx2-pf: Send UP messages to VF only when VF is up. octeontx2-pf: Use default max_active works instead of one octeontx2-pf: Wait till detach_resources msg is complete octeontx2: Detect the mbox up or down message via register devlink: fix port new reply cmd type tcp: Clear req->syncookie in reqsk_alloc(). net/bnx2x: Prevent access to a freed page in page_pool ...
2 parents 1d35aae + f99c5f5 commit cba9ffd

Some content is hidden

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

71 files changed

+610
-346
lines changed

Documentation/networking/device_drivers/ethernet/pensando/ionic.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Minimal SR-IOV support is currently offered and can be enabled by setting
9999
the sysfs 'sriov_numvfs' value, if supported by your particular firmware
100100
configuration.
101101

102+
XDP
103+
---
104+
105+
Support for XDP includes the basics, plus Jumbo frames, Redirect and
106+
ndo_xmit. There is no current support for zero-copy sockets or HW offload.
107+
102108
Statistics
103109
==========
104110

@@ -138,6 +144,12 @@ Driver port specific::
138144
rx_csum_none: 0
139145
rx_csum_complete: 3
140146
rx_csum_error: 0
147+
xdp_drop: 0
148+
xdp_aborted: 0
149+
xdp_pass: 0
150+
xdp_tx: 0
151+
xdp_redirect: 0
152+
xdp_frames: 0
141153

142154
Driver queue specific::
143155

@@ -149,18 +161,28 @@ Driver queue specific::
149161
tx_0_frags: 0
150162
tx_0_tso: 0
151163
tx_0_tso_bytes: 0
164+
tx_0_hwstamp_valid: 0
165+
tx_0_hwstamp_invalid: 0
152166
tx_0_csum_none: 3
153167
tx_0_csum: 0
154168
tx_0_vlan_inserted: 0
169+
tx_0_xdp_frames: 0
155170
rx_0_pkts: 2
156171
rx_0_bytes: 120
157172
rx_0_dma_map_err: 0
158173
rx_0_alloc_err: 0
159174
rx_0_csum_none: 0
160175
rx_0_csum_complete: 0
161176
rx_0_csum_error: 0
177+
rx_0_hwstamp_valid: 0
178+
rx_0_hwstamp_invalid: 0
162179
rx_0_dropped: 0
163180
rx_0_vlan_stripped: 0
181+
rx_0_xdp_drop: 0
182+
rx_0_xdp_aborted: 0
183+
rx_0_xdp_pass: 0
184+
rx_0_xdp_tx: 0
185+
rx_0_xdp_redirect: 0
164186

165187
Firmware port specific::
166188

Documentation/networking/multi-pf-netdev.rst

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,35 +87,35 @@ all using the same instance under "priv->mdev".
8787

8888
Observability
8989
=============
90-
The relation between PF, irq, napi, and queue can be observed via netlink spec:
91-
92-
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml --dump queue-get --json='{"ifindex": 13}'
93-
[{'id': 0, 'ifindex': 13, 'napi-id': 539, 'type': 'rx'},
94-
{'id': 1, 'ifindex': 13, 'napi-id': 540, 'type': 'rx'},
95-
{'id': 2, 'ifindex': 13, 'napi-id': 541, 'type': 'rx'},
96-
{'id': 3, 'ifindex': 13, 'napi-id': 542, 'type': 'rx'},
97-
{'id': 4, 'ifindex': 13, 'napi-id': 543, 'type': 'rx'},
98-
{'id': 0, 'ifindex': 13, 'napi-id': 539, 'type': 'tx'},
99-
{'id': 1, 'ifindex': 13, 'napi-id': 540, 'type': 'tx'},
100-
{'id': 2, 'ifindex': 13, 'napi-id': 541, 'type': 'tx'},
101-
{'id': 3, 'ifindex': 13, 'napi-id': 542, 'type': 'tx'},
102-
{'id': 4, 'ifindex': 13, 'napi-id': 543, 'type': 'tx'}]
103-
104-
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml --dump napi-get --json='{"ifindex": 13}'
105-
[{'id': 543, 'ifindex': 13, 'irq': 42},
106-
{'id': 542, 'ifindex': 13, 'irq': 41},
107-
{'id': 541, 'ifindex': 13, 'irq': 40},
108-
{'id': 540, 'ifindex': 13, 'irq': 39},
109-
{'id': 539, 'ifindex': 13, 'irq': 36}]
110-
111-
Here you can clearly observe our channels distribution policy:
112-
113-
$ ls /proc/irq/{36,39,40,41,42}/mlx5* -d -1
114-
/proc/irq/36/mlx5_comp1@pci:0000:08:00.0
115-
/proc/irq/39/mlx5_comp1@pci:0000:09:00.0
116-
/proc/irq/40/mlx5_comp2@pci:0000:08:00.0
117-
/proc/irq/41/mlx5_comp2@pci:0000:09:00.0
118-
/proc/irq/42/mlx5_comp3@pci:0000:08:00.0
90+
The relation between PF, irq, napi, and queue can be observed via netlink spec::
91+
92+
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml --dump queue-get --json='{"ifindex": 13}'
93+
[{'id': 0, 'ifindex': 13, 'napi-id': 539, 'type': 'rx'},
94+
{'id': 1, 'ifindex': 13, 'napi-id': 540, 'type': 'rx'},
95+
{'id': 2, 'ifindex': 13, 'napi-id': 541, 'type': 'rx'},
96+
{'id': 3, 'ifindex': 13, 'napi-id': 542, 'type': 'rx'},
97+
{'id': 4, 'ifindex': 13, 'napi-id': 543, 'type': 'rx'},
98+
{'id': 0, 'ifindex': 13, 'napi-id': 539, 'type': 'tx'},
99+
{'id': 1, 'ifindex': 13, 'napi-id': 540, 'type': 'tx'},
100+
{'id': 2, 'ifindex': 13, 'napi-id': 541, 'type': 'tx'},
101+
{'id': 3, 'ifindex': 13, 'napi-id': 542, 'type': 'tx'},
102+
{'id': 4, 'ifindex': 13, 'napi-id': 543, 'type': 'tx'}]
103+
104+
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml --dump napi-get --json='{"ifindex": 13}'
105+
[{'id': 543, 'ifindex': 13, 'irq': 42},
106+
{'id': 542, 'ifindex': 13, 'irq': 41},
107+
{'id': 541, 'ifindex': 13, 'irq': 40},
108+
{'id': 540, 'ifindex': 13, 'irq': 39},
109+
{'id': 539, 'ifindex': 13, 'irq': 36}]
110+
111+
Here you can clearly observe our channels distribution policy::
112+
113+
$ ls /proc/irq/{36,39,40,41,42}/mlx5* -d -1
114+
/proc/irq/36/mlx5_comp1@pci:0000:08:00.0
115+
/proc/irq/39/mlx5_comp1@pci:0000:09:00.0
116+
/proc/irq/40/mlx5_comp2@pci:0000:08:00.0
117+
/proc/irq/41/mlx5_comp2@pci:0000:09:00.0
118+
/proc/irq/42/mlx5_comp3@pci:0000:08:00.0
119119

120120
Steering
121121
========

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct_dev_ifalias* ifalias
1313
unsigned_long mem_end
1414
unsigned_long mem_start
1515
unsigned_long base_addr
16-
unsigned_long state
16+
unsigned_long state read_mostly read_mostly netif_running(dev)
1717
struct_list_head dev_list
1818
struct_list_head napi_list
1919
struct_list_head unreg_list

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15237,7 +15237,6 @@ F: drivers/net/ethernet/neterion/
1523715237
NETFILTER
1523815238
M: Pablo Neira Ayuso <[email protected]>
1523915239
M: Jozsef Kadlecsik <[email protected]>
15240-
M: Florian Westphal <[email protected]>
1524115240
1524215241
1524315242
S: Maintained

drivers/net/can/kvaser_pciefd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ static const struct kvaser_pciefd_irq_mask kvaser_pciefd_sf2_irq_mask = {
370370

371371
static const struct kvaser_pciefd_irq_mask kvaser_pciefd_xilinx_irq_mask = {
372372
.kcan_rx0 = BIT(4),
373-
.kcan_tx = { BIT(16), BIT(17), BIT(18), BIT(19) },
374-
.all = GENMASK(19, 16) | BIT(4),
373+
.kcan_tx = { BIT(16), BIT(17), BIT(18), BIT(19), BIT(20), BIT(21), BIT(22), BIT(23) },
374+
.all = GENMASK(23, 16) | BIT(4),
375375
};
376376

377377
static const struct kvaser_pciefd_dev_ops kvaser_pciefd_altera_dev_ops = {

drivers/net/dsa/mt7530.c

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -950,20 +950,56 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
950950
mutex_unlock(&priv->reg_mutex);
951951
}
952952

953+
/* On page 205, section "8.6.3 Frame filtering" of the active standard, IEEE Std
954+
* 802.1Q™-2022, it is stated that frames with 01:80:C2:00:00:00-0F as MAC DA
955+
* must only be propagated to C-VLAN and MAC Bridge components. That means
956+
* VLAN-aware and VLAN-unaware bridges. On the switch designs with CPU ports,
957+
* these frames are supposed to be processed by the CPU (software). So we make
958+
* the switch only forward them to the CPU port. And if received from a CPU
959+
* port, forward to a single port. The software is responsible of making the
960+
* switch conform to the latter by setting a single port as destination port on
961+
* the special tag.
962+
*
963+
* This switch intellectual property cannot conform to this part of the standard
964+
* fully. Whilst the REV_UN frame tag covers the remaining :04-0D and :0F MAC
965+
* DAs, it also includes :22-FF which the scope of propagation is not supposed
966+
* to be restricted for these MAC DAs.
967+
*/
953968
static void
954969
mt753x_trap_frames(struct mt7530_priv *priv)
955970
{
956-
/* Trap BPDUs to the CPU port(s) */
957-
mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
971+
/* Trap 802.1X PAE frames and BPDUs to the CPU port(s) and egress them
972+
* VLAN-untagged.
973+
*/
974+
mt7530_rmw(priv, MT753X_BPC, MT753X_PAE_EG_TAG_MASK |
975+
MT753X_PAE_PORT_FW_MASK | MT753X_BPDU_EG_TAG_MASK |
976+
MT753X_BPDU_PORT_FW_MASK,
977+
MT753X_PAE_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
978+
MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY) |
979+
MT753X_BPDU_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
958980
MT753X_BPDU_CPU_ONLY);
959981

960-
/* Trap 802.1X PAE frames to the CPU port(s) */
961-
mt7530_rmw(priv, MT753X_BPC, MT753X_PAE_PORT_FW_MASK,
962-
MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY));
982+
/* Trap frames with :01 and :02 MAC DAs to the CPU port(s) and egress
983+
* them VLAN-untagged.
984+
*/
985+
mt7530_rmw(priv, MT753X_RGAC1, MT753X_R02_EG_TAG_MASK |
986+
MT753X_R02_PORT_FW_MASK | MT753X_R01_EG_TAG_MASK |
987+
MT753X_R01_PORT_FW_MASK,
988+
MT753X_R02_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
989+
MT753X_R02_PORT_FW(MT753X_BPDU_CPU_ONLY) |
990+
MT753X_R01_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
991+
MT753X_BPDU_CPU_ONLY);
963992

964-
/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
965-
mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
966-
MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY));
993+
/* Trap frames with :03 and :0E MAC DAs to the CPU port(s) and egress
994+
* them VLAN-untagged.
995+
*/
996+
mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_EG_TAG_MASK |
997+
MT753X_R0E_PORT_FW_MASK | MT753X_R03_EG_TAG_MASK |
998+
MT753X_R03_PORT_FW_MASK,
999+
MT753X_R0E_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
1000+
MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY) |
1001+
MT753X_R03_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
1002+
MT753X_BPDU_CPU_ONLY);
9671003
}
9681004

9691005
static void
@@ -2192,22 +2228,16 @@ mt7530_setup(struct dsa_switch *ds)
21922228
}
21932229
}
21942230

2195-
/* Disable LEDs before reset to prevent the MT7530 sampling a
2196-
* potentially incorrect HT_XTAL_FSEL value.
2197-
*/
2198-
mt7530_write(priv, MT7530_LED_EN, 0);
2199-
usleep_range(1000, 1100);
2200-
22012231
/* Reset whole chip through gpio pin or memory-mapped registers for
22022232
* different type of hardware
22032233
*/
22042234
if (priv->mcm) {
22052235
reset_control_assert(priv->rstc);
2206-
usleep_range(1000, 1100);
2236+
usleep_range(5000, 5100);
22072237
reset_control_deassert(priv->rstc);
22082238
} else {
22092239
gpiod_set_value_cansleep(priv->reset, 0);
2210-
usleep_range(1000, 1100);
2240+
usleep_range(5000, 5100);
22112241
gpiod_set_value_cansleep(priv->reset, 1);
22122242
}
22132243

@@ -2420,11 +2450,11 @@ mt7531_setup(struct dsa_switch *ds)
24202450
*/
24212451
if (priv->mcm) {
24222452
reset_control_assert(priv->rstc);
2423-
usleep_range(1000, 1100);
2453+
usleep_range(5000, 5100);
24242454
reset_control_deassert(priv->rstc);
24252455
} else {
24262456
gpiod_set_value_cansleep(priv->reset, 0);
2427-
usleep_range(1000, 1100);
2457+
usleep_range(5000, 5100);
24282458
gpiod_set_value_cansleep(priv->reset, 1);
24292459
}
24302460

drivers/net/dsa/mt7530.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,33 @@ enum mt753x_id {
6565

6666
/* Registers for BPDU and PAE frame control*/
6767
#define MT753X_BPC 0x24
68-
#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0)
68+
#define MT753X_PAE_EG_TAG_MASK GENMASK(24, 22)
69+
#define MT753X_PAE_EG_TAG(x) FIELD_PREP(MT753X_PAE_EG_TAG_MASK, x)
6970
#define MT753X_PAE_PORT_FW_MASK GENMASK(18, 16)
7071
#define MT753X_PAE_PORT_FW(x) FIELD_PREP(MT753X_PAE_PORT_FW_MASK, x)
72+
#define MT753X_BPDU_EG_TAG_MASK GENMASK(8, 6)
73+
#define MT753X_BPDU_EG_TAG(x) FIELD_PREP(MT753X_BPDU_EG_TAG_MASK, x)
74+
#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0)
75+
76+
/* Register for :01 and :02 MAC DA frame control */
77+
#define MT753X_RGAC1 0x28
78+
#define MT753X_R02_EG_TAG_MASK GENMASK(24, 22)
79+
#define MT753X_R02_EG_TAG(x) FIELD_PREP(MT753X_R02_EG_TAG_MASK, x)
80+
#define MT753X_R02_PORT_FW_MASK GENMASK(18, 16)
81+
#define MT753X_R02_PORT_FW(x) FIELD_PREP(MT753X_R02_PORT_FW_MASK, x)
82+
#define MT753X_R01_EG_TAG_MASK GENMASK(8, 6)
83+
#define MT753X_R01_EG_TAG(x) FIELD_PREP(MT753X_R01_EG_TAG_MASK, x)
84+
#define MT753X_R01_PORT_FW_MASK GENMASK(2, 0)
7185

7286
/* Register for :03 and :0E MAC DA frame control */
7387
#define MT753X_RGAC2 0x2c
88+
#define MT753X_R0E_EG_TAG_MASK GENMASK(24, 22)
89+
#define MT753X_R0E_EG_TAG(x) FIELD_PREP(MT753X_R0E_EG_TAG_MASK, x)
7490
#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16)
7591
#define MT753X_R0E_PORT_FW(x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x)
92+
#define MT753X_R03_EG_TAG_MASK GENMASK(8, 6)
93+
#define MT753X_R03_EG_TAG(x) FIELD_PREP(MT753X_R03_EG_TAG_MASK, x)
94+
#define MT753X_R03_PORT_FW_MASK GENMASK(2, 0)
7695

7796
enum mt753x_bpdu_port_fw {
7897
MT753X_BPDU_FOLLOW_MFC,
@@ -253,6 +272,7 @@ enum mt7530_port_mode {
253272
enum mt7530_vlan_port_eg_tag {
254273
MT7530_VLAN_EG_DISABLED = 0,
255274
MT7530_VLAN_EG_CONSISTENT = 1,
275+
MT7530_VLAN_EG_UNTAGGED = 4,
256276
};
257277

258278
enum mt7530_vlan_port_attr {

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,9 +1002,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,
10021002
static inline void bnx2x_free_rx_mem_pool(struct bnx2x *bp,
10031003
struct bnx2x_alloc_pool *pool)
10041004
{
1005-
if (!pool->page)
1006-
return;
1007-
10081005
put_page(pool->page);
10091006

10101007
pool->page = NULL;
@@ -1015,6 +1012,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp,
10151012
{
10161013
int i;
10171014

1015+
if (!fp->page_pool.page)
1016+
return;
1017+
10181018
if (fp->mode == TPA_MODE_DISABLED)
10191019
return;
10201020

drivers/net/ethernet/marvell/octeontx2/af/cgx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ static irqreturn_t cgx_fwi_event_handler(int irq, void *data)
13381338

13391339
/* Release thread waiting for completion */
13401340
lmac->cmd_pend = false;
1341-
wake_up_interruptible(&lmac->wq_cmd_cmplt);
1341+
wake_up(&lmac->wq_cmd_cmplt);
13421342
break;
13431343
case CGX_EVT_ASYNC:
13441344
if (cgx_event_is_linkevent(event))

drivers/net/ethernet/marvell/octeontx2/af/mbox.c

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,12 @@ int otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid)
214214
}
215215
EXPORT_SYMBOL(otx2_mbox_busy_poll_for_rsp);
216216

217-
void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid)
217+
static void otx2_mbox_msg_send_data(struct otx2_mbox *mbox, int devid, u64 data)
218218
{
219219
struct otx2_mbox_dev *mdev = &mbox->dev[devid];
220220
struct mbox_hdr *tx_hdr, *rx_hdr;
221221
void *hw_mbase = mdev->hwbase;
222+
u64 intr_val;
222223

223224
tx_hdr = hw_mbase + mbox->tx_start;
224225
rx_hdr = hw_mbase + mbox->rx_start;
@@ -254,14 +255,52 @@ void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid)
254255

255256
spin_unlock(&mdev->mbox_lock);
256257

258+
/* Check if interrupt pending */
259+
intr_val = readq((void __iomem *)mbox->reg_base +
260+
(mbox->trigger | (devid << mbox->tr_shift)));
261+
262+
intr_val |= data;
257263
/* The interrupt should be fired after num_msgs is written
258264
* to the shared memory
259265
*/
260-
writeq(1, (void __iomem *)mbox->reg_base +
266+
writeq(intr_val, (void __iomem *)mbox->reg_base +
261267
(mbox->trigger | (devid << mbox->tr_shift)));
262268
}
269+
270+
void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid)
271+
{
272+
otx2_mbox_msg_send_data(mbox, devid, MBOX_DOWN_MSG);
273+
}
263274
EXPORT_SYMBOL(otx2_mbox_msg_send);
264275

276+
void otx2_mbox_msg_send_up(struct otx2_mbox *mbox, int devid)
277+
{
278+
otx2_mbox_msg_send_data(mbox, devid, MBOX_UP_MSG);
279+
}
280+
EXPORT_SYMBOL(otx2_mbox_msg_send_up);
281+
282+
bool otx2_mbox_wait_for_zero(struct otx2_mbox *mbox, int devid)
283+
{
284+
u64 data;
285+
286+
data = readq((void __iomem *)mbox->reg_base +
287+
(mbox->trigger | (devid << mbox->tr_shift)));
288+
289+
/* If data is non-zero wait for ~1ms and return to caller
290+
* whether data has changed to zero or not after the wait.
291+
*/
292+
if (!data)
293+
return true;
294+
295+
usleep_range(950, 1000);
296+
297+
data = readq((void __iomem *)mbox->reg_base +
298+
(mbox->trigger | (devid << mbox->tr_shift)));
299+
300+
return data == 0;
301+
}
302+
EXPORT_SYMBOL(otx2_mbox_wait_for_zero);
303+
265304
struct mbox_msghdr *otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid,
266305
int size, int size_rsp)
267306
{

0 commit comments

Comments
 (0)