From: Atzm Watanabe Subject: Re: [PATCH v3 3/3] packet: Deliver VLAN TPID to userspace Date: Mon, 16 Dec 2013 21:41:41 +0900 Message-ID: <87ioup6k8q.wl%atzm@stratosphere.co.jp> References: <87mwk16wpy.wl%atzm@stratosphere.co.jp> <52AED361.2070303@redhat.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: netdev@vger.kernel.org, Stephen Hemminger , Ben Hutchings , David Miller , David Laight To: Daniel Borkmann Return-path: Received: from mail-yh0-f53.google.com ([209.85.213.53]:63271 "EHLO mail-yh0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753958Ab3LPMlv (ORCPT ); Mon, 16 Dec 2013 07:41:51 -0500 Received: by mail-yh0-f53.google.com with SMTP id b20so3580637yha.40 for ; Mon, 16 Dec 2013 04:41:50 -0800 (PST) In-Reply-To: <52AED361.2070303@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: At Mon, 16 Dec 2013 11:18:09 +0100, Daniel Borkmann wrote: > > On 12/16/2013 09:12 AM, Atzm Watanabe wrote: > > This enables userspace to get VLAN TPID as well as the VLAN TCI. > > > > Signed-off-by: Atzm Watanabe > > Looks good, one comment below though: Thank you for comments. > > __u32 tp_rxhash; > > __u32 tp_vlan_tci; > > + __u32 tp_vlan_tpid; > > Why is this not __u16? If this needs to be __u32 aligned, then > probably we should pad with another __u16. I think we should not > waste any space here in case there are future additions of new > members. Ah, indeed. I think it does not need to be __u32 aligned too. I'll fix it next time. > > diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c > > index 5c75a1d..58d4fd7 100644 > > --- a/net/packet/af_packet.c > > +++ b/net/packet/af_packet.c > > @@ -977,9 +977,11 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc, > > { > > if (vlan_tx_tag_present(pkc->skb)) { > > ppd->hv1.tp_vlan_tci = vlan_tx_tag_get(pkc->skb); > > - ppd->tp_status = TP_STATUS_VLAN_VALID; > > + ppd->hv1.tp_vlan_tpid = (__force __u32)ntohs(pkc->skb->vlan_proto); > > Nit: ^^^^ one space here, resp. with __u16 > you won't need the cast. Yes, will remove the cast next time. Thank you again!