Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp823319lqb; Wed, 29 May 2024 11:30:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGB1ZMNT2IwYzlStl17/ePy7i5URAWG4Ao5D2mf36wJDd90W3YPnHPN1CJ2WO7RWrz2EKNWz5jwaVSh1Ydz//qwS4b/bs4xqvD9NWUlQ== X-Google-Smtp-Source: AGHT+IGNo7nLI3mk+KIu71YLPqu5JFOliESAVKiGnmuYlpDrrr5l8kTPcWWjLn1RHbwi+a6OnamV X-Received: by 2002:a19:f717:0:b0:51e:41a1:4d5 with SMTP id 2adb3069b0e04-52b7d40ec95mr28305e87.9.1717007443368; Wed, 29 May 2024 11:30:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717007443; cv=pass; d=google.com; s=arc-20160816; b=PKp05fef9PRH4/fCGw8jSOTrP+Ud7px6UcNdJeLYVoOVGiJammwONICWPPOAE6eZ7c F7KT6cIabvDMPv3259JvcrXsmGnHhQtG77epgdks7yY4g6bHHZbV9sSXeyoBMf1+s7vf W4xdJBnDTUSl/WAhGWUesvWomXPjwLcuxryxszYHil+IBxFTnHGPd0a1KMpTGBimQfKh V6ZFUV5BbxIi0AWxWciuo15nC6+bsBy3xIvkqNh0KL4C9p1lroK6GcLzf5XngqftIpmY 2RYI8MU67bhuSg3ZN08LnVQBFa2BDYoikCzws/jdV/yQOL/aT9NCOeLkfCUaDsnn6As2 dRfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=oKXsIs6NBCBCWmMajXu8Vivsoe24SB7BVxpLv2rJ3zw=; fh=6J0mQSvL1R6IrgTiGMaCDMm/gQZugI0exFAhUzhS1Vg=; b=HCeidlN/nkJdMmBFGcrgtkI19ZJ8epJId8CHsWGL0nEmrZwLEv2uK2v61J+AhC7ulH lxEJ5vxkRRApDiMpHqsr/sX9k7ic5GA91eEIhn1OMcBtSl7O/ecY/tzagKgJUWp8ZKK1 2FCnOkHdV53yf71ta4BsI3YuczqFtApzbwe/Ew3oLAPR7uArxAA2r3HuziNyFMTLgr2v qG9I/gFJZ+wB2RzFGU1dfYsskBEmozZcLkyE4m3hUP5G61J1CGDvxcty5XBbwBoBeLIr J3EaGOJdFfPnpfh9N4jTIA+1ClJz1mQIiiuXlCcmWtFXjL8swAfq1Brz/tl4ujJOTzik CXvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=omp.ru); spf=pass (google.com: domain of linux-kernel+bounces-194570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194570-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc64118si636502566b.548.2024.05.29.11.30.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 11:30:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=omp.ru); spf=pass (google.com: domain of linux-kernel+bounces-194570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194570-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E550C1F23E6E for ; Wed, 29 May 2024 18:30:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 644F71C0DCF; Wed, 29 May 2024 18:30:32 +0000 (UTC) Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1ABF1B949; Wed, 29 May 2024 18:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.154.21.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717007431; cv=none; b=FGFIrJCY0+XqLnMHCMLOuuhrxXIlF7UXIOOU/CDq7C+nT/r6AOZWqg5dhRZy7oJswKwqQzW8We+Gg80kWWAKu6dX5h3CoMQiInQn8rKbPLZeV3csUcucxW49ceS+RBhBT+EuIitXfo8g4yg9JbZ8o5MbNZuQhVvmMyFG4cqrmkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717007431; c=relaxed/simple; bh=v/g7ChUERc+YBX4PR0tIacx+5V0vyX+QMkYyi8IFySY=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=OI+1UdPJqFOkXJYkbt/wHq3bM+7zANvrp/DZ68wisoMfSgy6SCkFimiYak4vM2Hb67iPJu0ToKdd2R8QsfANUDJMrghWMj8naTfdecBKLY5E4Yt4/inR4doTyItZYU0GPyV3JluOwMElt9LFfsNpYdY7rZVvMaVSJV6dFpWmTVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru; spf=pass smtp.mailfrom=omp.ru; arc=none smtp.client-ip=90.154.21.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=omp.ru Received: from [192.168.1.105] (178.176.72.107) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Wed, 29 May 2024 21:30:09 +0300 Subject: Re: [net-next PATCH v4 4/7] net: ravb: Refactor GbEth RX code path To: Paul Barker , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?UTF-8?Q?Niklas_S=c3=b6derlund?= CC: Biju Das , Claudiu Beznea , Yoshihiro Shimoda , , , References: <20240528150339.6791-1-paul.barker.ct@bp.renesas.com> <20240528150339.6791-5-paul.barker.ct@bp.renesas.com> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: <611a49b8-ecdb-6b91-9d3e-262bf3851f5b@omp.ru> Date: Wed, 29 May 2024 21:30:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240528150339.6791-5-paul.barker.ct@bp.renesas.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 6.1.0, Database issued on: 05/29/2024 18:07:30 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 59 X-KSE-AntiSpam-Info: Lua profiles 185600 [May 29 2024] X-KSE-AntiSpam-Info: Version: 6.1.0.4 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 20 0.3.20 743589a8af6ec90b529f2124c2bbfc3ce1d2f20f X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: {relay has no DNS name} X-KSE-AntiSpam-Info: {SMTP from is not routable} X-KSE-AntiSpam-Info: {Found in DNSBL: 178.176.72.107 in (user) dbl.spamhaus.org} X-KSE-AntiSpam-Info: omp.ru:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1 X-KSE-AntiSpam-Info: ApMailHostAddress: 178.176.72.107 X-KSE-AntiSpam-Info: {DNS response errors} X-KSE-AntiSpam-Info: Rate: 59 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=temperror header.from=omp.ru;spf=temperror smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 05/29/2024 18:11:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 5/29/2024 5:02:00 PM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit On 5/28/24 6:03 PM, Paul Barker wrote: > We can reduce code duplication in ravb_rx_gbeth(). > > Signed-off-by: Paul Barker [...] > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index 7df7d2e93a3a..c9c5cc641589 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -817,47 +817,54 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) > stats->rx_missed_errors++; > } else { > die_dt = desc->die_dt & 0xF0; > + skb = ravb_get_skb_gbeth(ndev, entry, desc); > switch (die_dt) { Why not do instead (as I've asked you alraedy): case DT_FSTART: priv->rx_1st_skb = skb; fallthrough; > case DT_FSINGLE: > - skb = ravb_get_skb_gbeth(ndev, entry, desc); > + case DT_FSTART: > + /* Start of packet: > + * Set initial data length. > + */ Please consider turning that block comment into one-liner... > skb_put(skb, desc_len); > + > + /* Save this SKB if the packet spans multiple > + * descriptors. > + */ This one too... (The current line length limit is 100 columns.) > + if (die_dt == DT_FSTART) > + priv->rx_1st_skb = skb; This needs to be done under *case* DT_FSTART above instead... > + break; > + > + case DT_FMID: > + case DT_FEND: > + /* Continuing a packet: > + * Move data into the saved SKB. > + */ > + skb_copy_to_linear_data_offset(priv->rx_1st_skb, > + priv->rx_1st_skb->len, > + skb->data, > + desc_len); > + skb_put(priv->rx_1st_skb, desc_len); > + dev_kfree_skb(skb); > + > + /* Set skb to point at the whole packet so that Please call it consistently, either SKB or skb (I prefer this one). > + * we only need one code path for finishing a > + * packet. > + */ > + skb = priv->rx_1st_skb; > + } > + > + switch (die_dt) { > + case DT_FSINGLE: > + case DT_FEND: > + /* Finishing a packet: > + * Determine protocol & checksum, hand off to > + * NAPI and update our stats. > + */ > skb->protocol = eth_type_trans(skb, ndev); > if (ndev->features & NETIF_F_RXCSUM) > ravb_rx_csum_gbeth(skb); > + stats->rx_bytes += skb->len; > napi_gro_receive(&priv->napi[q], skb); > rx_packets++; Otherwise, this is very good patch! Sorry for letting in the duplcate code earlier! :-) [...] MBR, Sergey