Skip to content

Commit 0058b0a

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) BPF sample build fixes from Björn Töpel 2) Fix powerpc bpf tail call implementation, from Eric Dumazet. 3) DCCP leaks jiffies on the wire, fix also from Eric Dumazet. 4) Fix crash in ebtables when using dnat target, from Florian Westphal. 5) Fix port disable handling whne removing bcm_sf2 driver, from Florian Fainelli. 6) Fix kTLS sk_msg trim on fallback to copy mode, from Jakub Kicinski. 7) Various KCSAN fixes all over the networking, from Eric Dumazet. 8) Memory leaks in mlx5 driver, from Alex Vesker. 9) SMC interface refcounting fix, from Ursula Braun. 10) TSO descriptor handling fixes in stmmac driver, from Jose Abreu. 11) Add a TX lock to synchonize the kTLS TX path properly with crypto operations. From Jakub Kicinski. 12) Sock refcount during shutdown fix in vsock/virtio code, from Stefano Garzarella. 13) Infinite loop in Intel ice driver, from Colin Ian King. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (108 commits) ixgbe: need_wakeup flag might not be set for Tx i40e: need_wakeup flag might not be set for Tx igb/igc: use ktime accessors for skb->tstamp i40e: Fix for ethtool -m issue on X722 NIC iavf: initialize ITRN registers with correct values ice: fix potential infinite loop because loop counter being too small qede: fix NULL pointer deref in __qede_remove() net: fix data-race in neigh_event_send() vsock/virtio: fix sock refcnt holding during the shutdown net: ethernet: octeon_mgmt: Account for second possible VLAN header mac80211: fix station inactive_time shortly after boot net/fq_impl: Switch to kvmalloc() for memory allocation mac80211: fix ieee80211_txq_setup_flows() failure path ipv4: Fix table id reference in fib_sync_down_addr ipv6: fixes rt6_probe() and fib6_nh->last_probe init net: hns: Fix the stray netpoll locks causing deadlock in NAPI path net: usb: qmi_wwan: add support for DW5821e with eSIM support CDC-NCM: handle incomplete transfer of MTU nfc: netlink: fix double device reference drop NFC: st21nfca: fix double free ...
2 parents 5cb8418 + a2582cd commit 0058b0a

File tree

111 files changed

+1093
-483
lines changed

Some content is hidden

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

111 files changed

+1093
-483
lines changed

Documentation/networking/tls-offload.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ by the driver:
436436
encryption.
437437
* ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream
438438
but did not arrive in the expected order.
439+
* ``tx_tls_skip_no_sync_data`` - number of TX packets which were part of
440+
a TLS stream and arrived out-of-order, but skipped the HW offload routine
441+
and went to the regular transmit flow as they were retransmissions of the
442+
connection handshake.
439443
* ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of
440444
a TLS stream dropped, because they arrived out of order and associated
441445
record could not be found.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,7 @@ M: Daniel Borkmann <[email protected]>
30533053
R: Martin KaFai Lau <[email protected]>
30543054
R: Song Liu <[email protected]>
30553055
R: Yonghong Song <[email protected]>
3056+
R: Andrii Nakryiko <[email protected]>
30563057
30573058
30583059
T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,19 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
11411141
goto out_addrs;
11421142
}
11431143

1144+
/*
1145+
* If we have seen a tail call, we need a second pass.
1146+
* This is because bpf_jit_emit_common_epilogue() is called
1147+
* from bpf_jit_emit_tail_call() with a not yet stable ctx->seen.
1148+
*/
1149+
if (cgctx.seen & SEEN_TAILCALL) {
1150+
cgctx.idx = 0;
1151+
if (bpf_jit_build_body(fp, 0, &cgctx, addrs, false)) {
1152+
fp = org_fp;
1153+
goto out_addrs;
1154+
}
1155+
}
1156+
11441157
/*
11451158
* Pretend to build prologue, given the features we've seen. This will
11461159
* update ctgtx.idx as it pretends to output instructions, then we can

drivers/net/bonding/bond_main.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,8 +2083,7 @@ static int bond_miimon_inspect(struct bonding *bond)
20832083
ignore_updelay = !rcu_dereference(bond->curr_active_slave);
20842084

20852085
bond_for_each_slave_rcu(bond, slave, iter) {
2086-
slave->new_link = BOND_LINK_NOCHANGE;
2087-
slave->link_new_state = slave->link;
2086+
bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
20882087

20892088
link_state = bond_check_dev_link(bond, slave->dev, 0);
20902089

@@ -2118,7 +2117,7 @@ static int bond_miimon_inspect(struct bonding *bond)
21182117
}
21192118

21202119
if (slave->delay <= 0) {
2121-
slave->new_link = BOND_LINK_DOWN;
2120+
bond_propose_link_state(slave, BOND_LINK_DOWN);
21222121
commit++;
21232122
continue;
21242123
}
@@ -2155,7 +2154,7 @@ static int bond_miimon_inspect(struct bonding *bond)
21552154
slave->delay = 0;
21562155

21572156
if (slave->delay <= 0) {
2158-
slave->new_link = BOND_LINK_UP;
2157+
bond_propose_link_state(slave, BOND_LINK_UP);
21592158
commit++;
21602159
ignore_updelay = false;
21612160
continue;
@@ -2193,7 +2192,7 @@ static void bond_miimon_commit(struct bonding *bond)
21932192
struct slave *slave, *primary;
21942193

21952194
bond_for_each_slave(bond, slave, iter) {
2196-
switch (slave->new_link) {
2195+
switch (slave->link_new_state) {
21972196
case BOND_LINK_NOCHANGE:
21982197
/* For 802.3ad mode, check current slave speed and
21992198
* duplex again in case its port was disabled after
@@ -2265,8 +2264,8 @@ static void bond_miimon_commit(struct bonding *bond)
22652264

22662265
default:
22672266
slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",
2268-
slave->new_link);
2269-
slave->new_link = BOND_LINK_NOCHANGE;
2267+
slave->link_new_state);
2268+
bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
22702269

22712270
continue;
22722271
}
@@ -2674,13 +2673,13 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
26742673
bond_for_each_slave_rcu(bond, slave, iter) {
26752674
unsigned long trans_start = dev_trans_start(slave->dev);
26762675

2677-
slave->new_link = BOND_LINK_NOCHANGE;
2676+
bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
26782677

26792678
if (slave->link != BOND_LINK_UP) {
26802679
if (bond_time_in_interval(bond, trans_start, 1) &&
26812680
bond_time_in_interval(bond, slave->last_rx, 1)) {
26822681

2683-
slave->new_link = BOND_LINK_UP;
2682+
bond_propose_link_state(slave, BOND_LINK_UP);
26842683
slave_state_changed = 1;
26852684

26862685
/* primary_slave has no meaning in round-robin
@@ -2705,7 +2704,7 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
27052704
if (!bond_time_in_interval(bond, trans_start, 2) ||
27062705
!bond_time_in_interval(bond, slave->last_rx, 2)) {
27072706

2708-
slave->new_link = BOND_LINK_DOWN;
2707+
bond_propose_link_state(slave, BOND_LINK_DOWN);
27092708
slave_state_changed = 1;
27102709

27112710
if (slave->link_failure_count < UINT_MAX)
@@ -2736,8 +2735,8 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
27362735
goto re_arm;
27372736

27382737
bond_for_each_slave(bond, slave, iter) {
2739-
if (slave->new_link != BOND_LINK_NOCHANGE)
2740-
slave->link = slave->new_link;
2738+
if (slave->link_new_state != BOND_LINK_NOCHANGE)
2739+
slave->link = slave->link_new_state;
27412740
}
27422741

27432742
if (slave_state_changed) {
@@ -2760,9 +2759,9 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
27602759
}
27612760

27622761
/* Called to inspect slaves for active-backup mode ARP monitor link state
2763-
* changes. Sets new_link in slaves to specify what action should take
2764-
* place for the slave. Returns 0 if no changes are found, >0 if changes
2765-
* to link states must be committed.
2762+
* changes. Sets proposed link state in slaves to specify what action
2763+
* should take place for the slave. Returns 0 if no changes are found, >0
2764+
* if changes to link states must be committed.
27662765
*
27672766
* Called with rcu_read_lock held.
27682767
*/
@@ -2774,12 +2773,12 @@ static int bond_ab_arp_inspect(struct bonding *bond)
27742773
int commit = 0;
27752774

27762775
bond_for_each_slave_rcu(bond, slave, iter) {
2777-
slave->new_link = BOND_LINK_NOCHANGE;
2776+
bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
27782777
last_rx = slave_last_rx(bond, slave);
27792778

27802779
if (slave->link != BOND_LINK_UP) {
27812780
if (bond_time_in_interval(bond, last_rx, 1)) {
2782-
slave->new_link = BOND_LINK_UP;
2781+
bond_propose_link_state(slave, BOND_LINK_UP);
27832782
commit++;
27842783
}
27852784
continue;
@@ -2807,7 +2806,7 @@ static int bond_ab_arp_inspect(struct bonding *bond)
28072806
if (!bond_is_active_slave(slave) &&
28082807
!rcu_access_pointer(bond->current_arp_slave) &&
28092808
!bond_time_in_interval(bond, last_rx, 3)) {
2810-
slave->new_link = BOND_LINK_DOWN;
2809+
bond_propose_link_state(slave, BOND_LINK_DOWN);
28112810
commit++;
28122811
}
28132812

@@ -2820,7 +2819,7 @@ static int bond_ab_arp_inspect(struct bonding *bond)
28202819
if (bond_is_active_slave(slave) &&
28212820
(!bond_time_in_interval(bond, trans_start, 2) ||
28222821
!bond_time_in_interval(bond, last_rx, 2))) {
2823-
slave->new_link = BOND_LINK_DOWN;
2822+
bond_propose_link_state(slave, BOND_LINK_DOWN);
28242823
commit++;
28252824
}
28262825
}
@@ -2840,7 +2839,7 @@ static void bond_ab_arp_commit(struct bonding *bond)
28402839
struct slave *slave;
28412840

28422841
bond_for_each_slave(bond, slave, iter) {
2843-
switch (slave->new_link) {
2842+
switch (slave->link_new_state) {
28442843
case BOND_LINK_NOCHANGE:
28452844
continue;
28462845

@@ -2890,8 +2889,9 @@ static void bond_ab_arp_commit(struct bonding *bond)
28902889
continue;
28912890

28922891
default:
2893-
slave_err(bond->dev, slave->dev, "impossible: new_link %d on slave\n",
2894-
slave->new_link);
2892+
slave_err(bond->dev, slave->dev,
2893+
"impossible: link_new_state %d on slave\n",
2894+
slave->link_new_state);
28952895
continue;
28962896
}
28972897

drivers/net/can/c_can/c_can.c

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#define CONTROL_EX_PDR BIT(8)
5353

5454
/* control register */
55+
#define CONTROL_SWR BIT(15)
5556
#define CONTROL_TEST BIT(7)
5657
#define CONTROL_CCE BIT(6)
5758
#define CONTROL_DISABLE_AR BIT(5)
@@ -97,6 +98,9 @@
9798
#define BTR_TSEG2_SHIFT 12
9899
#define BTR_TSEG2_MASK (0x7 << BTR_TSEG2_SHIFT)
99100

101+
/* interrupt register */
102+
#define INT_STS_PENDING 0x8000
103+
100104
/* brp extension register */
101105
#define BRP_EXT_BRPE_MASK 0x0f
102106
#define BRP_EXT_BRPE_SHIFT 0
@@ -569,6 +573,26 @@ static void c_can_configure_msg_objects(struct net_device *dev)
569573
IF_MCONT_RCV_EOB);
570574
}
571575

576+
static int c_can_software_reset(struct net_device *dev)
577+
{
578+
struct c_can_priv *priv = netdev_priv(dev);
579+
int retry = 0;
580+
581+
if (priv->type != BOSCH_D_CAN)
582+
return 0;
583+
584+
priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_SWR | CONTROL_INIT);
585+
while (priv->read_reg(priv, C_CAN_CTRL_REG) & CONTROL_SWR) {
586+
msleep(20);
587+
if (retry++ > 100) {
588+
netdev_err(dev, "CCTRL: software reset failed\n");
589+
return -EIO;
590+
}
591+
}
592+
593+
return 0;
594+
}
595+
572596
/*
573597
* Configure C_CAN chip:
574598
* - enable/disable auto-retransmission
@@ -578,6 +602,11 @@ static void c_can_configure_msg_objects(struct net_device *dev)
578602
static int c_can_chip_config(struct net_device *dev)
579603
{
580604
struct c_can_priv *priv = netdev_priv(dev);
605+
int err;
606+
607+
err = c_can_software_reset(dev);
608+
if (err)
609+
return err;
581610

582611
/* enable automatic retransmission */
583612
priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_ENABLE_AR);
@@ -886,6 +915,9 @@ static int c_can_handle_state_change(struct net_device *dev,
886915
struct can_berr_counter bec;
887916

888917
switch (error_type) {
918+
case C_CAN_NO_ERROR:
919+
priv->can.state = CAN_STATE_ERROR_ACTIVE;
920+
break;
889921
case C_CAN_ERROR_WARNING:
890922
/* error warning state */
891923
priv->can.can_stats.error_warning++;
@@ -916,6 +948,13 @@ static int c_can_handle_state_change(struct net_device *dev,
916948
ERR_CNT_RP_SHIFT;
917949

918950
switch (error_type) {
951+
case C_CAN_NO_ERROR:
952+
/* error warning state */
953+
cf->can_id |= CAN_ERR_CRTL;
954+
cf->data[1] = CAN_ERR_CRTL_ACTIVE;
955+
cf->data[6] = bec.txerr;
956+
cf->data[7] = bec.rxerr;
957+
break;
919958
case C_CAN_ERROR_WARNING:
920959
/* error warning state */
921960
cf->can_id |= CAN_ERR_CRTL;
@@ -1029,10 +1068,16 @@ static int c_can_poll(struct napi_struct *napi, int quota)
10291068
u16 curr, last = priv->last_status;
10301069
int work_done = 0;
10311070

1032-
priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);
1033-
/* Ack status on C_CAN. D_CAN is self clearing */
1034-
if (priv->type != BOSCH_D_CAN)
1035-
priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
1071+
/* Only read the status register if a status interrupt was pending */
1072+
if (atomic_xchg(&priv->sie_pending, 0)) {
1073+
priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);
1074+
/* Ack status on C_CAN. D_CAN is self clearing */
1075+
if (priv->type != BOSCH_D_CAN)
1076+
priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
1077+
} else {
1078+
/* no change detected ... */
1079+
curr = last;
1080+
}
10361081

10371082
/* handle state changes */
10381083
if ((curr & STATUS_EWARN) && (!(last & STATUS_EWARN))) {
@@ -1054,11 +1099,17 @@ static int c_can_poll(struct napi_struct *napi, int quota)
10541099
/* handle bus recovery events */
10551100
if ((!(curr & STATUS_BOFF)) && (last & STATUS_BOFF)) {
10561101
netdev_dbg(dev, "left bus off state\n");
1057-
priv->can.state = CAN_STATE_ERROR_ACTIVE;
1102+
work_done += c_can_handle_state_change(dev, C_CAN_ERROR_PASSIVE);
10581103
}
1104+
10591105
if ((!(curr & STATUS_EPASS)) && (last & STATUS_EPASS)) {
10601106
netdev_dbg(dev, "left error passive state\n");
1061-
priv->can.state = CAN_STATE_ERROR_ACTIVE;
1107+
work_done += c_can_handle_state_change(dev, C_CAN_ERROR_WARNING);
1108+
}
1109+
1110+
if ((!(curr & STATUS_EWARN)) && (last & STATUS_EWARN)) {
1111+
netdev_dbg(dev, "left error warning state\n");
1112+
work_done += c_can_handle_state_change(dev, C_CAN_NO_ERROR);
10621113
}
10631114

10641115
/* handle lec errors on the bus */
@@ -1083,10 +1134,16 @@ static irqreturn_t c_can_isr(int irq, void *dev_id)
10831134
{
10841135
struct net_device *dev = (struct net_device *)dev_id;
10851136
struct c_can_priv *priv = netdev_priv(dev);
1137+
int reg_int;
10861138

1087-
if (!priv->read_reg(priv, C_CAN_INT_REG))
1139+
reg_int = priv->read_reg(priv, C_CAN_INT_REG);
1140+
if (!reg_int)
10881141
return IRQ_NONE;
10891142

1143+
/* save for later use */
1144+
if (reg_int & INT_STS_PENDING)
1145+
atomic_set(&priv->sie_pending, 1);
1146+
10901147
/* disable all interrupts and schedule the NAPI */
10911148
c_can_irq_control(priv, false);
10921149
napi_schedule(&priv->napi);

drivers/net/can/c_can/c_can.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ struct c_can_priv {
198198
struct net_device *dev;
199199
struct device *device;
200200
atomic_t tx_active;
201+
atomic_t sie_pending;
201202
unsigned long tx_dir;
202203
int last_status;
203204
u16 (*read_reg) (const struct c_can_priv *priv, enum reg index);

drivers/net/can/dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ void of_can_transceiver(struct net_device *dev)
848848
return;
849849

850850
ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);
851+
of_node_put(dn);
851852
if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))
852853
netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");
853854
}

drivers/net/can/flexcan.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr)
677677
struct can_frame *cf;
678678
bool rx_errors = false, tx_errors = false;
679679
u32 timestamp;
680+
int err;
680681

681682
timestamp = priv->read(&regs->timer) << 16;
682683

@@ -725,7 +726,9 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr)
725726
if (tx_errors)
726727
dev->stats.tx_errors++;
727728

728-
can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
729+
err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
730+
if (err)
731+
dev->stats.rx_fifo_errors++;
729732
}
730733

731734
static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
@@ -738,6 +741,7 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
738741
int flt;
739742
struct can_berr_counter bec;
740743
u32 timestamp;
744+
int err;
741745

742746
timestamp = priv->read(&regs->timer) << 16;
743747

@@ -769,7 +773,9 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
769773
if (unlikely(new_state == CAN_STATE_BUS_OFF))
770774
can_bus_off(dev);
771775

772-
can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
776+
err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
777+
if (err)
778+
dev->stats.rx_fifo_errors++;
773779
}
774780

775781
static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)
@@ -1188,6 +1194,7 @@ static int flexcan_chip_start(struct net_device *dev)
11881194
reg_mecr = priv->read(&regs->mecr);
11891195
reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS;
11901196
priv->write(reg_mecr, &regs->mecr);
1197+
reg_mecr |= FLEXCAN_MECR_ECCDIS;
11911198
reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK |
11921199
FLEXCAN_MECR_FANCEI_MSK);
11931200
priv->write(reg_mecr, &regs->mecr);

0 commit comments

Comments
 (0)