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.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED 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 60A35C10F0E for ; Mon, 15 Apr 2019 09:57:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39EE92073F for ; Mon, 15 Apr 2019 09:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfDOJ5g (ORCPT ); Mon, 15 Apr 2019 05:57:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53852 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727183AbfDOJ5g (ORCPT ); Mon, 15 Apr 2019 05:57:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDDC4308A9E1; Mon, 15 Apr 2019 09:57:34 +0000 (UTC) Received: from carbon (ovpn-200-23.brq.redhat.com [10.40.200.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C6B95D71D; Mon, 15 Apr 2019 09:57:29 +0000 (UTC) Date: Mon, 15 Apr 2019 11:57:26 +0200 From: Jesper Dangaard Brouer To: Toshiaki Makita Cc: Yuya Kusakabe , davem@davemloft.net, taketarou2@gmail.com, netdev@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend Subject: Re: [PATCH] net: Fix missing meta data in skb with vlan packet Message-ID: <20190415115726.3e1dc865@carbon> In-Reply-To: References: Organization: Red Hat Inc. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 15 Apr 2019 09:57:35 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, 15 Apr 2019 15:05:36 +0900 Toshiaki Makita wrote: > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > > index ef2cd5712098..6bc663249c4c 100644 > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c [...] > > @@ -5095,6 +5096,13 @@ static struct sk_buff > > *skb_reorder_vlan_header(struct sk_buff *skb) > > memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb), > > mac_len - VLAN_HLEN - ETH_TLEN); > > } > > + > > + meta_len = skb_metadata_len(skb); > > + if (meta_len) { > > Since this is not used by non-XDP skb and skb path is slow-path for XDP > anyway, should add unlikely here in favor of non-XDP case? I want to stress, that XDP is meant to cooperate with network stack. The XDP metadata is meant as a communication channel between XDP and network-stack SKBs. Thus, there are use-cases where this is not considered a slow-path. That said I don't care if this is marked unlikely(), as not many people are using this metadata communication channel yet. In one customer use-case I have seen, they wanted to pop VLAN tags (Q-in-Q) at XDP layer, but keep some of the info in metadata for TC-bpf hook. I don't think they kept/left any VLAN headers in the SKB. > > + meta = skb_metadata_end(skb) - meta_len; > > + memmove(meta + VLAN_HLEN, meta, meta_len); > > + }; > > + -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer