Skip to content

Commit 8faabc0

Browse files
committed
Merge tag 'net-6.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from can and netfilter. Current release - regressions: - rtnetlink: try the outer netns attribute in rtnl_get_peer_net() - rust: net::phy fix module autoloading Current release - new code bugs: - phy: avoid undefined behavior in *_led_polarity_set() - eth: octeontx2-pf: fix netdev memory leak in rvu_rep_create() Previous releases - regressions: - smc: check sndbuf_space again after NOSPACE flag is set in smc_poll - ipvs: fix clamp() of ip_vs_conn_tab on small memory systems - dsa: restore dsa_software_vlan_untag() ability to operate on VLAN-untagged traffic - eth: - tun: fix tun_napi_alloc_frags() - ionic: no double destroy workqueue - idpf: trigger SW interrupt when exiting wb_on_itr mode - rswitch: rework ts tags management - team: fix feature exposure when no ports are present Previous releases - always broken: - core: fix repeated netlink messages in queue dump - mdiobus: fix an OF node reference leak - smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg - can: fix missed interrupts with m_can_pci - eth: oa_tc6: fix infinite loop error when tx credits becomes 0" * tag 'net-6.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (45 commits) net: mctp: handle skb cleanup on sock_queue failures net: mdiobus: fix an OF node reference leak octeontx2-pf: fix error handling of devlink port in rvu_rep_create() octeontx2-pf: fix netdev memory leak in rvu_rep_create() psample: adjust size if rate_as_probability is set netdev-genl: avoid empty messages in queue dump net: dsa: restore dsa_software_vlan_untag() ability to operate on VLAN-untagged traffic selftests: openvswitch: fix tcpdump execution net: usb: qmi_wwan: add Quectel RG255C net: phy: avoid undefined behavior in *_led_polarity_set() netfilter: ipset: Fix for recursive locking warning ipvs: Fix clamp() of ip_vs_conn_tab on small memory systems can: m_can: fix missed interrupts with m_can_pci can: m_can: set init flag earlier in probe rtnetlink: Try the outer netns attribute in rtnl_get_peer_net(). net: netdevsim: fix nsim_pp_hold_write() idpf: trigger SW interrupt when exiting wb_on_itr mode idpf: add support for SW triggered interrupts qed: fix possible uninit pointer read in qed_mcp_nvm_info_populate() net: ethernet: bgmac-platform: fix an OF node reference leak ...
2 parents baaa256 + ce1219c commit 8faabc0

File tree

46 files changed

+410
-156
lines changed

Some content is hidden

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

46 files changed

+410
-156
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,20 +1220,32 @@ static void m_can_coalescing_update(struct m_can_classdev *cdev, u32 ir)
12201220
static int m_can_interrupt_handler(struct m_can_classdev *cdev)
12211221
{
12221222
struct net_device *dev = cdev->net;
1223-
u32 ir;
1223+
u32 ir = 0, ir_read;
12241224
int ret;
12251225

12261226
if (pm_runtime_suspended(cdev->dev))
12271227
return IRQ_NONE;
12281228

1229-
ir = m_can_read(cdev, M_CAN_IR);
1229+
/* The m_can controller signals its interrupt status as a level, but
1230+
* depending in the integration the CPU may interpret the signal as
1231+
* edge-triggered (for example with m_can_pci). For these
1232+
* edge-triggered integrations, we must observe that IR is 0 at least
1233+
* once to be sure that the next interrupt will generate an edge.
1234+
*/
1235+
while ((ir_read = m_can_read(cdev, M_CAN_IR)) != 0) {
1236+
ir |= ir_read;
1237+
1238+
/* ACK all irqs */
1239+
m_can_write(cdev, M_CAN_IR, ir);
1240+
1241+
if (!cdev->irq_edge_triggered)
1242+
break;
1243+
}
1244+
12301245
m_can_coalescing_update(cdev, ir);
12311246
if (!ir)
12321247
return IRQ_NONE;
12331248

1234-
/* ACK all irqs */
1235-
m_can_write(cdev, M_CAN_IR, ir);
1236-
12371249
if (cdev->ops->clear_interrupts)
12381250
cdev->ops->clear_interrupts(cdev);
12391251

@@ -1695,6 +1707,14 @@ static int m_can_dev_setup(struct m_can_classdev *cdev)
16951707
return -EINVAL;
16961708
}
16971709

1710+
/* Write the INIT bit, in case no hardware reset has happened before
1711+
* the probe (for example, it was observed that the Intel Elkhart Lake
1712+
* SoCs do not properly reset the CAN controllers on reboot)
1713+
*/
1714+
err = m_can_cccr_update_bits(cdev, CCCR_INIT, CCCR_INIT);
1715+
if (err)
1716+
return err;
1717+
16981718
if (!cdev->is_peripheral)
16991719
netif_napi_add(dev, &cdev->napi, m_can_poll);
17001720

@@ -1746,11 +1766,7 @@ static int m_can_dev_setup(struct m_can_classdev *cdev)
17461766
return -EINVAL;
17471767
}
17481768

1749-
/* Forcing standby mode should be redundant, as the chip should be in
1750-
* standby after a reset. Write the INIT bit anyways, should the chip
1751-
* be configured by previous stage.
1752-
*/
1753-
return m_can_cccr_update_bits(cdev, CCCR_INIT, CCCR_INIT);
1769+
return 0;
17541770
}
17551771

17561772
static void m_can_stop(struct net_device *dev)

drivers/net/can/m_can/m_can.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct m_can_classdev {
9999
int pm_clock_support;
100100
int pm_wake_source;
101101
int is_peripheral;
102+
bool irq_edge_triggered;
102103

103104
// Cached M_CAN_IE register content
104105
u32 active_interrupts;

drivers/net/can/m_can/m_can_pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
127127
mcan_class->pm_clock_support = 1;
128128
mcan_class->pm_wake_source = 0;
129129
mcan_class->can.clock.freq = id->driver_data;
130+
mcan_class->irq_edge_triggered = true;
130131
mcan_class->ops = &m_can_pci_ops;
131132

132133
pci_set_drvdata(pci, mcan_class);

drivers/net/ethernet/broadcom/bgmac-platform.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static int platform_phy_connect(struct bgmac *bgmac)
171171
static int bgmac_probe(struct platform_device *pdev)
172172
{
173173
struct device_node *np = pdev->dev.of_node;
174+
struct device_node *phy_node;
174175
struct bgmac *bgmac;
175176
struct resource *regs;
176177
int ret;
@@ -236,7 +237,9 @@ static int bgmac_probe(struct platform_device *pdev)
236237
bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset;
237238
bgmac->get_bus_clock = platform_bgmac_get_bus_clock;
238239
bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32;
239-
if (of_parse_phandle(np, "phy-handle", 0)) {
240+
phy_node = of_parse_phandle(np, "phy-handle", 0);
241+
if (phy_node) {
242+
of_node_put(phy_node);
240243
bgmac->phy_connect = platform_phy_connect;
241244
} else {
242245
bgmac->phy_connect = bgmac_phy_connect_direct;

drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,9 @@ static struct sk_buff *copy_gl_to_skb_pkt(const struct pkt_gl *gl,
346346
* driver. Once driver synthesizes cpl_pass_accept_req the skb will go
347347
* through the regular cpl_pass_accept_req processing in TOM.
348348
*/
349-
skb = alloc_skb(gl->tot_len + sizeof(struct cpl_pass_accept_req)
350-
- pktshift, GFP_ATOMIC);
349+
skb = alloc_skb(size_add(gl->tot_len,
350+
sizeof(struct cpl_pass_accept_req)) -
351+
pktshift, GFP_ATOMIC);
351352
if (unlikely(!skb))
352353
return NULL;
353354
__skb_put(skb, gl->tot_len + sizeof(struct cpl_pass_accept_req)

drivers/net/ethernet/huawei/hinic/hinic_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ static int create_txqs(struct hinic_dev *nic_dev)
172172
hinic_sq_dbgfs_uninit(nic_dev);
173173

174174
devm_kfree(&netdev->dev, nic_dev->txqs);
175+
nic_dev->txqs = NULL;
175176
return err;
176177
}
177178

@@ -268,6 +269,7 @@ static int create_rxqs(struct hinic_dev *nic_dev)
268269
hinic_rq_dbgfs_uninit(nic_dev);
269270

270271
devm_kfree(&netdev->dev, nic_dev->rxqs);
272+
nic_dev->rxqs = NULL;
271273
return err;
272274
}
273275

drivers/net/ethernet/intel/idpf/idpf_dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static int idpf_intr_reg_init(struct idpf_vport *vport)
101101
intr->dyn_ctl_itridx_s = PF_GLINT_DYN_CTL_ITR_INDX_S;
102102
intr->dyn_ctl_intrvl_s = PF_GLINT_DYN_CTL_INTERVAL_S;
103103
intr->dyn_ctl_wb_on_itr_m = PF_GLINT_DYN_CTL_WB_ON_ITR_M;
104+
intr->dyn_ctl_swint_trig_m = PF_GLINT_DYN_CTL_SWINT_TRIG_M;
105+
intr->dyn_ctl_sw_itridx_ena_m =
106+
PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_M;
104107

105108
spacing = IDPF_ITR_IDX_SPACING(reg_vals[vec_id].itrn_index_spacing,
106109
IDPF_PF_ITR_IDX_SPACING);

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3604,21 +3604,31 @@ static void idpf_vport_intr_dis_irq_all(struct idpf_vport *vport)
36043604
/**
36053605
* idpf_vport_intr_buildreg_itr - Enable default interrupt generation settings
36063606
* @q_vector: pointer to q_vector
3607-
* @type: itr index
3608-
* @itr: itr value
36093607
*/
3610-
static u32 idpf_vport_intr_buildreg_itr(struct idpf_q_vector *q_vector,
3611-
const int type, u16 itr)
3608+
static u32 idpf_vport_intr_buildreg_itr(struct idpf_q_vector *q_vector)
36123609
{
3613-
u32 itr_val;
3610+
u32 itr_val = q_vector->intr_reg.dyn_ctl_intena_m;
3611+
int type = IDPF_NO_ITR_UPDATE_IDX;
3612+
u16 itr = 0;
3613+
3614+
if (q_vector->wb_on_itr) {
3615+
/*
3616+
* Trigger a software interrupt when exiting wb_on_itr, to make
3617+
* sure we catch any pending write backs that might have been
3618+
* missed due to interrupt state transition.
3619+
*/
3620+
itr_val |= q_vector->intr_reg.dyn_ctl_swint_trig_m |
3621+
q_vector->intr_reg.dyn_ctl_sw_itridx_ena_m;
3622+
type = IDPF_SW_ITR_UPDATE_IDX;
3623+
itr = IDPF_ITR_20K;
3624+
}
36143625

36153626
itr &= IDPF_ITR_MASK;
36163627
/* Don't clear PBA because that can cause lost interrupts that
36173628
* came in while we were cleaning/polling
36183629
*/
3619-
itr_val = q_vector->intr_reg.dyn_ctl_intena_m |
3620-
(type << q_vector->intr_reg.dyn_ctl_itridx_s) |
3621-
(itr << (q_vector->intr_reg.dyn_ctl_intrvl_s - 1));
3630+
itr_val |= (type << q_vector->intr_reg.dyn_ctl_itridx_s) |
3631+
(itr << (q_vector->intr_reg.dyn_ctl_intrvl_s - 1));
36223632

36233633
return itr_val;
36243634
}
@@ -3716,9 +3726,8 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector)
37163726
/* net_dim() updates ITR out-of-band using a work item */
37173727
idpf_net_dim(q_vector);
37183728

3729+
intval = idpf_vport_intr_buildreg_itr(q_vector);
37193730
q_vector->wb_on_itr = false;
3720-
intval = idpf_vport_intr_buildreg_itr(q_vector,
3721-
IDPF_NO_ITR_UPDATE_IDX, 0);
37223731

37233732
writel(intval, q_vector->intr_reg.dyn_ctl);
37243733
}

drivers/net/ethernet/intel/idpf/idpf_txrx.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ struct idpf_vec_regs {
354354
* @dyn_ctl_itridx_m: Mask for ITR index
355355
* @dyn_ctl_intrvl_s: Register bit offset for ITR interval
356356
* @dyn_ctl_wb_on_itr_m: Mask for WB on ITR feature
357+
* @dyn_ctl_sw_itridx_ena_m: Mask for SW ITR index
358+
* @dyn_ctl_swint_trig_m: Mask for dyn_ctl SW triggered interrupt enable
357359
* @rx_itr: RX ITR register
358360
* @tx_itr: TX ITR register
359361
* @icr_ena: Interrupt cause register offset
@@ -367,6 +369,8 @@ struct idpf_intr_reg {
367369
u32 dyn_ctl_itridx_m;
368370
u32 dyn_ctl_intrvl_s;
369371
u32 dyn_ctl_wb_on_itr_m;
372+
u32 dyn_ctl_sw_itridx_ena_m;
373+
u32 dyn_ctl_swint_trig_m;
370374
void __iomem *rx_itr;
371375
void __iomem *tx_itr;
372376
void __iomem *icr_ena;
@@ -437,7 +441,7 @@ struct idpf_q_vector {
437441
cpumask_var_t affinity_mask;
438442
__cacheline_group_end_aligned(cold);
439443
};
440-
libeth_cacheline_set_assert(struct idpf_q_vector, 112,
444+
libeth_cacheline_set_assert(struct idpf_q_vector, 120,
441445
24 + sizeof(struct napi_struct) +
442446
2 * sizeof(struct dim),
443447
8 + sizeof(cpumask_var_t));
@@ -471,6 +475,8 @@ struct idpf_tx_queue_stats {
471475
#define IDPF_ITR_IS_DYNAMIC(itr_mode) (itr_mode)
472476
#define IDPF_ITR_TX_DEF IDPF_ITR_20K
473477
#define IDPF_ITR_RX_DEF IDPF_ITR_20K
478+
/* Index used for 'SW ITR' update in DYN_CTL register */
479+
#define IDPF_SW_ITR_UPDATE_IDX 2
474480
/* Index used for 'No ITR' update in DYN_CTL register */
475481
#define IDPF_NO_ITR_UPDATE_IDX 3
476482
#define IDPF_ITR_IDX_SPACING(spacing, dflt) (spacing ? spacing : dflt)

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static int idpf_vf_intr_reg_init(struct idpf_vport *vport)
101101
intr->dyn_ctl_itridx_s = VF_INT_DYN_CTLN_ITR_INDX_S;
102102
intr->dyn_ctl_intrvl_s = VF_INT_DYN_CTLN_INTERVAL_S;
103103
intr->dyn_ctl_wb_on_itr_m = VF_INT_DYN_CTLN_WB_ON_ITR_M;
104+
intr->dyn_ctl_swint_trig_m = VF_INT_DYN_CTLN_SWINT_TRIG_M;
105+
intr->dyn_ctl_sw_itridx_ena_m =
106+
VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_M;
104107

105108
spacing = IDPF_ITR_IDX_SPACING(reg_vals[vec_id].itrn_index_spacing,
106109
IDPF_VF_ITR_IDX_SPACING);

drivers/net/ethernet/marvell/octeontx2/nic/rep.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,14 +680,17 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
680680
ndev->features |= ndev->hw_features;
681681
eth_hw_addr_random(ndev);
682682
err = rvu_rep_devlink_port_register(rep);
683-
if (err)
683+
if (err) {
684+
free_netdev(ndev);
684685
goto exit;
686+
}
685687

686688
SET_NETDEV_DEVLINK_PORT(ndev, &rep->dl_port);
687689
err = register_netdev(ndev);
688690
if (err) {
689691
NL_SET_ERR_MSG_MOD(extack,
690692
"PFVF representor registration failed");
693+
rvu_rep_devlink_port_unregister(rep);
691694
free_netdev(ndev);
692695
goto exit;
693696
}

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ void ocelot_ifh_set_basic(void *ifh, struct ocelot *ocelot, int port,
14321432

14331433
memset(ifh, 0, OCELOT_TAG_LEN);
14341434
ocelot_ifh_set_bypass(ifh, 1);
1435-
ocelot_ifh_set_src(ifh, BIT_ULL(ocelot->num_phys_ports));
1435+
ocelot_ifh_set_src(ifh, ocelot->num_phys_ports);
14361436
ocelot_ifh_set_dest(ifh, BIT_ULL(port));
14371437
ocelot_ifh_set_qos_class(ifh, qos_class);
14381438
ocelot_ifh_set_tag_type(ifh, tag_type);

drivers/net/ethernet/oa_tc6.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ struct oa_tc6 {
113113
struct mii_bus *mdiobus;
114114
struct spi_device *spi;
115115
struct mutex spi_ctrl_lock; /* Protects spi control transfer */
116+
spinlock_t tx_skb_lock; /* Protects tx skb handling */
116117
void *spi_ctrl_tx_buf;
117118
void *spi_ctrl_rx_buf;
118119
void *spi_data_tx_buf;
@@ -1004,8 +1005,10 @@ static u16 oa_tc6_prepare_spi_tx_buf_for_tx_skbs(struct oa_tc6 *tc6)
10041005
for (used_tx_credits = 0; used_tx_credits < tc6->tx_credits;
10051006
used_tx_credits++) {
10061007
if (!tc6->ongoing_tx_skb) {
1008+
spin_lock_bh(&tc6->tx_skb_lock);
10071009
tc6->ongoing_tx_skb = tc6->waiting_tx_skb;
10081010
tc6->waiting_tx_skb = NULL;
1011+
spin_unlock_bh(&tc6->tx_skb_lock);
10091012
}
10101013
if (!tc6->ongoing_tx_skb)
10111014
break;
@@ -1111,8 +1114,9 @@ static int oa_tc6_spi_thread_handler(void *data)
11111114
/* This kthread will be waken up if there is a tx skb or mac-phy
11121115
* interrupt to perform spi transfer with tx chunks.
11131116
*/
1114-
wait_event_interruptible(tc6->spi_wq, tc6->waiting_tx_skb ||
1115-
tc6->int_flag ||
1117+
wait_event_interruptible(tc6->spi_wq, tc6->int_flag ||
1118+
(tc6->waiting_tx_skb &&
1119+
tc6->tx_credits) ||
11161120
kthread_should_stop());
11171121

11181122
if (kthread_should_stop())
@@ -1209,7 +1213,9 @@ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb)
12091213
return NETDEV_TX_OK;
12101214
}
12111215

1216+
spin_lock_bh(&tc6->tx_skb_lock);
12121217
tc6->waiting_tx_skb = skb;
1218+
spin_unlock_bh(&tc6->tx_skb_lock);
12131219

12141220
/* Wake spi kthread to perform spi transfer */
12151221
wake_up_interruptible(&tc6->spi_wq);
@@ -1239,6 +1245,7 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
12391245
tc6->netdev = netdev;
12401246
SET_NETDEV_DEV(netdev, &spi->dev);
12411247
mutex_init(&tc6->spi_ctrl_lock);
1248+
spin_lock_init(&tc6->tx_skb_lock);
12421249

12431250
/* Set the SPI controller to pump at realtime priority */
12441251
tc6->spi->rt = true;

drivers/net/ethernet/pensando/ionic/ionic_dev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ void ionic_dev_teardown(struct ionic *ionic)
277277
idev->phy_cmb_pages = 0;
278278
idev->cmb_npages = 0;
279279

280-
destroy_workqueue(ionic->wq);
280+
if (ionic->wq) {
281+
destroy_workqueue(ionic->wq);
282+
ionic->wq = NULL;
283+
}
281284
mutex_destroy(&idev->cmb_inuse_lock);
282285
}
283286

drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,8 @@ static int ionic_get_module_eeprom(struct net_device *netdev,
961961
len = min_t(u32, sizeof(xcvr->sprom), ee->len);
962962

963963
do {
964-
memcpy(data, xcvr->sprom, len);
965-
memcpy(tbuf, xcvr->sprom, len);
964+
memcpy(data, &xcvr->sprom[ee->offset], len);
965+
memcpy(tbuf, &xcvr->sprom[ee->offset], len);
966966

967967
/* Let's make sure we got a consistent copy */
968968
if (!memcmp(data, tbuf, len))

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,8 +3869,8 @@ int ionic_lif_register(struct ionic_lif *lif)
38693869
/* only register LIF0 for now */
38703870
err = register_netdev(lif->netdev);
38713871
if (err) {
3872-
dev_err(lif->ionic->dev, "Cannot register net device, aborting\n");
3873-
ionic_lif_unregister_phc(lif);
3872+
dev_err(lif->ionic->dev, "Cannot register net device: %d, aborting\n", err);
3873+
ionic_lif_unregister(lif);
38743874
return err;
38753875
}
38763876

drivers/net/ethernet/qlogic/qed/qed_mcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,7 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
33583358
p_ptt, &nvm_info.num_images);
33593359
if (rc == -EOPNOTSUPP) {
33603360
DP_INFO(p_hwfn, "DRV_MSG_CODE_BIST_TEST is not supported\n");
3361+
nvm_info.num_images = 0;
33613362
goto out;
33623363
} else if (rc || !nvm_info.num_images) {
33633364
DP_ERR(p_hwfn, "Failed getting number of images\n");

0 commit comments

Comments
 (0)