Commit Graph

6516 Commits

Author SHA1 Message Date
Tomasz Kulasek
9b134aa397 net/fm10k: add Tx preparation
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-04 20:40:24 +01:00
Tomasz Kulasek
3f33e643e5 net/i40e: add Tx preparation
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-04 20:40:24 +01:00
Tomasz Kulasek
7829b8d52b net/ixgbe: add Tx preparation
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-04 20:40:22 +01:00
Tomasz Kulasek
2b76648872 net/e1000: add Tx preparation
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-04 20:40:20 +01:00
Tomasz Kulasek
4fb7e803eb ethdev: add Tx preparation
Added API for `rte_eth_tx_prepare`

uint16_t rte_eth_tx_prepare(uint8_t port_id, uint16_t queue_id,
	struct rte_mbuf **tx_pkts, uint16_t nb_pkts)

Added fields to the `struct rte_eth_desc_lim`:

	uint16_t nb_seg_max;
		/**< Max number of segments per whole packet. */

	uint16_t nb_mtu_seg_max;
		/**< Max number of segments per one MTU */

These fields can be used to create valid packets according to the
following rules:

 * For non-TSO packet, a single transmit packet may span up to
   "nb_mtu_seg_max" buffers.

 * For TSO packet the total number of data descriptors is "nb_seg_max",
   and each segment within the TSO may span up to "nb_mtu_seg_max".

Added functions:

int
rte_validate_tx_offload(struct rte_mbuf *m)

  to validate general requirements for tx offload set in mbuf of packet
  such a flag completness. In current implementation this function is
  called optionaly when RTE_LIBRTE_ETHDEV_DEBUG is enabled.

int rte_net_intel_cksum_prepare(struct rte_mbuf *m)

  to prepare pseudo header checksum for TSO and non-TSO tcp/udp packets
  before hardware tx checksum offload.
   - for non-TSO tcp/udp packets full pseudo-header checksum is
     counted and set.
   - for TSO the IP payload length is not included.

int
rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)

  this function uses same logic as rte_net_intel_cksum_prepare, but
  allows application to choose which offloads should be taken into
  account, if full preparation is not required.

PERFORMANCE TESTS
-----------------

This feature was tested with modified csum engine from test-pmd.

The packet checksum preparation was moved from application to Tx
preparation step placed before burst.

We may expect some overhead costs caused by:
1) using additional callback before burst,
2) rescanning burst,
3) additional condition checking (packet validation),
4) worse optimization (e.g. packet data access, etc.)

We tested it using ixgbe Tx preparation implementation with some parts
disabled to have comparable information about the impact of different
parts of implementation.

IMPACT:

1) For unimplemented Tx preparation callback the performance impact is
   negligible,
2) For packet condition check without checksum modifications (nb_segs,
   available offloads, etc.) is 14626628/14252168 (~2.62% drop),
3) Full support in ixgbe driver (point 2 + packet checksum
   initialization) is 14060924/13588094 (~3.48% drop)

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-04 20:40:15 +01:00
Olivier Matz
6d52d1d4af ethdev: clarify extended statistics documentation
Reword the API documentation of ethdev xstats.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2017-01-04 19:08:21 +01:00
Olivier Matz
513c78ae3f ethdev: fix extended statistics name index
The function rte_eth_xstats_get() return an array of tuples (id,
value). The value is the statistic counter, while the id references a
name in the array returned by rte_eth_xstats_get_name().

Today, each 'id' returned by rte_eth_xstats_get() is equal to the index
in the returned array, making this value useless. It also prevents a
driver from having different indexes for names and value, like in the
example below:

  rte_eth_xstats_get_name() returns:
    0: "rx0_stat"
    1: "rx1_stat"
    2: ...
    7: "rx7_stat"
    8: "tx0_stat"
    9: "tx1_stat"
    ...
    15: "tx7_stat"

  rte_eth_xstats_get() returns:
    0: id=0, val=<stat>    ("rx0_stat")
    1: id=1, val=<stat>    ("rx1_stat")
    2: id=8, val=<stat>    ("tx0_stat")
    3: id=9, val=<stat>    ("tx1_stat")

This patch fixes the drivers to set the 'id' in their ethdev->xstats_get()
(except e1000 which was already doing it), and fixes ethdev by not setting
the 'id' field to the index of the table for pmd-specific stats: instead,
they should just be shifted by the max number of generic statistics.

Fixes: bd6aa172cf ("ethdev: fetch extended statistics with integer ids")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2017-01-04 19:04:30 +01:00
Jan Blunck
eac901ce29 ethdev: decouple from PCI device
This makes struct rte_eth_dev independent of struct rte_pci_device by
replacing it with a pointer to the generic struct rte_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:30:19 +01:00
Jan Blunck
ae34410a8a ethdev: move info filling of PCI into drivers
Only the drivers itself can decide if it could fill PCI information fields
of dev_info.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:25:42 +01:00
Jan Blunck
0e1b45a284 ethdev: decouple interrupt handling from PCI device
The struct rte_intr_handle is an abstraction layer for different types of
interrupt mechanisms. It is embedded in the low-level device (e.g. PCI).
On allocation of a struct rte_eth_dev a reference to the intr_handle
should be stored for devices supporting interrupts.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:25:14 +01:00
Jan Blunck
36f8f62b7b net/vmxnet3: use driver name from ethdev
Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-25 23:23:37 +01:00
Jan Blunck
8acba705b1 net/szedata2: localize handling of PCI resources
This changes the driver to handle the PCI resource directly instead
of repeatedly going through eth_dev.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-25 23:20:22 +01:00
Jan Blunck
230862e88a net/nfp: localize mapping of ethdev to PCI device
This simplifies later changes to ethdev.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-25 23:18:28 +01:00
Jan Blunck
d4b7f6734f net/qede: localize mapping of ethdev to PCI device
This simplifies later changes to ethdev.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Harish Patil <harish.patil@qlogic.com>
2016-12-25 23:16:51 +01:00
Jan Blunck
ded03dbedc net/bnx2x: localize mapping of ethdev to PCI device
Use device private information to minimize the places that assume eth_dev
contains pci_dev.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Harish Patil <harish.patil@qlogic.com>
2016-12-25 23:15:09 +01:00
Jan Blunck
b9866505d8 net/fm10k: localize mapping of ethdev to PCI device
This simplifies later changes to ethdev.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-25 23:14:39 +01:00
Jan Blunck
6a7c0dfcdf net/virtio: do not depend on PCI device of ethdev
We don't need to depend on rte_eth_dev->pci_dev to differentiate between
the virtio_user and the virtio_pci case. Instead we can use the private
virtio_hw struct to get that information.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:12:35 +01:00
Jan Blunck
f5880e1f29 net/virtio: add helper to get interrrupt handle
This adds a helper to get the rte_intr_handle from the virtio_hw. This is
safe to do since the usage of the helper is guarded by RTE_ETH_DEV_INTR_LSC
which is only set if we found a PCI device during initialization.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:11:22 +01:00
Jan Blunck
4fe8b2eec8 net/virtio: remove useless driver name copy
This is overwritten in rte_eth_dev_info_get().

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: David Marchand <david.marchand@6wind.com>
2016-12-25 22:48:56 +01:00
Stephen Hemminger
61f607093f net/bnxt: localize mapping of ethdev to PCI device
Use existing information about pci and interrupt handle to minimize
the number of places that assume eth_dev contains pci_device
information.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:54:49 +01:00
Stephen Hemminger
2ce7a1ed09 net/i40e: localize mapping of ethdev to PCI device
Simplify later changes to eth_dev.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:54:48 +01:00
Stephen Hemminger
032e995864 net/ixgbe: localize mapping of ethdev to PCI device
Since later changes will change where PCI information is,
localize mapping in one macro.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:54:41 +01:00
Stephen Hemminger
2e8aad98fa net/e1000: localize mapping of ethdev to PCI device
Create one macro for where PCI device information is extracted
from ethernet device. Makes later changes easier to review, and test.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:54:33 +01:00
Stephen Hemminger
74343fa77d drivers: remove useless reset of PCI device pointer
Since rte_eth_dev_info_get does memset() on dev_info before
calling device specific code, the explicit assignment of NULL
in all these virtual drivers has no effect.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:47:19 +01:00
Stephen Hemminger
71ff78a7f7 eal: make driver pointer const in device struct
The info in rte_device about driver is immutable and
shouldn't change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-24 18:46:40 +01:00
Jan Blunck
bb30369dc1 eal: allow passing const interrupt handle
Both register/unregister and enable/disable don't necessarily require the
rte_intr_handle to be modifiable. Therefore lets constify it.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:45:50 +01:00
Jan Blunck
9b815f2141 eal: define container_of macro
This macro is based on Jan Viktorin's original patch but also checks the
type of the passed pointer against the type of the member.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
[jblunck@infradead.org: add type checking and __extension__]
Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:45:01 +01:00
Adrien Mazarguil
47a20b73e2 app/testpmd: fix flow command build on FreeBSD
A missing include causes the following compilation errors:

 error: use of undeclared identifier 'AF_INET'
 error: use of undeclared identifier 'AF_INET6'

Fixes: ef6e38550f ("app/testpmd: add items ipv4/ipv6 to flow command")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-12-23 16:55:36 +01:00
Adrien Mazarguil
3912aa3771 doc: update release notes for flow API
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-12-23 15:22:50 +01:00
Adrien Mazarguil
1419fd5a6c app/testpmd: add protocol fields to flow command
This commit exposes the following item fields through the flow command:

- VLAN priority code point, drop eligible indicator and VLAN identifier
  (all part of TCI).
- IPv4 type of service, time to live and protocol.
- IPv6 traffic class, flow label, next header and hop limit.
- SCTP tag and checksum.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-12-23 10:27:32 +01:00
Adrien Mazarguil
a997a33b2a doc: describe testpmd flow command
Document syntax, interaction with rte_flow and provide usage examples.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-12-23 10:26:51 +01:00
Adrien Mazarguil
05d34c6e9d app/testpmd: add queue actions to flow command
- QUEUE: assign packets to a given queue index.
- DUP: duplicate packets to a given queue index.
- RSS: spread packets among several queues.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:49 +01:00
Adrien Mazarguil
7a91969ad3 app/testpmd: add various actions to flow command
- MARK: attach 32 bit value to packets.
- FLAG: flag packets.
- DROP: drop packets.
- COUNT: enable counters for a rule.
- PF: redirect packets to physical device function.
- VF: redirect packets to virtual device function.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:39 +01:00
Adrien Mazarguil
638c4ad56d app/testpmd: add L4 items to flow command
Add the ability to match a few properties of common L4[.5] protocol
headers:

- ICMP: type and code.
- UDP: source and destination ports.
- TCP: source and destination ports.
- SCTP: source and destination ports.
- VXLAN: network identifier.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:22 +01:00
Adrien Mazarguil
ef6e38550f app/testpmd: add items ipv4/ipv6 to flow command
Add the ability to match basic fields from IPv4 and IPv6 headers (source
and destination addresses only).

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:20 +01:00
Adrien Mazarguil
6df81b325f app/testpmd: add items eth/vlan to flow command
These pattern items match basic Ethernet headers (source, destination and
type) and related 802.1Q/ad VLAN headers.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:14 +01:00
Adrien Mazarguil
abc3d81aca app/testpmd: add item raw to flow command
Matches arbitrary byte strings with properties:

- relative: look for pattern after the previous item.
- search: search pattern from offset (see also limit).
- offset: absolute or relative offset for pattern.
- limit: search area limit for start of pattern.
- length: pattern length.
- pattern: byte string to look for.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:13 +01:00
Adrien Mazarguil
02ef65f82c app/testpmd: add various items to flow command
- PF: match packets addressed to the physical function.
- VF: match packets addressed to a virtual function ID.
- PORT: device-specific physical port index to use.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:10 +01:00
Adrien Mazarguil
47bfa6adea app/testpmd: add item any to flow command
This pattern item matches any protocol in place of the current layer and
has two properties:

- min: minimum number of layers covered (0 or more).
- max: maximum number of layers covered (0 means infinity).

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:26:02 +01:00
Adrien Mazarguil
00d78f550f app/testpmd: support flow bit-field
Several rte_flow structures expose bit-fields that cannot be set in a
generic fashion at byte level. Add bit-mask support to handle them.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:25:50 +01:00
Adrien Mazarguil
d3f61b7bad app/testpmd: add flow item spec prefix length
Generating bit-masks from prefix lengths is often more convenient than
providing them entirely (e.g. to define IPv4 and IPv6 subnets).

This commit adds the "prefix" operator that assigns generated bit-masks to
any pattern item specification field.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:25:35 +01:00
Adrien Mazarguil
95f51cab43 app/testpmd: add flow item spec handler
Add parser code to fully set individual fields of pattern item
specification structures, using the following operators:

- fix: sets field and applies full bit-mask for perfect matching.
- spec: sets field without modifying its bit-mask.
- last: sets upper value of the spec => last range.
- mask: sets bit-mask affecting both spec and last from arbitrary value.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:30 +01:00
Adrien Mazarguil
5ac3502ed1 app/testpmd: add flow query command
Syntax:

 flow query {port_id} {rule_id} {action}

Query a specific action of an existing flow rule.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:28 +01:00
Adrien Mazarguil
fbe0e73e1d app/testpmd: add flow validate/create commands
Syntax:

 flow (validate|create) {port_id}
    [group {group_id}] [priority {level}] [ingress] [egress]
    pattern {item} [/ {item} [...]] / end
    actions {action} [/ {action} [...]] / end

Either check the validity of a flow rule or create it. Any number of
pattern items and actions can be provided in any order. Completion is
available for convenience.

This commit only adds support for the most basic item and action types,
namely:

- END: terminates pattern items and actions lists.
- VOID: item/action filler, no operation.
- INVERT: inverted pattern matching, process packets that do not match.
- PASSTHRU: action that leaves packets up for additional processing by
  subsequent flow rules.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:15 +01:00
Adrien Mazarguil
e0bbe277ce app/testpmd: add flow destroy command
Syntax:

 flow destroy {port_id} rule {rule_id} [...]

Destroy a given set of flow rules associated with a port.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:13 +01:00
Adrien Mazarguil
6ae4abac55 app/testpmd: add flow flush command
Syntax:

 flow flush {port_id}

Destroy all flow rules on a port.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:12 +01:00
Adrien Mazarguil
311569ab1b app/testpmd: add flow list command
Syntax:

 flow list {port_id} [group {group_id}] [...]

List configured flow rules on a port. Output can optionally be limited to a
given set of group identifiers.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:24:07 +01:00
Adrien Mazarguil
8a03ab58cc app/testpmd: support flow integer
Parse all integer types and handle conversion to network byte order in a
single function.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:20:54 +01:00
Adrien Mazarguil
19c90af628 app/testpmd: add flow command
Managing generic flow API functions from command line requires the use of
dynamic tokens for convenience as flow rules are not fixed and cannot be
defined statically.

This commit adds specific flexible parser code and object for a new "flow"
command in separate file.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:20:47 +01:00
Adrien Mazarguil
938a184a18 app/testpmd: implement basic support for flow API
Add basic management functions for the generic flow API (validate, create,
destroy, flush, query and list). Flow rule objects and properties are
arranged in lists associated with each port.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:19:15 +01:00