From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by dpdk.org (Postfix) with ESMTP id 2FBFA2C8 for ; Tue, 4 Jul 2017 11:03:13 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id u36so25928374pgn.3 for ; Tue, 04 Jul 2017 02:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZaYcaL3OyX/k6rNnFx0uTgs5P4yyNOeu8m3W6IxxcVk=; b=UXuI1juPdRFuoBJt1dZw/1NjIyRPmGKGTRloJgYsTso9XE7pOHlH1Wml6vIJdx+Rkw HVYHdXEhGT9dy067odMdlaQEd7Ws1ndDTHMj0iJEIIoiGgGlM35MyAxX+Q4lykmVebkU E9Nl5Z/nxpPdE/EMqX3+ucr0R0h/ykBn98IyGCPwrIknf8PgZgD29IZcSajOW5j/4urR 4V2xDVlNIloCjTgBWHwCuugE1MHDhuaCplcl0OPBKNYPjiMD0hVWNqa9UdSAWy/1PpDF Cg5EGWJ4j/As4OH001Qt2dOqOr4mZ22cm1pJlq3xBoZ3JqQtz6NerRIXDMiw29EKWcqk mQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZaYcaL3OyX/k6rNnFx0uTgs5P4yyNOeu8m3W6IxxcVk=; b=HVldW3DYnEwJkj/TCnFWZQC9DnlIq+r8mTYGH5Z5J2oJdj8Ffs09MyV/Whd7D8y6y1 UiyF3g3rWIZJ3PTwxUUJZuKhw7WDpKwuFaB4QilNmBRQzUWj7iyvlVPGovc5jNICPhBe rwbP7PwglANx7NaNEWy/kMv2f6hIQAUp4l4Xn/cmqO/SzJzpXGvtzkvuBpJt3+o1bsvM lqGM9CSVHpbn5c4N8y3DbZVx6ooMEkiX6iMKCFI6MkNKh46Wdm3KeOppZYyChcHVgJcq DHPmgLlkOAoWPXuGTHMIFAbQZdAZ+PBfOnV7+L4srDIGUTIYVUd15Vg7RSQ0Napkb7a2 DSDQ== X-Gm-Message-State: AIVw112zioQpZBOGHYb9SR6x9LPwDYfoAbMb1SP60SS0CVmVBywaPbeH /aRKc4O6W46miAvZFasGnA== X-Received: by 10.99.7.129 with SMTP id 123mr14754368pgh.171.1499158992442; Tue, 04 Jul 2017 02:03:12 -0700 (PDT) Received: from yliu-home ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id c63sm46588439pfk.79.2017.07.04.02.03.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 02:03:11 -0700 (PDT) Date: Tue, 4 Jul 2017 17:03:04 +0800 From: Yuanhan Liu To: Jiayu Hu Cc: dev@dpdk.org, konstantin.ananyev@intel.com, stephen@networkplumber.org, jianfeng.tan@intel.com, jingjing.wu@intel.com, lei.a.yao@intel.com, tiwei.bie@intel.com Message-ID: <20170704090304.GL11626@yliu-home> References: <1498805618-63649-1-git-send-email-jiayu.hu@intel.com> <1498907323-17563-1-git-send-email-jiayu.hu@intel.com> <1498907323-17563-3-git-send-email-jiayu.hu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1498907323-17563-3-git-send-email-jiayu.hu@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH v10 2/3] lib/gro: add TCP/IPv4 GRO support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 09:03:13 -0000 Again, just some quick comments after a glimpse. On Sat, Jul 01, 2017 at 07:08:42PM +0800, Jiayu Hu wrote: > + for (i = 0; i < nb_pkts; i++) { > + if (RTE_ETH_IS_IPV4_HDR(pkts[i]->packet_type) && > + (pkts[i]->packet_type & RTE_PTYPE_L4_TCP)) { > + ret = gro_tcp4_reassemble(pkts[i], > + &tcp_tbl, > + param->max_packet_size, > + current_time); > + if (ret > 0) > + /* merge successfully */ > + nb_after_gro--; > + else if (ret < 0) > + unprocess_pkts[unprocess_num++] = > + pkts[i]; Even it's just one statement, if the statement is spawned more than one line, including the comment, the {} should be used. Section 1.6.2. Control Statements and Loops of: http://dpdk.org/doc/guides/contributing/coding_style.html > + } else > + unprocess_pkts[unprocess_num++] = > + pkts[i]; Besides, why breaking it to two lines, judging that it can be fit into one line smaller than 80 chars. > + } > + > + /* re-arrange GROed packets */ > + if (nb_after_gro < nb_pkts) { > + i = gro_tcp4_tbl_timeout_flush(&tcp_tbl, 0, > + pkts, nb_pkts); > + if (unprocess_num > 0) > + memcpy(&pkts[i], unprocess_pkts, > + sizeof(struct rte_mbuf *) * > + unprocess_num); Ditto. > +void *gro_tcp4_tbl_create(uint16_t socket_id, > + uint16_t max_flow_num, > + uint16_t max_item_per_flow) > +{ > + size_t size; > + uint32_t entries_num; > + struct gro_tcp4_tbl *tbl; > + > + entries_num = max_flow_num * max_item_per_flow; > + entries_num = entries_num > GRO_TCP4_TBL_MAX_ITEM_NUM ? > + GRO_TCP4_TBL_MAX_ITEM_NUM : entries_num; > + > + if (entries_num == 0) > + return NULL; > + > + tbl = (struct gro_tcp4_tbl *)rte_zmalloc_socket( > + __func__, > + sizeof(struct gro_tcp4_tbl), > + RTE_CACHE_LINE_SIZE, > + socket_id); Again, the cast (from void *) is unnessary and should be dropped. > + memcpy(&(tbl->keys[key_idx].key), > + &key, sizeof(struct tcp4_key)); Again, I believe they two can be fit into one single line. --yliu