Commit Graph

344 Commits

Author SHA1 Message Date
Chaoyong He
c3b7254093 net/nfp: support IPv6 VXLAN encap flow action
Add the offload support of encap action for IPv6 VXLAN tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
724662b4ce net/nfp: support IPv4 VXLAN encap flow action
Add the offload support of encap action for IPv4 VXLAN tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
36fb222db9 net/nfp: prepare for IPv6 tunnel encap flow action
Add the related data structure and functions, prepare for
the encap action of IPv6 tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
f382761cd2 net/nfp: prepare for IPv4 tunnel encap flow action
Add the related data structure and functions, prepare for
the encap action of IPv4 tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
ea6f2fa073 net/nfp: support IPv6 VXLAN flow item
Add the corresponding data structure and logics, to support
the offload of IPv6 VXLAN item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
d617b75a71 net/nfp: support IPv4 VXLAN flow item
Add the corresponding data structure and logics, to support
the offload of IPv4 VXLAN item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
a5b876a5aa net/nfp: fix CPP bridge service exit
The CPP (Command Pull Push) bridge service is needed for some debug
tools, but if no debug tools has ever been run, the initial logic of
CPP bridge service will block in accept() function call, and the
DPDK app can't exit normally.

Fixes: bab0e6f48b ("net/nfp: fix infinite loop")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
2022-10-25 10:53:33 +02:00
Chaoyong He
39d82d2098 net/nfp: fix promiscuous mode for representor port
The original functions of promiscuous mode can't process the
representor port rightly, revise the logic to do that.

Fixes: e1124c4f8a ("net/nfp: add flower representor framework")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
2022-10-24 14:30:43 +02:00
Chaoyong He
3202b003be net/nfp: support IPv6 DSCP flow action
Add the corresponding logics to support the offload of
set IPv6 DSCP action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
9c665d70f7 net/nfp: support IPv4 DSCP flow action
Add the corresponding logics to support the offload of
set IPv4 DSCP action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
ac12e126c4 net/nfp: support TTL flow action
Add the corresponding data structure and logics, to support
the offload of set TTL action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
87986df09d net/nfp: support TP destination flow action
Add the corresponding logics to support the offload of set
TP dest port action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
fc185097bb net/nfp: support TP source flow action
Add the corresponding data structure and logics, to support
the offload of set TP source port action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
51384f79b2 net/nfp: support IPv6 destination flow action
Add the corresponding logics to support the offload of
set dest IPv6 address action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
596ae22172 net/nfp: support IPv6 source flow action
Add the corresponding data structure and logics, to support
the offload of set source IPv6 address action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
f85c1e05bf net/nfp: support IPv4 destination flow action
Add the corresponding logics to support the offload of
set dest IPv4 address action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
ab80975b0a net/nfp: support IPv4 source flow action
Add the corresponding data structure and logics, to support
the offload of set source IPv4 address action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
eb9277cb2f net/nfp: support VLAN push flow action
Add the corresponding data structure and logics, to support
the offload of push_vlan action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
0203474d75 net/nfp: support VLAN pop flow action
Add the corresponding data structure and logics, to support
the offload of pop_vlan action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
eecc7ca308 net/nfp: support MAC destination flow action
Add the corresponding logics to support the offload of
set dest MAC action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
4f69831545 net/nfp: support MAC source flow action
Add the corresponding data structure and logics, to support
the offload of set source MAC action.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
cdb4743541 net/nfp: support SCTP flow item
Add the corresponding logics to support the offload
of SCTP item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
17956c4e6f net/nfp: support UDP flow item
Add the corresponding logics to support the offload
of UDP item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
4b768cc836 net/nfp: support TCP flow item
Add the corresponding data structure and logics, to support
the offload of TCP item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
d965074044 net/nfp: support IPv6 flow item
Add the corresponding data structure and logics, to support
the offload of IPv6 item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
e8abcff52e net/nfp: support IPv4 flow item
Add the corresponding data structure and logics, to support
the offload of IPv4 item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
397fa00bf8 net/nfp: support VLAN flow item
Add the corresponding data structure and logics, to support
the offload of VLAN item.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
4d946034bf net/nfp: support basic flow actions
Add the offload support of very basic actions: count, drop
and output.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
8ad9ffa2ce net/nfp: support basic flow items
Add the offload support of very basic items: ethernet and
port id.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
30ecce5227 net/nfp: support flow API
Add the flow validate/create/query/destroy/flush API of nfp PMD.

The flow create API construct a control cmsg and send it to
firmware, then add this flow  to the hash table.

The flow query API get flow stats from the flow_priv structure.
Note there exist an rte_spin_lock to prevent the update and query
action occur at the same time.

The flow destroy API construct a control cmsg and send it to
firmware, then adelete this flow from the hash table.

The flow flush API just iterate the flows in hash table and
call the flow destroy API.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
5c30647de8 net/nfp: add stats logic in ctrl VNIC service
Add the flow stats process logic in the ctrl VNIC service.
The flower firmware pass the flow stats to nfp driver through
control message, we store them in the flow_priv structure.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
ac09376096 net/nfp: add structures and functions for flow offload
Add the structures and functions to process mask table, flow
table, and flow stats id, which are used in the rte_flow
offload logics.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
bab0e6f48b net/nfp: fix infinite loop
The services don't have a method to break the infinite loop, and
this will cause the DPDK app can't end normally.

Fixes: a36634e87e ("net/nfp: add flower ctrl VNIC Rx/Tx")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
2022-10-21 15:00:25 +02:00
Chaoyong He
dee23e6c36 net/nfp: fix CPP bridge service requirement
The CPP (Command Pull Push) bridge service is needed for some debug
tools, and should be optional, so remove the mandatory requirement of
service lcore parameter.

Fixes: b188042195 ("net/nfp: add initial flower firmware support")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
2022-10-21 15:00:25 +02:00
Peng Zhang
dbad6f64f9 net/nfp: fix internal buffer size and MTU check
When MTU is bigger than hw->flbufsz, it can't work. hw->flbufsz is set
in the nfp_net_rx_queue_setup().

At first, in the nfp_net_configure(), the hw->flbufsz isn't set the
value, it just judge the initialized value and MTU, it is unreasonable.

Now, it just check the MTU can't be more than the NFP_FRAME_SIZE_MAX in
the nfp_net_configure(), when hw->flbufsz is set the value, in the
nfp_net_start(), judge the hw->flbufsz and MTU.

Fixes: 5c305e218f ("net/nfp: fix initialization")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-21 11:56:59 +02:00
Chaoyong He
c55abf6141 net/nfp: support RSS on VXLAN inner layer
Add the logics to support the feature of RSS packets based on
the inner layer of VXLAN tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-17 14:11:39 +02:00
Long Wu
bb340f56fc net/nfp: fix memory leak in Rx
nfp_net_recv_pkts() should not return a value that less than 0 and the
inappropriate return value in receive loop also causes the memory leak.
Modify code to avoid return a value less than 0. Furthermore, When
nfp_net_recv_pkts() break out from the receive loop because of packet
problems, a rte_mbuf will not be freed and it will cause memory leak.
Free the rte_mbuf before break out.

Fixes: b812daadad ("nfp: add Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
ad83f5ee71 net/nfp: add representor port Rx/Tx
For the Rx logic, the representor port decap packet from the
corresponding ring.

For the Tx logic, the representor port prepend the metadata
into packet, and send to firmware through the queue 0 of pf
vNIC.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
cf559c2a1d net/nfp: add flower PF Rx/Tx
For the Rx logic, fallback packets are multiplexed to the
correct representor port based on the prepended metadata.

For the Tx logic, because fallback packets are prepended
metadata, the start of the packet has to be adjusted for
in the Tx descriptor.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
a5f377d8f5 net/nfp: move Rx/Tx functions to header file
The flower firmware application makes use of the same Rx
and Tx checksum logic as the normal PMD. Expose it so that
flower firmware application also can make use of it.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
831c44ab78 net/nfp: add flower PF related routines
Adds the start/stop/close routine of the flower PF vNIC.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
e1124c4f8a net/nfp: add flower representor framework
Adds the framework to support flower representors. The number of VF
representors are parsed from the command line. For physical port
representors the current logic aims to create a representor for
each physical port present on the hardware.

An eth_dev is created for each physical port and VF, and flower
firmware requires a MAC repr cmsg to be transmitted to firmware
with info about the number of physical ports configured.

Reify messages are sent to hardware for each physical port representor.
An rte_ring is also created per representor so that traffic can be
pushed and pulled to this interface.

To up and down the real device represented by a flower representor port
a port mod message is used to convey that info to the firmware. This
message will be used in the dev_ops callbacks of flower representors.

Each cmsg generated by the driver is prepended with a cmsg header.
This commit also adds the logic to fill in the header of cmsgs.

Also add the Rx and Tx path for flower representors. For Rx packets are
dequeued from the representor ring and passed to the eth_dev. For Tx
the first queue of the PF vNIC is used. Metadata about the representor
is added before the packet is sent down to firmware.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
a36634e87e net/nfp: add flower ctrl VNIC Rx/Tx
Adds the Rx and Tx function for the ctrl VNIC. The logic is mostly
identical to the normal Rx and Tx functionality of the NFP PMD.

Make use of the ctrl VNIC service logic to service the ctrl vNIC Rx
path.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
d981d315ac net/nfp: move common Rx/Tx functions for flower use
Move some common Rx and Tx logic to the header file so that
they can be re-used by flower Tx and Rx logic.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
945441ebdb net/nfp: add flower ctrl VNIC
Adds the setup/start logic for the ctrl vNIC. This vNIC is used by
the PMD and flower firmware application as a communication channel
between driver and firmware. In the case of OVS it is also used to
communicate flow statistics from hardware to the driver.

A rte_eth device is not exposed to DPDK for this vNIC as it is strictly
used internally by flower logic.

Because of the add of ctrl vNIC, a new PCItoCPPBar is needed. Modify the
related logics.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
5e13debf44 net/nfp: add flower PF setup
Adds the vNIC initialization logic for the flower PF vNIC. The flower
firmware application exposes this vNIC for the purposes of fallback
traffic in the switchdev use-case.

Adds minimal dev_ops for this PF vNIC device. Because the device is
being exposed externally to DPDK it needs to implements a minimal set
of dev_ops.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
b188042195 net/nfp: add initial flower firmware support
Adds the basic probing infrastructure to support the flower firmware
application.

Adds the cpp service, used for some user tools.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
d5f39e07e9 net/nfp: move application firmware init to own function
The NFP card can load different firmware applications.
This commit move the init logic of corenic app of the
secondary process into its own function.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
7feb8909ca net/nfp: simplify initialization
Calling nfp_net_init() is only done for the corenic firmware flavor
and it is guaranteed to always be called from the primary process,
so the explicit check for RTE_PROC_PRIMARY can be dropped.

The calling graph of nfp_net_init() already guaranteed the free of
resources when it fail, so remove the necessary free logics inside it.

While at it remove the unused member is_phyport from struct nfp_net_hw.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00
Chaoyong He
968ec1c3bf net/nfp: move app firmware attributes to own struct
The NFP card can load different application firmwares. Currently
only the CoreNIC application firmware is supported. This commit makes
needed infrastructure changes in order to support other application
firmwares too.

Clearer separation is made between the PF device and any application
firmware specific concepts. The PF struct is now generic regardless
of the application firmware loaded. A new struct is also made for the
CoreNIC application firmware. Future additions to support other
application firmwares should also add an application firmware specific
struct.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-10-05 18:09:21 +02:00