From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73D0FC282C0 for ; Wed, 23 Jan 2019 14:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D89520870 for ; Wed, 23 Jan 2019 14:12:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EKo/5Qac" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbfAWOMK (ORCPT ); Wed, 23 Jan 2019 09:12:10 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38360 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbfAWOMJ (ORCPT ); Wed, 23 Jan 2019 09:12:09 -0500 Received: by mail-ed1-f66.google.com with SMTP id h50so1805879ede.5 for ; Wed, 23 Jan 2019 06:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qp3G3ITC1Pxkf/xzIZCop8KzNgaLnC2QdQJaJ10SAvM=; b=EKo/5QacRIRLI9dwdFmioB2+7r6NFiP+AFLcXpggVqj1zINOIWnDu93H9NUhc9/Vvg bszMLM7aoh0R4CWi7+h3xQerM89JzAQzobt08I2ZpA640G0gH9tSturyv7/cwz7AMq7h d5D27hSmXPeuasfjJTEhDvT7IA8hD8eDdCgLoZELGDpJS+miw3yaMmbE6mkSoMFAsSIK R1bZNhXcQoXU3hwP+VLVAzWLj0R6k+HovLkbnej/+ChWGPFLPF47twfR0mJMhxY1SScF u1Keeh7nMmVyfyk7J2DFrYQiCeXIRHmb15nPcya1gOanm6VFJLWUVs1gbz48gIf5h8MH cvGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qp3G3ITC1Pxkf/xzIZCop8KzNgaLnC2QdQJaJ10SAvM=; b=ElPocZXCEs4W4+B4/BC8owGf9PMYDlN4So2djWVMlP4YbJBEYMEMX4hycH25yDQCuW 6mYYid9422z3HplVuoJlQQMnmMYtULjVskXls/YAFHysoSXXE56klYqaeMsAhmdttZEr Vp7SK1/60fnFpNUfB/YXbs0XBADKxoREpE38N0tDuXu2n++bBgBm7ZNA9c+XtpaL6PJX P5ubMNacRgti72iJI23DANgK3HdaI+cvxCM6vaw6kX90el1sEmoaGC2196c8RK+Y2ulQ 4Zif6f9zv65FWG3ThY89JTkSxIQ6YfQjFhzioBCiZ0kE18h85gavP1RjnV/ZYhfl8XBb 2C8w== X-Gm-Message-State: AJcUukfBVZD3r4rGXosl32ShvWk6sqYtCIpFD8pwOPw927bPGg5TX5ll uULtxLLXhMqwRX5Q1uC8o9IjMo04oIfshPGgksM= X-Google-Smtp-Source: ALg8bN4BaIr6Zz2K2e805sCYvEgfYbGJ3Kllyh2bUV4Bl+XDzonbW3ZxmG+dKHhGsJ8dWOASd+0alHn3AcerYaWgtJQ= X-Received: by 2002:a17:906:3603:: with SMTP id q3-v6mr2584078ejb.164.1548252727087; Wed, 23 Jan 2019 06:12:07 -0800 (PST) MIME-Version: 1.0 References: <20190114131841.1932-1-maximmi@mellanox.com> <20190114131841.1932-2-maximmi@mellanox.com> In-Reply-To: From: Willem de Bruijn Date: Wed, 23 Jan 2019 09:11:30 -0500 Message-ID: Subject: Re: [PATCH 1/7] net: Don't set transport offset to invalid value To: Maxim Mikityanskiy Cc: "David S. Miller" , Saeed Mahameed , Willem de Bruijn , Jason Wang , Eric Dumazet , "netdev@vger.kernel.org" , Eran Ben Elisha , Tariq Toukan Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 23, 2019 at 5:17 AM Maxim Mikityanskiy wrote: > > > -----Original Message----- > > From: Willem de Bruijn > > Sent: 17 January, 2019 17:16 > > To: Maxim Mikityanskiy > > Cc: David S. Miller ; Saeed Mahameed > > ; Willem de Bruijn ; Jason Wang > > ; Eric Dumazet ; > > netdev@vger.kernel.org; Eran Ben Elisha ; Tariq Toukan > > > > Subject: Re: [PATCH 1/7] net: Don't set transport offset to invalid value > > > > On Thu, Jan 17, 2019 at 4:10 AM Maxim Mikityanskiy > > wrote: > > > > > > > This is a lot of code change. This would do. > > > > > > > > @@ -2434,8 +2434,6 @@ static inline void > > > > skb_probe_transport_header(struct sk_buff *skb, > > > > > > > > if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, > > 0)) > > > > skb_set_transport_header(skb, keys.control.thoff); > > > > - else > > > > - skb_set_transport_header(skb, offset_hint); > > > > } > > > > > > > > Though leaving an unused argument is a bit ugly. For net-next, indeed > > > > better to clean up (please mark your patchset with net or net-next, > > > > btw) > > > > > > It's for net-next (I'll resend with the correct mark), so I'll stick > > > with the current implementation. > > > > Absolutely, sounds good. > > > > > > > diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen- > > > > netback/netback.c > > > > > index 80aae3a32c2a..b49b6e56ca47 100644 > > > > > --- a/drivers/net/xen-netback/netback.c > > > > > +++ b/drivers/net/xen-netback/netback.c > > > > > @@ -1105,6 +1105,7 @@ static int xenvif_tx_submit(struct xenvif_queue > > > > *queue) > > > > > struct xen_netif_tx_request *txp; > > > > > u16 pending_idx; > > > > > unsigned data_len; > > > > > + bool th_set; > > > > > > > > > > pending_idx = XENVIF_TX_CB(skb)->pending_idx; > > > > > txp = &queue->pending_tx_info[pending_idx].req; > > > > > @@ -1169,20 +1170,22 @@ static int xenvif_tx_submit(struct > > xenvif_queue > > > > *queue) > > > > > continue; > > > > > } > > > > > > > > > > - skb_probe_transport_header(skb, 0); > > > > > + th_set = skb_try_probe_transport_header(skb); > > > > > > > > Can use skb_transport_header_was_set(). Then at least there is no need > > > > to change the function's return value. > > > > > > I suppose this comment relates to the previous one, and if we do it for > > > net-next, it's fine to make change I made, isn't it? > > > > If this is the only reason for the boolean return value, using > > skb_transport_header_was_set() is more standard (I immediately know > > what's happening when I read it), slightly less code change and avoids > > introducing a situation where the majority of callers ignore a return > > value. I think it's preferable. But these merits are certainly > > debatable, so either is fine. > > From my side, I wanted to avoid calling skb_transport_header_was_set > twice, so I made skb_try_probe_transport_header return whether it > succeeded or not. I think "try" in the function name indicates this idea > pretty clearly. This result status is pretty useful, it just happened > that it's not needed in many places, Which is an indication that it's perhaps not needed. > but the general idea is that we > report this status, so if you say that my version is also good for you, > I'll leave it as is. It was just a rationale for my decision. It's fine. But please avoid the code churn in xenvif_tx_submit with to extra indentation. This is equivalent: - if (skb_is_gso(skb)) { + if (skb_is_gso(skb) && th_set) { More fundamentally, the code has the assumption that th_set always holds if skb_is_gso(skb). Why add the check? This is another example that the return value is not really needed.