From owner-freebsd-net@FreeBSD.ORG Wed May 22 12:56:03 2013 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DF1E987D for ; Wed, 22 May 2013 12:56:03 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id A93C1D7E for ; Wed, 22 May 2013 12:56:00 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 7413D7300A; Wed, 22 May 2013 14:58:28 +0200 (CEST) Date: Wed, 22 May 2013 14:58:28 +0200 From: Luigi Rizzo To: net@freebsd.org Subject: RFC: removing redundant checks in ether_input_internal() Message-ID: <20130522125828.GA93728@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2013 12:56:03 -0000 if_ethersubr.c :: ether_input_internal() is only called as follows: static void ether_nh_input(struct mbuf *m) { ether_input_internal(m->m_pkthdr.rcvif, m); } hence the following checks in the body are unnecessary: if (m->m_pkthdr.rcvif == NULL) { if_printf(ifp, "discard frame w/o interface pointer\n"); ifp->if_ierrors++; m_freem(m); return; } #ifdef DIAGNOSTIC if (m->m_pkthdr.rcvif != ifp) { if_printf(ifp, "Warning, frame marked as received on %s\n", m->m_pkthdr.rcvif->if_xname); } #endif Any objection if i remove them ? cheers luigi