From mboxrd@z Thu Jan 1 00:00:00 1970 From: Atzm Watanabe Subject: Re: [PATCH] packet: Deliver VLAN TPID to userspace Date: Wed, 23 Oct 2013 15:51:21 +0900 Message-ID: <87hac8jx92.wl%atzm@stratosphere.co.jp> References: <87a9i6jymc.wl%atzm@stratosphere.co.jp> <20131018105655.2cdc628e@nehalam.linuxnetplumber.net> <87k3h9hjen.wl%atzm@stratosphere.co.jp> <1382347494.25689.8.camel@deadeye.wl.decadent.org.uk> <87txgaj9nk.wl%atzm@stratosphere.co.jp> <20131022154110.518282ba@nehalam.linuxnetplumber.net> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: Ben Hutchings , To: Stephen Hemminger Return-path: Received: from mail-pd0-f176.google.com ([209.85.192.176]:38424 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903Ab3JWGuw (ORCPT ); Wed, 23 Oct 2013 02:50:52 -0400 Received: by mail-pd0-f176.google.com with SMTP id g10so452106pdj.35 for ; Tue, 22 Oct 2013 23:50:52 -0700 (PDT) In-Reply-To: <20131022154110.518282ba@nehalam.linuxnetplumber.net> Sender: netdev-owner@vger.kernel.org List-ID: At Tue, 22 Oct 2013 15:41:10 -0700, Stephen Hemminger wrote: > > On Tue, 22 Oct 2013 11:56:31 +0900 > Atzm Watanabe wrote: > > > Hmm... I think TPACKET{,2,3}_HDRLEN should not be removed without > > careful considerations. Because some userspace programs (e.g libpcap) > > are using them in order to check mmap ability of the kernel... > > > That's bad because it means the library then depends on the headers > of the machine it was built on, not the machine it is running on. I often > build software on boxes where /usr/include version of kernel headers is out dated. Yes, this means that building such library with the new header (TPACKET{,2,3}_HDRLEN were deleted) will make the binary that does not support PACKET_MMAP. :-( So, IMHO, we should be prudent in deleting TPACKET{,2,3}_HDRLEN, otherwise we will break such userspace programs very easily... e.g. snippet of the latest libpcap-1.4.0 (pcap-linux.c): /* check for memory mapped access avaibility. We assume every needed * struct is defined if the macro TPACKET_HDRLEN is defined, because it * uses many ring related structs and macros */ # ifdef TPACKET_HDRLEN # define HAVE_PACKET_RING # ifdef TPACKET2_HDRLEN # define HAVE_TPACKET2 # else # define TPACKET_V1 0 # endif /* TPACKET2_HDRLEN */ # endif /* TPACKET_HDRLEN */ It looks like PACKET_MMAP is used when HAVE_PACKET_RING is defined.