* [PATCH v2 0/2] net/i40e: fix segmentation fault
From: Bernard Iremonger @ 2017-01-09 16:29 UTC (permalink / raw)
To: dev, wenzhuo.lu, jingjing.wu, helin.zhang; +Cc: Bernard Iremonger
Changes in v2:
These two patches were previously part of the following patchset:
[PATCH v7 00/27] Support VFD on i40e
They are being submitted seperately as they are not needed for VFD.
The net/i40e patch has been revised.
The testpmd patch is needed to setup VMDq in order to test the fix.
Bernard Iremonger (2):
net/i40e: fix segmentation fault in close
app/testpmd: add command to configure VMDq
app/test-pmd/cmdline.c | 60 +++++++++++++
app/test-pmd/testpmd.c | 126 ++++++++++++++++++++++++++++
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
drivers/net/i40e/i40e_ethdev.c | 12 +--
5 files changed, 201 insertions(+), 5 deletions(-)
--
2.10.1
^ permalink raw reply
* [PATCH v2 2/2] app/testpmd: add command to configure VMDq
From: Bernard Iremonger @ 2017-01-09 16:29 UTC (permalink / raw)
To: dev, wenzhuo.lu, jingjing.wu, helin.zhang; +Cc: Bernard Iremonger
In-Reply-To: <1483979366-16914-1-git-send-email-bernard.iremonger@intel.com>
Add the following command to configure VMDq:
port config <port> vmdq
Add new command to testpmd user guide.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/cmdline.c | 60 +++++++++++++
app/test-pmd/testpmd.c | 126 ++++++++++++++++++++++++++++
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
4 files changed, 194 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4e8b0d8..b780f3f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -604,6 +604,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" pfc (on|off)\n"
" Set the DCB mode.\n\n"
+ "port config (port_id) vmdq\n"
+ " Configure VMDq.\n\n"
+
"port config all burst (value)\n"
" Set the number of packets per burst.\n\n"
@@ -2297,6 +2300,62 @@ cmdline_parse_inst_t cmd_config_dcb = {
},
};
+/* *** Configure VMDq *** */
+struct cmd_config_vmdq {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ uint8_t port_id;
+ cmdline_fixed_string_t vmdq;
+};
+
+static void
+cmd_config_vmdq_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_vmdq *res = parsed_result;
+ portid_t port_id = res->port_id;
+ struct rte_port *port;
+ int ret;
+
+ port = &ports[port_id];
+ /** Check if the port is not started **/
+ if (port->port_status != RTE_PORT_STOPPED) {
+ printf("Please stop port %d first\n", port_id);
+ return;
+ }
+
+ ret = init_port_vmdq_config(port_id);
+ if (ret != 0) {
+ printf("Cannot initialize network ports.\n");
+ return;
+ }
+
+ cmd_reconfig_device_queue(port_id, 0, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_vmdq_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, port, "port");
+cmdline_parse_token_string_t cmd_config_vmdq_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, config, "config");
+cmdline_parse_token_num_t cmd_config_vmdq_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_config_vmdq, port_id, UINT8);
+cmdline_parse_token_string_t cmd_config_vmdq_vmdq =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, vmdq, "vmdq");
+
+cmdline_parse_inst_t cmd_config_vmdq = {
+ .f = cmd_config_vmdq_parsed,
+ .data = NULL,
+ .help_str = "port config <port-id> vmdq",
+ .tokens = {
+ (void *)&cmd_config_vmdq_port,
+ (void *)&cmd_config_vmdq_config,
+ (void *)&cmd_config_vmdq_port_id,
+ (void *)&cmd_config_vmdq_vmdq,
+ NULL,
+ },
+};
+
/* *** configure number of packets per burst *** */
struct cmd_config_burst {
cmdline_fixed_string_t port;
@@ -11572,6 +11631,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg,
(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
(cmdline_parse_inst_t *)&cmd_config_dcb,
+ (cmdline_parse_inst_t *)&cmd_config_vmdq,
(cmdline_parse_inst_t *)&cmd_read_reg,
(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
(cmdline_parse_inst_t *)&cmd_read_reg_bit,
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index bfb2f8e..9850b7f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -196,6 +196,34 @@ uint8_t dcb_test = 0;
queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
queueid_t nb_txq = 1; /**< Number of TX queues per port. */
+static const struct rte_eth_conf vmdq_conf_default = {
+ .rxmode = {
+ .mq_mode = ETH_MQ_RX_VMDQ_ONLY,
+ .split_hdr_size = 0,
+ .header_split = 0, /**< Header Split disabled */
+ .hw_ip_checksum = 0, /**< IP checksum offload disabled */
+ .hw_vlan_filter = 0, /**< VLAN filtering disabled */
+ .jumbo_frame = 0, /**< Jumbo Frame Support disabled */
+ },
+
+ .txmode = {
+ .mq_mode = ETH_MQ_TX_NONE,
+ },
+ .rx_adv_conf = {
+ /*
+ * should be overridden separately in code with
+ * appropriate values
+ */
+ .vmdq_rx_conf = {
+ .nb_queue_pools = ETH_8_POOLS,
+ .enable_default_pool = 0,
+ .default_pool = 0,
+ .nb_pool_maps = 0,
+ .pool_map = {{0, 0},},
+ },
+ },
+};
+
/*
* Configurable number of RX/TX ring descriptors.
*/
@@ -1895,6 +1923,104 @@ const uint16_t vlan_tags[] = {
24, 25, 26, 27, 28, 29, 30, 31
};
+const uint16_t num_vlans = RTE_DIM(vlan_tags);
+static uint16_t num_pf_queues, num_vmdq_queues;
+static uint16_t vmdq_pool_base, vmdq_queue_base;
+/* number of pools (if user does not specify any, 8 by default */
+static uint32_t num_queues = 8;
+static uint32_t num_pools = 8;
+
+/**
+ * Builds up the correct configuration for vmdq based on the vlan tags array
+ * given above, and determine the queue number and pool map number according to
+ * valid pool number
+ */
+static int
+get_eth_vmdq_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
+{
+ struct rte_eth_vmdq_rx_conf conf;
+ unsigned i;
+
+ conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+ conf.nb_pool_maps = num_pools;
+ conf.enable_default_pool = 0;
+ conf.default_pool = 0; /* set explicit value, even if not used */
+
+ for (i = 0; i < conf.nb_pool_maps; i++) {
+ conf.pool_map[i].vlan_id = vlan_tags[i];
+ conf.pool_map[i].pools = (1UL << (i % num_pools));
+ }
+
+ (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
+ (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf,
+ sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+ return 0;
+}
+
+/**
+ * Configures VMDq for a given port using global settings.
+ */
+int
+init_port_vmdq_config(uint8_t port)
+{
+ struct rte_eth_dev_info dev_info;
+ struct rte_eth_conf port_conf;
+ uint16_t rx_queues, tx_queues;
+ int retval;
+ uint16_t queues_per_pool;
+ uint32_t max_nb_pools;
+
+ if (port >= rte_eth_dev_count())
+ return -1;
+ /**
+ * The max pool number from dev_info will be used to validate the pool
+ * number.
+ */
+ rte_eth_dev_info_get(port, &dev_info);
+ max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
+ /**
+ * We allow to process part of VMDQ pools specified by num_pools in
+ * command line.
+ */
+ if (num_pools > max_nb_pools) {
+ printf("num_pools %d >max_nb_pools %d\n",
+ num_pools, max_nb_pools);
+ return -1;
+ }
+
+ retval = get_eth_vmdq_conf(&port_conf, num_pools);
+ if (retval < 0)
+ return retval;
+
+ /*
+ * NIC queues are divided into pf queues and vmdq queues.
+ */
+ /* There is assumption here all ports have the same configuration! */
+ num_pf_queues = dev_info.max_rx_queues - dev_info.vmdq_queue_num;
+ queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
+ num_vmdq_queues = num_pools * queues_per_pool;
+ num_queues = num_pf_queues + num_vmdq_queues;
+ vmdq_queue_base = dev_info.vmdq_queue_base;
+ vmdq_pool_base = dev_info.vmdq_pool_base;
+
+ printf("pf queue num: %u, configured vmdq pool num: %u,"
+ " each vmdq pool has %u queues\n",
+ num_pf_queues, num_pools, queues_per_pool);
+ printf("vmdq queue base: %d pool base %d\n",
+ vmdq_queue_base, vmdq_pool_base);
+
+ /*
+ * All queues including pf queues are setup.
+ * This is because VMDQ queues doesn't always start from zero, and the
+ * PMD layer doesn't support selectively initialising part of rx/tx
+ * queues.
+ */
+ rx_queues = (uint16_t)dev_info.max_rx_queues;
+ tx_queues = (uint16_t)dev_info.max_tx_queues;
+ retval = rte_eth_dev_configure(port, rx_queues, tx_queues, &port_conf);
+ return retval;
+}
+
static int
get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
enum dcb_mode_enable dcb_mode,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 22ce2d6..6e72420 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -580,6 +580,7 @@ uint8_t port_is_bonding_slave(portid_t slave_pid);
int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode,
enum rte_eth_nb_tcs num_tcs,
uint8_t pfc_en);
+int init_port_vmdq_config(uint8_t port);
int start_port(portid_t pid);
void stop_port(portid_t pid);
void close_port(portid_t pid);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index c611dc5..d9839cc 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1374,6 +1374,13 @@ Set the DCB mode for an individual port::
The traffic class should be 4 or 8.
+port config - VMDq
+~~~~~~~~~~~~~~~~~~
+
+Configure VMDq for an individual port::
+
+ testpmd> port config (port_id) vmdq
+
port config - Burst
~~~~~~~~~~~~~~~~~~~
--
2.10.1
^ permalink raw reply related
* [PATCH] tools: fix active interface detection in dpdk-devbind.py
From: Yoni Gilad @ 2017-01-09 16:37 UTC (permalink / raw)
To: pablo.de.lara.guarch, deepak.k.jain; +Cc: dev, Yoni Gilad, stable
When adding crypto devices, the "Active" and "Ssh_if" attributes of
existing network devices were reset. This causes the follwing issues:
- Network interfaces aren't marked as "*Active*" in the --status output.
- Active network interfaces can be unbound without the --force option,
causing loss of network connection.
The reset was caused by the call to devices[d].update in
get_crypto_details.
This patch prevents the update on non-crypto devices.
Fixes: cb4a1d1 ("tools: bind crypto devices")
CC: stable@dpdk.org
Signed-off-by: Yoni Gilad <yonig@radcom.com>
---
usertools/dpdk-devbind.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index e057b87..1b9c651 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -328,6 +328,9 @@ def get_crypto_details():
# based on the basic info, get extended text details
for d in devices.keys():
+ if devices[d]["Class"][0:2] != CRYPTO_BASE_CLASS:
+ continue
+
# get additional info and add it to existing data
devices[d] = devices[d].copy()
devices[d].update(get_pci_device_details(d).items())
--
1.7.1
^ permalink raw reply related
* Re: Cannot use MLX4 with igb_uio driver
From: Royce Niu @ 2017-01-09 16:57 UTC (permalink / raw)
To: Adrien Mazarguil, Royce Niu; +Cc: dev
In-Reply-To: <20170109161326.GD12822@6wind.com>
It is a simple L2FWD. It can be 14mpps in x520 nics. So, do you think where
should I check? Thanks
On Tue, 10 Jan 2017 at 12:13 AM, Adrien Mazarguil <
adrien.mazarguil@6wind.com> wrote:
> On Mon, Jan 09, 2017 at 11:23:56PM +0800, Royce Niu wrote:
>
> > Hi, Adrien,
>
> >
>
> > Actually, I tested using the original kernel module without binding. It
>
> > works.
>
> >
>
> > However, it is only 6Mpps for 64B in pkt-gen, which is so slow for a
> 40Gbps
>
> > NIC.
>
> >
>
> > Is that right?
>
>
>
> That's difficult to say without knowing your specific setup or application,
>
> however 6 Mpps seems abnormally slow assuming testpmd performing basic I/O
>
> forwarding using a single thread and two ports.
>
>
>
> > On Mon, Jan 9, 2017 at 11:13 PM, Adrien Mazarguil <
>
> > adrien.mazarguil@6wind.com> wrote:
>
> >
>
> > > Hi Royce,
>
> > >
>
> > > On Mon, Jan 09, 2017 at 10:53:37PM +0800, Royce Niu wrote:
>
> > > > Dear all,
>
> > > >
>
> > > > I cannot use my Mellanox 3 Pro, after I binded it with igb_uio
> driver.
>
> > > >
>
> > > > It always shows when I use my DPDK application.
>
> > > >
>
> > > > EAL: Detected 32 lcore(s)
>
> > > > EAL: Probing VFIO support...
>
> > > > PMD: bnxt_rte_pmd_init() called for (null)
>
> > > > EAL: PCI device 0000:02:00.0 on NUMA socket 0
>
> > > > EAL: probe driver: 8086:1521 rte_igb_pmd
>
> > > > EAL: PCI device 0000:02:00.1 on NUMA socket 0
>
> > > > EAL: probe driver: 8086:1521 rte_igb_pmd
>
> > > > EAL: PCI device 0000:02:00.2 on NUMA socket 0
>
> > > > EAL: probe driver: 8086:1521 rte_igb_pmd
>
> > > > EAL: PCI device 0000:02:00.3 on NUMA socket 0
>
> > > > EAL: probe driver: 8086:1521 rte_igb_pmd
>
> > > > EAL: PCI device 0000:81:00.0 on NUMA socket 1
>
> > > > EAL: probe driver: 15b3:1007 librte_pmd_mlx4
>
> > > > PMD: librte_pmd_mlx4: cannot access device, is mlx4_ib loaded?
>
> > > > EAL: Error - exiting with code: 1
>
> > > > Cause: Cannot create mbuf pool
>
> > > >
>
> > > > ---------------
>
> > > > I have added CONFIG_RTE_LIBRTE_MLX4_PMD=y in .config, and
>
> > > > install MLNX_OFED_LINUX-3.4-2.0.0.0.
>
> > >
>
> > > The mlx4 PMD does not operate through igb_uio (see mlx4 documentation
> [1]),
>
> > > PCI devices must remain bound to their original kernel module
> (mlx4_core),
>
> > > however you have to additionally load mlx4_ib, mlx4_en and ib_uverbs
> [2].
>
> > >
>
> > > [1] http://dpdk.org/doc/guides/nics/mlx4.html
>
> > > [2] http://dpdk.org/doc/guides/nics/mlx4.html#prerequisites
>
> > >
>
> > > --
>
> > > Adrien Mazarguil
>
> > > 6WIND
>
> > >
>
> >
>
> >
>
> >
>
> > --
>
> > Regards,
>
> >
>
> > Royce
>
>
>
> --
>
> Adrien Mazarguil
>
> 6WIND
>
>
^ permalink raw reply
* Re: [PATCH] net/bnxt: Add support for new PCI IDs
From: Stephen Hemminger @ 2017-01-09 17:03 UTC (permalink / raw)
To: Ajit Khaparde; +Cc: dev
In-Reply-To: <20170106195517.52821-1-ajit.khaparde@broadcom.com>
fine BROADCOM_DEV_ID_57416_MF 0x16ee
>
> static struct rte_pci_id bnxt_pci_id_map[] = {
> { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57301) },
> @@ -95,6 +110,21 @@ static struct rte_pci_id bnxt_pci_id_map[] = {
> { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57407_MF) },
Adding new id's is good. Does this now cover all the devices in the Linux kernel?
The PCI id table should be const?
^ permalink raw reply
* Re: [PATCH] ixgbe: fix wrong VMDq function name
From: Iremonger, Bernard @ 2017-01-09 17:06 UTC (permalink / raw)
To: Lu, Wenzhuo, dev@dpdk.org; +Cc: stable@dpdk.org
In-Reply-To: <1483669846-106719-1-git-send-email-wenzhuo.lu@intel.com>
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Friday, January 6, 2017 2:31 AM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; stable@dpdk.org
> Subject: [PATCH] ixgbe: fix wrong VMDq function name
>
> The function name ixgbe_vmdq_mode_check is not right.
> This function checks if Virtualization Technology is enabled. It's for both
> VMDq and IOV.
> Others may be misled by the current name.
>
> Fixes: fe3a45fd4104 ("ixgbe: add VMDq support")
>
> CC: stable@dpdk.org
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
^ permalink raw reply
* Re: [PATCH v4] ethdev: fix port data mismatched in multiple process model
From: Thomas Monjalon @ 2017-01-09 17:08 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: dev, stable, Bruce Richardson, Ferruh Yigit
In-Reply-To: <1483948259-8652-1-git-send-email-yuanhan.liu@linux.intel.com>
Hi Yuanhan,
Nit: the title should be "v4 1/6"
Except that, good patch :)
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
^ permalink raw reply
* Re: [PATCH 0/2] minor cleanups
From: Thomas Monjalon @ 2017-01-09 17:09 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
In-Reply-To: <20161208014751.24285-1-stephen@networkplumber.org>
Hi Stephen,
This series is still pending.
Would you mind to make a v2, please?
2016-12-07 17:47, Stephen Hemminger:
> Saw this while reviewing other changes
>
> Stephen Hemminger (2):
> eth: get rid of goto's in rte_eth_dev_detach
> sched/malloc: remove unnecesary return statements
^ permalink raw reply
* Re: [PATCH v2 1/7] pci: If a driver's probe function fails, unmap resources.
From: Thomas Monjalon @ 2017-01-09 17:12 UTC (permalink / raw)
To: Ben Walker; +Cc: Shreyansh Jain, dev
In-Reply-To: <64510177.2V8Gqa4j9X@xps13>
2017-01-04 18:39, Thomas Monjalon:
> 2016-12-21 17:19, Thomas Monjalon:
> > 2016-11-25 14:51, Shreyansh Jain:
> > > On Thursday 24 November 2016 01:37 AM, Ben Walker wrote:
> > > > If resources were mapped prior to probe, unmap them
> > > > if probe fails.
> > > >
> > > > This does not handle the case where the kernel driver was
> > > > forcibly unbound prior to probe.
> > > >
> > > > Signed-off-by: Ben Walker <benjamin.walker@intel.com>
> > >
> > > Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >
> > The 3 first patches of this series seems good and easy to agree,
> > except some minor nits.
> >
> > Please Ben or Shreyansh, could you respin only them to help make
> > progress before applying a PCI/bus rework from Shreyansh?
> > As soon as one of you shoot a partial v3, I'll apply them.
> > Thanks
>
> Please Ben, do you want to make a partial v3?
Please, would you mind to re-send the first 3 patches as v3?
^ permalink raw reply
* Re: [PATCH v5 1/5] ethdev: add firmware version get
From: Stephen Hemminger @ 2017-01-09 17:23 UTC (permalink / raw)
To: Remy Horton; +Cc: Yang, Qiming, dev@dpdk.org, Yigit, Ferruh, Zhang, Helin
In-Reply-To: <8c746d3c-abb2-9ec5-80d0-2315f854e5bf@intel.com>
On Mon, 9 Jan 2017 10:01:40 +0000
Remy Horton <remy.horton@intel.com> wrote:
> On 09/01/2017 07:16, Yang, Qiming wrote:
> > -----Original Message-----
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> [..]
> >> void
> >> +rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, int
> >> +fw_length) {
> >> + struct rte_eth_dev *dev;
> >> +
> >> + RTE_ETH_VALID_PORTID_OR_RET(port_id);
> >> + dev = &rte_eth_devices[port_id];
> >> +
> >> + RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get);
> >> + (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_length); }
> >
> > Maybe dev argument to fw_version_get should be:
> > const struct rte_eth_dev *dev
> > Qiming: do you means the argument to ops fw_version_get?
> > why should add 'const'? both two are OK, but we usually use struct rte_eth_dev *dev.
>
> Does seem a bit odd to me as I don't think any of the other rte_dev_ops
> entrypoints use const. Maybe they should but if that's now policy (I've
> been under a rock recently) probably better to do them all in a seperate
> cleanup patchset..
DPDK is somewhat lazy about using const.
^ permalink raw reply
* Re: [PATCH 13/13] i40e: improve message grepability
From: Stephen Hemminger @ 2017-01-09 17:25 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Bruce Richardson, Wu, Jingjing, Michal Miroslaw,
Yigit, Ferruh
In-Reply-To: <2026939.L9sH03DzKe@xps13>
On Mon, 09 Jan 2017 14:18:58 +0100
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2017-01-09 12:02, Bruce Richardson:
> > On Wed, Dec 28, 2016 at 03:51:56AM +0000, Wu, Jingjing wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Miroslaw
> > > > Sent: Tuesday, December 13, 2016 9:08 AM
> > > > To: dev@dpdk.org
> > > > Subject: [dpdk-dev] [PATCH 13/13] i40e: improve message grepability
> > > >
> > > > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> > > > ---
> > > > drivers/net/i40e/i40e_ethdev.c | 198 +++++++++++++++--------------------------
> > > > 1 file changed, 73 insertions(+), 125 deletions(-)
> > > >
> > > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> > > > index 39fbcfe..4d73aca 100644
> > > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > > @@ -763,8 +763,7 @@ i40e_add_tx_flow_control_drop_filter(struct i40e_pf
> > > > *pf)
> > > > pf->main_vsi_seid, 0,
> > > > TRUE, NULL, NULL);
> > > > if (ret)
> > > > - PMD_INIT_LOG(ERR, "Failed to add filter to drop flow control "
> > > > - " frames from VSIs.");
> > > > + PMD_INIT_LOG(ERR, "Failed to add filter to drop flow control
> > > > frames
> > > > +from VSIs.");
> > > > }
> > >
> > > You are right, it makes grep easily. But it will break the coding style "Line length is recommended to be not more than 80 characters, including comments."
> > >
> > > Any comments from committers?
> > >
> > Being able to grep error messages is more important that having lines
> > wrapped at 80 characters. I believe checkpatch ignores long strings when
> > checking line lengths.
>
> I agree keeping strings is more important than checkpatch conformity.
> Please, if checkpatch complains, try to tune the script checkpatch.sh.
> There are some options to manage strings.
Checkpatch does not complain as long as string is on one line.
i.e
PMD_INIT_LOG(ERR,
""Failed to add filter to drop flow control frames from VSIs.");
^ permalink raw reply
* Re: [dpdk-stable] [PATCH] ixgbe: fix wrong VMDq function name
From: Ferruh Yigit @ 2017-01-09 17:37 UTC (permalink / raw)
To: Iremonger, Bernard, Lu, Wenzhuo, dev@dpdk.org; +Cc: stable@dpdk.org
In-Reply-To: <8CEF83825BEC744B83065625E567D7C224D1BF6B@IRSMSX108.ger.corp.intel.com>
On 1/9/2017 5:06 PM, Iremonger, Bernard wrote:
>> -----Original Message-----
>> From: Lu, Wenzhuo
>> Sent: Friday, January 6, 2017 2:31 AM
>> To: dev@dpdk.org
>> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; Lu, Wenzhuo
>> <wenzhuo.lu@intel.com>; stable@dpdk.org
>> Subject: [PATCH] ixgbe: fix wrong VMDq function name
>>
>> The function name ixgbe_vmdq_mode_check is not right.
>> This function checks if Virtualization Technology is enabled. It's for both
>> VMDq and IOV.
>> Others may be misled by the current name.
>>
>> Fixes: fe3a45fd4104 ("ixgbe: add VMDq support")
>>
>> CC: stable@dpdk.org
>> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
>
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
>
Hi Wenzhuo,
This patch seems on top of main repo, would you mind sending a new
version rebased on next-net?
You can keep the Bernard's ack.
Thanks,
ferruh
^ permalink raw reply
* Re: [PATCH v3 00/33] NXP DPAA2 PMD
From: Ferruh Yigit @ 2017-01-09 17:42 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: thomas.monjalon, bruce.richardson, john.mcnamara, jerin.jacob
In-Reply-To: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com>
On 12/29/2016 5:16 AM, Shreyansh Jain wrote:
> ** Sending v3 on behalf of Hemant Agrawal **
>
<...>
Hi,
Getting compile error for shared library [1] build.
Not investigated, copying here.
Thanks,
ferruh
[1]
== Build drivers/net/dpaa2
LD librte_pmd_dpaa2.so.1.1
/usr/bin/ld: cannot find -lrte_pmd_dpaa2_qbman
/usr/bin/ld: cannot find -lrte_pmd_dpaa2_pool
^ permalink raw reply
* Re: [PATCH 5/5] net/virtio: fix Tso when mbuf is shared
From: Olivier Matz @ 2017-01-09 17:46 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: dev, maxime.coquelin, huawei.xie, stephen, Tan, Jianfeng
In-Reply-To: <20161214072750.GK18991@yliu-dev.sh.intel.com>
Hi Yuanhan,
On Wed, 14 Dec 2016 15:27:50 +0800, Yuanhan Liu
<yuanhan.liu@linux.intel.com> wrote:
> Firstly sorry for late response!
No problem, I fully understand ;)
> On Thu, Nov 24, 2016 at 09:56:38AM +0100, Olivier Matz wrote:
> > With virtio, doing tso requires to modify the network
> > packet data:
>
> I thought more about it this time, and I'm wondering why it's needed.
>
> > - the dpdk API requires to set the l4 checksum to an
> > Intel-Nic-like pseudo header checksum that does
> > not include the ip length
>
> If the packet is for a NIC pmd driver in the end, then the NIC driver
> (or application) would handle the checksum correctly. You could check
> the tx_prep patchset for example.
>
> > - the virtio peer expects that the l4 checksum is
> > a standard pseudo header checksum.
>
> For this case, the checksum is then not needed: we could assume the
> data between virtio to virtio transmission on the same host is always
> valid, that checksum validation is unnecessary.
>
> So, in either case, it doesn't seem to me we have to generate the
> checksum here. Or am I miss something?
The virtio specifications requires that the L4 checksum is set to the
pseudo header checksum. You can search for "pseudo header" in the
following doc:
http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.pdf
Especially in 5.1.6.2.1, we can see that if we use the csum flag, we
must set the checksum to phdr, and if we do tso, we must set the csum
flag.
We can check that this is really needed with Linux vhost by replaying
the test plan described at [1].
[1] http://dpdk.org/ml/archives/dev/2016-October/048793.html
If we add the following patch to disable the checksum fix (on top of
this patchset), the test1 "large packets (lro/tso)" won't work.
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -224,6 +224,9 @@
uint32_t tmp;
int shared = 0;
+ if (1)
+ return 0;
+
/* mbuf is write-only, we need to copy the headers in a linear
buffer */ if (unlikely(rte_pktmbuf_data_is_shared(m, 0, hdrlen))) {
shared = 1;
In one direction ("flow1" in the test desc), large packets are
transmitted from host on the ixgbe interface, and received by the
guest. Then, testpmd bridges the packet to the virtio interface. But
the packet is not received by the host.
>
> OTOH, even if it does, I still see some issues (see below).
>
> > /* TCP Segmentation Offload */
> > if (cookie->ol_flags & PKT_TX_TCP_SEG) {
> > - virtio_tso_fix_cksum(cookie);
> > + offset = virtio_tso_fix_cksum(cookie,
> > + RTE_PTR_ADD(hdr,
> > start_dp[hdr_idx].len),
> > + VIRTIO_MAX_HDR_SZ);
> > + if (offset > 0) {
> > + RTE_ASSERT(can_push != 0);
>
> I think it's (can_push == 0) ?
>
Yes, indeed. I'll fix that in next version.
> > + start_dp[hdr_idx].len += offset;
>
> Actually, there is an assumption if you do this, that the backend
> driver must have to support ANY_LAYOUT. Otherwise, it won't work: the
> driver would expect the header and packet data is totally separated
> into two desc buffers.
>
> Though the assumption is most likely true in nowadays, I don't think
> it's a guarantee.
Right.
There are at least 2 options for this one:
- try to use 2 different descriptors (the patch is probably harder,
and it may slow-down the case where ANY_LAYOUT is supported)
- refuse to initialize with TSO enabled if ANY_LAYOUT is not supported.
If you think ANY_LAYOUT is most likely true today, we could choose
option 2. Let me know what's your preference here.
Thank you for the review.
Olivier
^ permalink raw reply
* Re: [PATCH 5/5] net/virtio: fix Tso when mbuf is shared
From: Stephen Hemminger @ 2017-01-09 17:59 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, yuanhan.liu, maxime.coquelin, huawei.xie
In-Reply-To: <1479977798-13417-6-git-send-email-olivier.matz@6wind.com>
On Thu, 24 Nov 2016 09:56:38 +0100
Olivier Matz <olivier.matz@6wind.com> wrote:
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 22d97a4..577c775 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -211,43 +211,73 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct rte_mbuf *cookie)
>
> /* When doing TSO, the IP length is not included in the pseudo header
> * checksum of the packet given to the PMD, but for virtio it is
> - * expected.
> + * expected. Fix the mbuf or a copy if the mbuf is shared.
> */
> -static void
> -virtio_tso_fix_cksum(struct rte_mbuf *m)
> +static unsigned int
> +virtio_tso_fix_cksum(struct rte_mbuf *m, char *hdr, size_t hdr_sz)
> {
> - /* common case: header is not fragmented */
> - if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len +
> - m->l4_len)) {
> - struct ipv4_hdr *iph;
> - struct ipv6_hdr *ip6h;
> - struct tcp_hdr *th;
> - uint16_t prev_cksum, new_cksum, ip_len, ip_paylen;
> - uint32_t tmp;
> -
> - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len);
> - th = RTE_PTR_ADD(iph, m->l3_len);
> - if ((iph->version_ihl >> 4) == 4) {
> - iph->hdr_checksum = 0;
> - iph->hdr_checksum = rte_ipv4_cksum(iph);
> - ip_len = iph->total_length;
> - ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) -
> - m->l3_len);
> - } else {
> - ip6h = (struct ipv6_hdr *)iph;
> - ip_paylen = ip6h->payload_len;
> + struct ipv4_hdr *iph, iph_copy;
> + struct ipv6_hdr *ip6h = NULL, ip6h_copy;
> + struct tcp_hdr *th, th_copy;
> + size_t hdrlen = m->l2_len + m->l3_len + m->l4_len;
> + uint16_t prev_cksum, new_cksum, ip_len, ip_paylen;
> + uint32_t tmp;
> + int shared = 0;
Minor nit, uses bool instead of int for shared?
^ permalink raw reply
* Re: [PATCH v2 0/5] Elastic Flow Distributor
From: Maciocco, Christian @ 2017-01-09 18:19 UTC (permalink / raw)
To: De Lara Guarch, Pablo, dev@dpdk.org; +Cc: De Lara Guarch, Pablo
In-Reply-To: <1483751166-32423-1-git-send-email-pablo.de.lara.guarch@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Friday, January 06, 2017 5:06 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev] [PATCH v2 0/5] Elastic Flow Distributor
>
> EFD is a distributor library that uses perfect hashing to determine a target/value
> for a given incoming flow key. It has the following advantages:
> first, because it uses perfect hashing it does not store the key itself and hence
> lookup performance is not dependent on the key size. Second, the target/value
> can be any arbitrary value hence the system designer and/or operator can better
> optimize service rates and inter-cluster network traffic locating. Third, since the
> storage requirement is much smaller than a hash-based flow table (i.e. better fit
> for CPU cache), EFD can scale to millions of flow keys. Finally, with current
> optimized library implementation performance is fully scalable with number of
> CPU cores.
>
> The basic idea of EFD is when a given key is to be inserted, a family of hash
> functions is searched until the correct hash function that maps the input key to
> the correct value is found. However, rather than explicitly storing all keys and
> their associated values, EFD stores only indices of hash functions that map keys
> to values, and thereby consumes much less space than conventional flow-based
> tables. The lookup operation is very simple, similar to computational-based
> scheme, given an input key the lookup operation is reduced to hashing that key
> with the correct hash function.
>
> Intuitively, finding a hash function that maps each of a large number (millions) of
> input keys to the correct output value is effectively impossible, as a result EFD,
> breaks the problem into smaller pieces (divide and conquer). EFD divides the
> entire input key set into many small groups. Each group consists of
> approximately 20-28 keys (a configurable parameter for the library), then, for
> each small group, a brute force search to find a hash function that produces the
> correct outputs for each key in the group.
> It should be mentioned that since in the online lookup table for EFD doesn’t
> store the key itself, the size of the EFD table is independent of the key size and
> hence EFD lookup performance which is almost constant irrespective of the
> length of the key which is a highly desirable feature especially for longer keys.
>
> Library code is included in the patch, plus an sample application that shows how
> the library can be used.
>
> RFC for this library was already sent:
> http://dpdk.org/ml/archives/dev/2016-October/049238.html
>
> For more information on the library, check out the following document:
> https://github.com/pablodelara/perfect_hash_flow_distributor/blob/master/EF
> D_description.pdf
>
> Changes in v2:
>
> - Added documentation for library and sample app
> - Fixed checkpatch errors/warnings
> - Added functional and performance tests
> - Made key size variable at runtime
> - Made code multi-architecture compatible at runtime
>
>
> Pablo de Lara (5):
> efd: new Elastic Flow Distributor library
> app/test: add EFD functional and perf tests
> examples/flow_distributor: sample app to demonstrate EFD usage
> doc: add EFD library section in Programmers guide
> doc: add flow distributor guide
>
> MAINTAINERS | 9 +
> app/test/Makefile | 3 +
> app/test/test_efd.c | 494 ++++++++
> app/test/test_efd_perf.c | 407 ++++++
> config/common_base | 5 +
> doc/api/doxy-api-index.md | 3 +-
> doc/api/doxy-api.conf | 1 +
> doc/api/examples.dox | 4 +
> doc/guides/prog_guide/efd_lib.rst | 413 ++++++
> doc/guides/prog_guide/img/efd_i1.svg | 78 ++
> doc/guides/prog_guide/img/efd_i10.svg | 1272 +++++++++++++++++++
> doc/guides/prog_guide/img/efd_i11.svg | 413 ++++++
> doc/guides/prog_guide/img/efd_i12.svg | 590 +++++++++
> doc/guides/prog_guide/img/efd_i13.svg | 1407
> +++++++++++++++++++++
> doc/guides/prog_guide/img/efd_i2.svg | 209 +++
> doc/guides/prog_guide/img/efd_i3.svg | 420 ++++++
> doc/guides/prog_guide/img/efd_i4.svg | 364 ++++++
> doc/guides/prog_guide/img/efd_i5.svg | 578 +++++++++
> doc/guides/prog_guide/img/efd_i6.svg | 413 ++++++
> doc/guides/prog_guide/img/efd_i8.svg | 776 ++++++++++++
> doc/guides/prog_guide/img/efd_i9.svg | 271 ++++
> doc/guides/prog_guide/index.rst | 1 +
> doc/guides/rel_notes/release_17_02.rst | 15 +
> doc/guides/sample_app_ug/flow_distributor.rst | 492 +++++++
> doc/guides/sample_app_ug/img/flow_distributor.svg | 417 ++++++
> doc/guides/sample_app_ug/index.rst | 1 +
> examples/Makefile | 1 +
> examples/flow_distributor/Makefile | 44 +
> examples/flow_distributor/distributor/Makefile | 57 +
> examples/flow_distributor/distributor/args.c | 200 +++
> examples/flow_distributor/distributor/args.h | 39 +
> examples/flow_distributor/distributor/init.c | 371 ++++++
> examples/flow_distributor/distributor/init.h | 76 ++
> examples/flow_distributor/distributor/main.c | 362 ++++++
> examples/flow_distributor/node/Makefile | 48 +
> examples/flow_distributor/node/node.c | 417 ++++++
> examples/flow_distributor/shared/common.h | 99 ++
> lib/Makefile | 1 +
> lib/librte_eal/common/include/rte_log.h | 1 +
> lib/librte_efd/Makefile | 56 +
> lib/librte_efd/rte_efd.c | 1354 ++++++++++++++++++++
> lib/librte_efd/rte_efd.h | 294 +++++
> lib/librte_efd/rte_efd_version.map | 12 +
> mk/rte.app.mk | 1 +
> 44 files changed, 12488 insertions(+), 1 deletion(-) create mode 100644
> app/test/test_efd.c create mode 100644 app/test/test_efd_perf.c create
> mode 100644 doc/guides/prog_guide/efd_lib.rst create mode 100644
> doc/guides/prog_guide/img/efd_i1.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i10.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i11.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i12.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i13.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i2.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i3.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i4.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i5.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i6.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i8.svg
> create mode 100644 doc/guides/prog_guide/img/efd_i9.svg
> create mode 100644 doc/guides/sample_app_ug/flow_distributor.rst
> create mode 100644 doc/guides/sample_app_ug/img/flow_distributor.svg
> create mode 100644 examples/flow_distributor/Makefile
> create mode 100644 examples/flow_distributor/distributor/Makefile
> create mode 100644 examples/flow_distributor/distributor/args.c
> create mode 100644 examples/flow_distributor/distributor/args.h
> create mode 100644 examples/flow_distributor/distributor/init.c
> create mode 100644 examples/flow_distributor/distributor/init.h
> create mode 100644 examples/flow_distributor/distributor/main.c
> create mode 100644 examples/flow_distributor/node/Makefile
> create mode 100644 examples/flow_distributor/node/node.c
> create mode 100644 examples/flow_distributor/shared/common.h
> create mode 100644 lib/librte_efd/Makefile create mode 100644
> lib/librte_efd/rte_efd.c create mode 100644 lib/librte_efd/rte_efd.h create
> mode 100644 lib/librte_efd/rte_efd_version.map
>
> --
> 2.7.4
Series-acked-by: Christian Maciocco <christian.maciocco@intel.com>
^ permalink raw reply
* [PATCH v2] net/enic: add support for TSO
From: John Daley @ 2017-01-09 18:58 UTC (permalink / raw)
To: ferruh.yigit; +Cc: bruce.richardson, dev, John Daley
In-Reply-To: <93fdc344-8c32-aaad-817a-c33c89aa821c@intel.com>
The enic TSO implementation requires that the length of the Eth/IP/TCP
headers be passed to the NIC. Other than that, it's just a matter of
setting the mss and offload mode on a per packet basis.
In TSO mode, IP and TCP checksums are offloaded even if not requested
with mb->ol_flags.
Signed-off-by: John Daley <johndale@cisco.com>
---
v2: document TSO feature for enic
doc/guides/nics/features/enic.ini | 1 +
drivers/net/enic/enic_ethdev.c | 3 +-
drivers/net/enic/enic_rxtx.c | 93 ++++++++++++++++++++++++++++++++++-----
3 files changed, 84 insertions(+), 13 deletions(-)
diff --git a/doc/guides/nics/features/enic.ini b/doc/guides/nics/features/enic.ini
index 86576a7..51b330f 100644
--- a/doc/guides/nics/features/enic.ini
+++ b/doc/guides/nics/features/enic.ini
@@ -10,6 +10,7 @@ Queue start/stop = Y
MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
+TSO = Y
Promiscuous mode = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index e5ceb98..c3ba2aa 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -475,7 +475,8 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
- DEV_TX_OFFLOAD_TCP_CKSUM;
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_TSO;
device_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH
};
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index f762a26..ed2b721 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -37,6 +37,9 @@
#include "enic_compat.h"
#include "rq_enet_desc.h"
#include "enic.h"
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_tcp.h>
#define RTE_PMD_USE_PREFETCH
@@ -129,6 +132,60 @@ enic_cq_rx_desc_n_bytes(struct cq_desc *cqd)
CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
}
+/* Find the offset to L5. This is needed by enic TSO implementation.
+ * Return 0 if not a TCP packet or can't figure out the length.
+ */
+static inline uint8_t tso_header_len(struct rte_mbuf *mbuf)
+{
+ struct ether_hdr *eh;
+ struct vlan_hdr *vh;
+ struct ipv4_hdr *ip4;
+ struct ipv6_hdr *ip6;
+ struct tcp_hdr *th;
+ uint8_t hdr_len;
+ uint16_t ether_type;
+
+ /* offset past Ethernet header */
+ eh = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
+ ether_type = eh->ether_type;
+ hdr_len = sizeof(struct ether_hdr);
+ if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+ vh = rte_pktmbuf_mtod_offset(mbuf, struct vlan_hdr *, hdr_len);
+ ether_type = vh->eth_proto;
+ hdr_len += sizeof(struct vlan_hdr);
+ }
+
+ /* offset past IP header */
+ switch (rte_be_to_cpu_16(ether_type)) {
+ case ETHER_TYPE_IPv4:
+ ip4 = rte_pktmbuf_mtod_offset(mbuf, struct ipv4_hdr *, hdr_len);
+ if (ip4->next_proto_id != IPPROTO_TCP)
+ return 0;
+ hdr_len += (ip4->version_ihl & 0xf) * 4;
+ break;
+ case ETHER_TYPE_IPv6:
+ ip6 = rte_pktmbuf_mtod_offset(mbuf, struct ipv6_hdr *, hdr_len);
+ if (ip6->proto != IPPROTO_TCP)
+ return 0;
+ hdr_len += sizeof(struct ipv6_hdr);
+ break;
+ default:
+ return 0;
+ }
+
+ if ((hdr_len + sizeof(struct tcp_hdr)) > mbuf->pkt_len)
+ return 0;
+
+ /* offset past TCP header */
+ th = rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, hdr_len);
+ hdr_len += (th->data_off >> 4) * 4;
+
+ if (hdr_len > mbuf->pkt_len)
+ return 0;
+
+ return hdr_len;
+}
+
static inline uint8_t
enic_cq_rx_check_err(struct cq_desc *cqd)
{
@@ -462,10 +519,12 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
struct vnic_wq_buf *buf;
unsigned int desc_count;
struct wq_enet_desc *descs, *desc_p, desc_tmp;
- uint16_t mss;
+ uint16_t mss = 0;
uint8_t vlan_tag_insert;
uint8_t eop;
uint64_t bus_addr;
+ uint8_t offload_mode;
+ uint16_t header_len;
enic_cleanup_wq(enic, wq);
wq_desc_avail = vnic_wq_desc_avail(wq);
@@ -487,7 +546,6 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
pkt_len = tx_pkt->pkt_len;
data_len = tx_pkt->data_len;
ol_flags = tx_pkt->ol_flags;
- mss = 0;
vlan_id = 0;
vlan_tag_insert = 0;
bus_addr = (dma_addr_t)
@@ -497,13 +555,17 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
desc_p = descs + head_idx;
eop = (data_len == pkt_len);
-
- if (ol_flags & ol_flags_mask) {
- if (ol_flags & PKT_TX_VLAN_PKT) {
- vlan_tag_insert = 1;
- vlan_id = tx_pkt->vlan_tci;
+ offload_mode = WQ_ENET_OFFLOAD_MODE_CSUM;
+ header_len = 0;
+
+ if (tx_pkt->tso_segsz) {
+ header_len = tso_header_len(tx_pkt);
+ if (header_len) {
+ offload_mode = WQ_ENET_OFFLOAD_MODE_TSO;
+ mss = tx_pkt->tso_segsz;
}
-
+ }
+ if ((ol_flags & ol_flags_mask) && (header_len == 0)) {
if (ol_flags & PKT_TX_IP_CKSUM)
mss |= ENIC_CALC_IP_CKSUM;
@@ -516,8 +578,14 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
}
- wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, 0, 0, eop,
- eop, 0, vlan_tag_insert, vlan_id, 0);
+ if (ol_flags & PKT_TX_VLAN_PKT) {
+ vlan_tag_insert = 1;
+ vlan_id = tx_pkt->vlan_tci;
+ }
+
+ wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, header_len,
+ offload_mode, eop, eop, 0, vlan_tag_insert,
+ vlan_id, 0);
*desc_p = desc_tmp;
buf = &wq->bufs[head_idx];
@@ -537,8 +605,9 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+ tx_pkt->data_off);
wq_enet_desc_enc((struct wq_enet_desc *)
&desc_tmp, bus_addr, data_len,
- mss, 0, 0, eop, eop, 0,
- vlan_tag_insert, vlan_id, 0);
+ mss, 0, offload_mode, eop, eop,
+ 0, vlan_tag_insert, vlan_id,
+ 0);
*desc_p = desc_tmp;
buf = &wq->bufs[head_idx];
--
2.10.0
^ permalink raw reply related
* [PATCH v3] net/enic: add support for TSO
From: John Daley @ 2017-01-09 23:04 UTC (permalink / raw)
To: ferruh.yigit; +Cc: bruce.richardson, dev, John Daley
In-Reply-To: <93fdc344-8c32-aaad-817a-c33c89aa821c@intel.com>
The enic TSO implementation requires that the length of the Eth/IP/TCP
headers be passed to the NIC. Other than that, it's just a matter of
setting the mss and offload mode on a per packet basis.
In TSO mode, IP and TCP checksums are offloaded even if not requested
with mb->ol_flags.
Signed-off-by: John Daley <johndale@cisco.com>
---
v2: document TSO feature for enic
v3: initialize enic mss field on every packet
doc/guides/nics/features/enic.ini | 1 +
drivers/net/enic/enic_ethdev.c | 3 +-
drivers/net/enic/enic_rxtx.c | 90 ++++++++++++++++++++++++++++++++++-----
3 files changed, 83 insertions(+), 11 deletions(-)
diff --git a/doc/guides/nics/features/enic.ini b/doc/guides/nics/features/enic.ini
index 86576a7..51b330f 100644
--- a/doc/guides/nics/features/enic.ini
+++ b/doc/guides/nics/features/enic.ini
@@ -10,6 +10,7 @@ Queue start/stop = Y
MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
+TSO = Y
Promiscuous mode = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index e5ceb98..c3ba2aa 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -475,7 +475,8 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
- DEV_TX_OFFLOAD_TCP_CKSUM;
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_TSO;
device_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH
};
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index f762a26..5d59d8f 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -37,6 +37,9 @@
#include "enic_compat.h"
#include "rq_enet_desc.h"
#include "enic.h"
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_tcp.h>
#define RTE_PMD_USE_PREFETCH
@@ -129,6 +132,60 @@ enic_cq_rx_desc_n_bytes(struct cq_desc *cqd)
CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
}
+/* Find the offset to L5. This is needed by enic TSO implementation.
+ * Return 0 if not a TCP packet or can't figure out the length.
+ */
+static inline uint8_t tso_header_len(struct rte_mbuf *mbuf)
+{
+ struct ether_hdr *eh;
+ struct vlan_hdr *vh;
+ struct ipv4_hdr *ip4;
+ struct ipv6_hdr *ip6;
+ struct tcp_hdr *th;
+ uint8_t hdr_len;
+ uint16_t ether_type;
+
+ /* offset past Ethernet header */
+ eh = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
+ ether_type = eh->ether_type;
+ hdr_len = sizeof(struct ether_hdr);
+ if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+ vh = rte_pktmbuf_mtod_offset(mbuf, struct vlan_hdr *, hdr_len);
+ ether_type = vh->eth_proto;
+ hdr_len += sizeof(struct vlan_hdr);
+ }
+
+ /* offset past IP header */
+ switch (rte_be_to_cpu_16(ether_type)) {
+ case ETHER_TYPE_IPv4:
+ ip4 = rte_pktmbuf_mtod_offset(mbuf, struct ipv4_hdr *, hdr_len);
+ if (ip4->next_proto_id != IPPROTO_TCP)
+ return 0;
+ hdr_len += (ip4->version_ihl & 0xf) * 4;
+ break;
+ case ETHER_TYPE_IPv6:
+ ip6 = rte_pktmbuf_mtod_offset(mbuf, struct ipv6_hdr *, hdr_len);
+ if (ip6->proto != IPPROTO_TCP)
+ return 0;
+ hdr_len += sizeof(struct ipv6_hdr);
+ break;
+ default:
+ return 0;
+ }
+
+ if ((hdr_len + sizeof(struct tcp_hdr)) > mbuf->pkt_len)
+ return 0;
+
+ /* offset past TCP header */
+ th = rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, hdr_len);
+ hdr_len += (th->data_off >> 4) * 4;
+
+ if (hdr_len > mbuf->pkt_len)
+ return 0;
+
+ return hdr_len;
+}
+
static inline uint8_t
enic_cq_rx_check_err(struct cq_desc *cqd)
{
@@ -466,6 +523,8 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint8_t vlan_tag_insert;
uint8_t eop;
uint64_t bus_addr;
+ uint8_t offload_mode;
+ uint16_t header_len;
enic_cleanup_wq(enic, wq);
wq_desc_avail = vnic_wq_desc_avail(wq);
@@ -497,13 +556,17 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
desc_p = descs + head_idx;
eop = (data_len == pkt_len);
-
- if (ol_flags & ol_flags_mask) {
- if (ol_flags & PKT_TX_VLAN_PKT) {
- vlan_tag_insert = 1;
- vlan_id = tx_pkt->vlan_tci;
+ offload_mode = WQ_ENET_OFFLOAD_MODE_CSUM;
+ header_len = 0;
+
+ if (tx_pkt->tso_segsz) {
+ header_len = tso_header_len(tx_pkt);
+ if (header_len) {
+ offload_mode = WQ_ENET_OFFLOAD_MODE_TSO;
+ mss = tx_pkt->tso_segsz;
}
-
+ }
+ if ((ol_flags & ol_flags_mask) && (header_len == 0)) {
if (ol_flags & PKT_TX_IP_CKSUM)
mss |= ENIC_CALC_IP_CKSUM;
@@ -516,8 +579,14 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
}
- wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, 0, 0, eop,
- eop, 0, vlan_tag_insert, vlan_id, 0);
+ if (ol_flags & PKT_TX_VLAN_PKT) {
+ vlan_tag_insert = 1;
+ vlan_id = tx_pkt->vlan_tci;
+ }
+
+ wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, header_len,
+ offload_mode, eop, eop, 0, vlan_tag_insert,
+ vlan_id, 0);
*desc_p = desc_tmp;
buf = &wq->bufs[head_idx];
@@ -537,8 +606,9 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+ tx_pkt->data_off);
wq_enet_desc_enc((struct wq_enet_desc *)
&desc_tmp, bus_addr, data_len,
- mss, 0, 0, eop, eop, 0,
- vlan_tag_insert, vlan_id, 0);
+ mss, 0, offload_mode, eop, eop,
+ 0, vlan_tag_insert, vlan_id,
+ 0);
*desc_p = desc_tmp;
buf = &wq->bufs[head_idx];
--
2.10.0
^ permalink raw reply related
* [PATCH v2 0/7] minor cleanup
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Mostly things found while inspecting other code.
Stephen Hemminger (7):
bonding,malloc,bitmap: remove useless return
ethdev: reduce goto's in attach/detach
bnx2x: remove useless return's
kni: remove useless return statements
i40e: remove useless return
ixgbe: remove useless return
igb: remove useless return's
drivers/net/bnx2x/bnx2x.c | 2 -
drivers/net/bnx2x/bnx2x_ethdev.c | 2 -
drivers/net/bnx2x/elink.c | 1 -
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/e1000/igb_pf.c | 2 -
drivers/net/i40e/i40e_ethdev_vf.c | 3 --
drivers/net/ixgbe/ixgbe_82599_bypass.c | 10 ++---
lib/librte_eal/common/rte_malloc.c | 1 -
.../linuxapp/kni/ethtool/igb/e1000_82575.c | 4 --
.../linuxapp/kni/ethtool/igb/e1000_i210.c | 2 -
.../linuxapp/kni/ethtool/igb/e1000_mac.c | 4 --
.../linuxapp/kni/ethtool/igb/e1000_phy.c | 1 -
.../linuxapp/kni/ethtool/igb/igb_ethtool.c | 3 +-
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 2 -
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c | 11 +----
.../linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c | 2 -
lib/librte_ether/rte_ethdev.c | 52 +++++++++-------------
lib/librte_sched/rte_bitmap.h | 2 -
18 files changed, 29 insertions(+), 77 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH 1/7] bonding, malloc, bitmap: remove useless return
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
return statements at end of void functions are unnecessary and unwanted.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
lib/librte_eal/common/rte_malloc.c | 1 -
lib/librte_sched/rte_bitmap.h | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c1796f22..dd9cfa47 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -241,8 +241,8 @@ arp_op_name(uint16_t arp_op, char *buf)
default:
break;
}
+
snprintf(buf, sizeof("Unknown"), "%s", "Unknown");
- return;
}
#endif
#define MaxIPv4String 16
diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index f4a88352..09970b06 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -232,7 +232,6 @@ rte_malloc_dump_stats(FILE *f, __rte_unused const char *type)
fprintf(f, "\tAlloc_count:%u,\n",sock_stats.alloc_count);
fprintf(f, "\tFree_count:%u,\n", sock_stats.free_count);
}
- return;
}
/*
diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
index 010d752c..d432fdfe 100644
--- a/lib/librte_sched/rte_bitmap.h
+++ b/lib/librte_sched/rte_bitmap.h
@@ -453,8 +453,6 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;
slab1 = bmp->array1 + index1;
*slab1 &= ~(1lu << offset1);
-
- return;
}
static inline int
--
2.11.0
^ permalink raw reply related
* [PATCH 2/7] ethdev: reduce goto's in attach/detach
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
Extra goto's to just a return are unnecessary.
Don't do unnecessary initialization. Propgate return value.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_ether/rte_ethdev.c | 52 +++++++++++++++++--------------------------
1 file changed, 21 insertions(+), 31 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9dea1f15..2bd7db6d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -419,18 +419,17 @@ rte_eth_dev_is_detachable(uint8_t port_id)
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- int ret = -1;
int current = rte_eth_dev_count();
char *name = NULL;
char *args = NULL;
+ int ret;
- if ((devargs == NULL) || (port_id == NULL)) {
- ret = -EINVAL;
- goto err;
- }
+ if (devargs == NULL || port_id == NULL)
+ return -EINVAL;
/* parse devargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ ret = rte_eal_parse_devargs_str(devargs, &name, &args);
+ if (ret < 0)
goto err;
ret = rte_eal_dev_attach(name, args);
@@ -441,20 +440,18 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
if (!rte_eth_dev_count()) {
RTE_LOG(ERR, EAL, "No port found for device (%s)\n", name);
ret = -1;
- goto err;
- }
-
- /* if nothing happened, there is a bug here, since some driver told us
- * it did attach a device, but did not create a port.
- */
- if (current == rte_eth_dev_count()) {
+ } else if (current == rte_eth_dev_count()) {
+ /*
+ * if nothing happened, there is a bug here, since
+ * some driver told us it did attach a device, but did
+ * not create a port.
+ */
ret = -1;
- goto err;
+ } else {
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
}
- *port_id = eth_dev_last_created_port;
- ret = 0;
-
err:
free(name);
free(args);
@@ -465,27 +462,20 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- int ret = -1;
+ int ret;
- if (name == NULL) {
- ret = -EINVAL;
- goto err;
- }
+ if (name == NULL)
+ return -EINVAL;
/* FIXME: move this to eal, once device flags are relocated there */
- if (rte_eth_dev_is_detachable(port_id))
- goto err;
+ ret = rte_eth_dev_is_detachable(port_id);
+ if (ret < 0)
+ return ret;
snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
"%s", rte_eth_devices[port_id].data->name);
- ret = rte_eal_dev_detach(name);
- if (ret < 0)
- goto err;
- return 0;
-
-err:
- return ret;
+ return rte_eal_dev_detach(name);
}
static int
--
2.11.0
^ permalink raw reply related
* [PATCH 3/7] bnx2x: remove useless return's
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
Don't need empty return; at end of void function.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnx2x/bnx2x.c | 2 --
drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
drivers/net/bnx2x/elink.c | 1 -
3 files changed, 5 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 28566302..38068f6b 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1371,8 +1371,6 @@ static void bnx2x_drain_tx_queues(struct bnx2x_softc *sc)
rmb();
}
}
-
- return;
}
static int
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7140118f..1d38c4bf 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -225,8 +225,6 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
PMD_DRV_LOG(DEBUG, "bnx2x_nic_unload failed (%d)", ret);
return;
}
-
- return;
}
static void
diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
index 53293962..287869d5 100644
--- a/drivers/net/bnx2x/elink.c
+++ b/drivers/net/bnx2x/elink.c
@@ -10362,7 +10362,6 @@ static void elink_5461x_set_link_led(struct elink_phy *phy,
elink_cl22_write(sc, phy,
MDIO_REG_GPHY_SHADOW,
MDIO_REG_GPHY_SHADOW_WR_ENA | temp);
- return;
}
static void elink_54618se_link_reset(struct elink_phy *phy,
--
2.11.0
^ permalink raw reply related
* [PATCH 4/7] kni: remove useless return statements
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
A return statement at end of void function is unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c | 4 ----
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c | 2 --
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c | 4 ----
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c | 1 -
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c | 3 +--
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 2 --
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c | 11 ++---------
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c | 2 --
8 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
index d558af20..d0f77b11 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
@@ -1384,8 +1384,6 @@ void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw)
E1000_WRITE_FLUSH(hw);
msec_delay(1);
}
-
- return;
}
/**
@@ -2034,8 +2032,6 @@ static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw)
/* If the management interface is not enabled, then power down */
if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw)))
e1000_power_down_phy_copper(hw);
-
- return;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
index 7e4c20a9..7b81fa65 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
@@ -798,8 +798,6 @@ void e1000_init_function_pointers_i210(struct e1000_hw *hw)
{
e1000_init_function_pointers_82575(hw);
hw->nvm.ops.init_params = e1000_init_nvm_params_i210;
-
- return;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
index 74319def..4e003dea 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
@@ -90,7 +90,6 @@ s32 e1000_null_ops_generic(struct e1000_hw E1000_UNUSEDARG *hw)
void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw)
{
DEBUGFUNC("e1000_null_mac_generic");
- return;
}
/**
@@ -122,7 +121,6 @@ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw,
u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
{
DEBUGFUNC("e1000_null_update_mc");
- return;
}
/**
@@ -133,7 +131,6 @@ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw,
u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b)
{
DEBUGFUNC("e1000_null_write_vfta");
- return;
}
/**
@@ -144,7 +141,6 @@ void e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw,
u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
{
DEBUGFUNC("e1000_null_rar_set");
- return;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
index d8a77c45..185c14e9 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
@@ -115,7 +115,6 @@ s32 e1000_null_read_reg(struct e1000_hw E1000_UNUSEDARG *hw,
void e1000_null_phy_generic(struct e1000_hw E1000_UNUSEDARG *hw)
{
DEBUGFUNC("e1000_null_phy_generic");
- return;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
index d7a987d5..8a79f386 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
@@ -2415,9 +2415,8 @@ static void igb_get_dmac(struct net_device *netdev,
struct ethtool_value *edata)
{
struct igb_adapter *adapter = netdev_priv(netdev);
- edata->data = adapter->dmac;
- return;
+ edata->data = adapter->dmac;
}
#endif
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index f4dca5a3..1f77db2c 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2492,8 +2492,6 @@ static void igb_set_fw_version(struct igb_adapter *adapter)
}
break;
}
-
- return;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
index 205da562..f48aebb0 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
@@ -197,8 +197,6 @@ void igb_vmdq_set_rx_mode(struct net_device *dev)
#endif
}
E1000_WRITE_REG(hw, E1000_VMOLR(hw_queue), vmolr);
-
- return;
}
int igb_vmdq_set_mac(struct net_device *dev, void *p)
@@ -247,9 +245,8 @@ void igb_vmdq_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
igb_enable_vlan_tags(adapter);
E1000_WRITE_REG(hw, E1000_VMVIR(hw_queue), 0);
-
- return;
}
+
void igb_vmdq_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
{
struct igb_vmdq_adapter *vadapter = netdev_priv(dev);
@@ -272,9 +269,8 @@ void igb_vmdq_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
v_netdev->features |= adapter->netdev->features;
vlan_group_set_device(vadapter->vlgrp, vid, v_netdev);
#endif
-
- return;
}
+
void igb_vmdq_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
{
struct igb_vmdq_adapter *vadapter = netdev_priv(dev);
@@ -285,9 +281,6 @@ void igb_vmdq_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
vlan_group_set_device(vadapter->vlgrp, vid, NULL);
/* remove vlan from VLVF table array */
igb_vlvf_set(adapter, vid, FALSE, hw_queue);
-
-
- return;
}
static int igb_vmdq_get_settings(struct net_device *netdev,
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
index e17b7f18..33a9213f 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
@@ -1291,6 +1291,4 @@ static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
/* Setup Tx packet buffer sizes */
for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++)
IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), IXGBE_TXPBSIZE_40KB);
-
- return;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 5/7] i40e: remove useless return
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
No need for return at end of void function.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/i40e/i40e_ethdev_vf.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 0dc0af52..482b339c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -882,8 +882,6 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
if (err)
PMD_DRV_LOG(ERR, "fail to execute command "
"OP_ADD_ETHER_ADDRESS");
-
- return;
}
static void
@@ -923,7 +921,6 @@ i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
if (err)
PMD_DRV_LOG(ERR, "fail to execute command "
"OP_DEL_ETHER_ADDRESS");
- return;
}
static int
--
2.11.0
^ permalink raw reply related
* [PATCH 6/7] ixgbe: remove useless return
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
In-Reply-To: <20170109233022.31154-1-stephen@networkplumber.org>
If all goto's lead to a return, then better to get rid of goto.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ixgbe/ixgbe_82599_bypass.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_82599_bypass.c b/drivers/net/ixgbe/ixgbe_82599_bypass.c
index de9fa5a7..af55cc0a 100644
--- a/drivers/net/ixgbe/ixgbe_82599_bypass.c
+++ b/drivers/net/ixgbe/ixgbe_82599_bypass.c
@@ -73,7 +73,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
&eeprom_data);
if (status) {
PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS0");
- goto out;
+ return;
}
eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
@@ -83,7 +83,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
eeprom_data);
if (status) {
PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS0");
- goto out;
+ return;
}
/* Set RS1 */
@@ -92,7 +92,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
&eeprom_data);
if (status) {
PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS1");
- goto out;
+ return;
}
eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
@@ -102,10 +102,8 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
eeprom_data);
if (status) {
PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS1");
- goto out;
+ return;
}
-out:
- return;
}
/**
--
2.11.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox