Commit Graph

237 Commits

Author SHA1 Message Date
Konstantin Ananyev
8d9c2c3a1f mbuf: add function to generate raw Tx offload value
Operations to set/update bit-fields often cause compilers
to generate suboptimal code.
To help avoid such situation for tx_offload fields:
introduce new enum for tx_offload bit-fields lengths and offsets,
and new function to generate raw tx_offload value.
Add new test-case into UT for introduced function.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-04-02 16:50:24 +02:00
Andrew Rybchenko
dfc6b2fd8d mbuf: remove Intel offload checks from generic API
rte_validate_tx_offload() is used in Tx prepare callbacks
(RTE_LIBRTE_ETHDEV_DEBUG only) to check Tx offloads consistency.
Requirement that packet headers should not be fragmented is not
documented and unclear where it comes from except
rte_net_intel_cksum_prepare() functions which relies on it.

It could be NIC vendor specific driver or hardware limitation, but,
if so, it should be documented and checked in corresponding Tx
prepare callbacks.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-04-02 16:42:52 +02:00
Rami Rosen
b13baac8d5 mbuf: fix a typo
This trivial patch fixes a typo in rte_mbuf.h.

Fixes: f20b50b946 ("mbuf: optimize refcnt update")
Cc: stable@dpdk.org

Signed-off-by: Rami Rosen <ramirose@gmail.com>
2019-02-12 14:32:01 +01:00
Ed Czeck
14ff7fb97e mbuf: fix struct initialization with C++
g++ reports "error: missing initializer for member"

Fixes: 5d3f721009 ("mbuf: implement generic format for sched field")

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2019-01-28 00:57:57 +01:00
Yongseok Koh
c277b34c1b mbuf: add function returning buffer address
This patch introduces two new functions - rte_mbuf_buf_addr() and
rte_mbuf_data_addr_default().

rte_mbuf_buf_addr() reutrns the buffer address of given mbuf which comes
after mbuf structure and private data.

rte_mbuf_data_addr_default() returns the default address of mbuf data
taking the headroom into account.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2019-01-15 02:40:40 +01:00
David Marchand
d4dca8fe43 mbuf: add a non fatal sanity check helper
Let's add a little helper that does the same as rte_mbuf_sanity_check but
without the panic.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-01-15 02:40:40 +01:00
David Marchand
dcd2a33d3c mbuf: add sanity checks on segment metadata
Add some basic checks on the segments offset and length metadata:
always funny to have a < 0 tailroom cast to uint16_t ;-).

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-01-15 02:40:40 +01:00
Yongseok Koh
bf78d4dc2b mbuf: remove experimental tag for external attachment
Remove the experimental tag of rte_pktmbuf_attach_extbuf() which was
introduced in 18.05.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-01-14 16:37:59 +01:00
Yongseok Koh
952f4cf5f0 mbuf: remove deprecated macro
RTE_MBUF_INDIRECT() is replaced with RTE_MBUF_CLONED() and removed.
This macro was deprecated in release 18.05 when EXT_ATTACHED_MBUF was
introduced.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-01-14 16:37:36 +01:00
Harry van Haaren
6af649a44c mbuf: fix C++ compatibility by making sched struct visible
Although C compilation works with the struct rte_mbuf_sched
declared inside the struct rte_mbuf namespace, C++ fails to
compile. This fix moves the rte_mbuf_sched struct up to the
global namespace, instead of declaring it inside the struct
mbuf namespace.

The struct rte_mbuf_sched is being used on the stack in
rte_mbuf_sched_get() and as a cast in _set(). For this
reason, it must be exposed as an available type.

Fixes: 5d3f721009 ("mbuf: implement generic format for sched field")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2019-01-14 16:03:28 +01:00
Reshma Pattan
5d3f721009 mbuf: implement generic format for sched field
This patch implements the changes proposed in the deprecation
notes [1][2].

librte_mbuf changes:
The mbuf->hash.sched field is updated to support generic
definition in line with the ethdev traffic manager and meter APIs.
The new generic format contains: queue ID, traffic class, color.

Added public APIs to set and get these new fields to and from mbuf.

librte_sched changes:
In addtion, following API functions of the sched library have
been modified with an additional parameter of type struct
rte_sched_port to accommodate the changes made to mbuf sched field.
(i)rte_sched_port_pkt_write()
(ii) rte_sched_port_pkt_read_tree_path()

librte_pipeline, qos_sched UT, qos_sched app are updated
to make use of new changes.

Also mbuf->hash.txadapter has been added for eventdev txq,
rte_event_eth_tx_adapter_txq_set and rte_event_eth_tx_adapter_txq_get()
are updated to use mbuf->hash.txadapter.txq.

doc:
Release notes updated.
Removed deprecation notice for mbuf->hash.sched and sched API.

[1] http://mails.dpdk.org/archives/dev/2018-February/090651.html
[2] https://mails.dpdk.org/archives/dev/2018-November/119051.html

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Nikhil Rao <nikhil.rao@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
2018-12-22 00:22:44 +01:00
Dekel Peled
839b20be0e ethdev: support metadata as flow rule criteria
As described in [1], a new rte_flow item is added to support metadata
to use as flow rule match pattern.
The metadata is an opaque item, fully controlled by the application.

The use of metadata is relevant for egress rules only.
It can be set in the flow rule using the RTE_FLOW_ITEM_META.

An additional member 'tx_metadata' is added in union with existing member
'hash' of struct 'rte_mbuf', located to avoid conflicts with existing
fields. This additional member is used to carry the metadata item.

Application should set the packet metadata in the mbuf dedicated field,
and set the PKT_TX_METADATA flag in the mbuf->ol_flags.
The NIC will use the packet metadata as match criteria for relevant
flow rules.

This patch introduces metadata item type for rte_flow RTE_FLOW_ITEM_META,
along with corresponding struct rte_flow_item_meta and ol_flag
PKT_TX_METADATA.

[1] "[RFC,v2] ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-26 22:14:05 +02:00
Jerin Jacob
a5cba5a2c4 mbuf: add IGMP packet type
Add support for IGMP packet type.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-10-25 15:51:16 +02:00
Jerin Jacob
8e255bdb1b mbuf: add MPLS packet type
Add support of MPLS packet type.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-10-25 15:48:30 +02:00
Jerin Jacob
07e70104e0 mbuf: add FCoE packet type
Add support of FCoE packet type.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-10-25 15:48:24 +02:00
Ferruh Yigit
63f54e650a mbuf: fix library version on meson build
Fixes: d27a626187 ("mbuf: remove control mbuf")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2018-10-25 14:29:22 +02:00
Nithin Dabilpuram
52d8bd535f mbuf: fix missing Tx outer UDP checksum flag name
Fix missing Tx outer udp checksum flag name

Fixes: df694a05bf ("ethdev: add Tx offload outer UDP checksum definition")

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-10-18 10:24:39 +02:00
Jerin Jacob
c23e465944 mbuf: fix offload flag name and list
Fix missing PKT_TX* & PKT_RX* ol_flag name and fix ol_flag list.

Fixes: 6d18505efa ("vhost: support UDP Fragmentation Offload")
Fixes: 829a1c2c41 ("mbuf: extend flow director field")
Fixes: 63c0d74daa ("mbuf: add Tx side tunneling type")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-10-18 10:24:39 +02:00
Jerin Jacob
df694a05bf ethdev: add Tx offload outer UDP checksum definition
Introduced DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flags and
PKT_TX_OUTER_UDP_CKSUM mbuf ol_flags to enable Tx outer UDP
checksum offload.

To use hardware Tx outer UDP checksum offload, the user needs to,

- enable following in mbuf:
a) fill outer_l2_len and outer_l3_len in mbuf
b) set the PKT_TX_OUTER_UDP_CKSUM flag
c) set the flag PKT_TX_OUTER_IPV4 or PKT_TX_OUTER_IPV6

- configure DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flags in slow path

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-11 18:53:49 +02:00
Jerin Jacob
ec7f71577f ethdev: add Rx offload outer UDP checksum definition
Introduced DEV_RX_OFFLOAD_OUTER_UDP_CKSUM Rx offload flag and
PKT_RX_OUTER_L4_CKSUM_* mbuf ol_flags to detect outer UDP checksum
status.

- To use hardware Rx outer UDP checksum offload, the user needs to
configure DEV_RX_OFFLOAD_OUTER_UDP_CKSUM offload flags in slowpath.

- Driver updates checksum status in mbuf ol_flag as
PKT_RX_OUTER_L4_CKSUM_* flags.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-11 18:53:49 +02:00
Ferruh Yigit
b2fd027389 mbuf: clarify QinQ flag usage
Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
should be also set.

Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
should be set.

So that appllication can rely on PKT_RX_QINQ flag to access both
mbuf.vlan_tci & mbuf.vlan_tci_outer

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-10-11 18:53:49 +02:00
Jerin Jacob
1037ed842c mbuf: fix Tx offload mask
Fixes missing PKT_TX_UDP_SEG, PKT_TX_OUTER_IPV6,PKT_TX_OUTER_IPV4,
PKT_TX_IPV6 and  PKT_TX_IPV4 values in PKT_TX_OFFLOAD_MASK.

Also sort them in bit wise order to recognize missing items later.

Fixes: 6d18505efa ("vhost: support UDP Fragmentation Offload")
Fixes: 1c3b7c33e9 ("mbuf: add Tx offloading flags for tunnels")
Fixes: 711ba9e23e ("mbuf: remove aliasing of Tx offloading flags with Rx ones")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jiayu Hu <jiayu.hu@intel.com>
2018-10-11 18:53:49 +02:00
Nikhil Rao
c9bf83947e eventdev: add eth Tx adapter APIs
The ethernet Tx adapter abstracts the transmit stage of an
event driven packet processing application. The transmit
stage may be implemented with eventdev PMD support or use a
rte_service function implemented in the adapter. These APIs
provide a common configuration and control interface and
an transmit API for the eventdev PMD implementation.

The transmit port is specified using mbuf::port. The transmit
queue is specified using the rte_event_eth_tx_adapter_txq_set()
function.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-10-01 16:49:41 +02:00
David Marchand
c4833b8ed3 mbuf: remove deprecated segment free functions
__rte_mbuf_raw_free and __rte_pktmbuf_prefree_seg have been deprecated for
a long time now (early 17.05), are not part of the abi and are easily
replaced with existing api.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-09-19 10:35:01 +02:00
Olivier Matz
6b867cc113 eal: remove experimental tag for user mbuf pool ops
Remove experimental tag from rte_eal_mbuf_user_pool_ops().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-08-09 01:03:14 +02:00
Hemant Agrawal
e9072968d8 mbuf: remove experimental tag from pool ops
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-07-26 23:37:08 +02:00
Dan Gora
f5f45caeb0 mbuf: add accessor function for private data area
Add an inline accessor function to return the starting address of
the private data area in the supplied mbuf.

This allows applications to easily access the private data area between
the struct rte_mbuf and the data buffer in the specified mbuf without
creating private macros or accessor functions.

No checks are made to ensure that a private data area actually exists
in the buffer.

Signed-off-by: Dan Gora <dg@adax.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-07-13 23:08:15 +02:00
Haiyue Wang
af87183b82 mbuf: fix typo in IPv6 macro comment
Comment should mention IPv6, not IPv4.

Fixes: f295a00a2b ("mbuf: add definitions of unified packet types")
Cc: stable@dpdk.org

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-06-15 18:03:33 +02:00
Yongseok Koh
242b46b814 doc: announce removal of indirect mbuf check macro
Link: http://dpdk.org/ml/archives/dev/2018-April/099476.html

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-05-28 02:53:30 +02:00
Andy Green
9d0b59f84e mbuf: avoid integer promotion in prepend/adj/chain
GCC 8.1 warned:

In function 'rte_pktmbuf_prepend':
rte_mbuf.h:1908:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off -= len;
                 ^~~
m->data_off is a uint16_t

        uint16_t data_off;

len (a uint16_t) is promoted to an int using -=.  Do the
subtraction explicitly and cast the result to uint16_t.

The below += or -= changes are solving the same thing.

In function 'rte_pktmbuf_adj':
rte_mbuf.h:1969:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off += len;
                 ^~~

In function 'rte_pktmbuf_chain':
rte_mbuf.h:2082:19: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  head->nb_segs += tail->nb_segs;
                   ^~~~
Also uint16_t

        uint16_t nb_segs;         /**< Number of segments. */

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Fixes: 1a60a0daa6 ("mbuf: fix segments number type increase")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
ef5092e16b mbuf: avoid implicit demotion in 64-bit arithmetic
GCC 8.1 warned:

In function 'rte_validate_tx_offload':
rte_mbuf.h:2112:19: warning: conversion to 'uint64_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
  inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
                   ^~

  uint64_t inner_l3_offset...

  /* fields for TX offloading of tunnels */
  uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
  uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */

We want to do the arithmetic entirely in uint64_t
space, but with the +=, the rhs type becomes int since the
bitfields will fit in int.

Elaborate the artithmetic to be u64 = u64 + int + int, so
the type of the result is correct to be stored in the u64.

Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
50f239c908 mbuf: fix type of variables in linearize function
GCC 8.1 warned:

In function 'rte_pktmbuf_linearize':
rte_mbuf.h:1873:32: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the result [-Wsign-conversion]
rte_mbuf.h:2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
   copy_len = rte_pktmbuf_pkt_len(mbuf) - rte_pktmbuf_data_len(mbuf);
rte_mbuf.h:2180:51: warning: conversion to 'size_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
                                                ^~~~~~~

The temp is consumed as a size_t.  So let's make it
a size_t in the first place.

Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
ad37810662 mbuf: fix type of private size in detach
GCC 8.1 warned:

In function 'rte_pktmbuf_detach':
rte_mbuf.h:1583:17: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  m->priv_size = priv_size;
                 ^~~~~~~~~

The temp priv_size is declared as a uint32_t.  But it
only deals in uint16_t.  m->priv_size is a uint16_t.
Change it to a uint16_t.

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:27:15 +02:00
Andy Green
c779ebdca0 mbuf: explicit cast of size on detach
GCC 8.1 warned:

In function 'rte_pktmbuf_detach':
rte_mbuf.h:1580:14: warning: conversion from 'long unsigned int'
to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion]
  mbuf_size = sizeof(struct rte_mbuf) + priv_size;
              ^~~~~~

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:21:19 +02:00
Andy Green
0298bfb263 mbuf: explicit cast of external buffer length
GCC 8.1 warned:

rte_common.h:141:34:
warning: conversion from 'long unsigned int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
 #define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) - (uintptr_t)(ptr2))
                                  ^
rte_mbuf.h:1360:13:
note: in expansion of macro 'RTE_PTR_DIFF'
  *buf_len = RTE_PTR_DIFF(shinfo, buf_addr);

Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:21:12 +02:00
Andy Green
553ff494cb mbuf: explicit cast of headroom on reset
GCC 8.1 warned:

rte_common.h:384:2:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  __extension__ ({ \
  ^~~~~~~~~~~~~
rte_mbuf.h:1204:16:
note: in expansion of macro 'RTE_MIN'
  m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);

RTE_PKTMBUF_HEADROOM is typ 128, so it doesn't make trouble.

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:21:05 +02:00
Andy Green
f6ffdf1c2c mbuf: explicit casts of reference counter
differences to the atomic16 are signed, but the
atomic16 itself is unsigned.  It needs to be
made explicit with casts.

Fixes: af75078fec ("first public release")
Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:48 +02:00
Andy Green
ee07d519ce mbuf: fix reference counter integer promotion
GCC 8.1 warned:

"1 + value", where value is an uint16_t causes promotion
to a signed int.  The compiler complained that we are
shoving an int into a uint16_t return type with different
size and sign.

Bumping and returning value directly instead removes the
promotion and the problem.

Fixes: f20b50b946 ("mbuf: optimize refcnt update")
Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:28 +02:00
David Marchand
a2ff2827dc mbuf: fix C++ build on void pointer cast
Including rte_mbuf.h in C++ triggers the following warning as C++ does not
allow implicit casting of a void *.

In file included from test.cpp:1:0:
rte_mbuf.h: In function ‘rte_mbuf_ext_shared_info*
rte_pktmbuf_ext_shinfo_init_helper(void*, uint16_t*,
rte_mbuf_extbuf_free_callback_t, void*)’:
rte_mbuf.h:1349:9: error: invalid conversion
from ‘void*’ to ‘rte_mbuf_ext_shared_info*’ [-fpermissive]
  shinfo = RTE_PTR_ALIGN_FLOOR(RTE_PTR_SUB(buf_end,
         ^

Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")

Signed-off-by: David Marchand <david.marchand@6wind.com>
2018-05-18 13:20:49 +02:00
Ferruh Yigit
04db1d0da7 lib: clear experimental version tag in linker scripts
Remove version tag from experimental block in linker version scripts
(.map files).

That label is not used by linker and information only. It is useful
for version blocks but not useful for experimental block but confusing.
Removing those labels.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2018-05-14 03:37:28 +02:00
Yongseok Koh
a53aa2b9f3 mbuf: support attaching external buffer
This patch introduces a new way of attaching an external buffer to a mbuf.

Attaching an external buffer is quite similar to mbuf indirection in
replacing buffer addresses and length of a mbuf, but a few differences:
  - When an indirect mbuf is attached, refcnt of the direct mbuf would be
    2 as long as the direct mbuf itself isn't freed after the attachment.
    In such cases, the buffer area of a direct mbuf must be read-only. But
    external buffer has its own refcnt and it starts from 1. Unless
    multiple mbufs are attached to a mbuf having an external buffer, the
    external buffer is writable.
  - There's no need to allocate buffer from a mempool. Any buffer can be
    attached with appropriate free callback.
  - Smaller metadata is required to maintain shared data such as refcnt.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-27 20:11:25 +02:00
Xueming Li
063f39f26d ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP
This patch adds new tunnel type for MPLS-in-GRE and MPLS-in-UDP.

MPLS-in-GRE protocol link:
https://tools.ietf.org/html/rfc4023

MPLS-in-UDP protocol link:
https://tools.ietf.org/html/rfc7510

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-27 18:00:55 +01:00
Xueming Li
6f99e5b54e ethdev: introduce new tunnel VXLAN-GPE
VXLAN-GPE enables VXLAN for all protocols. Protocol link:
https://www.ietf.org/id/draft-ietf-nvo3-vxlan-gpe-05.txt

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-04-27 18:00:55 +01:00
Xueming Li
5355f4439e ethdev: introduce generic IP/UDP tunnel checksum and TSO
This patch introduce new TX offload flags for device that supports
IP or UDP tunneled packet L3/L4 checksum and TSO offload.
It will be used for non-standard tunnels.

The support from the device is for inner and outer checksums on
IPV4/TCP/UDP and TSO for *any packet with the following format*:

<some headers> / [optional IPv4/IPv6] / [optional TCP/UDP] / <some
headers> / [optional inner IPv4/IPv6] / [optional TCP/UDP]

For example the following packets can use this feature:

1. eth / ipv4 / udp / VXLAN / ip / tcp
2. eth / ipv4 / GRE / MPLS / ipv4 / udp

Please note that specific tunnel headers that contain payload length,
sequence id or checksum will not be updated.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-04-27 17:34:41 +01:00
Thomas Monjalon
ab66fe0e4a mbuf: improve tunnel Tx offloads API doc
Add few details to remind TSO flag, checksum flags and header lengths.

The doxygen syntax for MPLS-in-UDP is fixed.

Fixes: d95188551f ("mbuf: introduce new Tx offload flag for MPLS-in-UDP")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-04-23 16:09:23 +02:00
Thomas Monjalon
f00dcb7b0a mbuf: fix Tx checksum offload API doc
When introducing rte_eth_tx_prepare(), the constraints on checksum
pre-filling for Tx offloads were relaxed because implemented in
the PMDs with rte_net_intel_cksum_flags_prepare() helper.
As a consequence, these old requirements are removed for:
	- PKT_TX_OUTER_IP_CKSUM
	- PKT_TX_IP_CKSUM
	- PKT_TX_[L4]_CKSUM
	- PKT_TX_TCP_SEG

Not sure SCTP offload is properly implemented though.

A reference to rte_eth_tx_prepare() is added in rte_eth_tx_burst() doc.

Fixes: 609dd68ef1 ("mbuf: enhance the API documentation of offload flags")
Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-04-23 12:54:51 +02:00
Olivier Matz
d27a626187 mbuf: remove control mbuf
The rte_ctrlmbuf structure is not used by any example application
in dpdk. Remove it, as announced on the mailing list.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-04-11 23:40:40 +02:00
Stephen Hemminger
8ea081f381 mbuf: fix truncated strncpy
Gcc-8 discovers issue with platform_mempool_ops.
rte_mbuf_pool_ops.c:26:3: error: ‘strncpy’ output truncated before
  terminating nul copying as many bytes from a string as its length
  [-Werror=stringop-truncation]
  strncpy(mz->addr, ops_name,  strlen(ops_name));

Since the ops_name is already checked for size, using strncpy
here is unnecessary; just use strcpy.

Fixes: a3acc3144a ("mbuf: add pool ops selection functions")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-04 17:34:20 +02:00
Nipun Gupta
028e4b1dbc mbuf: fix logic of user mempool ops API
The existing rte_eal_mbuf_default mempool ops can return the compile time
default ops name if the user has not provided command line inputs for
mempool ops name. It will break the logic of best mempool ops as it will
never return platform hw mempool ops.

This patch introduces a new API to just return the user mempool ops only.

Fixes: 8b0f7f4341 ("mbuf: maintain user and compile time mempool ops name")

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-02-06 01:02:12 +01:00
Olivier Matz
6aa0fe344c mbuf: use SPDX tags
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-02-01 02:27:22 +01:00