From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f173.google.com (mail-ig0-f173.google.com [209.85.213.173]) by dpdk.org (Postfix) with ESMTP id 3038C32A5 for ; Mon, 18 Apr 2016 17:47:53 +0200 (CEST) Received: by mail-ig0-f173.google.com with SMTP id g8so83518172igr.0 for ; Mon, 18 Apr 2016 08:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vdbyUhBcmxb2It6fLsjhmmfu2iwEhTv/B0ylBD/kU3o=; b=f8x8xoQ5QPK80ThPSyA5JHiTQ4PejWRX7/noPSLckpR9hxIV2CglcZr897mp7NbRq1 EUuMOn3JewB30IgTdtKKTgVrMuqNbMEq/+H1TPyc/e0RKpRF6f7mSYLGfNGlc/RpSf+L PXPoCYx8eoW+Fcn4SH8OHo+0kaJGi29d2X6aECNrH8N66kn7R+X7EQm5yeIxz9AqdswS P8EymK/qhbf6Oj9COFBljYn1gUISbSFRHF3fqFtVwi8wBnqxNzirtw1/ddCUyxQEBSuy FKnjaLFn2p3d4jYOW4S6YS4DHU3CT/Xc/KDRd+Vs9x4L8CW9DIPn+fD1ZXAftD+e746b PKSg== 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:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vdbyUhBcmxb2It6fLsjhmmfu2iwEhTv/B0ylBD/kU3o=; b=hlvlUQddMLZxP0nVqW62V+eMY9pZiUfQI927Uanp5wryyC/4JVZPsUU9M0dI4VjOEH mq0Nw2Lg2i2uzBKzOqStKY0njTi4+RZkKzlzopxWHEdYMF6llfAfC4qmPyyEiTM6S+be pbhx3UCu2GlPFsjXKwUX+3T2dh3AKMWPeNSX8Gq0rCljqH7po/Q97zzXl5qPkaMNICiK RMPfJSXi1+jOznirkOSBLuyFtNqPUevcwANZUfIcbDER6QKrmzjvYEKsc61J2ktw4b1M 4rX7kgiax8tHN+i/x2vv0r6PU/mu8aU3MqjYZ58z+bUokzxMPqnInHQND6Kagyc7AWKM cPEQ== X-Gm-Message-State: AOPr4FW4nw3ZiuGBRSkBotJA/8K49l8rFvhM2aquIHsuYndnebPjIXpSdvo+LgP9ybBy6E1F8CvPpG8+8oZI7Q== X-Received: by 10.50.66.141 with SMTP id f13mr19986330igt.60.1460994472466; Mon, 18 Apr 2016 08:47:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.33.144 with HTTP; Mon, 18 Apr 2016 08:47:33 -0700 (PDT) In-Reply-To: <6b15729351b224d4ad9a7ae4ceeb13@cweb23.nm.nhnsystem.com> References: <6b15729351b224d4ad9a7ae4ceeb13@cweb23.nm.nhnsystem.com> From: Andriy Berestovskyy Date: Mon, 18 Apr 2016 17:47:33 +0200 Message-ID: To: =?UTF-8?B?7LWc7J217ISx?= Cc: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] Questions about reading/writing/modifying packet header. 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: Mon, 18 Apr 2016 15:47:53 -0000 Hi Ick-Sung, Please see inline. On Mon, Apr 18, 2016 at 2:14 PM, =EC=B5=9C=EC=9D=B5=EC=84=B1 wrote: > If I take an example, the worker assignment method using & (not %) in= load balancing was not fixed yet. If the code works, there is nothing to fix, right? ;) > Question #1) I would like to know how can I read/write/modify TCP/UDP/ICM= P/IGMP/... headers from packet in rte_mbuf. > I will really appreciate if I can be given an example code. I guess it = would be somewhat complex. For an example please have a look at parse_ethernet() in test-pmd: http://dpdk.org/browse/dpdk/tree/app/test-pmd/csumonly.c#n171 The example usage is in the same file: eth_hdr =3D rte_pktmbuf_mtod(m, struct ether_hdr *); parse_ethernet(eth_hdr, &info); l3_hdr =3D (char *)eth_hdr + info.l2_len; if (info.l4_proto =3D=3D IPPROTO_UDP) { udp_hdr =3D (struct udp_hdr *)((char *)l3_hdr + info.l3_len); udp_hdr->dst_port =3D ... } Then you might need to recalculate the L4 checksum, so have a look at rte_ipv4_udptcp_cksum(). > Question #2) The IP checksum does not include 6 the ptr. 6 th ptr (ptr16[= 5]) is missing in the example code. Is it right? > ( ip_cksum +=3D ptr16[5]; in the following code.) The code seems fine, ptr16[5] is the checksum itself. It should be zero, so we can skip it. There is a users@dpdk.org mailing list now, so please use it for your further questions. Here is the link for your convenience: http://dpdk.org/ml Regards, Andriy