I want to insert a dsa tag to the packets received by fm1-mac4 in dpdk mode, but the chip drop the ip packets, how can i fix this problem
<distribution name="hash_ipv4_src_dst_dist3">
<queue count="1" base="0x700"/>
<key>
<fieldref name="ethernet.type"/>
</key>
</distribution>
<distribution name="hash_ipv4_src_dst_dist4">
<queue count="1" base="0x800"/>
<key>
<fieldref name="ethernet.type"/>
</key>
<action type="classification" name="clsf_insremovedsa"/>
</distribution>
<policy name="hash_ipsec_src_dst_spi_policy_mac3">
<dist_order>
<distributionref name="hash_ipv4_src_dst_dist3"/>
</dist_order>
</policy>
<policy name="hash_ipsec_src_dst_spi_policy_mac4">
<dist_order>
<distributionref name="hash_ipv4_src_dst_dist4"/>
</dist_order>
</policy>
<manipulations>
<header name="ins_dsa" parse="yes">
<insert>
<size>4</size>
<offset>12</offset>
<data>0x40080000</data>
</insert>
</header>
</manipulations>
<classification name="clsf_insremovedsa" max="0" masks="yes" statistics="none">
<key>
<fieldref name="ethernet.type"/>
</key>
<entry>
<data>0x0800</data>
<queue base="0x800"/>
<header name="ins_dsa"/>
</entry>
</classification>
log:
fmc -x
fmc -c /usr/local/dpdk/dpaa/usdpaa_config_ls1043_offload.xml -p /usr/local/dpdk/dpaa/usdpaa_policy_hash_ipv4_1queue3.xml -a
localhost:~# testpmd -c 0xf -n 1 -- -i --portmask=0x3 --nb-core=3 --coremask=0xe
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: DPAA Bus Detected
PMD: Using FMC script mode,Make sure to use DPDK supported FMC scripts only.
PMD: net: dpaa: fm1-mac3: 00:04:9f:05:ab:ec
PMD: net: dpaa: fm1-mac4: 00:04:9f:05:ab:ed
PMD: net: dpaa: fm1-mac9: 00:04:9f:05:ab:f0
PMD: dpaa_sec-3 cryptodev init
PMD: dpaa_sec-4 cryptodev init
PMD: dpaa_sec-5 cryptodev init
PMD: dpaa_sec-6 cryptodev init
Interactive-mode selected
previous number of forwarding ports 3 - changed to number of configured ports 2
testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=171456, size=2176, socket=0
testpmd: preferred mempool ops selected: dpaa
Configuring Port 0 (socket 0)
dpaa_eth_dev_configure(): Rx offloads non configurable - requested 0x0 ignored 0x4e
dpaa_eth_dev_configure(): Tx offloads non configurable - requested 0x10000 ignored 0x1c09e
Port 0: 00:04:9F:05:AB:EC
Configuring Port 1 (socket 0)
dpaa_eth_dev_configure(): Rx offloads non configurable - requested 0x0 ignored 0x4e
dpaa_eth_dev_configure(): Tx offloads non configurable - requested 0x10000 ignored 0x1c09e
Port 1: 00:04:9F:05:AB:ED
Configuring Port 2 (socket 0)
dpaa_eth_dev_configure(): Rx offloads non configurable - requested 0x0 ignored 0x4e
dpaa_eth_dev_configure(): Tx offloads non configurable - requested 0x10000 ignored 0x1c09e
Port 2: 00:04:9F:05:AB:F0
Checking link statuses...
Done
testpmd> start
io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support enabled, MP allocation mode: native
Logical Core 1 (socket 0) forwards packets on 1 streams:
RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
Logical Core 2 (socket 0) forwards packets on 1 streams:
RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
io packet forwarding packets/burst=32
nb forwarding cores=3 - nb forwarding ports=2
port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x10000
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0
RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
port 1: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x10000
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0
RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
port 2: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x10000
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0
RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
testpmd> show port xstats 1
rx_good_packets: 8
tx_good_packets: 138
rx_good_bytes: 983
tx_good_bytes: 17859
rx_missed_errors: 0
rx_errors: 1
tx_errors: 0
rx_mbuf_allocation_errors: 0
rx_q0packets: 0
rx_q0bytes: 0
rx_q0errors: 0
tx_q0packets: 0
tx_q0bytes: 0
rx_align_err: 0
rx_valid_pause: 0
rx_fcs_err: 0
rx_vlan_frame: 0
rx_frame_err: 1
rx_drop_err: 6103
rx_undersized: 0
rx_oversize_err: 0
rx_fragment_pkt: 0
tx_valid_pause: 1
tx_fcs_err: 0
tx_vlan_frame: 0
rx_undersized: 0
First of all, if you want FMAN to insert something into frame headers, you must reserve space for it. Extra headroom must be specified explicitly in the Device Tree. If you did not do it, that is the most likely reason for your frames being dropped. Here is an example:
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
index e19e05ddae08..a09ceb64ec28 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
@@ -30,6 +30,24 @@
rtc1 = &ftm_alarm0;
};
+ chosen {
+ name = "chosen";
+
+ dpaa-extended-args {
+ fman0-extd-args {
+ cell-index = <0>;
+ compatible = "fsl,fman-extended-args";
+ dma-aid-mode = "port";
+
+
+ fman0_rx3-extd-args {
+ cell-index = <3>;
+ compatible = "fsl,fman-port-1g-rx-extended-args";
+ buffer-layout = <0x80 0x40>;
+ };
+ };
+ };
+ };
cpus {
#address-cells = <1>;
#size-cells = <0>;
In the example above, the buffer-layout property was added for the port with id = 4 in xml file that is ethernet@e6000. In your case it will probably be id =5 that is ethernet@e8000, so make sure you don't just cut-paste the above into your Devce Tree definition and set the "cell-index" as appropriate.
If you want to test that everything is fine, use a context without DPDK first. The frame after manipulation will have an unknown eth type because of the custom value inserted after the source MAC
address, like below:
0x0000: 0004 9f05 e318 0010 9400 0002 4008 0000 ............@...
0x0010: 0800 4500
The frame will be accepted by the DPAA in this case as there is no hardware parser error, but will be dropped by the upper layers, with dropped counter incremented. The point here is that you can capture the frame with tcpdump and see your header inserted. If that works in Linux, but fails under DPDK, you may need to make changes in DPDK to ensure the packets are not dropped there due to unrecognized header format.
Hope this helps,
Platon