From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) by dpdk.org (Postfix) with ESMTP id 29FD01B1EF for ; Fri, 29 Sep 2017 10:15:25 +0200 (CEST) Received: by mail-oi0-f67.google.com with SMTP id r20so916472oie.0 for ; Fri, 29 Sep 2017 01:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=J9OzhijZEqoGb6vpfQlHlIVomNK9zjvATe9FwYfxK6w=; b=CtlKkW1BCeId4xVxuDJNaF66ULzQnlD9W/efK6k5+8kWm1lkAFnSFXnG1oPP9Zkcpk 3aOymWOhwhz2JWaeANMN97ZyrnCFdOu+YvA44AMiepJrI/FxAW+MbBpO2GL4NwhzhJVR 3+KK1mSqohbULh/j724LqIArmDh4ZJdF07D3NaS0pIjz6gRHMoIIZ4TWM3dDPYElvZl/ Wq49CxoVFwdyCrQOhIYdZmJ7gEUYz/7HgWYY7G0+dVXIsEjU6LnoE5Ykd2MxhP8UBFcP z0yqfftP6xxhTT+HM2ONLIBbwJ7bt+Aq5aXkohb/1h5ufTgEyJvpbk0uS/pgnuKpcvc0 ls9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=J9OzhijZEqoGb6vpfQlHlIVomNK9zjvATe9FwYfxK6w=; b=aBRTlo3h2XKc69SfDe8R3hr3LUn4g8YIF6ulXp/jMZDDWXXVwzxhc879XRgo+R2rZS bLYwMcyyIHVBFmryg748vbEbsj2Lu0IRpJ14pxAKhgqTKjS8/DI2azt/A2NvG4Et2xow GWitkC81N2JP222B1rdVauVghh0DwBNlxbkG++SWShRJG1e27bbCCKWF0700Vg1VxhTW TXXRD3Pd3Onl5osfxhD6OvJcAJLeSzMZrtnVP3zEMDartcBaRSLlfKR1ajR+zKu4lWCY Y2DD4FptNNAyVxcdDcU4JQ2K4W7hDa2SwLszOCFY1dJAEWu8bfUz0Kd2r4qMrELFCijf f3og== X-Gm-Message-State: AMCzsaX0YY546r59mvlnpP94c9GXr+MyWa24NTYQIr8aFPuEygfV4XjC KOUZ4QLdkf0bhBqHAsbNZAMdOuZXb6ZauRg6NMk= X-Google-Smtp-Source: AOwi7QBCtGjf2QTcS8EOkcc2yZkMWOnTDx20jAspjd4Dj1XNQsTYz4xIqfRE5DDbGaV5RRSq42UNtYxf2AOo3kNU26E= X-Received: by 10.202.72.209 with SMTP id v200mr2006654oia.135.1506672924493; Fri, 29 Sep 2017 01:15:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.83.193 with HTTP; Fri, 29 Sep 2017 01:15:24 -0700 (PDT) In-Reply-To: <1506662342-18966-7-git-send-email-beilei.xing@intel.com> References: <1506565054-67690-1-git-send-email-beilei.xing@intel.com> <1506662342-18966-1-git-send-email-beilei.xing@intel.com> <1506662342-18966-7-git-send-email-beilei.xing@intel.com> From: Sean Harte Date: Fri, 29 Sep 2017 09:15:24 +0100 Message-ID: To: Beilei Xing Cc: jingjing.wu@intel.com, andrey.chilikin@intel.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v6 6/8] net/i40e: add FDIR support for GTP-C and GTP-U 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: Fri, 29 Sep 2017 08:15:25 -0000 On 29 September 2017 at 06:19, Beilei Xing wrote: > This patch adds FDIR support for GTP-C and GTP-U. The > input set of GTP-C and GTP-U is TEID. > > Signed-off-by: Beilei Xing > --- > drivers/net/i40e/i40e_ethdev.h | 30 +++++ > drivers/net/i40e/i40e_fdir.c | 200 ++++++++++++++++++++++--------- > drivers/net/i40e/i40e_flow.c | 263 +++++++++++++++++++++++++++++++++++------ > 3 files changed, 396 insertions(+), 97 deletions(-) > @@ -1173,10 +1196,69 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, > rte_cpu_to_be_16(ETHER_TYPE_ARP)) > payload += sizeof(struct arp_hdr); > set_idx = I40E_FLXPLD_L2_IDX; > - break; > - default: > - PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); > - return -EINVAL; > + } else if (fdir_input->flow_ext.customized_pctype) { > + /* If customized pctype is used */ > + cus_pctype = i40e_flow_fdir_find_customized_pctype(pf, pctype); > + if (cus_pctype->index == I40E_CUSTOMIZED_GTPC || > + cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 || > + cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || > + cus_pctype->index == I40E_CUSTOMIZED_GTPU) { > + udp = (struct udp_hdr *)(raw_pkt + len); > + udp->dgram_len = > + rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); > + > + gtp = (struct rte_flow_item_gtp *) > + ((unsigned char *)udp + sizeof(struct udp_hdr)); > + gtp->v_pt_rsv_flags = 0x30; 0x30 isn't valid for GTP-C, the sequence number must be present in GTP-C so it will be 0x32 or more. Is this byte actually matched against by the device using the GTP pctypes? > + gtp->msg_len = > + rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); > + gtp->teid = fdir_input->flow.gtp_flow.teid; > + gtp->msg_type = 0x1; Why use this value? > + > + if (cus_pctype->index == I40E_CUSTOMIZED_GTPC) > + udp->dst_port = rte_cpu_to_be_16(2123); This will only match half of GTP-C messages. GTP-C messages have a UDP port destination of 2123, or a UDP source port of 2123. To match all GTP-C packets you need to look at both. > + else > + udp->dst_port = rte_cpu_to_be_16(2152); > + > + if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { > + gtp->msg_type = 0xFF; > + gtp_ipv4 = (struct ipv4_hdr *) > + ((unsigned char *)gtp + > + sizeof(struct rte_flow_item_gtp)); This is only valid if v_pt_rsv_flags is 0x30. GTP-U packets are allowed to have a sequence number, which adds an extra 4 bytes to the GTP header. > + gtp_ipv4->version_ihl = > + I40E_FDIR_IP_DEFAULT_VERSION_IHL; > + gtp_ipv4->next_proto_id = IPPROTO_IP; > + gtp_ipv4->total_length = > + rte_cpu_to_be_16( > + I40E_FDIR_INNER_IP_DEFAULT_LEN); > + payload = (unsigned char *)gtp_ipv4 + > + sizeof(struct ipv4_hdr); > + } else if (cus_pctype->index == > + I40E_CUSTOMIZED_GTPU_IPV6) { > + gtp->msg_type = 0xFF; > + gtp_ipv6 = (struct ipv6_hdr *) > + ((unsigned char *)gtp + > + sizeof(struct rte_flow_item_gtp)); This is only valid if v_pt_rsv_flags is 0x30. GTP-U packets are allowed to have a sequence number, which adds an extra 4 bytes to the GTP header. > + gtp_ipv6->vtc_flow = > + rte_cpu_to_be_32( > + I40E_FDIR_IPv6_DEFAULT_VTC_FLOW | > + (0 << I40E_FDIR_IPv6_TC_OFFSET)); > + gtp_ipv6->proto = IPPROTO_NONE; > + gtp_ipv6->payload_len = > + rte_cpu_to_be_16( > + I40E_FDIR_INNER_IPv6_DEFAULT_LEN); > + gtp_ipv6->hop_limits = > + I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; > + payload = (unsigned char *)gtp_ipv6 + > + sizeof(struct ipv6_hdr); > + } else > + payload = (unsigned char *)gtp + > + sizeof(struct rte_flow_item_gtp); > + } > + } else { > + PMD_DRV_LOG(ERR, "unknown pctype %u.", > + fdir_input->pctype); > + return -1; > } > > /* fill the flexbytes to payload */