From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id C877B2FDD for ; Mon, 17 Jul 2017 10:32:55 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id t70so8162542wmt.1 for ; Mon, 17 Jul 2017 01:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=fs1sntqn0plGDZqfDtBT3GZOlfGpoAe34QIrFE55Ikw=; b=FHZZu8/WkfSNox5OrcwZOsQHXZPVqi/unmAm8H0UxbKi/jPt0RNnXQS+aZtO1200Gl yZ1UNbcAeBtr6dFEb7Rtl4xxTcM36tKHH/7z7aLuZOfZQHlQ3SeSt+6HuS2ON1z12lxC dZvf6ys3m9Zz3puuNv1ZSZLFR+z0OyLAUFFE8UhzFm7ENpkH9ovZb7dcgk6lMH0/BeW+ rhJ0OvGXQTRfvEI7jX8PEerBWXcWAKszhluXv0SMG3LX/UU2tdey0IY1NpKtEI/iVGXW WwEVDkSkebr7yhUWnVVZmfMMeCAbBtE0lkFfWM67WbKiHadb8T6jbDQrAZDmvjNWRrTX mxOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=fs1sntqn0plGDZqfDtBT3GZOlfGpoAe34QIrFE55Ikw=; b=S3Curc3gE7NYR5xXC8hlo6avXidtcXKaUJT0zl2DMmFkXkwtXEWDMulyBctWCQLv63 EPNLnikIvnEN4saGMjkLeeVpJd1eAViW3y3eNyFx8mNATvmZg28BL10wE4wzAQgenydK jI/sB/hTWHhGPgprm87+CnGhBGVh/NfYFs5gr1FBteMry30IvDoZ0hL7MvMRyah6UvuF AV3OfLTpcM8ik48sRJGR8CkeiUVgU6aqiQLciQa00RIEh0BFvfTWOuoLCqzlNrlQ40lq L4QJUoR1sniXF4xlDN1zS9o5DMQ7E8EEN2q3Nf5vAACugS/7zF5noMJbYgC+jmlHE7wf YCwQ== X-Gm-Message-State: AIVw112b6Oj3MLY/pJn/GE6CjU+BZwTFLPseSj9R2QFqAelGJbuDrbLF rFnDaAyLWGSV7XU9 X-Received: by 10.28.129.205 with SMTP id c196mr3680452wmd.120.1500280375381; Mon, 17 Jul 2017 01:32:55 -0700 (PDT) Received: from [10.16.0.184] (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id q17sm11488733wmd.4.2017.07.17.01.32.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 01:32:54 -0700 (PDT) To: Raslan Darawsheh Cc: adrien.mazarguil@6wind.com, dev@dpdk.org, stephen@networkplumber.org, thomas@monjalon.net References: <1499674423-4235-1-git-send-email-rasland@mellanox.com> <1500200322-65319-1-git-send-email-rasland@mellanox.com> From: Pascal Mazon Message-ID: Date: Mon, 17 Jul 2017 10:32:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1500200322-65319-1-git-send-email-rasland@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] net/tap: remove Linux version check 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: Mon, 17 Jul 2017 08:32:56 -0000 Hello Raslan, So I've compiled your code, and it looks fine. Just one remark: When trying to _create_ a rule, the error message keep stating "overlapping rules". That was fine before, at it was the main cause of error. But now it is also likely that the error comes from the kernel not supporting flower. Can you please change "overlapping rules" error messages to "overlapping rules or kernel too old for flower support"? On 07/16/2017 12:18 PM, Raslan Darawsheh wrote: > Remove checks of Linux kernel version > in order to support kernel with backported features. > > the expected behavior with a kernel that doesn't support flower > and other bits is the following: > -flow validate can return successfully > -flow create using the same rule fails. > > Using the "remote" feature without kernel flower does not fail silently. > The TAP instance is not initialized if the requested parameters cannot be satisfied. > > it has been tested on an old kernel without required support: > > PMD: Kernel refused TC filter rule creation (2): No such file or directory > PMD: tap0 failed to create implicit rules. > PMD: Can't set up remote feature: No such file of directory(2) > PMD: TAP Unable to initialize net_tap0 > > Signed-off-by: Raslan Darawsheh > --- > drivers/net/tap/rte_eth_tap.c | 34 +--------------------------------- > drivers/net/tap/rte_eth_tap.h | 2 -- > drivers/net/tap/tap_flow.c | 13 +------------ > 3 files changed, 2 insertions(+), 47 deletions(-) > > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index a4e5d11..c2b1d8a 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -1166,23 +1166,6 @@ static const struct eth_dev_ops ops = { > .filter_ctrl = tap_dev_filter_ctrl, > }; > > -static int > -tap_kernel_support(struct pmd_internals *pmd) > -{ > - struct utsname utsname; > - int ver[3]; > - > - if (uname(&utsname) == -1 || > - sscanf(utsname.release, "%d.%d.%d", > - &ver[0], &ver[1], &ver[2]) != 3) > - return 0; > - if (KERNEL_VERSION(ver[0], ver[1], ver[2]) >= FLOWER_KERNEL_VERSION) > - pmd->flower_support = 1; > - if (KERNEL_VERSION(ver[0], ver[1], ver[2]) >= > - FLOWER_VLAN_KERNEL_VERSION) > - pmd->flower_vlan_support = 1; > - return 1; > -} > > static int > eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, > @@ -1271,20 +1254,6 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, > if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) > goto error_exit; > > - tap_kernel_support(pmd); > - if (!pmd->flower_support) { > - if (remote_iface[0]) { > - RTE_LOG(ERR, PMD, > - "%s: kernel does not support TC rules, required for remote feature.", > - pmd->name); > - goto error_exit; > - } else { > - RTE_LOG(INFO, PMD, > - "%s: kernel too old for Flow API support.\n", > - pmd->name); > - return 0; > - } > - } > > /* > * Set up everything related to rte_flow: > @@ -1378,7 +1347,6 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, > RTE_LOG(ERR, PMD, "Remote feature requires flow support.\n"); > goto error_exit; > } > - pmd->flower_support = 0; > return 0; > > error_remote: > @@ -1543,7 +1511,7 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) > return 0; > > internals = eth_dev->data->dev_private; > - if (internals->flower_support && internals->nlsk_fd) { > + if (internals->nlsk_fd) { > tap_flow_flush(eth_dev, NULL); > tap_flow_implicit_flush(internals, NULL); > nl_final(internals->nlsk_fd); > diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h > index 33e1a52..928a045 100644 > --- a/drivers/net/tap/rte_eth_tap.h > +++ b/drivers/net/tap/rte_eth_tap.h > @@ -90,8 +90,6 @@ struct pmd_internals { > int ioctl_sock; /* socket for ioctl calls */ > int nlsk_fd; /* Netlink socket fd */ > int flow_isolate; /* 1 if flow isolation is enabled */ > - int flower_support; /* 1 if kernel supports, else 0 */ > - int flower_vlan_support; /* 1 if kernel supports, else 0 */ > LIST_HEAD(tap_flows, rte_flow) flows; /* rte_flow rules */ > /* implicit rte_flow rules set when a remote device is active */ > LIST_HEAD(tap_implicit_flows, rte_flow) implicit_flows; > diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c > index 18425eb..b643296 100644 > --- a/drivers/net/tap/tap_flow.c > +++ b/drivers/net/tap/tap_flow.c > @@ -1034,16 +1034,13 @@ priv_flow_process(struct pmd_internals *pmd, > if (err) > goto exit_item_not_supported; > if (flow && cur_item->convert) { > - if (!pmd->flower_vlan_support && > - cur_item->convert == tap_flow_create_vlan) > - goto exit_item_not_supported; > err = cur_item->convert(items, &data); > if (err) > goto exit_item_not_supported; > } > } > if (flow) { > - if (pmd->flower_vlan_support && data.vlan) { > + if (data.vlan) { > nlattr_add16(&flow->msg.nh, TCA_FLOWER_KEY_ETH_TYPE, > htons(ETH_P_8021Q)); > nlattr_add16(&flow->msg.nh, > @@ -1393,10 +1390,6 @@ tap_flow_isolate(struct rte_eth_dev *dev, > { > struct pmd_internals *pmd = dev->data->dev_private; > > - if (!pmd->flower_support) > - return -rte_flow_error_set( > - error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > - "rte_flow isolate requires TC flower kernel support"); > if (set) > pmd->flow_isolate = 1; > else > @@ -1642,10 +1635,6 @@ tap_dev_filter_ctrl(struct rte_eth_dev *dev, > enum rte_filter_op filter_op, > void *arg) > { > - struct pmd_internals *pmd = dev->data->dev_private; > - > - if (!pmd->flower_support) > - return -ENOTSUP; > switch (filter_type) { > case RTE_ETH_FILTER_GENERIC: > if (filter_op != RTE_ETH_FILTER_GET)