From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by dpdk.org (Postfix) with ESMTP id 0B21AB427 for ; Fri, 13 Feb 2015 12:31:17 +0100 (CET) Received: by mail-ob0-f172.google.com with SMTP id nt9so18850670obb.3 for ; Fri, 13 Feb 2015 03:31:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=MH+I7PjMi9yklt6MS57noGL+i5q9VFz+WxZgATtNU+M=; b=C/b6F4hm4igRky7Ll7IyHbtlLHP/ez/W54thBXZVPNEX3eajMmVpyEi4yzl0uTI9ev jSIDBM4ISNMQtstf4nwzPzT56kImNqW2+gtGAthdWYAPG0TlKaAnFpTg+vG7flceIu5G qICNsvWvPDYmnyTfpM20jbkBSk6eV8EpgAk5IsoexX77GBcew2Gspqcj5i9Tmb4VGRJy 5X3L04A8pnA8vyEEbD01DfH/VVjHzyYatg2UNBW5wFx4a6LZ1/jIooojrVqVKh4CJmco Ctq4KyT4+iASKBJHEALSq2NHqxvUQCK8v8xaQge1upNMIA3ARzKj23u8JcdbFJtNmy6J MxEQ== X-Gm-Message-State: ALoCoQkOyxQx8gtzy1VhwRUu702+SZq44HVGlRLAenGDRTTwSURn0PysCi3C0SUGTYcAR2QyKPN7 MIME-Version: 1.0 X-Received: by 10.182.120.230 with SMTP id lf6mr6049866obb.39.1423827076482; Fri, 13 Feb 2015 03:31:16 -0800 (PST) Received: by 10.76.95.198 with HTTP; Fri, 13 Feb 2015 03:31:16 -0800 (PST) In-Reply-To: <1423815597-17819-9-git-send-email-jing.d.chen@intel.com> References: <1423618298-2933-2-git-send-email-jing.d.chen@intel.com> <1423815597-17819-1-git-send-email-jing.d.chen@intel.com> <1423815597-17819-9-git-send-email-jing.d.chen@intel.com> Date: Fri, 13 Feb 2015 12:31:16 +0100 Message-ID: From: David Marchand To: "Chen Jing D(Mark)" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v5 08/17] fm10k: add RX/TX single queue start/stop function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2015 11:31:17 -0000 Hello, On Fri, Feb 13, 2015 at 9:19 AM, Chen Jing D(Mark) wrote: [snip] +/* > + * Verify Rx packet buffer alignment is valid. > + * > + * Hardware requires specific alignment for Rx packet buffers. At > + * least one of the following two conditions must be satisfied. > + * 1. Address is 512B aligned > + * 2. Address is 8B aligned and buffer does not cross 4K boundary. > + * > + * Return 1 if buffer alignment satisfies at least one condition, > + * otherwise return 0. > + * > + * Note: Alignment is checked by the driver when the Rx queue is reset. It > + * is assumed that if an entire descriptor ring can be filled with > + * buffers containing valid alignment, then all buffers in that > mempool > + * have valid address alignment. It is the responsibility of the > user > + * to ensure all buffers have valid alignment, as it is the user who > + * creates the mempool. > + * Note: It is assumed the buffer needs only to store a maximum size > Ethernet > + * frame. > + */ > +static inline int > +fm10k_addr_alignment_valid(struct rte_mbuf *mb) > +{ > + uint64_t addr = MBUF_DMA_ADDR_DEFAULT(mb); > + uint64_t boundary1, boundary2; > + > + /* 512B aligned? */ > + if (RTE_ALIGN(addr, 512) == addr) > + return 1; > + > + /* 8B aligned, and max Ethernet frame would not cross a 4KB > boundary? */ > + if (RTE_ALIGN(addr, 8) == addr) { > + boundary1 = RTE_ALIGN_FLOOR(addr, 4096); > + boundary2 = RTE_ALIGN_FLOOR(addr + > ETHER_MAX_VLAN_FRAME_LEN, > + 4096); > + if (boundary1 == boundary2) > + return 1; > + } > + > + /* use RTE_LOG directly to make sure this error is seen */ > + RTE_LOG(ERR, PMD, "%s(): Error: Invalid buffer alignment\n", > __func__); > + > + return 0; > +} > Same comment as before, do not directly use RTE_LOG. This is init stuff, you have a PMD_INIT_LOG macro. By the way, I need to dig deeper into this, but I can see multiple patches ensuring buffer alignment. Do we really need to validate this alignment here, if we already validated this constraint at the mempool level ? -- David Marchand