···565565 if (ret < 0)566566 goto failed;567567 }568568- /* enable_error_frame */569569- /*568568+569569+ /* enable_error_frame570570+ *570571 * Error reporting is switched off at the moment since571572 * the receiving of them is not yet 100% verified572573 * This should be enabled sooner or later573573- *574574- if (error_reporting) {574574+ */575575+ if (0 && error_reporting) {575576 ret = softing_fct_cmd(card, 51, "enable_error_frame");576577 if (ret < 0)577578 goto failed;578579 }579579- */580580+580581 /* initialize interface */581582 iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]);582583 iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]);
+4-1
drivers/net/can/usb/gs_usb.c
···321321322322 /* device reports out of range channel id */323323 if (hf->channel >= GS_MAX_INTF)324324- goto resubmit_urb;324324+ goto device_detach;325325326326 dev = usbcan->canch[hf->channel];327327···405405406406 /* USB failure take down all interfaces */407407 if (rc == -ENODEV) {408408+ device_detach:408409 for (rc = 0; rc < GS_MAX_INTF; rc++) {409410 if (usbcan->canch[rc])410411 netif_device_detach(usbcan->canch[rc]->netdev);···507506508507 hf->echo_id = idx;509508 hf->channel = dev->channel;509509+ hf->flags = 0;510510+ hf->reserved = 0;510511511512 cf = (struct can_frame *)skb->data;512513
+6-1
drivers/net/can/xilinx_can.c
···17581758 spin_lock_init(&priv->tx_lock);1759175917601760 /* Get IRQ for the device */17611761- ndev->irq = platform_get_irq(pdev, 0);17611761+ ret = platform_get_irq(pdev, 0);17621762+ if (ret < 0)17631763+ goto err_free;17641764+17651765+ ndev->irq = ret;17661766+17621767 ndev->flags |= IFF_ECHO; /* We support local echo */1763176817641769 platform_set_drvdata(pdev, ndev);
···684684 err = register_netdev(netdev);685685 if (err) {686686 dev_err(dev, "Failed to register netdevice\n");687687- goto err_detach_rsrc;687687+ goto err_ptp_destroy;688688 }689689690690 err = otx2_wq_init(vf);···709709710710err_unreg_netdev:711711 unregister_netdev(netdev);712712+err_ptp_destroy:713713+ otx2_ptp_destroy(vf);712714err_detach_rsrc:713715 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))714716 qmem_free(vf->dev, vf->dync_lmt);···744742 unregister_netdev(netdev);745743 if (vf->otx2_wq)746744 destroy_workqueue(vf->otx2_wq);745745+ otx2_ptp_destroy(vf);747746 otx2vf_disable_mbox_intr(vf);748747 otx2_detach_resources(&vf->mbox);749748 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
+7-29
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
···148148 if (!refcount_dec_and_test(&ent->refcnt))149149 return;150150151151- if (ent->idx >= 0)152152- cmd_free_index(ent->cmd, ent->idx);151151+ if (ent->idx >= 0) {152152+ struct mlx5_cmd *cmd = ent->cmd;153153+154154+ cmd_free_index(cmd, ent->idx);155155+ up(ent->page_queue ? &cmd->pages_sem : &cmd->sem);156156+ }153157154158 cmd_free_ent(ent);155159}···904900 return cmd->allowed_opcode == opcode;905901}906902907907-static int cmd_alloc_index_retry(struct mlx5_cmd *cmd)908908-{909909- unsigned long alloc_end = jiffies + msecs_to_jiffies(1000);910910- int idx;911911-912912-retry:913913- idx = cmd_alloc_index(cmd);914914- if (idx < 0 && time_before(jiffies, alloc_end)) {915915- /* Index allocation can fail on heavy load of commands. This is a temporary916916- * situation as the current command already holds the semaphore, meaning that917917- * another command completion is being handled and it is expected to release918918- * the entry index soon.919919- */920920- cpu_relax();921921- goto retry;922922- }923923- return idx;924924-}925925-926903bool mlx5_cmd_is_down(struct mlx5_core_dev *dev)927904{928905 return pci_channel_offline(dev->pdev) ||···931946 sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;932947 down(sem);933948 if (!ent->page_queue) {934934- alloc_ret = cmd_alloc_index_retry(cmd);949949+ alloc_ret = cmd_alloc_index(cmd);935950 if (alloc_ret < 0) {936951 mlx5_core_err_rl(dev, "failed to allocate command entry\n");937952 if (ent->callback) {···15871602 vector = vec & 0xffffffff;15881603 for (i = 0; i < (1 << cmd->log_sz); i++) {15891604 if (test_bit(i, &vector)) {15901590- struct semaphore *sem;15911591-15921605 ent = cmd->ent_arr[i];1593160615941607 /* if we already completed the command, ignore it */···16091626 dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)16101627 cmd_ent_put(ent);1611162816121612- if (ent->page_queue)16131613- sem = &cmd->pages_sem;16141614- else16151615- sem = &cmd->sem;16161629 ent->ts2 = ktime_get_ns();16171630 memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out));16181631 dump_command(dev, ent, 0);···16621683 */16631684 complete(&ent->done);16641685 }16651665- up(sem);16661686 }16671687 }16681688}
···19381938 return ip_version;19391939}1940194019411941+/* Tunnel device follows RFC 6040, see include/net/inet_ecn.h.19421942+ * And changes inner ip_ecn depending on inner and outer ip_ecn as follows:19431943+ * +---------+----------------------------------------+19441944+ * |Arriving | Arriving Outer Header |19451945+ * | Inner +---------+---------+---------+----------+19461946+ * | Header | Not-ECT | ECT(0) | ECT(1) | CE |19471947+ * +---------+---------+---------+---------+----------+19481948+ * | Not-ECT | Not-ECT | Not-ECT | Not-ECT | <drop> |19491949+ * | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* |19501950+ * | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* |19511951+ * | CE | CE | CE | CE | CE |19521952+ * +---------+---------+---------+---------+----------+19531953+ *19541954+ * Tc matches on inner after decapsulation on tunnel device, but hw offload matches19551955+ * the inner ip_ecn value before hardware decap action.19561956+ *19571957+ * Cells marked are changed from original inner packet ip_ecn value during decap, and19581958+ * so matching those values on inner ip_ecn before decap will fail.19591959+ *19601960+ * The following helper allows offload when inner ip_ecn won't be changed by outer ip_ecn,19611961+ * except for the outer ip_ecn = CE, where in all cases inner ip_ecn will be changed to CE,19621962+ * and such we can drop the inner ip_ecn=CE match.19631963+ */19641964+19651965+static int mlx5e_tc_verify_tunnel_ecn(struct mlx5e_priv *priv,19661966+ struct flow_cls_offload *f,19671967+ bool *match_inner_ecn)19681968+{19691969+ u8 outer_ecn_mask = 0, outer_ecn_key = 0, inner_ecn_mask = 0, inner_ecn_key = 0;19701970+ struct flow_rule *rule = flow_cls_offload_flow_rule(f);19711971+ struct netlink_ext_ack *extack = f->common.extack;19721972+ struct flow_match_ip match;19731973+19741974+ *match_inner_ecn = true;19751975+19761976+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) {19771977+ flow_rule_match_enc_ip(rule, &match);19781978+ outer_ecn_key = match.key->tos & INET_ECN_MASK;19791979+ outer_ecn_mask = match.mask->tos & INET_ECN_MASK;19801980+ }19811981+19821982+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IP)) {19831983+ flow_rule_match_ip(rule, &match);19841984+ inner_ecn_key = match.key->tos & INET_ECN_MASK;19851985+ inner_ecn_mask = match.mask->tos & INET_ECN_MASK;19861986+ }19871987+19881988+ if (outer_ecn_mask != 0 && outer_ecn_mask != INET_ECN_MASK) {19891989+ NL_SET_ERR_MSG_MOD(extack, "Partial match on enc_tos ecn bits isn't supported");19901990+ netdev_warn(priv->netdev, "Partial match on enc_tos ecn bits isn't supported");19911991+ return -EOPNOTSUPP;19921992+ }19931993+19941994+ if (!outer_ecn_mask) {19951995+ if (!inner_ecn_mask)19961996+ return 0;19971997+19981998+ NL_SET_ERR_MSG_MOD(extack,19991999+ "Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported");20002000+ netdev_warn(priv->netdev,20012001+ "Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported");20022002+ return -EOPNOTSUPP;20032003+ }20042004+20052005+ if (inner_ecn_mask && inner_ecn_mask != INET_ECN_MASK) {20062006+ NL_SET_ERR_MSG_MOD(extack,20072007+ "Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported");20082008+ netdev_warn(priv->netdev,20092009+ "Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported");20102010+ return -EOPNOTSUPP;20112011+ }20122012+20132013+ if (!inner_ecn_mask)20142014+ return 0;20152015+20162016+ /* Both inner and outer have full mask on ecn */20172017+20182018+ if (outer_ecn_key == INET_ECN_ECT_1) {20192019+ /* inner ecn might change by DECAP action */20202020+20212021+ NL_SET_ERR_MSG_MOD(extack, "Match on enc_tos ecn = ECT(1) isn't supported");20222022+ netdev_warn(priv->netdev, "Match on enc_tos ecn = ECT(1) isn't supported");20232023+ return -EOPNOTSUPP;20242024+ }20252025+20262026+ if (outer_ecn_key != INET_ECN_CE)20272027+ return 0;20282028+20292029+ if (inner_ecn_key != INET_ECN_CE) {20302030+ /* Can't happen in software, as packet ecn will be changed to CE after decap */20312031+ NL_SET_ERR_MSG_MOD(extack,20322032+ "Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported");20332033+ netdev_warn(priv->netdev,20342034+ "Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported");20352035+ return -EOPNOTSUPP;20362036+ }20372037+20382038+ /* outer ecn = CE, inner ecn = CE, as decap will change inner ecn to CE in anycase,20392039+ * drop match on inner ecn20402040+ */20412041+ *match_inner_ecn = false;20422042+20432043+ return 0;20442044+}20452045+19412046static int parse_tunnel_attr(struct mlx5e_priv *priv,19422047 struct mlx5e_tc_flow *flow,19432048 struct mlx5_flow_spec *spec,···22362131 struct flow_rule *rule = flow_cls_offload_flow_rule(f);22372132 struct flow_dissector *dissector = rule->match.dissector;22382133 enum fs_flow_table_type fs_type;21342134+ bool match_inner_ecn = true;22392135 u16 addr_type = 0;22402136 u8 ip_proto = 0;22412137 u8 *match_level;···22902184 headers_c = get_match_inner_headers_criteria(spec);22912185 headers_v = get_match_inner_headers_value(spec);22922186 }21872187+21882188+ err = mlx5e_tc_verify_tunnel_ecn(priv, f, &match_inner_ecn);21892189+ if (err)21902190+ return err;22932191 }2294219222952193 err = mlx5e_flower_parse_meta(filter_dev, f);···25172407 struct flow_match_ip match;2518240825192409 flow_rule_match_ip(rule, &match);25202520- MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn,25212521- match.mask->tos & 0x3);25222522- MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn,25232523- match.key->tos & 0x3);24102410+ if (match_inner_ecn) {24112411+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn,24122412+ match.mask->tos & 0x3);24132413+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn,24142414+ match.key->tos & 0x3);24152415+ }2524241625252417 MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_dscp,25262418 match.mask->tos >> 2);
···6969#define MPHDRLEN 6 /* multilink protocol header length */7070#define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */71717272+#define PPP_PROTO_LEN 27373+7274/*7375 * An instance of /dev/ppp can be associated with either a ppp7476 * interface unit or a ppp channel. In both cases, file->private_data···500498501499 if (!pf)502500 return -ENXIO;501501+ /* All PPP packets should start with the 2-byte protocol */502502+ if (count < PPP_PROTO_LEN)503503+ return -EINVAL;503504 ret = -ENOMEM;504505 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL);505506 if (!skb)···17701765 }1771176617721767 ++ppp->stats64.tx_packets;17731773- ppp->stats64.tx_bytes += skb->len - 2;17681768+ ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN;1774176917751770 switch (proto) {17761771 case PPP_IP:
+10-2
drivers/net/usb/mcs7830.c
···108108109109static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)110110{111111- return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ,112112- 0x0000, index, data, size);111111+ int ret;112112+113113+ ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ,114114+ 0x0000, index, data, size);115115+ if (ret < 0)116116+ return ret;117117+ else if (ret < size)118118+ return -ENODATA;119119+120120+ return ret;113121}114122115123static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data)
···632632633633static void smc_conn_abort(struct smc_sock *smc, int local_first)634634{635635+ struct smc_connection *conn = &smc->conn;636636+ struct smc_link_group *lgr = conn->lgr;637637+638638+ smc_conn_free(conn);635639 if (local_first)636636- smc_lgr_cleanup_early(&smc->conn);637637- else638638- smc_conn_free(&smc->conn);640640+ smc_lgr_cleanup_early(lgr);639641}640642641643/* check if there is a rdma device available for this connection. */
+7-5
net/smc/smc_core.c
···171171172172 if (!conn->lgr->is_smcd) {173173 rc = smcr_lgr_conn_assign_link(conn, first);174174- if (rc)174174+ if (rc) {175175+ conn->lgr = NULL;175176 return rc;177177+ }176178 }177179 /* find a new alert_token_local value not yet used by some connection178180 * in this link group···627625 return skb->len;628626}629627630630-void smc_lgr_cleanup_early(struct smc_connection *conn)628628+void smc_lgr_cleanup_early(struct smc_link_group *lgr)631629{632632- struct smc_link_group *lgr = conn->lgr;633630 spinlock_t *lgr_lock;634631635632 if (!lgr)636633 return;637634638638- smc_conn_free(conn);639635 smc_lgr_list_head(lgr, &lgr_lock);640636 spin_lock_bh(lgr_lock);641637 /* do not use this link group for new connections */···18511851 write_lock_bh(&lgr->conns_lock);18521852 rc = smc_lgr_register_conn(conn, true);18531853 write_unlock_bh(&lgr->conns_lock);18541854- if (rc)18541854+ if (rc) {18551855+ smc_lgr_cleanup_early(lgr);18551856 goto out;18571857+ }18561858 }18571859 conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE;18581860 conn->local_tx_ctrl.len = SMC_WR_TX_SIZE;
···637637 struct netlink_ext_ack *extack)638638{639639 struct net *net = dev_net(dev);640640- struct xfrm_if_parms p;640640+ struct xfrm_if_parms p = {};641641 struct xfrm_if *xi;642642 int err;643643644644 xfrmi_netlink_parms(data, &p);645645+ if (!p.if_id) {646646+ NL_SET_ERR_MSG(extack, "if_id must be non zero");647647+ return -EINVAL;648648+ }649649+645650 xi = xfrmi_locate(net, &p);646651 if (xi)647652 return -EEXIST;···671666{672667 struct xfrm_if *xi = netdev_priv(dev);673668 struct net *net = xi->net;674674- struct xfrm_if_parms p;669669+ struct xfrm_if_parms p = {};670670+671671+ if (!p.if_id) {672672+ NL_SET_ERR_MSG(extack, "if_id must be non zero");673673+ return -EINVAL;674674+ }675675676676 xfrmi_netlink_parms(data, &p);677677 xi = xfrmi_locate(net, &p);
+25-5
net/xfrm/xfrm_output.c
···648648 * This requires hardware to know the inner packet type to calculate649649 * the inner header checksum. Save inner ip protocol here to avoid650650 * traversing the packet in the vendor's xmit code.651651- * If the encap type is IPIP, just save skb->inner_ipproto. Otherwise,652652- * get the ip protocol from the IP header.651651+ * For IPsec tunnel mode save the ip protocol from the IP header of the652652+ * plain text packet. Otherwise If the encap type is IPIP, just save653653+ * skb->inner_ipproto in any other case get the ip protocol from the IP654654+ * header.653655 */654654-static void xfrm_get_inner_ipproto(struct sk_buff *skb)656656+static void xfrm_get_inner_ipproto(struct sk_buff *skb, struct xfrm_state *x)655657{656658 struct xfrm_offload *xo = xfrm_offload(skb);657659 const struct ethhdr *eth;658660659661 if (!xo)662662+ return;663663+664664+ if (x->outer_mode.encap == XFRM_MODE_TUNNEL) {665665+ switch (x->outer_mode.family) {666666+ case AF_INET:667667+ xo->inner_ipproto = ip_hdr(skb)->protocol;668668+ break;669669+ case AF_INET6:670670+ xo->inner_ipproto = ipv6_hdr(skb)->nexthdr;671671+ break;672672+ default:673673+ break;674674+ }675675+676676+ return;677677+ }678678+679679+ /* non-Tunnel Mode */680680+ if (!skb->encapsulation)660681 return;661682662683 if (skb->inner_protocol_type == ENCAP_TYPE_IPPROTO) {···734713 sp->xvec[sp->len++] = x;735714 xfrm_state_hold(x);736715737737- if (skb->encapsulation)738738- xfrm_get_inner_ipproto(skb);716716+ xfrm_get_inner_ipproto(skb, x);739717 skb->encapsulation = 1;740718741719 if (skb_is_gso(skb)) {
···41414242checktool "iptables --version" "run test without iptables"4343checktool "ip -Version" "run test without ip tool"4444-checktool "which nc" "run test without nc (netcat)"4444+checktool "which socat" "run test without socat"4545checktool "ip netns add ${r_a}" "create net namespace"46464747for n in ${r_b} ${r_w} ${c_a} ${c_b};do···6060test_path() {6161 msg="$1"62626363- ip netns exec ${c_b} nc -n -w 3 -q 3 -u -l -p 5000 > ${rx} < /dev/null &6363+ ip netns exec ${c_b} socat -t 3 - udp4-listen:5000,reuseaddr > ${rx} < /dev/null &64646565 sleep 16666 for i in 1 2 3; do6767- head -c1400 /dev/zero | tr "\000" "a" | ip netns exec ${c_a} nc -n -w 1 -u 192.168.20.2 50006767+ head -c1400 /dev/zero | tr "\000" "a" | \6868+ ip netns exec ${c_a} socat -t 1 -u STDIN UDP:192.168.20.2:50006869 done69707071 wait···190189#---------------------191190#Now we send a 1400 bytes UDP packet from Client A to Client B:192191193193-# clienta:~# head -c1400 /dev/zero | tr "\000" "a" | nc -u 192.168.20.2 5000192192+# clienta:~# head -c1400 /dev/zero | tr "\000" "a" | socat -u STDIN UDP:192.168.20.2:5000194193test_path "without"195194196195# The IPv4 stack on Client A already knows the PMTU to Client B, so the