Skip to content

Commit e728258

Browse files
committed
Merge tag 'net-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski: "Including fixes from Netfilter. Steady stream of fixes. Last two weeks feel comparable to the two weeks before the merge window. Lots of AI-aided bug discovery. A newer big source is Sashiko/Gemini (Roman Gushchin's system), which points out issues in existing code during patch review (maybe 25% of fixes here likely originating from Sashiko). Nice thing is these are often fixed by the respective maintainers, not drive-bys. Current release - new code bugs: - kconfig: MDIO_PIC64HPSC should depend on ARCH_MICROCHIP Previous releases - regressions: - add async ndo_set_rx_mode and switch drivers which we promised to be called under the per-netdev mutex to it - dsa: remove duplicate netdev_lock_ops() for conduit ethtool ops - hv_sock: report EOF instead of -EIO for FIN - vsock/virtio: fix MSG_PEEK calculation on bytes to copy Previous releases - always broken: - ipv6: fix possible UAF in icmpv6_rcv() - icmp: validate reply type before using icmp_pointers - af_unix: drop all SCM attributes for SOCKMAP - netfilter: fix a number of bugs in the osf (OS fingerprinting) - eth: intel: fix timestamp interrupt configuration for E825C Misc: - bunch of data-race annotations" * tag 'net-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (148 commits) rxrpc: Fix error handling in rxgk_extract_token() rxrpc: Fix re-decryption of RESPONSE packets rxrpc: Fix rxrpc_input_call_event() to only unshare DATA packets rxrpc: Fix missing validation of ticket length in non-XDR key preparsing rxgk: Fix potential integer overflow in length check rxrpc: Fix conn-level packet handling to unshare RESPONSE packets rxrpc: Fix potential UAF after skb_unshare() failure rxrpc: Fix rxkad crypto unalignment handling rxrpc: Fix memory leaks in rxkad_verify_response() net: rds: fix MR cleanup on copy error m68k: mvme147: Make me the maintainer net: txgbe: fix firmware version check selftests/bpf: check epoll readiness during reuseport migration tcp: call sk_data_ready() after listener migration vhost_net: fix sleeping with preempt-disabled in vhost_net_busy_poll() ipv6: Cap TLV scan in ip6_tnl_parse_tlv_enc_lim tipc: fix double-free in tipc_buf_append() llc: Return -EINPROGRESS from llc_ui_connect() ipv4: icmp: validate reply type before using icmp_pointers selftests/net: packetdrill: cover RFC 5961 5.2 challenge ACK on both edges ...
2 parents e8df5a0 + 5e6391d commit e728258

172 files changed

Lines changed: 3534 additions & 1414 deletions

File tree

Some content is hidden

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

Documentation/networking/netdevices.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,19 @@ ndo_tx_timeout:
289289
ndo_set_rx_mode:
290290
Synchronization: netif_addr_lock spinlock.
291291
Context: BHs disabled
292+
Notes: Deprecated in favor of ndo_set_rx_mode_async which runs
293+
in process context.
294+
295+
ndo_set_rx_mode_async:
296+
Synchronization: rtnl_lock() semaphore. In addition, netdev instance
297+
lock if the driver implements queue management or shaper API.
298+
Context: process (from a work queue)
299+
Notes: Async version of ndo_set_rx_mode which runs in process
300+
context. Receives snapshots of the unicast and multicast address lists.
301+
302+
ndo_change_rx_flags:
303+
Synchronization: rtnl_lock() semaphore. In addition, netdev instance
304+
lock if the driver implements queue management or shaper API.
292305

293306
ndo_setup_tc:
294307
``TC_SETUP_BLOCK`` and ``TC_SETUP_FT`` are running under NFT locks

Documentation/process/maintainer-netdev.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ The exact rules a driver must follow to acquire the ``Supported`` status:
528528
status will be withdrawn.
529529

530530
5. Test failures due to bugs either in the driver or the test itself,
531-
or lack of support for the feature the test is targgeting are
531+
or lack of support for the feature the test is targeting are
532532
*not* a basis for losing the ``Supported`` status.
533533

534534
netdev CI will maintain an official page of supported devices, listing their

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15337,6 +15337,13 @@ S: Maintained
1533715337
W: http://www.tazenda.demon.co.uk/phil/linux-hp
1533815338
F: arch/m68k/hp300/
1533915339

15340+
M68K ON MVME147
15341+
M: Daniel Palmer <[email protected]>
15342+
S: Maintained
15343+
F: arch/m68k/mvme147/
15344+
F: drivers/net/ethernet/amd/mvme147.c
15345+
F: drivers/scsi/mvme147.*
15346+
1534015347
M88DS3103 MEDIA DRIVER
1534115348
1534215349
S: Orphan

drivers/net/dsa/realtek/rtl8365mb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
(_extint) == 2 ? RTL8365MB_DIGITAL_INTERFACE_SELECT_REG1 : \
217217
0x0)
218218
#define RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(_extint) \
219-
(0xF << (((_extint) % 2)))
219+
(0xF << (((_extint) % 2) * 4))
220220
#define RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(_extint) \
221221
(((_extint) % 2) * 4)
222222

drivers/net/dummy.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
static int numdummies = 1;
4848

4949
/* fake multicast ability */
50-
static void set_multicast_list(struct net_device *dev)
50+
static void set_multicast_list(struct net_device *dev,
51+
struct netdev_hw_addr_list *uc,
52+
struct netdev_hw_addr_list *mc)
5153
{
5254
}
5355

@@ -87,7 +89,7 @@ static const struct net_device_ops dummy_netdev_ops = {
8789
.ndo_init = dummy_dev_init,
8890
.ndo_start_xmit = dummy_xmit,
8991
.ndo_validate_addr = eth_validate_addr,
90-
.ndo_set_rx_mode = set_multicast_list,
92+
.ndo_set_rx_mode_async = set_multicast_list,
9193
.ndo_set_mac_address = eth_mac_addr,
9294
.ndo_get_stats64 = dummy_get_stats64,
9395
.ndo_change_carrier = dummy_change_carrier,

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 87 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -745,14 +745,18 @@ static int airoha_qdma_init_rx_queue(struct airoha_queue *q,
745745
dma_addr_t dma_addr;
746746

747747
q->buf_size = PAGE_SIZE / 2;
748-
q->ndesc = ndesc;
749748
q->qdma = qdma;
750749

751-
q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry),
750+
q->entry = devm_kzalloc(eth->dev, ndesc * sizeof(*q->entry),
752751
GFP_KERNEL);
753752
if (!q->entry)
754753
return -ENOMEM;
755754

755+
q->desc = dmam_alloc_coherent(eth->dev, ndesc * sizeof(*q->desc),
756+
&dma_addr, GFP_KERNEL);
757+
if (!q->desc)
758+
return -ENOMEM;
759+
756760
q->page_pool = page_pool_create(&pp_params);
757761
if (IS_ERR(q->page_pool)) {
758762
int err = PTR_ERR(q->page_pool);
@@ -761,11 +765,7 @@ static int airoha_qdma_init_rx_queue(struct airoha_queue *q,
761765
return err;
762766
}
763767

764-
q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc),
765-
&dma_addr, GFP_KERNEL);
766-
if (!q->desc)
767-
return -ENOMEM;
768-
768+
q->ndesc = ndesc;
769769
netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll);
770770

771771
airoha_qdma_wr(qdma, REG_RX_RING_BASE(qid), dma_addr);
@@ -843,6 +843,21 @@ static int airoha_qdma_init_rx(struct airoha_qdma *qdma)
843843
return 0;
844844
}
845845

846+
static void airoha_qdma_wake_netdev_txqs(struct airoha_queue *q)
847+
{
848+
struct airoha_qdma *qdma = q->qdma;
849+
struct airoha_eth *eth = qdma->eth;
850+
int i;
851+
852+
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
853+
struct airoha_gdm_port *port = eth->ports[i];
854+
855+
if (port && port->qdma == qdma)
856+
netif_tx_wake_all_queues(port->dev);
857+
}
858+
q->txq_stopped = false;
859+
}
860+
846861
static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget)
847862
{
848863
struct airoha_tx_irq_queue *irq_q;
@@ -919,12 +934,21 @@ static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget)
919934

920935
txq = netdev_get_tx_queue(skb->dev, queue);
921936
netdev_tx_completed_queue(txq, 1, skb->len);
922-
if (netif_tx_queue_stopped(txq) &&
923-
q->ndesc - q->queued >= q->free_thr)
924-
netif_tx_wake_queue(txq);
925-
926937
dev_kfree_skb_any(skb);
927938
}
939+
940+
if (q->txq_stopped && q->ndesc - q->queued >= q->free_thr) {
941+
/* Since multiple net_device TX queues can share the
942+
* same hw QDMA TX queue, there is no guarantee we have
943+
* inflight packets queued in hw belonging to a
944+
* net_device TX queue stopped in the xmit path.
945+
* In order to avoid any potential net_device TX queue
946+
* stall, we need to wake all the net_device TX queues
947+
* feeding the same hw QDMA TX queue.
948+
*/
949+
airoha_qdma_wake_netdev_txqs(q);
950+
}
951+
928952
unlock:
929953
spin_unlock_bh(&q->lock);
930954
}
@@ -954,27 +978,27 @@ static int airoha_qdma_init_tx_queue(struct airoha_queue *q,
954978
dma_addr_t dma_addr;
955979

956980
spin_lock_init(&q->lock);
957-
q->ndesc = size;
958981
q->qdma = qdma;
959982
q->free_thr = 1 + MAX_SKB_FRAGS;
960983
INIT_LIST_HEAD(&q->tx_list);
961984

962-
q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry),
985+
q->entry = devm_kzalloc(eth->dev, size * sizeof(*q->entry),
963986
GFP_KERNEL);
964987
if (!q->entry)
965988
return -ENOMEM;
966989

967-
q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc),
990+
q->desc = dmam_alloc_coherent(eth->dev, size * sizeof(*q->desc),
968991
&dma_addr, GFP_KERNEL);
969992
if (!q->desc)
970993
return -ENOMEM;
971994

972-
for (i = 0; i < q->ndesc; i++) {
995+
for (i = 0; i < size; i++) {
973996
u32 val = FIELD_PREP(QDMA_DESC_DONE_MASK, 1);
974997

975998
list_add_tail(&q->entry[i].list, &q->tx_list);
976999
WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val));
9771000
}
1001+
q->ndesc = size;
9781002

9791003
/* xmit ring drop default setting */
9801004
airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(qid),
@@ -996,8 +1020,6 @@ static int airoha_qdma_tx_irq_init(struct airoha_tx_irq_queue *irq_q,
9961020
struct airoha_eth *eth = qdma->eth;
9971021
dma_addr_t dma_addr;
9981022

999-
netif_napi_add_tx(eth->napi_dev, &irq_q->napi,
1000-
airoha_qdma_tx_napi_poll);
10011023
irq_q->q = dmam_alloc_coherent(eth->dev, size * sizeof(u32),
10021024
&dma_addr, GFP_KERNEL);
10031025
if (!irq_q->q)
@@ -1007,6 +1029,9 @@ static int airoha_qdma_tx_irq_init(struct airoha_tx_irq_queue *irq_q,
10071029
irq_q->size = size;
10081030
irq_q->qdma = qdma;
10091031

1032+
netif_napi_add_tx(eth->napi_dev, &irq_q->napi,
1033+
airoha_qdma_tx_napi_poll);
1034+
10101035
airoha_qdma_wr(qdma, REG_TX_IRQ_BASE(id), dma_addr);
10111036
airoha_qdma_rmw(qdma, REG_TX_IRQ_CFG(id), TX_IRQ_DEPTH_MASK,
10121037
FIELD_PREP(TX_IRQ_DEPTH_MASK, size));
@@ -1039,12 +1064,15 @@ static int airoha_qdma_init_tx(struct airoha_qdma *qdma)
10391064

10401065
static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q)
10411066
{
1042-
struct airoha_eth *eth = q->qdma->eth;
1043-
int i;
1067+
struct airoha_qdma *qdma = q->qdma;
1068+
struct airoha_eth *eth = qdma->eth;
1069+
int i, qid = q - &qdma->q_tx[0];
1070+
u16 index = 0;
10441071

10451072
spin_lock_bh(&q->lock);
10461073
for (i = 0; i < q->ndesc; i++) {
10471074
struct airoha_queue_entry *e = &q->entry[i];
1075+
struct airoha_qdma_desc *desc = &q->desc[i];
10481076

10491077
if (!e->dma_addr)
10501078
continue;
@@ -1055,8 +1083,33 @@ static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q)
10551083
e->dma_addr = 0;
10561084
e->skb = NULL;
10571085
list_add_tail(&e->list, &q->tx_list);
1086+
1087+
/* Reset DMA descriptor */
1088+
WRITE_ONCE(desc->ctrl, 0);
1089+
WRITE_ONCE(desc->addr, 0);
1090+
WRITE_ONCE(desc->data, 0);
1091+
WRITE_ONCE(desc->msg0, 0);
1092+
WRITE_ONCE(desc->msg1, 0);
1093+
WRITE_ONCE(desc->msg2, 0);
1094+
10581095
q->queued--;
10591096
}
1097+
1098+
if (!list_empty(&q->tx_list)) {
1099+
struct airoha_queue_entry *e;
1100+
1101+
e = list_first_entry(&q->tx_list, struct airoha_queue_entry,
1102+
list);
1103+
index = e - q->entry;
1104+
}
1105+
/* Set TX_DMA_IDX to TX_CPU_IDX to notify the hw the QDMA TX ring is
1106+
* empty.
1107+
*/
1108+
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK,
1109+
FIELD_PREP(TX_RING_CPU_IDX_MASK, index));
1110+
airoha_qdma_rmw(qdma, REG_TX_DMA_IDX(qid), TX_RING_DMA_IDX_MASK,
1111+
FIELD_PREP(TX_RING_DMA_IDX_MASK, index));
1112+
10601113
spin_unlock_bh(&q->lock);
10611114
}
10621115

@@ -1398,8 +1451,12 @@ static void airoha_qdma_cleanup(struct airoha_qdma *qdma)
13981451
}
13991452
}
14001453

1401-
for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++)
1454+
for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) {
1455+
if (!qdma->q_tx_irq[i].size)
1456+
continue;
1457+
14021458
netif_napi_del(&qdma->q_tx_irq[i].napi);
1459+
}
14031460

14041461
for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) {
14051462
if (!qdma->q_tx[i].ndesc)
@@ -1727,7 +1784,7 @@ static int airoha_set_gdm2_loopback(struct airoha_gdm_port *port)
17271784
{
17281785
struct airoha_eth *eth = port->qdma->eth;
17291786
u32 val, pse_port, chan;
1730-
int src_port;
1787+
int i, src_port;
17311788

17321789
/* Forward the traffic to the proper GDM port */
17331790
pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
@@ -1769,6 +1826,9 @@ static int airoha_set_gdm2_loopback(struct airoha_gdm_port *port)
17691826
SP_CPORT_MASK(val),
17701827
__field_prep(SP_CPORT_MASK(val), FE_PSE_PORT_CDM2));
17711828

1829+
for (i = 0; i < eth->soc->num_ppe; i++)
1830+
airoha_ppe_set_cpu_port(port, i, AIROHA_GDM2_IDX);
1831+
17721832
if (port->id == AIROHA_GDM4_IDX && airoha_is_7581(eth)) {
17731833
u32 mask = FC_ID_OF_SRC_PORT_MASK(port->nbq);
17741834

@@ -1807,7 +1867,8 @@ static int airoha_dev_init(struct net_device *dev)
18071867
}
18081868

18091869
for (i = 0; i < eth->soc->num_ppe; i++)
1810-
airoha_ppe_set_cpu_port(port, i);
1870+
airoha_ppe_set_cpu_port(port, i,
1871+
airoha_get_fe_port(port));
18111872

18121873
return 0;
18131874
}
@@ -1984,6 +2045,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
19842045
if (q->queued + nr_frags >= q->ndesc) {
19852046
/* not enough space in the queue */
19862047
netif_tx_stop_queue(txq);
2048+
q->txq_stopped = true;
19872049
spin_unlock_bh(&q->lock);
19882050
return NETDEV_TX_BUSY;
19892051
}
@@ -2039,8 +2101,10 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
20392101
TX_RING_CPU_IDX_MASK,
20402102
FIELD_PREP(TX_RING_CPU_IDX_MASK, index));
20412103

2042-
if (q->ndesc - q->queued < q->free_thr)
2104+
if (q->ndesc - q->queued < q->free_thr) {
20432105
netif_tx_stop_queue(txq);
2106+
q->txq_stopped = true;
2107+
}
20442108

20452109
spin_unlock_bh(&q->lock);
20462110

drivers/net/ethernet/airoha/airoha_eth.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ struct airoha_queue {
193193
int ndesc;
194194
int free_thr;
195195
int buf_size;
196+
bool txq_stopped;
196197

197198
struct napi_struct napi;
198199
struct page_pool *page_pool;
@@ -653,7 +654,8 @@ int airoha_get_fe_port(struct airoha_gdm_port *port);
653654
bool airoha_is_valid_gdm_port(struct airoha_eth *eth,
654655
struct airoha_gdm_port *port);
655656

656-
void airoha_ppe_set_cpu_port(struct airoha_gdm_port *port, u8 ppe_id);
657+
void airoha_ppe_set_cpu_port(struct airoha_gdm_port *port, u8 ppe_id,
658+
u8 fport);
657659
bool airoha_ppe_is_enabled(struct airoha_eth *eth, int index);
658660
void airoha_ppe_check_skb(struct airoha_ppe_dev *dev, struct sk_buff *skb,
659661
u16 hash, bool rx_wlan);

0 commit comments

Comments
 (0)