Move PMDs out of lib directory
Subsystems (5)
PATCH v2 9/19 ixbge: move ixgbe PMD to drivers/net directory
In reply to Bruce Richardsonmove ixgbe PMD to drivers/net directory.
As part of the move, we rename the ixgbe directory, containing the ixgbe "base driver" code, from "ixgbe" to "base".
--- drivers/net/Makefile | 2 +- drivers/net/ixgbe/Makefile | 126 + drivers/net/ixgbe/base/README | 67 + drivers/net/ixgbe/base/ixgbe_82598.c | 1435 +++++++ drivers/net/ixgbe/base/ixgbe_82598.h | 52 + drivers/net/ixgbe/base/ixgbe_82599.c | 2713 +++++++++++++ drivers/net/ixgbe/base/ixgbe_82599.h | 65 + drivers/net/ixgbe/base/ixgbe_api.c | 1477 +++++++ drivers/net/ixgbe/base/ixgbe_api.h | 206 + drivers/net/ixgbe/base/ixgbe_common.c | 4940 ++++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_common.h | 183 + drivers/net/ixgbe/base/ixgbe_dcb.c | 714 ++++ drivers/net/ixgbe/base/ixgbe_dcb.h | 174 + drivers/net/ixgbe/base/ixgbe_dcb_82598.c | 360 ++ drivers/net/ixgbe/base/ixgbe_dcb_82598.h | 99 + drivers/net/ixgbe/base/ixgbe_dcb_82599.c | 593 +++ drivers/net/ixgbe/base/ixgbe_dcb_82599.h | 153 + drivers/net/ixgbe/base/ixgbe_mbx.c | 789 ++++ drivers/net/ixgbe/base/ixgbe_mbx.h | 150 + drivers/net/ixgbe/base/ixgbe_osdep.h | 155 + drivers/net/ixgbe/base/ixgbe_phy.c | 2583 +++++++++++++ drivers/net/ixgbe/base/ixgbe_phy.h | 181 + drivers/net/ixgbe/base/ixgbe_type.h | 3858 ++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_vf.c | 724 ++++ drivers/net/ixgbe/base/ixgbe_vf.h | 140 + drivers/net/ixgbe/base/ixgbe_x540.c | 1040 +++++ drivers/net/ixgbe/base/ixgbe_x540.h | 66 + drivers/net/ixgbe/base/ixgbe_x550.c | 2113 ++++++++++ drivers/net/ixgbe/base/ixgbe_x550.h | 91 + drivers/net/ixgbe/ixgbe_82599_bypass.c | 314 ++ drivers/net/ixgbe/ixgbe_bypass.c | 414 ++ drivers/net/ixgbe/ixgbe_bypass.h | 68 + drivers/net/ixgbe/ixgbe_bypass_api.h | 299 ++ drivers/net/ixgbe/ixgbe_bypass_defines.h | 160 + drivers/net/ixgbe/ixgbe_ethdev.c | 4453 +++++++++++++++++++++ drivers/net/ixgbe/ixgbe_ethdev.h | 400 ++ drivers/net/ixgbe/ixgbe_fdir.c | 1144 ++++++ drivers/net/ixgbe/ixgbe_logs.h | 78 + drivers/net/ixgbe/ixgbe_pf.c | 629 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 4780 +++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 293 ++ drivers/net/ixgbe/ixgbe_rxtx_vec.c | 792 ++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 4 + lib/Makefile | 1 - lib/librte_pmd_ixgbe/Makefile | 126 - lib/librte_pmd_ixgbe/ixgbe/README | 67 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.c | 1435 ------- lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.h | 52 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c | 2713 ------------- lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.h | 65 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.c | 1477 ------- lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.h | 206 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c | 4940 ------------------------ lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h | 183 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.c | 714 ---- lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.h | 174 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.c | 360 -- lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.h | 99 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.c | 593 --- lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.h | 153 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c | 789 ---- lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.h | 150 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_osdep.h | 155 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c | 2583 ------------- lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.h | 181 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h | 3858 ------------------ lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c | 724 ---- lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.h | 140 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.c | 1040 ----- lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.h | 66 - lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c | 2113 ---------- lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h | 91 - lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c | 314 -- lib/librte_pmd_ixgbe/ixgbe_bypass.c | 414 -- lib/librte_pmd_ixgbe/ixgbe_bypass.h | 68 - lib/librte_pmd_ixgbe/ixgbe_bypass_api.h | 299 -- lib/librte_pmd_ixgbe/ixgbe_bypass_defines.h | 160 - lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 4453 --------------------- lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 400 -- lib/librte_pmd_ixgbe/ixgbe_fdir.c | 1144 ------ lib/librte_pmd_ixgbe/ixgbe_logs.h | 78 - lib/librte_pmd_ixgbe/ixgbe_pf.c | 629 --- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 4780 ----------------------- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 293 -- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 792 ---- lib/librte_pmd_ixgbe/rte_pmd_ixgbe_version.map | 4 - 86 files changed, 39076 insertions(+), 39077 deletions(-) create mode 100644 drivers/net/ixgbe/Makefile create mode 100644 drivers/net/ixgbe/base/README create mode 100644 drivers/net/ixgbe/base/ixgbe_82598.c create mode 100644 drivers/net/ixgbe/base/ixgbe_82598.h create mode 100644 drivers/net/ixgbe/base/ixgbe_82599.c create mode 100644 drivers/net/ixgbe/base/ixgbe_82599.h create mode 100644 drivers/net/ixgbe/base/ixgbe_api.c create mode 100644 drivers/net/ixgbe/base/ixgbe_api.h create mode 100644 drivers/net/ixgbe/base/ixgbe_common.c create mode 100644 drivers/net/ixgbe/base/ixgbe_common.h create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb.c create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb.h create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb_82598.c create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb_82598.h create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb_82599.c create mode 100644 drivers/net/ixgbe/base/ixgbe_dcb_82599.h create mode 100644 drivers/net/ixgbe/base/ixgbe_mbx.c create mode 100644 drivers/net/ixgbe/base/ixgbe_mbx.h create mode 100644 drivers/net/ixgbe/base/ixgbe_osdep.h create mode 100644 drivers/net/ixgbe/base/ixgbe_phy.c create mode 100644 drivers/net/ixgbe/base/ixgbe_phy.h create mode 100644 drivers/net/ixgbe/base/ixgbe_type.h create mode 100644 drivers/net/ixgbe/base/ixgbe_vf.c create mode 100644 drivers/net/ixgbe/base/ixgbe_vf.h create mode 100644 drivers/net/ixgbe/base/ixgbe_x540.c create mode 100644 drivers/net/ixgbe/base/ixgbe_x540.h create mode 100644 drivers/net/ixgbe/base/ixgbe_x550.c create mode 100644 drivers/net/ixgbe/base/ixgbe_x550.h create mode 100644 drivers/net/ixgbe/ixgbe_82599_bypass.c create mode 100644 drivers/net/ixgbe/ixgbe_bypass.c create mode 100644 drivers/net/ixgbe/ixgbe_bypass.h create mode 100644 drivers/net/ixgbe/ixgbe_bypass_api.h create mode 100644 drivers/net/ixgbe/ixgbe_bypass_defines.h create mode 100644 drivers/net/ixgbe/ixgbe_ethdev.c create mode 100644 drivers/net/ixgbe/ixgbe_ethdev.h create mode 100644 drivers/net/ixgbe/ixgbe_fdir.c create mode 100644 drivers/net/ixgbe/ixgbe_logs.h create mode 100644 drivers/net/ixgbe/ixgbe_pf.c create mode 100644 drivers/net/ixgbe/ixgbe_rxtx.c create mode 100644 drivers/net/ixgbe/ixgbe_rxtx.h create mode 100644 drivers/net/ixgbe/ixgbe_rxtx_vec.c create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe_version.map delete mode 100644 lib/librte_pmd_ixgbe/Makefile delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/README delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_osdep.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_bypass.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_bypass.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_bypass_api.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_bypass_defines.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_ethdev.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_ethdev.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_fdir.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_logs.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_pf.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_rxtx.c delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_rxtx.h delete mode 100644 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c delete mode 100644 lib/librte_pmd_ixgbe/rte_pmd_ixgbe_version.map
drivers/net/Makefile +1 -1
@@ -37,7 +37,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e -#DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe +DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe #DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += librte_pmd_mlx4 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring #DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap
drivers/net/ixgbe/Makefile new file +126 -0
126 lines not on this page · raw message
drivers/net/ixgbe/base/README new file +67 -0
67 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_82598.c new file +1435 -0
1,435 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_82598.h new file +52 -0
52 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_82599.c new file +2713 -0
1,312 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_82599.h new file +65 -0
65 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_api.c new file +1477 -0
1,477 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_api.h new file +206 -0
206 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_common.c new file +4940 -0
4,940 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_common.h new file +183 -0
183 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb.c new file +714 -0
714 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb.h new file +174 -0
174 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb_82598.c new file +360 -0
360 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb_82598.h new file +99 -0
99 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb_82599.c new file +593 -0
593 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_dcb_82599.h new file +153 -0
153 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_mbx.c new file +789 -0
789 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_mbx.h new file +150 -0
150 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_osdep.h new file +155 -0
155 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_phy.c new file +2583 -0
2,583 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_phy.h new file +181 -0
181 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_type.h new file +3858 -0
3,858 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_vf.c new file +724 -0
724 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_vf.h new file +140 -0
140 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_x540.c new file +1040 -0
1,040 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_x540.h new file +66 -0
66 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_x550.c new file +2113 -0
2,113 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_x550.h new file +91 -0
91 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_82599_bypass.c new file +314 -0
314 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_bypass.c new file +414 -0
414 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_bypass.h new file +68 -0
68 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_bypass_api.h new file +299 -0
299 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_bypass_defines.h new file +160 -0
160 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethdev.c new file +4453 -0
4,453 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethdev.h new file +400 -0
400 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_fdir.c new file +1144 -0
1,144 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_logs.h new file +78 -0
78 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_pf.c new file +629 -0
629 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.c new file +4780 -0
4,780 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h new file +293 -0
293 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx_vec.c new file +792 -0
792 lines not on this page · raw message
drivers/net/ixgbe/rte_pmd_ixgbe_version.map new file +4 -0
Lines of this file are not shown. View the raw message.
lib/librte_pmd_ixgbe/Makefile deleted +0 -126
126 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/README deleted +0 -67
67 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.c deleted +0 -1435
1,435 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.h deleted +0 -52
52 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c deleted +0 -2713
2,713 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.h deleted +0 -65
65 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.c deleted +0 -1477
1,477 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.h deleted +0 -206
206 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c deleted +0 -4940
4,940 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h deleted +0 -183
183 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.c deleted +0 -714
714 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb.h deleted +0 -174
174 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.c deleted +0 -360
360 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82598.h deleted +0 -99
99 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.c deleted +0 -593
593 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.h deleted +0 -153
153 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c deleted +0 -789
789 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.h deleted +0 -150
150 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_osdep.h deleted +0 -155
155 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c deleted +0 -2583
2,583 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.h deleted +0 -181
181 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h deleted +0 -3858
3,858 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c deleted +0 -724
724 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.h deleted +0 -140
140 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.c deleted +0 -1040
1,040 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.h deleted +0 -66
66 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c deleted +0 -2113
2,113 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h deleted +0 -91
91 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c deleted +0 -314
314 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_bypass.c deleted +0 -414
414 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_bypass.h deleted +0 -68
68 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_bypass_api.h deleted +0 -299
299 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_bypass_defines.h deleted +0 -160
160 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_ethdev.c deleted +0 -4453
4,453 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_ethdev.h deleted +0 -400
400 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_fdir.c deleted +0 -1144
1,144 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_logs.h deleted +0 -78
78 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_pf.c deleted +0 -629
629 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_rxtx.c deleted +0 -4780
4,780 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_rxtx.h deleted +0 -293
293 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c deleted +0 -792
792 lines not on this page · raw message
lib/librte_pmd_ixgbe/rte_pmd_ixgbe_version.map deleted +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
PATCH v2 10/19 mlx4: move mlx4 PMD to drivers/net directory
In reply to Bruce Richardsonmove mlx4 PMD to drivers/net directory
--- drivers/net/Makefile | 2 +- drivers/net/mlx4/Makefile | 121 + drivers/net/mlx4/mlx4.c | 4686 ++++++++++++++++++++++++++ drivers/net/mlx4/mlx4.h | 157 + drivers/net/mlx4/rte_pmd_mlx4_version.map | 4 + lib/Makefile | 1 - lib/librte_pmd_mlx4/Makefile | 121 - lib/librte_pmd_mlx4/mlx4.c | 4686 -------------------------- lib/librte_pmd_mlx4/mlx4.h | 157 - lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map | 4 - 10 files changed, 4969 insertions(+), 4970 deletions(-) create mode 100644 drivers/net/mlx4/Makefile create mode 100644 drivers/net/mlx4/mlx4.c create mode 100644 drivers/net/mlx4/mlx4.h create mode 100644 drivers/net/mlx4/rte_pmd_mlx4_version.map delete mode 100644 lib/librte_pmd_mlx4/Makefile delete mode 100644 lib/librte_pmd_mlx4/mlx4.c delete mode 100644 lib/librte_pmd_mlx4/mlx4.h delete mode 100644 lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map
drivers/net/Makefile +1 -1
@@ -38,7 +38,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe -#DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += librte_pmd_mlx4 +DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring #DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap #DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio
drivers/net/mlx4/Makefile new file +121 -0
121 lines not on this page · raw message
drivers/net/mlx4/mlx4.c new file +4686 -0
2,871 lines not on this page · raw message
drivers/net/mlx4/mlx4.h new file +157 -0
157 lines not on this page · raw message
drivers/net/mlx4/rte_pmd_mlx4_version.map new file +4 -0
Lines of this file are not shown. View the raw message.
lib/librte_pmd_mlx4/Makefile deleted +0 -121
121 lines not on this page · raw message
lib/librte_pmd_mlx4/mlx4.c deleted +0 -4686
4,686 lines not on this page · raw message
lib/librte_pmd_mlx4/mlx4.h deleted +0 -157
157 lines not on this page · raw message
lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map deleted +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 10/19] mlx4: move mlx4 PMD to drivers/net directory
Quoted 15 lines · Bruce Richardson
move mlx4 PMD to
drivers/netdirectorySigned-off-by Bruce Richardson <[email protected]>--- drivers/net/Makefile | 2 +- drivers/net/mlx4/Makefile | 121 + drivers/net/mlx4/mlx4.c | 4686 ++++++++++++++++++++++++++ drivers/net/mlx4/mlx4.h | 157 + drivers/net/mlx4/rte_pmd_mlx4_version.map | 4 + lib/Makefile | 1 - lib/librte_pmd_mlx4/Makefile | 121 - lib/librte_pmd_mlx4/mlx4.c | 4686 -------------------------- lib/librte_pmd_mlx4/mlx4.h | 157 - lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map | 4 - 10 files changed, 4969 insertions(+), 4970 deletions(-)
Quoted 8 lines
create mode 100644 drivers/net/mlx4/Makefile create mode 100644 drivers/net/mlx4/mlx4.c create mode 100644 drivers/net/mlx4/mlx4.h create mode 100644 drivers/net/mlx4/rte_pmd_mlx4_version.map delete mode 100644 lib/librte_pmd_mlx4/Makefile delete mode 100644 lib/librte_pmd_mlx4/mlx4.c delete mode 100644 lib/librte_pmd_mlx4/mlx4.h delete mode 100644 lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map
There's a way to do source movements with git such that history remains, see for example in the upstream kernel the way the ethernet drivers were moved from drivers/net to drivers/net/ethernet couple of years ago.
Please make sure to use that practice here too.
Or.
Quoted 9,787 lines
drivers/net/mlx4/mlx4.c new file +4607
-0+#include <rte_dev.h> +#include <rte_mbuf.h> +#include <rte_errno.h> +#include <rte_mempool.h> +#include <rte_prefetch.h> +#include <rte_malloc.h> +#include <rte_spinlock.h> +#include <rte_atomic.h> +#include <rte_version.h> +#include <rte_log.h> +#ifdef PEDANTIC +#pragma GCC diagnostic error "-pedantic" +#endif + +/* Generated configuration header. */ +#include "mlx4_autoconf.h" + +/* PMD header. */ +#include "mlx4.h" + +/* Runtime logging through RTE_LOG() is enabled when not in debugging mode. +* Intermediate LOG_*() macros add the required end-of-line characters. */ +#ifndef NDEBUG +#define INFO (...) DEBUG(__VA_ARGS__) +#define WARN (...) DEBUG(__VA_ARGS__) +#define ERROR (...) DEBUG(__VA_ARGS__) +#else +#define LOG__ (level, m, ...) \ + RTE_LOG(level, PMD, MLX4_DRIVER_NAME ": " m "%c", __VA_ARGS__) +#define LOG_ (level, ...) LOG__(level, __VA_ARGS__, '\n') +#define INFO (...) LOG_(INFO, __VA_ARGS__) +#define WARN (...) LOG_(WARNING, __VA_ARGS__) +#define ERROR (...) LOG_(ERR, __VA_ARGS__) +#endif + +/* Convenience macros for accessing mbuf fields. */ +#define NEXT (m) ((m)->next) +#define DATA_LEN (m) ((m)->data_len) +#define PKT_LEN (m) ((m)->pkt_len) +#define DATA_OFF (m) ((m)->data_off) +#define SET_DATA_OFF (m, o) ((m)->data_off = (o)) +#define NB_SEGS (m) ((m)->nb_segs) +#define PORT (m) ((m)->port) + +/* Work Request ID data type (64 bit). */ +typedef union { +struct { +uint32_t id; +uint16_t offset; + } data; +uint64_t raw; +}wr_id_t ; + +#define WR_ID (o) (((wr_id_t *)&(o))->data) + +/* Compile-time check. */ +static inline void wr_id_t_check (void ) +{ +wr_id_t check[1 + (2 * -!(sizeof (wr_id_t) ==sizeof (uint64_t )))]; + + (void )check; + (void )wr_id_t_check; +} + +/* If raw send operations are available, use them since they are faster. */ +#ifdef SEND_RAW_WR_SUPPORT +typedef struct ibv_send_wr_raw mlx4_send_wr_t ; +#define mlx4_post_send ibv_post_send_raw +#else +typedef struct ibv_send_wr mlx4_send_wr_t ; +#define mlx4_post_send ibv_post_send +#endif + +struct mlx4_rxq_stats { +unsigned int idx;/**< Mapping index. */ +#ifdef MLX4_PMD_SOFT_COUNTERS +uint64_t ipackets;/**< Total of successfully received packets. */ +uint64_t ibytes;/**< Total of successfully received bytes. */ +#endif +uint64_t idropped;/**< Total of packets dropped when RX ring full. */ +uint64_t rx_nombuf;/**< Total of RX mbuf allocation failures. */ +}; + +struct mlx4_txq_stats { +unsigned int idx;/**< Mapping index. */ +#ifdef MLX4_PMD_SOFT_COUNTERS +uint64_t opackets;/**< Total of successfully sent packets. */ +uint64_t obytes;/**< Total of successfully sent bytes. */ +#endif +uint64_t odropped;/**< Total of packets not sent when TX ring full. */ +}; + +/* RX element (scattered packets). */ +struct rxq_elt_sp { +struct ibv_recv_wr wr;/* Work Request. */ +struct ibv_sge sges[MLX4_PMD_SGE_WR_N ];/* Scatter/Gather Elements. */ +struct rte_mbuf *bufs[MLX4_PMD_SGE_WR_N ];/* SGEs buffers. */ +}; + +/* RX element. */ +struct rxq_elt { +struct ibv_recv_wr wr;/* Work Request. */ +struct ibv_sge sge;/* Scatter/Gather Element. */ +/* mbuf pointer is derived from WR_ID(wr.wr_id).offset. */ +}; + +/* RX queue descriptor. */ +struct rxq { +struct priv *priv;/* Back pointer to private data. */ +struct rte_mempool *mp;/* Memory Pool for allocations. */ +struct ibv_mr *mr;/* Memory Region (for mp). */ +struct ibv_cq *cq;/* Completion Queue. */ +struct ibv_qp *qp;/* Queue Pair. */ +/* +* There is exactly one flow configured per MAC address. Each flow +* may contain several specifications, one per configured VLAN ID. +*/ + BITFIELD_DECLARE(mac_configured, uint32_t, MLX4_MAX_MAC_ADDRESSES); +struct ibv_exp_flow *mac_flow[MLX4_MAX_MAC_ADDRESSES ]; +struct ibv_exp_flow *promisc_flow;/* Promiscuous flow. */ +struct ibv_exp_flow *allmulti_flow;/* Multicast flow. */ +unsigned int port_id;/* Port ID for incoming packets. */ +unsigned int elts_n;/* (*elts)[] length. */ +union { +struct rxq_elt_sp (*sp)[];/* Scattered RX elements. */ +struct rxq_elt (*no_sp)[];/* RX elements. */ + } elts; +unsigned int sp:1 ;/* Use scattered RX elements. */ +uint32_t mb_len;/* Length of a mp-issued mbuf. */ +struct mlx4_rxq_stats stats;/* RX queue counters. */ +unsigned int socket;/* CPU socket ID for allocations. */ +}; + +/* TX element. */ +struct txq_elt { +mlx4_send_wr_t wr;/* Work Request. */ +struct ibv_sge sges[MLX4_PMD_SGE_WR_N ];/* Scatter/Gather Elements. */ +/* mbuf pointer is derived from WR_ID(wr.wr_id).offset. */ +}; + +/* Linear buffer type. It is used when transmitting buffers with too many +* segments that do not fit the hardware queue (see max_send_sge). +* Extra segments are copied (linearized) in such buffers, replacing the +* last SGE during TX. +* The size is arbitrary but large enough to hold a jumbo frame with +* 8 segments considering mbuf.buf_len is about 2048 bytes. */ +typedef uint8_t linear_t [16384 ]; + +/* TX queue descriptor. */ +struct txq { +struct priv *priv;/* Back pointer to private data. */ +struct { +struct rte_mempool *mp;/* Cached Memory Pool. */ +struct ibv_mr *mr;/* Memory Region (for mp). */ +uint32_t lkey;/* mr->lkey */ + } mp2mr[MLX4_PMD_TX_MP_CACHE ];/* MP to MR translation table. */ +struct ibv_cq *cq;/* Completion Queue. */ +struct ibv_qp *qp;/* Queue Pair. */ +#if MLX4_PMD_MAX_INLINE >0 +uint32_t max_inline;/* Max inline send size <= MLX4_PMD_MAX_INLINE. */ +#endif +unsigned int elts_n;/* (*elts)[] length. */ +struct txq_elt (*elts)[];/* TX elements. */ +unsigned int elts_head;/* Current index in (*elts)[]. */ +unsigned int elts_tail;/* First element awaiting completion. */ +unsigned int elts_comp;/* Number of completion requests. */ +struct mlx4_txq_stats stats;/* TX queue counters. */ +linear_t (*elts_linear)[];/* Linearized buffers. */ +struct ibv_mr *mr_linear;/* Memory Region for linearized buffers. */ +unsigned int socket;/* CPU socket ID for allocations. */ +}; + +struct priv { +struct rte_eth_dev *dev;/* Ethernet device. */ +struct ibv_context *ctx;/* Verbs context. */ +struct ibv_device_attr device_attr;/* Device properties. */ +struct ibv_port_attr port_attr;/* Physical port properties. */ +struct ibv_pd *pd;/* Protection Domain. */ +/* +* MAC addresses array and configuration bit-field. +* An extra entry that cannot be modified by the DPDK is reserved +* for broadcast frames (destination MAC address ff:ff:ff:ff:ff:ff). +*/ +struct ether_addr mac[MLX4_MAX_MAC_ADDRESSES ]; + BITFIELD_DECLARE(mac_configured, uint32_t, MLX4_MAX_MAC_ADDRESSES); +/* VLAN filters. */ +struct { +unsigned int enabled:1 ;/* If enabled. */ +unsigned int id:12 ;/* VLAN ID (0-4095). */ + } vlan_filter[MLX4_MAX_VLAN_IDS ];/* VLAN filters table. */ +/* Device properties. */ +uint16_t mtu;/* Configured MTU. */ +uint8_t port;/* Physical port number. */ +unsigned int started:1 ;/* Device started, flows enabled. */ +unsigned int promisc:1 ;/* Device in promiscuous mode. */ +unsigned int promisc_ok:1 ;/* Promiscuous flow is supported. */ +unsigned int allmulti:1 ;/* Device receives all multicast packets. */ +unsigned int hw_qpg:1 ;/* QP groups are supported. */ +unsigned int hw_tss:1 ;/* TSS is supported. */ +unsigned int hw_rss:1 ;/* RSS is supported. */ +unsigned int rss:1 ;/* RSS is enabled. */ +unsigned int vf:1 ;/* This is a VF device. */ +#ifdef INLINE_RECV +unsigned int inl_recv_size;/* Inline recv size */ +#endif +unsigned int max_rss_tbl_sz;/* Maximum number of RSS queues. */ +/* RX/TX queues. */ +struct rxq rxq_parent;/* Parent queue when RSS is enabled. */ +unsigned int rxqs_n;/* RX queues array size. */ +unsigned int txqs_n;/* TX queues array size. */ +struct rxq *(*rxqs)[];/* RX queues. */ +struct txq *(*txqs)[];/* TX queues. */ +rte_spinlock_t lock;/* Lock for control functions. */ +}; + +/** +* Lock private structure to protect it from concurrent access in the +* control path. +* +* @param priv +* Pointer to private structure. +*/ +static void +priv_lock (struct priv *priv) +{ +rte_spinlock_lock (&priv->lock); +} + +/** +* Unlock private structure. +* +* @param priv +* Pointer to private structure. +*/ +static void +priv_unlock (struct priv *priv) +{ +rte_spinlock_unlock (&priv->lock); +} + +/* Allocate a buffer on the stack and fill it with a printf format string. */ +#define MKSTR (name, ...) \ + char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ + \ + snprintf(name, sizeof(name), __VA_ARGS__) + +/** +* Get interface name from private structure. +* +* @param[in] priv +* Pointer to private structure. +* @param[out] ifname +* Interface name output buffer. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_get_ifname (const struct priv *priv,char (*ifname)[IF_NAMESIZE ]) +{ +int ret =-1 ; +DIR *dir; +struct dirent *dent; + + { +MKSTR (path,"%s/device/net" , priv->ctx->device->ibdev_path); + + dir =opendir (path); +if (dir ==NULL ) +return -1 ; + } +while ((dent =readdir (dir)) !=NULL ) { +char *name = dent->d_name; +FILE *file; +unsigned int dev_id; +int r; + +if ((name[0 ] =='.' ) && + ((name[1 ] =='\0' ) || + ((name[1 ] =='.' ) && (name[2 ] =='\0' )))) +continue ; + +MKSTR (path,"%s/device/net/%s/dev_id" , + priv->ctx->device->ibdev_path, name); + + file =fopen (path,"rb" ); +if (file ==NULL ) +continue ; + r =fscanf (file,"%x" , &dev_id); +fclose (file); +if ((r ==1 ) && (dev_id == (priv->port -1u ))) { +snprintf (*ifname,sizeof (*ifname),"%s" , name); + ret =0 ; +break ; + } + } +closedir (dir); +return ret; +} + +/** +* Read from sysfs entry. +* +* @param[in] priv +* Pointer to private structure. +* @param[in] entry +* Entry name relative to sysfs path. +* @param[out] buf +* Data output buffer. +* @param size +* Buffer size. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_sysfs_read (const struct priv *priv,const char *entry, +char *buf,size_t size) +{ +char ifname[IF_NAMESIZE ]; +FILE *file; +int ret; +int err; + +if (priv_get_ifname (priv, &ifname)) +return -1 ; + +MKSTR (path,"%s/device/net/%s/%s" , priv->ctx->device->ibdev_path, + ifname, entry); + + file =fopen (path,"rb" ); +if (file ==NULL ) +return -1 ; + ret =fread (buf,1 , size, file); + err = errno; +if (((size_t )ret < size) && (ferror (file))) + ret =-1 ; +else + ret = size; +fclose (file); + errno = err; +return ret; +} + +/** +* Write to sysfs entry. +* +* @param[in] priv +* Pointer to private structure. +* @param[in] entry +* Entry name relative to sysfs path. +* @param[in] buf +* Data buffer. +* @param size +* Buffer size. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_sysfs_write (const struct priv *priv,const char *entry, +char *buf,size_t size) +{ +char ifname[IF_NAMESIZE ]; +FILE *file; +int ret; +int err; + +if (priv_get_ifname (priv, &ifname)) +return -1 ; + +MKSTR (path,"%s/device/net/%s/%s" , priv->ctx->device->ibdev_path, + ifname, entry); + + file =fopen (path,"wb" ); +if (file ==NULL ) +return -1 ; + ret =fwrite (buf,1 , size, file); + err = errno; +if (((size_t )ret < size) || (ferror (file))) + ret =-1 ; +else + ret = size; +fclose (file); + errno = err; +return ret; +} + +/** +* Get unsigned long sysfs property. +* +* @param priv +* Pointer to private structure. +* @param[in] name +* Entry name relative to sysfs path. +* @param[out] value +* Value output buffer. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_get_sysfs_ulong (struct priv *priv,const char *name,unsigned long *value) +{ +int ret; +unsigned long value_ret; +char value_str[32 ]; + + ret =priv_sysfs_read (priv, name, value_str, (sizeof (value_str) -1 )); +if (ret ==-1 ) { +DEBUG ("cannot read %s value from sysfs: %s" , + name,strerror (errno)); +return -1 ; + } + value_str[ret] ='\0' ; + errno =0 ; + value_ret =strtoul (value_str,NULL ,0 ); +if (errno) { +DEBUG ("invalid %s value `%s': %s" , name, value_str, +strerror (errno)); +return -1 ; + } + *value = value_ret; +return 0 ; +} + +/** +* Set unsigned long sysfs property. +* +* @param priv +* Pointer to private structure. +* @param[in] name +* Entry name relative to sysfs path. +* @param value +* Value to set. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_set_sysfs_ulong (struct priv *priv,const char *name,unsigned long value) +{ +int ret; +MKSTR (value_str,"%lu" , value); + + ret =priv_sysfs_write (priv, name, value_str, (sizeof (value_str) -1 )); +if (ret ==-1 ) { +DEBUG ("cannot write %s `%s' (%lu) to sysfs: %s" , + name, value_str, value,strerror (errno)); +return -1 ; + } +return 0 ; +} + +/** +* Perform ifreq ioctl() on associated Ethernet device. +* +* @param[in] priv +* Pointer to private structure. +* @param req +* Request number to pass to ioctl(). +* @param[out] ifr +* Interface request structure output buffer. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_ifreq (const struct priv *priv,int req,struct ifreq *ifr) +{ +int sock =socket (PF_INET ,SOCK_DGRAM ,IPPROTO_IP ); +int ret =-1 ; + +if (sock ==-1 ) +return ret; +if (priv_get_ifname (priv, &ifr->ifr_name) ==0 ) + ret =ioctl (sock, req, ifr); +close (sock); +return ret; +} + +/** +* Get device MTU. +* +* @param priv +* Pointer to private structure. +* @param[out] mtu +* MTU value output buffer. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_get_mtu (struct priv *priv,uint16_t *mtu) +{ +unsigned long ulong_mtu; + +if (priv_get_sysfs_ulong (priv,"mtu" , &ulong_mtu) ==-1 ) +return -1 ; + *mtu = ulong_mtu; +return 0 ; +} + +/** +* Set device MTU. +* +* @param priv +* Pointer to private structure. +* @param mtu +* MTU value to set. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_set_mtu (struct priv *priv,uint16_t mtu) +{ +return priv_set_sysfs_ulong (priv,"mtu" , mtu); +} + +/** +* Set device flags. +* +* @param priv +* Pointer to private structure. +* @param keep +* Bitmask for flags that must remain untouched. +* @param flags +* Bitmask for flags to modify. +* +* @return +* 0 on success, -1 on failure and errno is set. +*/ +static int +priv_set_flags (struct priv *priv,unsigned int keep,unsigned int flags) +{ +unsigned long tmp; + +if (priv_get_sysfs_ulong (priv,"flags" , &tmp) ==-1 ) +return -1 ; + tmp &= keep; + tmp |= flags; +return priv_set_sysfs_ulong (priv,"flags" , tmp); +} + +/* Device configuration. */ + +static int +rxq_setup (struct rte_eth_dev *dev,struct rxq *rxq,uint16_t desc, +unsigned int socket,const struct rte_eth_rxconf *conf, +struct rte_mempool *mp); + +static void +rxq_cleanup (struct rxq *rxq); + +/** +* Ethernet device configuration. +* +* Prepare the driver for a given number of TX and RX queues. +* Allocate parent RSS queue when several RX queues are requested. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +dev_configure (struct rte_eth_dev *dev) +{ +struct priv *priv = dev->data->dev_private; +unsigned int rxqs_n = dev->data->nb_rx_queues; +unsigned int txqs_n = dev->data->nb_tx_queues; +unsigned int tmp; +int ret; + + priv->rxqs = (void *)dev->data->rx_queues; + priv->txqs = (void *)dev->data->tx_queues; +if (txqs_n != priv->txqs_n) { +INFO ("%p: TX queues number update: %u -> %u" , + (void *)dev, priv->txqs_n, txqs_n); + priv->txqs_n = txqs_n; + } +if (rxqs_n == priv->rxqs_n) +return 0 ; +INFO ("%p: RX queues number update: %u -> %u" , + (void *)dev, priv->rxqs_n, rxqs_n); +/* If RSS is enabled, disable it first. */ +if (priv->rss) { +unsigned int i; + +/* Only if there are no remaining child RX queues. */ +for (i =0 ; (i != priv->rxqs_n); ++i) +if ((*priv->rxqs)[i] !=NULL ) +return EINVAL ; +rxq_cleanup (&priv->rxq_parent); + priv->rss =0 ; + priv->rxqs_n =0 ; + } +if (rxqs_n <=1 ) { +/* Nothing else to do. */ + priv->rxqs_n = rxqs_n; +return 0 ; + } +/* Allocate a new RSS parent queue if supported by hardware. */ +if (!priv->hw_rss) { +ERROR ("%p: only a single RX queue can be configured when" +" hardware doesn't support RSS" , + (void *)dev); +return EINVAL ; + } +/* Fail if hardware doesn't support that many RSS queues. */ +if (rxqs_n >= priv->max_rss_tbl_sz) { +ERROR ("%p: only %u RX queues can be configured for RSS" , + (void *)dev, priv->max_rss_tbl_sz); +return EINVAL ; + } + priv->rss =1 ; + tmp = priv->rxqs_n; + priv->rxqs_n = rxqs_n; + ret =rxq_setup (dev, &priv->rxq_parent,0 ,0 ,NULL ,NULL ); +if (!ret) +return 0 ; +/* Failure, rollback. */ + priv->rss =0 ; + priv->rxqs_n = tmp; +assert (ret >0 ); +return ret; +} + +/** +* DPDK callback for Ethernet device configuration. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, negative errno value on failure. +*/ +static int +mlx4_dev_configure (struct rte_eth_dev *dev) +{ +struct priv *priv = dev->data->dev_private; +int ret; + +priv_lock (priv); + ret =dev_configure (dev); +assert (ret >=0 ); +priv_unlock (priv); +return -ret; +} + +/* TX queues handling. */ + +/** +* Allocate TX queue elements. +* +* @param txq +* Pointer to TX queue structure. +* @param elts_n +* Number of elements to allocate. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +txq_alloc_elts (struct txq *txq,unsigned int elts_n) +{ +unsigned int i; +struct txq_elt (*elts)[elts_n] = +rte_calloc_socket ("TXQ" ,1 ,sizeof (*elts),0 , txq->socket); +linear_t (*elts_linear)[elts_n] = +rte_calloc_socket ("TXQ" ,1 ,sizeof (*elts_linear),0 , + txq->socket); +struct ibv_mr *mr_linear =NULL ; +int ret =0 ; + +if ((elts ==NULL ) || (elts_linear ==NULL )) { +ERROR ("%p: can't allocate packets array" , (void *)txq); + ret =ENOMEM ; + goto error; + } + mr_linear = +ibv_reg_mr (txq->priv->pd, elts_linear,sizeof (*elts_linear), + (IBV_ACCESS_LOCAL_WRITE |IBV_ACCESS_REMOTE_WRITE )); +if (mr_linear ==NULL ) { +ERROR ("%p: unable to configure MR, ibv_reg_mr() failed" , + (void *)txq); + ret =EINVAL ; + goto error; + } +for (i =0 ; (i != elts_n); ++i) { +struct txq_elt *elt = &(*elts)[i]; +mlx4_send_wr_t *wr = &elt->wr; + +/* Configure WR. */ +WR_ID (wr->wr_id).id = i; +WR_ID (wr->wr_id).offset =0 ; + wr->sg_list = &elt->sges[0 ]; + wr->opcode =IBV_WR_SEND ; +/* Other fields are updated during TX. */ + } +DEBUG ("%p: allocated and configured %u WRs" , (void *)txq, elts_n); + txq->elts_n = elts_n; + txq->elts = elts; + txq->elts_head =0 ; + txq->elts_tail =0 ; + txq->elts_comp =0 ; + txq->elts_linear = elts_linear; + txq->mr_linear = mr_linear; +assert (ret ==0 ); +return 0 ; +error: +if (mr_linear !=NULL ) +claim_zero (ibv_dereg_mr (mr_linear)); + +rte_free (elts_linear); +rte_free (elts); + +DEBUG ("%p: failed, freed everything" , (void *)txq); +assert (ret >0 ); +return ret; +} + +/** +* Free TX queue elements. +* +* @param txq +* Pointer to TX queue structure. +*/ +static void +txq_free_elts (struct txq *txq) +{ +unsigned int i; +unsigned int elts_n = txq->elts_n; +struct txq_elt (*elts)[elts_n] = txq->elts; +linear_t (*elts_linear)[elts_n] = txq->elts_linear; +struct ibv_mr *mr_linear = txq->mr_linear; + +DEBUG ("%p: freeing WRs" , (void *)txq); + txq->elts_n =0 ; + txq->elts =NULL ; + txq->elts_linear =NULL ; + txq->mr_linear =NULL ; +if (mr_linear !=NULL ) +claim_zero (ibv_dereg_mr (mr_linear)); + +rte_free (elts_linear); +if (elts ==NULL ) +return ; +for (i =0 ; (i !=elemof (*elts)); ++i) { +struct txq_elt *elt = &(*elts)[i]; + +if (WR_ID (elt->wr.wr_id).offset ==0 ) +continue ; +rte_pktmbuf_free ((void *)(elt->sges[0 ].addr - +WR_ID (elt->wr.wr_id).offset)); + } +rte_free (elts); +} + + +/** +* Clean up a TX queue. +* +* Destroy objects, free allocated memory and reset the structure for reuse. +* +* @param txq +* Pointer to TX queue structure. +*/ +static void +txq_cleanup (struct txq *txq) +{ +size_t i; + +DEBUG ("cleaning up %p" , (void *)txq); +txq_free_elts (txq); +if (txq->qp !=NULL ) +claim_zero (ibv_destroy_qp (txq->qp)); +if (txq->cq !=NULL ) +claim_zero (ibv_destroy_cq (txq->cq)); +for (i =0 ; (i !=elemof (txq->mp2mr)); ++i) { +if (txq->mp2mr[i].mp ==NULL ) +break ; +assert (txq->mp2mr[i].mr !=NULL ); +claim_zero (ibv_dereg_mr (txq->mp2mr[i].mr)); + } +memset (txq,0 ,sizeof (*txq)); +} + +/** +* Manage TX completions. +* +* When sending a burst, mlx4_tx_burst() posts several WRs. +* To improve performance, a completion event is only required for the last of +* them. Doing so discards completion information for other WRs, but this +* information would not be used anyway. +* +* @param txq +* Pointer to TX queue structure. +* +* @return +* 0 on success, -1 on failure. +*/ +static int +txq_complete (struct txq *txq) +{ +unsigned int elts_comp = txq->elts_comp; +unsigned int elts_tail; +const unsigned int elts_n = txq->elts_n; +struct ibv_wc wcs[elts_comp]; +int wcs_n; + +if (unlikely (elts_comp ==0 )) +return 0 ; +#ifdef DEBUG_SEND +DEBUG ("%p: processing %u work requests completions" , + (void *)txq, elts_comp); +#endif + wcs_n =ibv_poll_cq (txq->cq, elts_comp, wcs); +if (unlikely (wcs_n ==0 )) +return 0 ; +if (unlikely (wcs_n <0 )) { +DEBUG ("%p: ibv_poll_cq() failed (wcs_n=%d)" , + (void *)txq, wcs_n); +return -1 ; + } + elts_comp -= wcs_n; +assert (elts_comp <= txq->elts_comp); +/* +* Work Completion ID contains the associated element index in +* (*txq->elts)[]. Since WCs are returned in order, we only need to +* look at the last WC to clear older Work Requests. +* +* Assume WC status is successful as nothing can be done about it +* anyway. +*/ + elts_tail =WR_ID (wcs[wcs_n -1 ].wr_id).id; +/* Consume the last WC. */ +if (++elts_tail >= elts_n) + elts_tail =0 ; + txq->elts_tail = elts_tail; + txq->elts_comp = elts_comp; +return 0 ; +} + +/** +* Get Memory Region (MR) <-> Memory Pool (MP) association from txq->mp2mr[]. +* Add MP to txq->mp2mr[] if it's not registered yet. If mp2mr[] is full, +* remove an entry first. +* +* @param txq +* Pointer to TX queue structure. +* @param[in] mp +* Memory Pool for which a Memory Region lkey must be returned. +* +* @return +* mr->lkey on success, (uint32_t)-1 on failure. +*/ +static uint32_t +txq_mp2mr (struct txq *txq,struct rte_mempool *mp) +{ +unsigned int i; +struct ibv_mr *mr; + +for (i =0 ; (i !=elemof (txq->mp2mr)); ++i) { +if (unlikely (txq->mp2mr[i].mp ==NULL )) { +/* Unknown MP, add a new MR for it. */ +break ; + } +if (txq->mp2mr[i].mp == mp) { +assert (txq->mp2mr[i].lkey != (uint32_t )-1 ); +assert (txq->mp2mr[i].mr->lkey == txq->mp2mr[i].lkey); +return txq->mp2mr[i].lkey; + } + } +/* Add a new entry, register MR first. */ +DEBUG ("%p: discovered new memory pool %p" , (void *)txq, (void *)mp); + mr =ibv_reg_mr (txq->priv->pd, + (void *)mp->elt_va_start, + (mp->elt_va_end - mp->elt_va_start), + (IBV_ACCESS_LOCAL_WRITE |IBV_ACCESS_REMOTE_WRITE )); +if (unlikely (mr ==NULL )) { +DEBUG ("%p: unable to configure MR, ibv_reg_mr() failed." , + (void *)txq); +return (uint32_t )-1 ; + } +if (unlikely (i ==elemof (txq->mp2mr))) { +/* Table is full, remove oldest entry. */ +DEBUG ("%p: MR <-> MP table full, dropping oldest entry." , + (void *)txq); + --i; +claim_zero (ibv_dereg_mr (txq->mp2mr[i].mr)); +memmove (&txq->mp2mr[0 ], &txq->mp2mr[1 ], + (sizeof (txq->mp2mr) -sizeof (txq->mp2mr[0 ]))); + } +/* Store the new entry. */ + txq->mp2mr[i].mp = mp; + txq->mp2mr[i].mr = mr; + txq->mp2mr[i].lkey = mr->lkey; +DEBUG ("%p: new MR lkey for MP %p: 0x%08" PRIu32, + (void *)txq, (void *)mp, txq->mp2mr[i].lkey); +return txq->mp2mr[i].lkey; +} + +/** +* Copy scattered mbuf contents to a single linear buffer. +* +* @param[out] linear +* Linear output buffer. +* @param[in] buf +* Scattered input buffer. +* +* @return +* Number of bytes copied to the output buffer or 0 if not large enough. +*/ +static unsigned int +linearize_mbuf (linear_t *linear,struct rte_mbuf *buf) +{ +unsigned int size =0 ; +unsigned int offset; + +do { +unsigned int len =DATA_LEN (buf); + + offset = size; + size += len; +if (unlikely (size >sizeof (*linear))) +return 0 ; +memcpy (&(*linear)[offset], + rte_pktmbuf_mtod(buf, uint8_t *), + len); + buf =NEXT (buf); + }while (buf !=NULL ); +return size; +} + +/** +* DPDK callback for TX. +* +* @param dpdk_txq +* Generic pointer to TX queue structure. +* @param[in] pkts +* Packets to transmit. +* @param pkts_n +* Number of packets in array. +* +* @return +* Number of packets successfully transmitted (<= pkts_n). +*/ +static uint16_t +mlx4_tx_burst (void *dpdk_txq,struct rte_mbuf **pkts,uint16_t pkts_n) +{ +struct txq *txq = (struct txq *)dpdk_txq; +mlx4_send_wr_t head; +mlx4_send_wr_t **wr_next = &head.next; +mlx4_send_wr_t *bad_wr; +unsigned int elts_head = txq->elts_head; +const unsigned int elts_tail = txq->elts_tail; +const unsigned int elts_n = txq->elts_n; +unsigned int i; +unsigned int max; +int err; + +txq_complete (txq); + max = (elts_n - (elts_head - elts_tail)); +if (max > elts_n) + max -= elts_n; +assert (max >=1 ); +assert (max <= elts_n); +/* Always leave one free entry in the ring. */ + --max; +if (max ==0 ) +return 0 ; +if (max > pkts_n) + max = pkts_n; +for (i =0 ; (i != max); ++i) { +struct rte_mbuf *buf = pkts[i]; +struct txq_elt *elt = &(*txq->elts)[elts_head]; +mlx4_send_wr_t *wr = &elt->wr; +unsigned int segs =NB_SEGS (buf); +#if (MLX4_PMD_MAX_INLINE >0 ) || defined(MLX4_PMD_SOFT_COUNTERS ) +unsigned int sent_size =0 ; +#endif +unsigned int j; +int linearize =0 ; + +/* Clean up old buffer. */ +if (likely (WR_ID (wr->wr_id).offset !=0 )) { +struct rte_mbuf *tmp = (void *) + (elt->sges[0 ].addr -WR_ID (wr->wr_id).offset); + +/* Faster than rte_pktmbuf_free(). */ +do { +struct rte_mbuf *next =NEXT (tmp); + +rte_pktmbuf_free_seg (tmp); + tmp = next; + }while (tmp !=NULL ); + } +#ifndef NDEBUG +/* For assert(). */ +WR_ID (wr->wr_id).offset =0 ; +for (j =0 ; ((int )j < wr->num_sge); ++j) { + elt->sges[j].addr =0 ; + elt->sges[j].length =0 ; + elt->sges[j].lkey =0 ; + } + wr->next =NULL ; + wr->num_sge =0 ; +#endif +/* Sanity checks, most of which are only relevant with +* debugging enabled. */ +assert (WR_ID (wr->wr_id).id == elts_head); +assert (WR_ID (wr->wr_id).offset ==0 ); +assert (wr->next ==NULL ); +assert (wr->sg_list == &elt->sges[0 ]); +assert (wr->num_sge ==0 ); +assert (wr->opcode ==IBV_WR_SEND ); +/* When there are too many segments, extra segments are +* linearized in the last SGE. */ +if (unlikely (segs >elemof (elt->sges))) { + segs = (elemof (elt->sges) -1 ); + linearize =1 ; + } +/* Set WR fields. */ + assert(((uintptr_t)rte_pktmbuf_mtod(buf, char *) - + (uintptr_t )buf) <=0xffff ); +WR_ID (wr->wr_id).offset = + ((uintptr_t)rte_pktmbuf_mtod(buf, char *) - + (uintptr_t )buf); + wr->num_sge = segs; +/* Register segments as SGEs. */ +for (j =0 ; (j != segs); ++j) { +struct ibv_sge *sge = &elt->sges[j]; +uint32_t lkey; + +/* Retrieve Memory Region key for this memory pool. */ + lkey =txq_mp2mr (txq, buf->pool); +if (unlikely (lkey == (uint32_t )-1 )) { +/* MR does not exist. */ +DEBUG ("%p: unable to get MP <-> MR" +" association" , (void *)txq); +/* Clean up TX element. */ +WR_ID (elt->wr.wr_id).offset =0 ; +#ifndef NDEBUG +/* For assert(). */ +while (j) { + --j; + --sge; + sge->addr =0 ; + sge->length =0 ; + sge->lkey =0 ; + } + wr->num_sge =0 ; +#endif + goto stop; + } +/* Sanity checks, only relevant with debugging +* enabled. */ +assert (sge->addr ==0 ); +assert (sge->length ==0 ); +assert (sge->lkey ==0 ); +/* Update SGE. */ + sge->addr = (uintptr_t)rte_pktmbuf_mtod(buf, char *); +if (txq->priv->vf) +rte_prefetch0 ((volatile void *)sge->addr); + sge->length =DATA_LEN (buf); + sge->lkey = lkey; +#if (MLX4_PMD_MAX_INLINE >0 ) || defined(MLX4_PMD_SOFT_COUNTERS ) + sent_size += sge->length; +#endif + buf =NEXT (buf); + } +/* If buf is not NULL here and is not going to be linearized, +* nb_segs is not valid. */ +assert (j == segs); +assert ((buf ==NULL ) || (linearize)); +/* Linearize extra segments. */ +if (linearize) { +struct ibv_sge *sge = &elt->sges[segs]; +linear_t *linear = &(*txq->elts_linear)[elts_head]; +unsigned int size =linearize_mbuf (linear, buf); + +assert (segs == (elemof (elt->sges) -1 )); +if (size ==0 ) { +/* Invalid packet. */ +DEBUG ("%p: packet too large to be linearized." , + (void *)txq); +/* Clean up TX element. */ +WR_ID (elt->wr.wr_id).offset =0 ; +#ifndef NDEBUG +/* For assert(). */ +while (j) { + --j; + --sge; + sge->addr =0 ; + sge->length =0 ; + sge->lkey =0 ; + } + wr->num_sge =0 ; +#endif + goto stop; + } +/* If MLX4_PMD_SGE_WR_N is 1, free mbuf immediately +* and clear offset from WR ID. */ +if (elemof (elt->sges) ==1 ) { +do { +struct rte_mbuf *next =NEXT (buf); + +rte_pktmbuf_free_seg (buf); + buf = next; + }while (buf !=NULL ); +WR_ID (wr->wr_id).offset =0 ; + } +/* Set WR fields and fill SGE with linear buffer. */ + ++wr->num_sge; +/* Sanity checks, only relevant with debugging +* enabled. */ +assert (sge->addr ==0 ); +assert (sge->length ==0 ); +assert (sge->lkey ==0 ); +/* Update SGE. */ + sge->addr = (uintptr_t )&(*linear)[0 ]; + sge->length = size; + sge->lkey = txq->mr_linear->lkey; +#if (MLX4_PMD_MAX_INLINE >0 ) || defined(MLX4_PMD_SOFT_COUNTERS ) + sent_size += size; +#endif + } +/* Link WRs together for ibv_post_send(). */ + *wr_next = wr; + wr_next = &wr->next; +#if MLX4_PMD_MAX_INLINE >0 +if (sent_size <= txq->max_inline) + wr->send_flags =IBV_SEND_INLINE ; + else +#endif + wr->send_flags =0 ; +if (++elts_head >= elts_n) + elts_head =0 ; +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increment sent bytes counter. */ + txq->stats.obytes += sent_size; +#endif + } +stop: +/* Take a shortcut if nothing must be sent. */ +if (unlikely (i ==0 )) +return 0 ; +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increment sent packets counter. */ + txq->stats.opackets += i; +#endif + *wr_next =NULL ; +/* The last WR is the only one asking for a completion event. */ +containerof (wr_next, mlx4_send_wr_t, next)-> + send_flags |=IBV_SEND_SIGNALED ; + err =mlx4_post_send (txq->qp, head.next, &bad_wr); +if (unlikely (err)) { +unsigned int unsent =0 ; + +/* An error occurred, completion event is lost. Fix counters. */ +while (bad_wr !=NULL ) { +struct txq_elt *elt = + containerof(bad_wr, struct txq_elt, wr); +mlx4_send_wr_t *wr = &elt->wr; +mlx4_send_wr_t *next = wr->next; +#if defined(MLX4_PMD_SOFT_COUNTERS ) || !defined(NDEBUG ) +unsigned int j; +#endif + +assert (wr == bad_wr); +/* Clean up TX element without freeing it, caller +* should take care of this. */ +WR_ID (elt->wr.wr_id).offset =0 ; +#ifdef MLX4_PMD_SOFT_COUNTERS +for (j =0 ; ((int )j < wr->num_sge); ++j) + txq->stats.obytes -= wr->sg_list[j].length; +#endif + ++unsent; +#ifndef NDEBUG +/* For assert(). */ +for (j =0 ; ((int )j < wr->num_sge); ++j) { + elt->sges[j].addr =0 ; + elt->sges[j].length =0 ; + elt->sges[j].lkey =0 ; + } + wr->next =NULL ; + wr->num_sge =0 ; +#endif + bad_wr = next; + } +#ifdef MLX4_PMD_SOFT_COUNTERS + txq->stats.opackets -= unsent; +#endif +assert (i >= unsent); + i -= unsent; +/* "Unsend" remaining packets. */ + elts_head -= unsent; +if (elts_head >= elts_n) + elts_head += elts_n; +assert (elts_head < elts_n); +DEBUG ("%p: mlx4_post_send() failed, %u unprocessed WRs: %s" , + (void *)txq, unsent, + ((err <=-1 ) ?"Internal error" :strerror (err))); + }else + ++txq->elts_comp; + txq->elts_head = elts_head; +return i; +} + +/** +* Configure a TX queue. +* +* @param dev +* Pointer to Ethernet device structure. +* @param txq +* Pointer to TX queue structure. +* @param desc +* Number of descriptors to configure in queue. +* @param socket +* NUMA socket on which memory must be allocated. +* @param[in] conf +* Thresholds parameters. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +txq_setup (struct rte_eth_dev *dev,struct txq *txq,uint16_t desc, +unsigned int socket,const struct rte_eth_txconf *conf) +{ +struct priv *priv = dev->data->dev_private; +struct txq tmpl = { + .priv = priv, + .socket = socket + }; +union { +struct ibv_qp_init_attr init; +struct ibv_exp_qp_attr mod; + } attr; +int ret =0 ; + + (void )conf;/* Thresholds configuration (ignored). */ +if ((desc ==0 ) || (desc %MLX4_PMD_SGE_WR_N )) { +ERROR ("%p: invalid number of TX descriptors (must be a" +" multiple of %d)" , (void *)dev, desc); +return EINVAL ; + } + desc /=MLX4_PMD_SGE_WR_N ; +/* MRs will be registered in mp2mr[] later. */ + tmpl.cq =ibv_create_cq (priv->ctx, desc,NULL ,NULL ,0 ); +if (tmpl.cq ==NULL ) { + ret =ENOMEM ; +ERROR ("%p: CQ creation failure: %s" , + (void *)dev,strerror (ret)); + goto error; + } +DEBUG ("priv->device_attr.max_qp_wr is %d" , + priv->device_attr.max_qp_wr); +DEBUG ("priv->device_attr.max_sge is %d" , + priv->device_attr.max_sge); + attr.init = (struct ibv_qp_init_attr ){ +/* CQ to be associated with the send queue. */ + .send_cq = tmpl.cq, +/* CQ to be associated with the receive queue. */ + .recv_cq = tmpl.cq, + .cap = { +/* Max number of outstanding WRs. */ + .max_send_wr = ((priv->device_attr.max_qp_wr < desc) ? + priv->device_attr.max_qp_wr : + desc), +/* Max number of scatter/gather elements in a WR. */ + .max_send_sge = ((priv->device_attr.max_sge < +MLX4_PMD_SGE_WR_N ) ? + priv->device_attr.max_sge : +MLX4_PMD_SGE_WR_N ), +#if MLX4_PMD_MAX_INLINE > 0 + .max_inline_data =MLX4_PMD_MAX_INLINE , +#endif + }, + .qp_type =IBV_QPT_RAW_PACKET , +/* Do *NOT* enable this, completions events are managed per +* TX burst. */ + .sq_sig_all =0 + }; + tmpl.qp =ibv_create_qp (priv->pd, &attr.init); +if (tmpl.qp ==NULL ) { + ret = (errno ? errno :EINVAL ); +ERROR ("%p: QP creation failure: %s" , + (void *)dev,strerror (ret)); + goto error; + } +#if MLX4_PMD_MAX_INLINE >0 +/* ibv_create_qp() updates this value. */ + tmpl.max_inline = attr.init.cap.max_inline_data; +#endif + attr.mod = (struct ibv_exp_qp_attr ){ +/* Move the QP to this state. */ + .qp_state =IBV_QPS_INIT , +/* Primary port number. */ + .port_num = priv->port + }; + ret =ibv_exp_modify_qp (tmpl.qp, &attr.mod, + (IBV_EXP_QP_STATE |IBV_EXP_QP_PORT )); +if (ret) { +ERROR ("%p: QP state to IBV_QPS_INIT failed: %s" , + (void *)dev,strerror (ret)); + goto error; + } + ret =txq_alloc_elts (&tmpl, desc); +if (ret) { +ERROR ("%p: TXQ allocation failed: %s" , + (void *)dev,strerror (ret)); + goto error; + } + attr.mod = (struct ibv_exp_qp_attr ){ + .qp_state =IBV_QPS_RTR + }; + ret =ibv_exp_modify_qp (tmpl.qp, &attr.mod,IBV_EXP_QP_STATE ); +if (ret) { +ERROR ("%p: QP state to IBV_QPS_RTR failed: %s" , + (void *)dev,strerror (ret)); + goto error; + } + attr.mod.qp_state =IBV_QPS_RTS ; + ret =ibv_exp_modify_qp (tmpl.qp, &attr.mod,IBV_EXP_QP_STATE ); +if (ret) { +ERROR ("%p: QP state to IBV_QPS_RTS failed: %s" , + (void *)dev,strerror (ret)); + goto error; + } +/* Clean up txq in case we're reinitializing it. */ +DEBUG ("%p: cleaning-up old txq just in case" , (void *)txq); +txq_cleanup (txq); + *txq = tmpl; +DEBUG ("%p: txq updated with %p" , (void *)txq, (void *)&tmpl); +assert (ret ==0 ); +return 0 ; +error: +txq_cleanup (&tmpl); +assert (ret >0 ); +return ret; +} + +/** +* DPDK callback to configure a TX queue. +* +* @param dev +* Pointer to Ethernet device structure. +* @param idx +* TX queue index. +* @param desc +* Number of descriptors to configure in queue. +* @param socket +* NUMA socket on which memory must be allocated. +* @param[in] conf +* Thresholds parameters. +* +* @return +* 0 on success, negative errno value on failure. +*/ +static int +mlx4_tx_queue_setup (struct rte_eth_dev *dev,uint16_t idx,uint16_t desc, +unsigned int socket,const struct rte_eth_txconf *conf) +{ +struct priv *priv = dev->data->dev_private; +struct txq *txq = (*priv->txqs)[idx]; +int ret; + +priv_lock (priv); +DEBUG ("%p: configuring queue %u for %u descriptors" , + (void *)dev, idx, desc); +if (idx >= priv->txqs_n) { +ERROR ("%p: queue index out of range (%u >= %u)" , + (void *)dev, idx, priv->txqs_n); +priv_unlock (priv); +return -EOVERFLOW ; + } +if (txq !=NULL ) { +DEBUG ("%p: reusing already allocated queue index %u (%p)" , + (void *)dev, idx, (void *)txq); +if (priv->started) { +priv_unlock (priv); +return -EEXIST ; + } + (*priv->txqs)[idx] =NULL ; +txq_cleanup (txq); + }else { + txq =rte_calloc_socket ("TXQ" ,1 ,sizeof (*txq),0 , socket); +if (txq ==NULL ) { +ERROR ("%p: unable to allocate queue index %u" , + (void *)dev, idx); +priv_unlock (priv); +return -ENOMEM ; + } + } + ret =txq_setup (dev, txq, desc, socket, conf); +if (ret) +rte_free (txq); +else { + txq->stats.idx = idx; +DEBUG ("%p: adding TX queue %p to list" , + (void *)dev, (void *)txq); + (*priv->txqs)[idx] = txq; +/* Update send callback. */ + dev->tx_pkt_burst = mlx4_tx_burst; + } +priv_unlock (priv); +return -ret; +} + +/** +* DPDK callback to release a TX queue. +* +* @param dpdk_txq +* Generic TX queue pointer. +*/ +static void +mlx4_tx_queue_release (void *dpdk_txq) +{ +struct txq *txq = (struct txq *)dpdk_txq; +struct priv *priv; +unsigned int i; + +if (txq ==NULL ) +return ; + priv = txq->priv; +priv_lock (priv); +for (i =0 ; (i != priv->txqs_n); ++i) +if ((*priv->txqs)[i] == txq) { +DEBUG ("%p: removing TX queue %p from list" , + (void *)priv->dev, (void *)txq); + (*priv->txqs)[i] =NULL ; +break ; + } +txq_cleanup (txq); +rte_free (txq); +priv_unlock (priv); +} + +/* RX queues handling. */ + +/** +* Allocate RX queue elements with scattered packets support. +* +* @param rxq +* Pointer to RX queue structure. +* @param elts_n +* Number of elements to allocate. +* @param[in] pool +* If not NULL, fetch buffers from this array instead of allocating them +* with rte_pktmbuf_alloc(). +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_alloc_elts_sp (struct rxq *rxq,unsigned int elts_n, +struct rte_mbuf **pool) +{ +unsigned int i; +struct rxq_elt_sp (*elts)[elts_n] = +rte_calloc_socket ("RXQ elements" ,1 ,sizeof (*elts),0 , + rxq->socket); +int ret =0 ; + +if (elts ==NULL ) { +ERROR ("%p: can't allocate packets array" , (void *)rxq); + ret =ENOMEM ; + goto error; + } +/* For each WR (packet). */ +for (i =0 ; (i != elts_n); ++i) { +unsigned int j; +struct rxq_elt_sp *elt = &(*elts)[i]; +struct ibv_recv_wr *wr = &elt->wr; +struct ibv_sge (*sges)[(elemof (elt->sges))] = &elt->sges; + +/* These two arrays must have the same size. */ +assert (elemof (elt->sges) ==elemof (elt->bufs)); +/* Configure WR. */ + wr->wr_id = i; + wr->next = &(*elts)[(i +1 )].wr; + wr->sg_list = &(*sges)[0 ]; + wr->num_sge =elemof (*sges); +/* For each SGE (segment). */ +for (j =0 ; (j !=elemof (elt->bufs)); ++j) { +struct ibv_sge *sge = &(*sges)[j]; +struct rte_mbuf *buf; + +if (pool !=NULL ) { + buf = *(pool++); +assert (buf !=NULL ); +rte_pktmbuf_reset (buf); + }else + buf =rte_pktmbuf_alloc (rxq->mp); +if (buf ==NULL ) { +assert (pool ==NULL ); +ERROR ("%p: empty mbuf pool" , (void *)rxq); + ret =ENOMEM ; + goto error; + } + elt->bufs[j] = buf; +/* Headroom is reserved by rte_pktmbuf_alloc(). */ +assert (DATA_OFF (buf) ==RTE_PKTMBUF_HEADROOM ); +/* Buffer is supposed to be empty. */ +assert (rte_pktmbuf_data_len (buf) ==0 ); +assert (rte_pktmbuf_pkt_len (buf) ==0 ); +/* sge->addr must be able to store a pointer. */ +assert (sizeof (sge->addr) >=sizeof (uintptr_t )); +if (j ==0 ) { +/* The first SGE keeps its headroom. */ + sge->addr = (uintptr_t )rte_pktmbuf_mtod (buf, + char *); + sge->length = (buf->buf_len - +RTE_PKTMBUF_HEADROOM ); + }else { +/* Subsequent SGEs lose theirs. */ +assert (DATA_OFF (buf) ==RTE_PKTMBUF_HEADROOM ); +SET_DATA_OFF (buf,0 ); + sge->addr = (uintptr_t )buf->buf_addr; + sge->length = buf->buf_len; + } + sge->lkey = rxq->mr->lkey; +/* Redundant check for tailroom. */ +assert (sge->length ==rte_pktmbuf_tailroom (buf)); + } + } +/* The last WR pointer must be NULL. */ + (*elts)[(i -1 )].wr.next =NULL ; +DEBUG ("%p: allocated and configured %u WRs (%zu segments)" , + (void *)rxq, elts_n, (elts_n *elemof ((*elts)[0 ].sges))); + rxq->elts_n = elts_n; + rxq->elts.sp = elts; +assert (ret ==0 ); +return 0 ; +error: +if (elts !=NULL ) { +assert (pool ==NULL ); +for (i =0 ; (i !=elemof (*elts)); ++i) { +unsigned int j; +struct rxq_elt_sp *elt = &(*elts)[i]; + +for (j =0 ; (j !=elemof (elt->bufs)); ++j) { +struct rte_mbuf *buf = elt->bufs[j]; + +if (buf !=NULL ) +rte_pktmbuf_free_seg (buf); + } + } +rte_free (elts); + } +DEBUG ("%p: failed, freed everything" , (void *)rxq); +assert (ret >0 ); +return ret; +} + +/** +* Free RX queue elements with scattered packets support. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_free_elts_sp (struct rxq *rxq) +{ +unsigned int i; +unsigned int elts_n = rxq->elts_n; +struct rxq_elt_sp (*elts)[elts_n] = rxq->elts.sp; + +DEBUG ("%p: freeing WRs" , (void *)rxq); + rxq->elts_n =0 ; + rxq->elts.sp =NULL ; +if (elts ==NULL ) +return ; +for (i =0 ; (i !=elemof (*elts)); ++i) { +unsigned int j; +struct rxq_elt_sp *elt = &(*elts)[i]; + +for (j =0 ; (j !=elemof (elt->bufs)); ++j) { +struct rte_mbuf *buf = elt->bufs[j]; + +if (buf !=NULL ) +rte_pktmbuf_free_seg (buf); + } + } +rte_free (elts); +} + +/** +* Allocate RX queue elements. +* +* @param rxq +* Pointer to RX queue structure. +* @param elts_n +* Number of elements to allocate. +* @param[in] pool +* If not NULL, fetch buffers from this array instead of allocating them +* with rte_pktmbuf_alloc(). +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_alloc_elts (struct rxq *rxq,unsigned int elts_n,struct rte_mbuf **pool) +{ +unsigned int i; +struct rxq_elt (*elts)[elts_n] = +rte_calloc_socket ("RXQ elements" ,1 ,sizeof (*elts),0 , + rxq->socket); +int ret =0 ; + +if (elts ==NULL ) { +ERROR ("%p: can't allocate packets array" , (void *)rxq); + ret =ENOMEM ; + goto error; + } +/* For each WR (packet). */ +for (i =0 ; (i != elts_n); ++i) { +struct rxq_elt *elt = &(*elts)[i]; +struct ibv_recv_wr *wr = &elt->wr; +struct ibv_sge *sge = &(*elts)[i].sge; +struct rte_mbuf *buf; + +if (pool !=NULL ) { + buf = *(pool++); +assert (buf !=NULL ); +rte_pktmbuf_reset (buf); + }else + buf =rte_pktmbuf_alloc (rxq->mp); +if (buf ==NULL ) { +assert (pool ==NULL ); +ERROR ("%p: empty mbuf pool" , (void *)rxq); + ret =ENOMEM ; + goto error; + } +/* Configure WR. Work request ID contains its own index in +* the elts array and the offset between SGE buffer header and +* its data. */ +WR_ID (wr->wr_id).id = i; +WR_ID (wr->wr_id).offset = + (((uintptr_t )buf->buf_addr +RTE_PKTMBUF_HEADROOM ) - + (uintptr_t )buf); + wr->next = &(*elts)[(i +1 )].wr; + wr->sg_list = sge; + wr->num_sge =1 ; +/* Headroom is reserved by rte_pktmbuf_alloc(). */ +assert (DATA_OFF (buf) ==RTE_PKTMBUF_HEADROOM ); +/* Buffer is supposed to be empty. */ +assert (rte_pktmbuf_data_len (buf) ==0 ); +assert (rte_pktmbuf_pkt_len (buf) ==0 ); +/* sge->addr must be able to store a pointer. */ +assert (sizeof (sge->addr) >=sizeof (uintptr_t )); +/* SGE keeps its headroom. */ + sge->addr = (uintptr_t ) + ((uint8_t *)buf->buf_addr +RTE_PKTMBUF_HEADROOM ); + sge->length = (buf->buf_len -RTE_PKTMBUF_HEADROOM ); + sge->lkey = rxq->mr->lkey; +/* Redundant check for tailroom. */ +assert (sge->length ==rte_pktmbuf_tailroom (buf)); +/* Make sure elts index and SGE mbuf pointer can be deduced +* from WR ID. */ +if ((WR_ID (wr->wr_id).id != i) || + ((void *)(sge->addr -WR_ID (wr->wr_id).offset) != buf)) { +ERROR ("%p: cannot store index and offset in WR ID" , + (void *)rxq); + sge->addr =0 ; +rte_pktmbuf_free (buf); + ret =EOVERFLOW ; + goto error; + } + } +/* The last WR pointer must be NULL. */ + (*elts)[(i -1 )].wr.next =NULL ; +DEBUG ("%p: allocated and configured %u single-segment WRs" , + (void *)rxq, elts_n); + rxq->elts_n = elts_n; + rxq->elts.no_sp = elts; +assert (ret ==0 ); +return 0 ; +error: +if (elts !=NULL ) { +assert (pool ==NULL ); +for (i =0 ; (i !=elemof (*elts)); ++i) { +struct rxq_elt *elt = &(*elts)[i]; +struct rte_mbuf *buf; + +if (elt->sge.addr ==0 ) +continue ; +assert (WR_ID (elt->wr.wr_id).id == i); + buf = (void *) + (elt->sge.addr -WR_ID (elt->wr.wr_id).offset); +rte_pktmbuf_free_seg (buf); + } +rte_free (elts); + } +DEBUG ("%p: failed, freed everything" , (void *)rxq); +assert (ret >0 ); +return ret; +} + +/** +* Free RX queue elements. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_free_elts (struct rxq *rxq) +{ +unsigned int i; +unsigned int elts_n = rxq->elts_n; +struct rxq_elt (*elts)[elts_n] = rxq->elts.no_sp; + +DEBUG ("%p: freeing WRs" , (void *)rxq); + rxq->elts_n =0 ; + rxq->elts.no_sp =NULL ; +if (elts ==NULL ) +return ; +for (i =0 ; (i !=elemof (*elts)); ++i) { +struct rxq_elt *elt = &(*elts)[i]; +struct rte_mbuf *buf; + +if (elt->sge.addr ==0 ) +continue ; +assert (WR_ID (elt->wr.wr_id).id == i); + buf = (void *)(elt->sge.addr -WR_ID (elt->wr.wr_id).offset); +rte_pktmbuf_free_seg (buf); + } +rte_free (elts); +} + +/** +* Unregister a MAC address from a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +* @param mac_index +* MAC address index. +*/ +static void +rxq_mac_addr_del (struct rxq *rxq,unsigned int mac_index) +{ +#ifndef NDEBUG +struct priv *priv = rxq->priv; +const uint8_t (*mac)[ETHER_ADDR_LEN ] = + (const uint8_t (*)[ETHER_ADDR_LEN ]) + priv->mac[mac_index].addr_bytes; +#endif + +assert (mac_index <elemof (priv->mac)); +if (!BITFIELD_ISSET (rxq->mac_configured, mac_index)) { +assert (rxq->mac_flow[mac_index] ==NULL ); +return ; + } +DEBUG ("%p: removing MAC address %02x:%02x:%02x:%02x:%02x:%02x" +" index %u" , + (void *)rxq, + (*mac)[0 ], (*mac)[1 ], (*mac)[2 ], (*mac)[3 ], (*mac)[4 ], (*mac)[5 ], + mac_index); +assert (rxq->mac_flow[mac_index] !=NULL ); +claim_zero (ibv_exp_destroy_flow (rxq->mac_flow[mac_index])); + rxq->mac_flow[mac_index] =NULL ; +BITFIELD_RESET (rxq->mac_configured, mac_index); +} + +/** +* Unregister all MAC addresses from a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_mac_addrs_del (struct rxq *rxq) +{ +struct priv *priv = rxq->priv; +unsigned int i; + +for (i =0 ; (i !=elemof (priv->mac)); ++i) +rxq_mac_addr_del (rxq, i); +} + +static int rxq_promiscuous_enable (struct rxq *); +static void rxq_promiscuous_disable (struct rxq *); + +/** +* Register a MAC address in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +* @param mac_index +* MAC address index to register. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_mac_addr_add (struct rxq *rxq,unsigned int mac_index) +{ +struct priv *priv = rxq->priv; +const uint8_t (*mac)[ETHER_ADDR_LEN ] = + (const uint8_t (*)[ETHER_ADDR_LEN ]) + priv->mac[mac_index].addr_bytes; +unsigned int vlans =0 ; +unsigned int specs =0 ; +unsigned int i, j; +struct ibv_exp_flow *flow; + +assert (mac_index <elemof (priv->mac)); +if (BITFIELD_ISSET (rxq->mac_configured, mac_index)) +rxq_mac_addr_del (rxq, mac_index); +/* Number of configured VLANs. */ +for (i =0 ; (i !=elemof (priv->vlan_filter)); ++i) +if (priv->vlan_filter[i].enabled) + ++vlans; + specs = (vlans ? vlans :1 ); + +/* Allocate flow specification on the stack. */ +struct ibv_exp_flow_attr data + [1 + + (sizeof (struct ibv_exp_flow_spec_eth [specs]) / +sizeof (struct ibv_exp_flow_attr )) + + !!(sizeof (struct ibv_exp_flow_spec_eth [specs]) % +sizeof (struct ibv_exp_flow_attr ))]; +struct ibv_exp_flow_attr *attr = (void *)&data[0 ]; +struct ibv_exp_flow_spec_eth *spec = (void *)&data[1 ]; + +/* +* No padding must be inserted by the compiler between attr and spec. +* This layout is expected by libibverbs. +*/ +assert (((uint8_t *)attr +sizeof (*attr)) == (uint8_t *)spec); + *attr = (struct ibv_exp_flow_attr ){ + .type =IBV_EXP_FLOW_ATTR_NORMAL , + .num_of_specs = specs, + .port = priv->port, + .flags =0 + }; + *spec = (struct ibv_exp_flow_spec_eth ){ + .type =IBV_EXP_FLOW_SPEC_ETH , + .size =sizeof (*spec), + .val = { + .dst_mac = { + (*mac)[0 ], (*mac)[1 ], (*mac)[2 ], + (*mac)[3 ], (*mac)[4 ], (*mac)[5 ] + } + }, + .mask = { + .dst_mac ="\xff\xff\xff\xff\xff\xff" , + .vlan_tag = (vlans ?htons (0xfff ) :0 ) + } + }; +/* Fill VLAN specifications. */ +for (i =0 , j =0 ; (i !=elemof (priv->vlan_filter)); ++i) { +if (!priv->vlan_filter[i].enabled) +continue ; +assert (j != vlans); +if (j) + spec[j] = spec[0 ]; + spec[j].val.vlan_tag =htons (priv->vlan_filter[i].id); + ++j; + } +DEBUG ("%p: adding MAC address %02x:%02x:%02x:%02x:%02x:%02x index %u" +" (%u VLAN(s) configured)" , + (void *)rxq, + (*mac)[0 ], (*mac)[1 ], (*mac)[2 ], (*mac)[3 ], (*mac)[4 ], (*mac)[5 ], + mac_index, + vlans); +/* Create related flow. */ + errno =0 ; + flow =ibv_exp_create_flow (rxq->qp, attr); +if (flow ==NULL ) { +int err = errno; + +/* Flow creation failure is not fatal when in DMFS A0 mode. +* Ignore error if promiscuity is already enabled or can be +* enabled. */ +if (priv->promisc_ok) +return 0 ; +if ((rxq->promisc_flow !=NULL ) || + (rxq_promiscuous_enable (rxq) ==0 )) { +if (rxq->promisc_flow !=NULL ) +rxq_promiscuous_disable (rxq); +WARN ("cannot configure normal flow but promiscuous" +" mode is fine, assuming promiscuous optimization" +" is enabled" +" (options mlx4_core log_num_mgm_entry_size=-7)" ); + priv->promisc_ok =1 ; +return 0 ; + } + errno = err; +/* It's not clear whether errno is always set in this case. */ +ERROR ("%p: flow configuration failed, errno=%d: %s" , + (void *)rxq, errno, + (errno ?strerror (errno) :"Unknown error" )); +if (errno) +return errno; +return EINVAL ; + } +assert (rxq->mac_flow[mac_index] ==NULL ); + rxq->mac_flow[mac_index] = flow; +BITFIELD_SET (rxq->mac_configured, mac_index); +return 0 ; +} + +/** +* Register all MAC addresses in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_mac_addrs_add (struct rxq *rxq) +{ +struct priv *priv = rxq->priv; +unsigned int i; +int ret; + +for (i =0 ; (i !=elemof (priv->mac)); ++i) { +if (!BITFIELD_ISSET (priv->mac_configured, i)) +continue ; + ret =rxq_mac_addr_add (rxq, i); +if (!ret) +continue ; +/* Failure, rollback. */ +while (i !=0 ) +rxq_mac_addr_del (rxq, --i); +assert (ret >0 ); +return ret; + } +return 0 ; +} + +/** +* Unregister a MAC address. +* +* In RSS mode, the MAC address is unregistered from the parent queue, +* otherwise it is unregistered from each queue directly. +* +* @param priv +* Pointer to private structure. +* @param mac_index +* MAC address index. +*/ +static void +priv_mac_addr_del (struct priv *priv,unsigned int mac_index) +{ +unsigned int i; + +assert (mac_index <elemof (priv->mac)); +if (!BITFIELD_ISSET (priv->mac_configured, mac_index)) +return ; +if (priv->rss) { +rxq_mac_addr_del (&priv->rxq_parent, mac_index); + goto end; + } +for (i =0 ; (i != priv->dev->data->nb_rx_queues); ++i) +rxq_mac_addr_del ((*priv->rxqs)[i], mac_index); +end: +BITFIELD_RESET (priv->mac_configured, mac_index); +} + +/** +* Register a MAC address. +* +* In RSS mode, the MAC address is registered in the parent queue, +* otherwise it is registered in each queue directly. +* +* @param priv +* Pointer to private structure. +* @param mac_index +* MAC address index to use. +* @param mac +* MAC address to register. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +priv_mac_addr_add (struct priv *priv,unsigned int mac_index, +const uint8_t (*mac)[ETHER_ADDR_LEN ]) +{ +unsigned int i; +int ret; + +assert (mac_index <elemof (priv->mac)); +/* First, make sure this address isn't already configured. */ +for (i =0 ; (i !=elemof (priv->mac)); ++i) { +/* Skip this index, it's going to be reconfigured. */ +if (i == mac_index) +continue ; +if (!BITFIELD_ISSET (priv->mac_configured, i)) +continue ; +if (memcmp (priv->mac[i].addr_bytes, *mac,sizeof (*mac))) +continue ; +/* Address already configured elsewhere, return with error. */ +return EADDRINUSE ; + } +if (BITFIELD_ISSET (priv->mac_configured, mac_index)) +priv_mac_addr_del (priv, mac_index); + priv->mac[mac_index] = (struct ether_addr ){ + { + (*mac)[0 ], (*mac)[1 ], (*mac)[2 ], + (*mac)[3 ], (*mac)[4 ], (*mac)[5 ] + } + }; +/* If device isn't started, this is all we need to do. */ +if (!priv->started) { +#ifndef NDEBUG +/* Verify that all queues have this index disabled. */ +for (i =0 ; (i != priv->rxqs_n); ++i) { +if ((*priv->rxqs)[i] ==NULL ) +continue ; +assert (!BITFIELD_ISSET + ((*priv->rxqs)[i]->mac_configured, mac_index)); + } +#endif + goto end; + } +if (priv->rss) { + ret =rxq_mac_addr_add (&priv->rxq_parent, mac_index); +if (ret) +return ret; + goto end; + } +for (i =0 ; (i != priv->rxqs_n); ++i) { +if ((*priv->rxqs)[i] ==NULL ) +continue ; + ret =rxq_mac_addr_add ((*priv->rxqs)[i], mac_index); +if (!ret) +continue ; +/* Failure, rollback. */ +while (i !=0 ) +if ((*priv->rxqs)[(--i)] !=NULL ) +rxq_mac_addr_del ((*priv->rxqs)[i], mac_index); +return ret; + } +end: +BITFIELD_SET (priv->mac_configured, mac_index); +return 0 ; +} + +/** +* Enable allmulti mode in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_allmulticast_enable (struct rxq *rxq) +{ +struct ibv_exp_flow *flow; +struct ibv_exp_flow_attr attr = { + .type =IBV_EXP_FLOW_ATTR_MC_DEFAULT , + .num_of_specs =0 , + .port = rxq->priv->port, + .flags =0 + }; + +DEBUG ("%p: enabling allmulticast mode" , (void *)rxq); +if (rxq->allmulti_flow !=NULL ) +return EBUSY ; + errno =0 ; + flow =ibv_exp_create_flow (rxq->qp, &attr); +if (flow ==NULL ) { +/* It's not clear whether errno is always set in this case. */ +ERROR ("%p: flow configuration failed, errno=%d: %s" , + (void *)rxq, errno, + (errno ?strerror (errno) :"Unknown error" )); +if (errno) +return errno; +return EINVAL ; + } + rxq->allmulti_flow = flow; +DEBUG ("%p: allmulticast mode enabled" , (void *)rxq); +return 0 ; +} + +/** +* Disable allmulti mode in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_allmulticast_disable (struct rxq *rxq) +{ +DEBUG ("%p: disabling allmulticast mode" , (void *)rxq); +if (rxq->allmulti_flow ==NULL ) +return ; +claim_zero (ibv_exp_destroy_flow (rxq->allmulti_flow)); + rxq->allmulti_flow =NULL ; +DEBUG ("%p: allmulticast mode disabled" , (void *)rxq); +} + +/** +* Enable promiscuous mode in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_promiscuous_enable (struct rxq *rxq) +{ +struct ibv_exp_flow *flow; +struct ibv_exp_flow_attr attr = { + .type =IBV_EXP_FLOW_ATTR_ALL_DEFAULT , + .num_of_specs =0 , + .port = rxq->priv->port, + .flags =0 + }; + +if (rxq->priv->vf) +return 0 ; +DEBUG ("%p: enabling promiscuous mode" , (void *)rxq); +if (rxq->promisc_flow !=NULL ) +return EBUSY ; + errno =0 ; + flow =ibv_exp_create_flow (rxq->qp, &attr); +if (flow ==NULL ) { +/* It's not clear whether errno is always set in this case. */ +ERROR ("%p: flow configuration failed, errno=%d: %s" , + (void *)rxq, errno, + (errno ?strerror (errno) :"Unknown error" )); +if (errno) +return errno; +return EINVAL ; + } + rxq->promisc_flow = flow; +DEBUG ("%p: promiscuous mode enabled" , (void *)rxq); +return 0 ; +} + +/** +* Disable promiscuous mode in a RX queue. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_promiscuous_disable (struct rxq *rxq) +{ +if (rxq->priv->vf) +return ; +DEBUG ("%p: disabling promiscuous mode" , (void *)rxq); +if (rxq->promisc_flow ==NULL ) +return ; +claim_zero (ibv_exp_destroy_flow (rxq->promisc_flow)); + rxq->promisc_flow =NULL ; +DEBUG ("%p: promiscuous mode disabled" , (void *)rxq); +} + +/** +* Clean up a RX queue. +* +* Destroy objects, free allocated memory and reset the structure for reuse. +* +* @param rxq +* Pointer to RX queue structure. +*/ +static void +rxq_cleanup (struct rxq *rxq) +{ +DEBUG ("cleaning up %p" , (void *)rxq); +if (rxq->sp) +rxq_free_elts_sp (rxq); +else +rxq_free_elts (rxq); +if (rxq->qp !=NULL ) { +rxq_promiscuous_disable (rxq); +rxq_allmulticast_disable (rxq); +rxq_mac_addrs_del (rxq); +claim_zero (ibv_destroy_qp (rxq->qp)); + } +if (rxq->cq !=NULL ) +claim_zero (ibv_destroy_cq (rxq->cq)); +if (rxq->mr !=NULL ) +claim_zero (ibv_dereg_mr (rxq->mr)); +memset (rxq,0 ,sizeof (*rxq)); +} + +static uint16_t +mlx4_rx_burst (void *dpdk_rxq,struct rte_mbuf **pkts,uint16_t pkts_n); + +/** +* DPDK callback for RX with scattered packets support. +* +* @param dpdk_rxq +* Generic pointer to RX queue structure. +* @param[out] pkts +* Array to store received packets. +* @param pkts_n +* Maximum number of packets in array. +* +* @return +* Number of packets successfully received (<= pkts_n). +*/ +static uint16_t +mlx4_rx_burst_sp (void *dpdk_rxq,struct rte_mbuf **pkts,uint16_t pkts_n) +{ +struct rxq *rxq = (struct rxq *)dpdk_rxq; +struct rxq_elt_sp (*elts)[rxq->elts_n] = rxq->elts.sp; +struct ibv_wc wcs[pkts_n]; +struct ibv_recv_wr head; +struct ibv_recv_wr **next = &head.next; +struct ibv_recv_wr *bad_wr; +int ret =0 ; +int wcs_n; +int i; + +if (unlikely (!rxq->sp)) +return mlx4_rx_burst (dpdk_rxq, pkts, pkts_n); +if (unlikely (elts ==NULL ))/* See RTE_DEV_CMD_SET_MTU. */ +return 0 ; + wcs_n =ibv_poll_cq (rxq->cq, pkts_n, wcs); +if (unlikely (wcs_n ==0 )) +return 0 ; +if (unlikely (wcs_n <0 )) { +DEBUG ("rxq=%p, ibv_poll_cq() failed (wc_n=%d)" , + (void *)rxq, wcs_n); +return 0 ; + } +assert (wcs_n <= (int )pkts_n); +/* For each work completion. */ +for (i =0 ; (i != wcs_n); ++i) { +struct ibv_wc *wc = &wcs[i]; +uint64_t wr_id = wc->wr_id; +uint32_t len = wc->byte_len; +struct rxq_elt_sp *elt = &(*elts)[wr_id]; +struct ibv_recv_wr *wr = &elt->wr; +struct rte_mbuf *pkt_buf =NULL ;/* Buffer returned in pkts. */ +struct rte_mbuf **pkt_buf_next = &pkt_buf; +unsigned int seg_headroom =RTE_PKTMBUF_HEADROOM ; +unsigned int j =0 ; + +/* Sanity checks. */ +assert (wr_id < rxq->elts_n); +assert (wr_id == wr->wr_id); +assert (wr->sg_list == elt->sges); +assert (wr->num_sge ==elemof (elt->sges)); +/* Link completed WRs together for repost. */ + *next = wr; + next = &wr->next; +if (unlikely (wc->status !=IBV_WC_SUCCESS )) { +/* Whatever, just repost the offending WR. */ +DEBUG ("rxq=%p, wr_id=%" PRIu64": bad work completion" +" status (%d): %s" , + (void *)rxq, wc->wr_id, wc->status, +ibv_wc_status_str (wc->status)); +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase dropped packets counter. */ + ++rxq->stats.idropped; +#endif + goto repost; + } +/* +* Replace spent segments with new ones, concatenate and +* return them as pkt_buf. +*/ +while (1 ) { +struct ibv_sge *sge = &elt->sges[j]; +struct rte_mbuf *seg = elt->bufs[j]; +struct rte_mbuf *rep; +unsigned int seg_tailroom; + +/* +* Fetch initial bytes of packet descriptor into a +* cacheline while allocating rep. +*/ +rte_prefetch0 (seg); + rep =__rte_mbuf_raw_alloc (rxq->mp); +if (unlikely (rep ==NULL )) { +/* +* Unable to allocate a replacement mbuf, +* repost WR. +*/ +DEBUG ("rxq=%p, wr_id=%" PRIu64":" +" can't allocate a new mbuf" , + (void *)rxq, wr_id); +if (pkt_buf !=NULL ) +rte_pktmbuf_free (pkt_buf); +/* Increase out of memory counters. */ + ++rxq->stats.rx_nombuf; + ++rxq->priv->dev->data->rx_mbuf_alloc_failed; + goto repost; + } +#ifndef NDEBUG +/* Poison user-modifiable fields in rep. */ +NEXT (rep) = (void *)((uintptr_t )-1 ); +SET_DATA_OFF (rep,0xdead ); +DATA_LEN (rep) =0xd00d ; +PKT_LEN (rep) =0xdeadd00d ; +NB_SEGS (rep) =0x2a ; +PORT (rep) =0x2a ; + rep->ol_flags =-1 ; +#endif +assert (rep->buf_len == seg->buf_len); +assert (rep->buf_len == rxq->mb_len); +/* Reconfigure sge to use rep instead of seg. */ +assert (sge->lkey == rxq->mr->lkey); + sge->addr = ((uintptr_t )rep->buf_addr + seg_headroom); + elt->bufs[j] = rep; + ++j; +/* Update pkt_buf if it's the first segment, or link +* seg to the previous one and update pkt_buf_next. */ + *pkt_buf_next = seg; + pkt_buf_next = &NEXT (seg); +/* Update seg information. */ + seg_tailroom = (seg->buf_len - seg_headroom); +assert (sge->length == seg_tailroom); +SET_DATA_OFF (seg, seg_headroom); +if (likely (len <= seg_tailroom)) { +/* Last segment. */ +DATA_LEN (seg) = len; +PKT_LEN (seg) = len; +/* Sanity check. */ +assert (rte_pktmbuf_headroom (seg) == + seg_headroom); +assert (rte_pktmbuf_tailroom (seg) == + (seg_tailroom - len)); +break ; + } +DATA_LEN (seg) = seg_tailroom; +PKT_LEN (seg) = seg_tailroom; +/* Sanity check. */ +assert (rte_pktmbuf_headroom (seg) == seg_headroom); +assert (rte_pktmbuf_tailroom (seg) ==0 ); +/* Fix len and clear headroom for next segments. */ + len -= seg_tailroom; + seg_headroom =0 ; + } +/* Update head and tail segments. */ + *pkt_buf_next =NULL ; +assert (pkt_buf !=NULL ); +assert (j !=0 ); +NB_SEGS (pkt_buf) = j; +PORT (pkt_buf) = rxq->port_id; +PKT_LEN (pkt_buf) = wc->byte_len; + pkt_buf->ol_flags =0 ; + +/* Return packet. */ + *(pkts++) = pkt_buf; + ++ret; +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase bytes counter. */ + rxq->stats.ibytes += wc->byte_len; +#endif +repost: +continue ; + } + *next =NULL ; +/* Repost WRs. */ +#ifdef DEBUG_RECV +DEBUG ("%p: reposting %d WRs starting from %" PRIu64" (%p)" , + (void *)rxq, wcs_n, wcs[0 ].wr_id, (void *)head.next); +#endif + i =ibv_post_recv (rxq->qp, head.next, &bad_wr); +if (unlikely (i)) { +/* Inability to repost WRs is fatal. */ +DEBUG ("%p: ibv_post_recv(): failed for WR %p: %s" , + (void *)rxq->priv, + (void *)bad_wr, +strerror (i)); +abort (); + } +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase packets counter. */ + rxq->stats.ipackets += ret; +#endif +return ret; +} + +/** +* DPDK callback for RX. +* +* The following function is the same as mlx4_rx_burst_sp(), except it doesn't +* manage scattered packets. Improves performance when MRU is lower than the +* size of the first segment. +* +* @param dpdk_rxq +* Generic pointer to RX queue structure. +* @param[out] pkts +* Array to store received packets. +* @param pkts_n +* Maximum number of packets in array. +* +* @return +* Number of packets successfully received (<= pkts_n). +*/ +static uint16_t +mlx4_rx_burst (void *dpdk_rxq,struct rte_mbuf **pkts,uint16_t pkts_n) +{ +struct rxq *rxq = (struct rxq *)dpdk_rxq; +struct rxq_elt (*elts)[rxq->elts_n] = rxq->elts.no_sp; +struct ibv_wc wcs[pkts_n]; +struct ibv_recv_wr head; +struct ibv_recv_wr **next = &head.next; +struct ibv_recv_wr *bad_wr; +int ret =0 ; +int wcs_n; +int i; + +if (unlikely (rxq->sp)) +return mlx4_rx_burst_sp (dpdk_rxq, pkts, pkts_n); + wcs_n =ibv_poll_cq (rxq->cq, pkts_n, wcs); +if (unlikely (wcs_n ==0 )) +return 0 ; +if (unlikely (wcs_n <0 )) { +DEBUG ("rxq=%p, ibv_poll_cq() failed (wc_n=%d)" , + (void *)rxq, wcs_n); +return 0 ; + } +assert (wcs_n <= (int )pkts_n); +/* For each work completion. */ +for (i =0 ; (i != wcs_n); ++i) { +struct ibv_wc *wc = &wcs[i]; +uint64_t wr_id = wc->wr_id; +uint32_t len = wc->byte_len; +struct rxq_elt *elt = &(*elts)[WR_ID (wr_id).id]; +struct ibv_recv_wr *wr = &elt->wr; +struct rte_mbuf *seg = + (void *)(elt->sge.addr -WR_ID (wr_id).offset); +struct rte_mbuf *rep; + +/* Sanity checks. */ +assert (WR_ID (wr_id).id < rxq->elts_n); +assert (wr_id == wr->wr_id); +assert (wr->sg_list == &elt->sge); +assert (wr->num_sge ==1 ); +/* Link completed WRs together for repost. */ + *next = wr; + next = &wr->next; +if (unlikely (wc->status !=IBV_WC_SUCCESS )) { +/* Whatever, just repost the offending WR. */ +DEBUG ("rxq=%p, wr_id=%" PRIu32": bad work completion" +" status (%d): %s" , + (void *)rxq,WR_ID (wr_id).id, wc->status, +ibv_wc_status_str (wc->status)); +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase dropped packets counter. */ + ++rxq->stats.idropped; +#endif + goto repost; + } +/* +* Fetch initial bytes of packet descriptor into a +* cacheline while allocating rep. +*/ +rte_prefetch0 (seg); + rep =__rte_mbuf_raw_alloc (rxq->mp); +if (unlikely (rep ==NULL )) { +/* +* Unable to allocate a replacement mbuf, +* repost WR. +*/ +DEBUG ("rxq=%p, wr_id=%" PRIu32":" +" can't allocate a new mbuf" , + (void *)rxq,WR_ID (wr_id).id); +/* Increase out of memory counters. */ + ++rxq->stats.rx_nombuf; + ++rxq->priv->dev->data->rx_mbuf_alloc_failed; + goto repost; + } + +/* Reconfigure sge to use rep instead of seg. */ + elt->sge.addr = (uintptr_t )rep->buf_addr +RTE_PKTMBUF_HEADROOM ; +assert (elt->sge.lkey == rxq->mr->lkey); +WR_ID (wr->wr_id).offset = + (((uintptr_t )rep->buf_addr +RTE_PKTMBUF_HEADROOM ) - + (uintptr_t )rep); +assert (WR_ID (wr->wr_id).id ==WR_ID (wr_id).id); + +/* Update seg information. */ +SET_DATA_OFF (seg,RTE_PKTMBUF_HEADROOM ); +NB_SEGS (seg) =1 ; +PORT (seg) = rxq->port_id; +NEXT (seg) =NULL ; +PKT_LEN (seg) = len; +DATA_LEN (seg) = len; + seg->ol_flags =0 ; + +/* Return packet. */ + *(pkts++) = seg; + ++ret; +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase bytes counter. */ + rxq->stats.ibytes += wc->byte_len; +#endif +repost: +continue ; + } + *next =NULL ; +/* Repost WRs. */ +#ifdef DEBUG_RECV +DEBUG ("%p: reposting %d WRs starting from %" PRIu32" (%p)" , + (void *)rxq, wcs_n,WR_ID (wcs[0 ].wr_id).id, (void *)head.next); +#endif + i =ibv_post_recv (rxq->qp, head.next, &bad_wr); +if (unlikely (i)) { +/* Inability to repost WRs is fatal. */ +DEBUG ("%p: ibv_post_recv(): failed for WR %p: %s" , + (void *)rxq->priv, + (void *)bad_wr, +strerror (i)); +abort (); + } +#ifdef MLX4_PMD_SOFT_COUNTERS +/* Increase packets counter. */ + rxq->stats.ipackets += ret; +#endif +return ret; +} + +#ifdef INLINE_RECV + +/** +* Allocate a Queue Pair in case inline receive is supported. +* +* @param priv +* Pointer to private structure. +* @param cq +* Completion queue to associate with QP. +* @param desc +* Number of descriptors in QP (hint only). +* +* @return +* QP pointer or NULL in case of error. +*/ +static struct ibv_qp * +rxq_setup_qp (struct priv *priv,struct ibv_cq *cq,uint16_t desc) +{ +struct ibv_exp_qp_init_attr attr = { +/* CQ to be associated with the send queue. */ + .send_cq = cq, +/* CQ to be associated with the receive queue. */ + .recv_cq = cq, + .max_inl_recv = priv->inl_recv_size, + .cap = { +/* Max number of outstanding WRs. */ + .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? + priv->device_attr.max_qp_wr : + desc), +/* Max number of scatter/gather elements in a WR. */ + .max_recv_sge = ((priv->device_attr.max_sge < +MLX4_PMD_SGE_WR_N ) ? + priv->device_attr.max_sge : +MLX4_PMD_SGE_WR_N ), + }, + .qp_type =IBV_QPT_RAW_PACKET , + .pd = priv->pd + }; + + attr.comp_mask =IBV_EXP_QP_INIT_ATTR_PD ; + attr.comp_mask |=IBV_EXP_QP_INIT_ATTR_INL_RECV ; + +return ibv_exp_create_qp (priv->ctx, &attr); +} + +#else /* INLINE_RECV */ + +/** +* Allocate a Queue Pair. +* +* @param priv +* Pointer to private structure. +* @param cq +* Completion queue to associate with QP. +* @param desc +* Number of descriptors in QP (hint only). +* +* @return +* QP pointer or NULL in case of error. +*/ +static struct ibv_qp * +rxq_setup_qp (struct priv *priv,struct ibv_cq *cq,uint16_t desc) +{ +struct ibv_qp_init_attr attr = { +/* CQ to be associated with the send queue. */ + .send_cq = cq, +/* CQ to be associated with the receive queue. */ + .recv_cq = cq, + .cap = { +/* Max number of outstanding WRs. */ + .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? + priv->device_attr.max_qp_wr : + desc), +/* Max number of scatter/gather elements in a WR. */ + .max_recv_sge = ((priv->device_attr.max_sge < +MLX4_PMD_SGE_WR_N ) ? + priv->device_attr.max_sge : +MLX4_PMD_SGE_WR_N ), + }, + .qp_type =IBV_QPT_RAW_PACKET + }; + +return ibv_create_qp (priv->pd, &attr); +} + +#endif /* INLINE_RECV */ + +#ifdef RSS_SUPPORT + +/** +* Allocate a RSS Queue Pair. +* +* @param priv +* Pointer to private structure. +* @param cq +* Completion queue to associate with QP. +* @param desc +* Number of descriptors in QP (hint only). +* @param parent +* If nonzero, create a parent QP, otherwise a child. +* +* @return +* QP pointer or NULL in case of error. +*/ +static struct ibv_qp * +rxq_setup_qp_rss (struct priv *priv,struct ibv_cq *cq,uint16_t desc, +int parent) +{ +struct ibv_exp_qp_init_attr attr = { +/* CQ to be associated with the send queue. */ + .send_cq = cq, +/* CQ to be associated with the receive queue. */ + .recv_cq = cq, +#ifdef INLINE_RECV + .max_inl_recv = priv->inl_recv_size, +#endif + .cap = { +/* Max number of outstanding WRs. */ + .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? + priv->device_attr.max_qp_wr : + desc), +/* Max number of scatter/gather elements in a WR. */ + .max_recv_sge = ((priv->device_attr.max_sge < +MLX4_PMD_SGE_WR_N ) ? + priv->device_attr.max_sge : +MLX4_PMD_SGE_WR_N ), + }, + .qp_type =IBV_QPT_RAW_PACKET , + .comp_mask = (IBV_EXP_QP_INIT_ATTR_PD | +IBV_EXP_QP_INIT_ATTR_QPG ), + .pd = priv->pd + }; + +#ifdef INLINE_RECV + attr.comp_mask |=IBV_EXP_QP_INIT_ATTR_INL_RECV ; +#endif +if (parent) { + attr.qpg.qpg_type =IBV_EXP_QPG_PARENT ; +/* TSS isn't necessary. */ + attr.qpg.parent_attrib.tss_child_count =0 ; + attr.qpg.parent_attrib.rss_child_count = priv->rxqs_n; +DEBUG ("initializing parent RSS queue" ); + }else { + attr.qpg.qpg_type =IBV_EXP_QPG_CHILD_RX ; + attr.qpg.qpg_parent = priv->rxq_parent.qp; +DEBUG ("initializing child RSS queue" ); + } +return ibv_exp_create_qp (priv->ctx, &attr); +} + +#endif /* RSS_SUPPORT */ + +/** +* Reconfigure a RX queue with new parameters. +* +* rxq_rehash() does not allocate mbufs, which, if not done from the right +* thread (such as a control thread), may corrupt the pool. +* In case of failure, the queue is left untouched. +* +* @param dev +* Pointer to Ethernet device structure. +* @param rxq +* RX queue pointer. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_rehash (struct rte_eth_dev *dev,struct rxq *rxq) +{ +struct priv *priv = rxq->priv; +struct rxq tmpl = *rxq; +unsigned int mbuf_n; +unsigned int desc_n; +struct rte_mbuf **pool; +unsigned int i, k; +struct ibv_exp_qp_attr mod; +struct ibv_recv_wr *bad_wr; +int err; +int parent = (rxq == &priv->rxq_parent); + +if (parent) { +ERROR ("%p: cannot rehash parent queue %p" , + (void *)dev, (void *)rxq); +return EINVAL ; + } +DEBUG ("%p: rehashing queue %p" , (void *)dev, (void *)rxq); +/* Number of descriptors and mbufs currently allocated. */ + desc_n = (tmpl.elts_n * (tmpl.sp ?MLX4_PMD_SGE_WR_N :1 )); + mbuf_n = desc_n; +/* Enable scattered packets support for this queue if necessary. */ +if ((dev->data->dev_conf.rxmode.jumbo_frame) && + (dev->data->dev_conf.rxmode.max_rx_pkt_len > + (tmpl.mb_len -RTE_PKTMBUF_HEADROOM ))) { + tmpl.sp =1 ; + desc_n /=MLX4_PMD_SGE_WR_N ; + }else + tmpl.sp =0 ; +DEBUG ("%p: %s scattered packets support (%u WRs)" , + (void *)dev, (tmpl.sp ?"enabling" :"disabling" ), desc_n); +/* If scatter mode is the same as before, nothing to do. */ +if (tmpl.sp == rxq->sp) { +DEBUG ("%p: nothing to do" , (void *)dev); +return 0 ; + } +/* Remove attached flows if RSS is disabled (no parent queue). */ +if (!priv->rss) { +rxq_allmulticast_disable (&tmpl); +rxq_promiscuous_disable (&tmpl); +rxq_mac_addrs_del (&tmpl); +/* Update original queue in case of failure. */ + rxq->allmulti_flow = tmpl.allmulti_flow; + rxq->promisc_flow = tmpl.promisc_flow; +memcpy (rxq->mac_configured, tmpl.mac_configured, +sizeof (rxq->mac_configured)); +memcpy (rxq->mac_flow, tmpl.mac_flow,sizeof (rxq->mac_flow)); + } +/* From now on, any failure will render the queue unusable. +* Reinitialize QP. */ + mod = (struct ibv_exp_qp_attr ){ .qp_state =IBV_QPS_RESET }; + err =ibv_exp_modify_qp (tmpl.qp, &mod,IBV_EXP_QP_STATE ); +if (err) { +ERROR ("%p: cannot reset QP: %s" , (void *)dev,strerror (err)); +assert (err >0 ); +return err; + } + err =ibv_resize_cq (tmpl.cq, desc_n); +if (err) { +ERROR ("%p: cannot resize CQ: %s" , (void *)dev,strerror (err)); +assert (err >0 ); +return err; + } + mod = (struct ibv_exp_qp_attr ){ +/* Move the QP to this state. */ + .qp_state =IBV_QPS_INIT , +/* Primary port number. */ + .port_num = priv->port + }; + err =ibv_exp_modify_qp (tmpl.qp, &mod, + (IBV_EXP_QP_STATE | +#ifdef RSS_SUPPORT + (parent ?IBV_EXP_QP_GROUP_RSS :0 ) | +#endif /* RSS_SUPPORT */ +IBV_EXP_QP_PORT )); +if (err) { +ERROR ("%p: QP state to IBV_QPS_INIT failed: %s" , + (void *)dev,strerror (err)); +assert (err >0 ); +return err; + }; +/* Reconfigure flows. Do not care for errors. */ +if (!priv->rss) { +rxq_mac_addrs_add (&tmpl); +if (priv->promisc) +rxq_promiscuous_enable (&tmpl); +if (priv->allmulti) +rxq_allmulticast_enable (&tmpl); +/* Update original queue in case of failure. */ + rxq->allmulti_flow = tmpl.allmulti_flow; + rxq->promisc_flow = tmpl.promisc_flow; +memcpy (rxq->mac_configured, tmpl.mac_configured, +sizeof (rxq->mac_configured)); +memcpy (rxq->mac_flow, tmpl.mac_flow,sizeof (rxq->mac_flow)); + } +/* Allocate pool. */ + pool =rte_malloc (__func__, (mbuf_n *sizeof (*pool)),0 ); +if (pool ==NULL ) { +ERROR ("%p: cannot allocate memory" , (void *)dev); +return ENOBUFS ; + } +/* Snatch mbufs from original queue. */ + k =0 ; +if (rxq->sp) { +struct rxq_elt_sp (*elts)[rxq->elts_n] = rxq->elts.sp; + +for (i =0 ; (i !=elemof (*elts)); ++i) { +struct rxq_elt_sp *elt = &(*elts)[i]; +unsigned int j; + +for (j =0 ; (j !=elemof (elt->bufs)); ++j) { +assert (elt->bufs[j] !=NULL ); + pool[k++] = elt->bufs[j]; + } + } + }else { +struct rxq_elt (*elts)[rxq->elts_n] = rxq->elts.no_sp; + +for (i =0 ; (i !=elemof (*elts)); ++i) { +struct rxq_elt *elt = &(*elts)[i]; +struct rte_mbuf *buf = (void *) + (elt->sge.addr -WR_ID (elt->wr.wr_id).offset); + +assert (WR_ID (elt->wr.wr_id).id == i); + pool[k++] = buf; + } + } +assert (k == mbuf_n); + tmpl.elts_n =0 ; + tmpl.elts.sp =NULL ; +assert ((void *)&tmpl.elts.sp == (void *)&tmpl.elts.no_sp); + err = ((tmpl.sp) ? +rxq_alloc_elts_sp (&tmpl, desc_n, pool) : +rxq_alloc_elts (&tmpl, desc_n, pool)); +if (err) { +ERROR ("%p: cannot reallocate WRs, aborting" , (void *)dev); +rte_free (pool); +assert (err >0 ); +return err; + } +assert (tmpl.elts_n == desc_n); +assert (tmpl.elts.sp !=NULL ); +rte_free (pool); +/* Clean up original data. */ + rxq->elts_n =0 ; +rte_free (rxq->elts.sp); + rxq->elts.sp =NULL ; +/* Post WRs. */ + err =ibv_post_recv (tmpl.qp, + (tmpl.sp ? + &(*tmpl.elts.sp)[0 ].wr : + &(*tmpl.elts.no_sp)[0 ].wr), + &bad_wr); +if (err) { +ERROR ("%p: ibv_post_recv() failed for WR %p: %s" , + (void *)dev, + (void *)bad_wr, +strerror (err)); + goto skip_rtr; + } + mod = (struct ibv_exp_qp_attr ){ + .qp_state =IBV_QPS_RTR + }; + err =ibv_exp_modify_qp (tmpl.qp, &mod,IBV_EXP_QP_STATE ); +if (err) +ERROR ("%p: QP state to IBV_QPS_RTR failed: %s" , + (void *)dev,strerror (err)); +skip_rtr: + *rxq = tmpl; +assert (err >=0 ); +return err; +} + +/** +* Configure a RX queue. +* +* @param dev +* Pointer to Ethernet device structure. +* @param rxq +* Pointer to RX queue structure. +* @param desc +* Number of descriptors to configure in queue. +* @param socket +* NUMA socket on which memory must be allocated. +* @param[in] conf +* Thresholds parameters. +* @param mp +* Memory pool for buffer allocations. +* +* @return +* 0 on success, errno value on failure. +*/ +static int +rxq_setup (struct rte_eth_dev *dev,struct rxq *rxq,uint16_t desc, +unsigned int socket,const struct rte_eth_rxconf *conf, +struct rte_mempool *mp) +{ +struct priv *priv = dev->data->dev_private; +struct rxq tmpl = { + .priv = priv, + .mp = mp, + .socket = socket + }; +struct ibv_exp_qp_attr mod; +struct ibv_recv_wr *bad_wr; +struct rte_mbuf *buf; +int ret =0 ; +int parent = (rxq == &priv->rxq_parent); + + (void )conf;/* Thresholds configuration (ignored). */ +/* +* If this is a parent queue, hardware must support RSS and +* RSS must be enabled. +*/ +assert ((!parent) || ((priv->hw_rss) && (priv->rss))); +if (parent) { +/* Even if unused, ibv_create_cq() requires at least one +* descriptor. */ + desc =1 ; + goto skip_mr; + } +if ((desc ==0 ) || (desc %MLX4_PMD_SGE_WR_N )) { +ERROR ("%p: invalid number of RX descriptors (must be a" +" multiple of %d)" , (void *)dev, desc); +return EINVAL ; + } +/* Get mbuf length. */ + buf =rte_pktmbuf_alloc (mp); +if (buf ==NULL ) { +ERROR ("%p: unable to allocate mbuf" , (void *)dev); +return ENOMEM ; + } + tmpl.mb_len = buf->buf_len; +assert ((rte_pktmbuf_headroom (buf) + +rte_pktmbuf_tailroom (buf)) == tmpl.mb_len); +assert (rte_pktmbuf_headroom (buf) ==RTE_PKTMBUF_HEADROOM ); +rte_pktmbuf_free (buf); +/* Enable scattered packets support for this queue if necessary. */ +if ((dev->data->dev_conf.rxmode.jumbo_frame) && + (dev->data->dev_conf.rxmode.max_rx_pkt_len > + (tmpl.mb_len -RTE_PKTMBUF_HEADROOM ))) { + tmpl.sp =1 ; + desc /=MLX4_PMD_SGE_WR_N ; + } +DEBUG ("%p: %s scattered packets support (%u WRs)" , + (void *)dev, (tmpl.sp ?"enabling" :"disabling" ), desc); +/* Use the entire RX mempool as the memory region. */ + tmpl.mr =ibv_reg_mr (priv->pd, + (void *)mp->elt_va_start, + (mp->elt_va_end - mp->elt_va_start), + (IBV_ACCESS_LOCAL_WRITE | +IBV_ACCESS_REMOTE_WRITE )); +if (tmpl.mr ==NULL ) { + ret =EINVAL ; +ERROR ("%p: MR creation failure: %s" , + (void *)dev,strerror (ret)); + goto error; + } +skip_mr: + tmpl.cq =ibv_create_cq (priv->ctx, desc,NULL ,NULL ,0 ); +if (tmpl.cq ==NULL ) { + ret =ENOMEM ; +ERROR ("%p: CQ creation failure: %s" , + (void *)dev,strerror (ret)); + goto error; + } +DEBUG ("priv->device_attr.max_qp_wr is %d" , + priv->device_attr.max_qp_wr); +DEBUG ("priv->device_attr.max_sge is %d" , + priv->device_attr.max_sge); +#ifdef RSS_SUPPORT +if (priv->rss) + tmpl.qp =rxq_setup_qp_rss (priv, tmpl.cq, desc, parent); + else +#endif /* RSS_SUPPORT */ + tmpl.qp =rxq_setup_qp (priv, tmpl.cq, desc); +if (tmpl.qp ==NULL ) { + ret = (errno ? errno :EINVAL ); +ERROR ("%p: QP creation failure: %s" , + (void *)dev,strerror (ret)); + goto error; + } + mod = (struct ibv_exp_qp_attr ){ +/* Move the QP to this state. */ + .qp_state =IBV_QPS_INIT , +/* Primary port number. */ + .port_num = priv->port + }; + ret =ibv_exp_modify_qp (tmpl.qp, &mod, + (IBV_EXP_QP_STATE | +#ifdef RSS_SUPPORT + (parent ?IBV_EXP_QP_GROUP_RSS :0 ) | +#endif /* RSS_SUPPORT */ +IBV_EXP_QP_PORT )); +if (ret) { +ERROR ("%p: QP state to IBV_QPS_INIT failed: %s" , + (void *)dev,strerror (ret)); + goto error; + } +if ((parent) || (!priv->rss)) { +/* Configure MAC and broadcast addresses. */ + ret =rxq_mac_addrs_add (&tmpl); +if (ret) { +ERROR ("%p: QP flow attachment failed: %s" , + (void *)dev,strerror (ret)); + goto error; + }Lines of this file are not shown. View the raw message.
drivers/net/mlx4/rte_pmd_mlx4_version.map new file +4
-0Lines of this file are not shown. View the raw message.
lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map deleted +0
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
2.1.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 10/19] mlx4: move mlx4 PMD to drivers/net directory
Hi,
2015-05-23 07:46, Or Gerlitz:
Quoted 26 lines
Quoted 15 lines · Bruce Richardson
move mlx4 PMD to
drivers/netdirectorySigned-off-by Bruce Richardson <[email protected]>--- drivers/net/Makefile | 2 +- drivers/net/mlx4/Makefile | 121 + drivers/net/mlx4/mlx4.c | 4686 ++++++++++++++++++++++++++ drivers/net/mlx4/mlx4.h | 157 + drivers/net/mlx4/rte_pmd_mlx4_version.map | 4 + lib/Makefile | 1 - lib/librte_pmd_mlx4/Makefile | 121 - lib/librte_pmd_mlx4/mlx4.c | 4686 -------------------------- lib/librte_pmd_mlx4/mlx4.h | 157 - lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map | 4 - 10 files changed, 4969 insertions(+), 4970 deletions(-)Quoted 8 lines
create mode 100644 drivers/net/mlx4/Makefile create mode 100644 drivers/net/mlx4/mlx4.c create mode 100644 drivers/net/mlx4/mlx4.h create mode 100644 drivers/net/mlx4/rte_pmd_mlx4_version.map delete mode 100644 lib/librte_pmd_mlx4/Makefile delete mode 100644 lib/librte_pmd_mlx4/mlx4.c delete mode 100644 lib/librte_pmd_mlx4/mlx4.h delete mode 100644 lib/librte_pmd_mlx4/rte_pmd_mlx4_version.map
Quoted 4 lines
There's a way to do source movements with git such that history remains, see for example in the upstream kernel the way the ethernet drivers were moved from
drivers/nettodrivers/net/ethernetcouple of years ago.
I don't see anything special here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5a2cc190eb3fe
It doesn't seem different of
http://dpdk.org/browse/dpdk/commit/?id=98a1f3776fc9a3de442
By the way, what do you mean by "history remains"?
Are you thinking about git log --follow which is known to be a hack?
http://permalink.gmane.org/gmane.comp.version-control.git/147089
My understanding is that file history doesn't fit well with git:
http://article.gmane.org/gmane.comp.version-control.git/217
Quoted 1 line
Please make sure to use that practice here too.
The change was applied before you sent this message:
http://dpdk.org/ml/archives/dev/2015-May/018064.html
But I'm still interested about best practices.
PATCH v2 11/19 null pmd: move null PMD to drivers/net directory
In reply to Bruce RichardsonMove null PMD to drivers/net directory
--- drivers/net/Makefile | 2 +- drivers/net/null/Makefile | 62 +++ drivers/net/null/rte_eth_null.c | 585 +++++++++++++++++++++++++++ drivers/net/null/rte_pmd_null_version.map | 4 + lib/Makefile | 1 - lib/librte_pmd_null/Makefile | 62 --- lib/librte_pmd_null/rte_eth_null.c | 585 --------------------------- lib/librte_pmd_null/rte_pmd_null_version.map | 4 - 8 files changed, 652 insertions(+), 653 deletions(-) create mode 100644 drivers/net/null/Makefile create mode 100644 drivers/net/null/rte_eth_null.c create mode 100644 drivers/net/null/rte_pmd_null_version.map delete mode 100644 lib/librte_pmd_null/Makefile delete mode 100644 lib/librte_pmd_null/rte_eth_null.c delete mode 100644 lib/librte_pmd_null/rte_pmd_null_version.map
drivers/net/Makefile +1 -1
@@ -39,12 +39,12 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4 +DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null #DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring #DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap #DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio #DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt -#DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += librte_pmd_null include $(RTE_SDK)/mk/rte.sharelib.mk include $(RTE_SDK)/mk/rte.subdir.mk
drivers/net/null/Makefile new file +62 -0
62 lines not on this page · raw message
drivers/net/null/rte_eth_null.c new file +585 -0
585 lines not on this page · raw message
drivers/net/null/rte_pmd_null_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + + local: *; +};
lib/Makefile +0 -1
@@ -47,7 +47,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost -DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += librte_pmd_null DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
lib/librte_pmd_null/Makefile deleted +0 -62
62 lines not on this page · raw message
lib/librte_pmd_null/rte_eth_null.c deleted +0 -585
585 lines not on this page · raw message
lib/librte_pmd_null/rte_pmd_null_version.map deleted +0 -4
@@ -1,4 +0,0 @@ -DPDK_2.0 { - - local: *; -};
Signature · 1 line
2.1.0
PATCH v2 12/19 pcap: move pcap pmd to drivers/net
In reply to Bruce RichardsonMove pcap pmd to drivers/net directory
--- drivers/net/Makefile | 2 +- drivers/net/pcap/Makefile | 63 ++ drivers/net/pcap/rte_eth_pcap.c | 994 +++++++++++++++++++++++++++ drivers/net/pcap/rte_pmd_pcap_version.map | 4 + lib/Makefile | 1 - lib/librte_eal/bsdapp/eal/Makefile | 4 +- lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_pmd_pcap/Makefile | 63 -- lib/librte_pmd_pcap/rte_eth_pcap.c | 994 --------------------------- lib/librte_pmd_pcap/rte_pmd_pcap_version.map | 4 - 10 files changed, 1065 insertions(+), 1066 deletions(-) create mode 100644 drivers/net/pcap/Makefile create mode 100644 drivers/net/pcap/rte_eth_pcap.c create mode 100644 drivers/net/pcap/rte_pmd_pcap_version.map delete mode 100644 lib/librte_pmd_pcap/Makefile delete mode 100644 lib/librte_pmd_pcap/rte_eth_pcap.c delete mode 100644 lib/librte_pmd_pcap/rte_pmd_pcap_version.map
drivers/net/Makefile +1 -1
@@ -40,8 +40,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap #DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring -#DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap #DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio #DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
drivers/net/pcap/Makefile new file +63 -0
63 lines not on this page · raw message
drivers/net/pcap/rte_eth_pcap.c new file +994 -0
994 lines not on this page · raw message
drivers/net/pcap/rte_pmd_pcap_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + + local: *; +};
lib/Makefile +0 -1
@@ -42,7 +42,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring -DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
lib/librte_eal/bsdapp/eal/Makefile +2 -2
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_mempool CFLAGS += -I$(RTE_SDK)/lib/librte_malloc CFLAGS += -I$(RTE_SDK)/lib/librte_ether CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring -CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap +CFLAGS += -I$(RTE_SDK)/drivers/net/pcap CFLAGS += $(WERROR_FLAGS) -O3 EXPORT_MAP := rte_eal_version.map
lib/librte_eal/linuxapp/eal/Makefile +1 -1
@@ -48,7 +48,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_malloc CFLAGS += -I$(RTE_SDK)/lib/librte_ether CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring -CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap +CFLAGS += -I$(RTE_SDK)/drivers/net/pcap CFLAGS += -I$(RTE_SDK)/drivers/net/af_packet CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt CFLAGS += $(WERROR_FLAGS) -O3
lib/librte_pmd_pcap/Makefile deleted +0 -63
63 lines not on this page · raw message
lib/librte_pmd_pcap/rte_eth_pcap.c deleted +0 -994
994 lines not on this page · raw message
lib/librte_pmd_pcap/rte_pmd_pcap_version.map deleted +0 -4
@@ -1,4 +0,0 @@ -DPDK_2.0 { - - local: *; -};
Signature · 1 line
2.1.0
PATCH v2 13/19 ring pmd: move ring PMD to the drivers directory
In reply to Bruce RichardsonMove ring PMD to drivers directory
--- drivers/net/Makefile | 2 +- drivers/net/ring/Makefile | 61 +++ drivers/net/ring/rte_eth_ring.c | 579 +++++++++++++++++++++++++++ drivers/net/ring/rte_eth_ring.h | 57 +++ drivers/net/ring/rte_eth_ring_version.map | 9 + lib/Makefile | 1 - lib/librte_eal/bsdapp/eal/Makefile | 2 +- lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_pmd_ring/Makefile | 61 --- lib/librte_pmd_ring/rte_eth_ring.c | 579 --------------------------- lib/librte_pmd_ring/rte_eth_ring.h | 57 --- lib/librte_pmd_ring/rte_eth_ring_version.map | 9 - 12 files changed, 709 insertions(+), 710 deletions(-) create mode 100644 drivers/net/ring/Makefile create mode 100644 drivers/net/ring/rte_eth_ring.c create mode 100644 drivers/net/ring/rte_eth_ring.h create mode 100644 drivers/net/ring/rte_eth_ring_version.map delete mode 100644 lib/librte_pmd_ring/Makefile delete mode 100644 lib/librte_pmd_ring/rte_eth_ring.c delete mode 100644 lib/librte_pmd_ring/rte_eth_ring.h delete mode 100644 lib/librte_pmd_ring/rte_eth_ring_version.map
drivers/net/Makefile +1 -1
@@ -41,7 +41,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap -#DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring +DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring #DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio #DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
drivers/net/ring/Makefile new file +61 -0
61 lines not on this page · raw message
drivers/net/ring/rte_eth_ring.c new file +579 -0
579 lines not on this page · raw message
drivers/net/ring/rte_eth_ring.h new file +57 -0
57 lines not on this page · raw message
drivers/net/ring/rte_eth_ring_version.map new file +9 -0
@@ -0,0 +1,9 @@ +DPDK_2.0 { + global: + + rte_eth_from_rings; + rte_eth_ring_pair_attach; + rte_eth_ring_pair_create; + + local: *; +};
lib/Makefile +0 -1
@@ -41,7 +41,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether -DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
lib/librte_eal/bsdapp/eal/Makefile +1 -1
@@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ring CFLAGS += -I$(RTE_SDK)/lib/librte_mempool CFLAGS += -I$(RTE_SDK)/lib/librte_malloc CFLAGS += -I$(RTE_SDK)/lib/librte_ether -CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring +CFLAGS += -I$(RTE_SDK)/drivers/net/ring CFLAGS += -I$(RTE_SDK)/drivers/net/pcap CFLAGS += $(WERROR_FLAGS) -O3
lib/librte_eal/linuxapp/eal/Makefile +1 -1
@@ -47,7 +47,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_mempool CFLAGS += -I$(RTE_SDK)/lib/librte_malloc CFLAGS += -I$(RTE_SDK)/lib/librte_ether CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem -CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring +CFLAGS += -I$(RTE_SDK)/drivers/net/ring CFLAGS += -I$(RTE_SDK)/drivers/net/pcap CFLAGS += -I$(RTE_SDK)/drivers/net/af_packet CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt
lib/librte_pmd_ring/Makefile deleted +0 -61
61 lines not on this page · raw message
lib/librte_pmd_ring/rte_eth_ring.c deleted +0 -579
579 lines not on this page · raw message
lib/librte_pmd_ring/rte_eth_ring.h deleted +0 -57
57 lines not on this page · raw message
lib/librte_pmd_ring/rte_eth_ring_version.map deleted +0 -9
@@ -1,9 +0,0 @@ -DPDK_2.0 { - global: - - rte_eth_from_rings; - rte_eth_ring_pair_attach; - rte_eth_ring_pair_create; - - local: *; -};
Signature · 1 line
2.1.0
PATCH v2 14/19 virtio: move virtio PMD to drivers/net
In reply to Bruce RichardsonMove virtio PMD to drivers/net directory
--- drivers/net/Makefile | 2 +- drivers/net/virtio/Makefile | 60 + drivers/net/virtio/rte_pmd_virtio_version.map | 4 + drivers/net/virtio/virtio_ethdev.c | 1504 ++++++++++++++++++++++ drivers/net/virtio/virtio_ethdev.h | 124 ++ drivers/net/virtio/virtio_logs.h | 70 + drivers/net/virtio/virtio_pci.c | 147 +++ drivers/net/virtio/virtio_pci.h | 270 ++++ drivers/net/virtio/virtio_ring.h | 163 +++ drivers/net/virtio/virtio_rxtx.c | 815 ++++++++++++ drivers/net/virtio/virtqueue.c | 70 + drivers/net/virtio/virtqueue.h | 325 +++++ lib/Makefile | 1 - lib/librte_pmd_virtio/Makefile | 60 - lib/librte_pmd_virtio/rte_pmd_virtio_version.map | 4 - lib/librte_pmd_virtio/virtio_ethdev.c | 1504 ---------------------- lib/librte_pmd_virtio/virtio_ethdev.h | 124 -- lib/librte_pmd_virtio/virtio_logs.h | 70 - lib/librte_pmd_virtio/virtio_pci.c | 147 --- lib/librte_pmd_virtio/virtio_pci.h | 270 ---- lib/librte_pmd_virtio/virtio_ring.h | 163 --- lib/librte_pmd_virtio/virtio_rxtx.c | 815 ------------ lib/librte_pmd_virtio/virtqueue.c | 70 - lib/librte_pmd_virtio/virtqueue.h | 325 ----- 24 files changed, 3553 insertions(+), 3554 deletions(-) create mode 100644 drivers/net/virtio/Makefile create mode 100644 drivers/net/virtio/rte_pmd_virtio_version.map create mode 100644 drivers/net/virtio/virtio_ethdev.c create mode 100644 drivers/net/virtio/virtio_ethdev.h create mode 100644 drivers/net/virtio/virtio_logs.h create mode 100644 drivers/net/virtio/virtio_pci.c create mode 100644 drivers/net/virtio/virtio_pci.h create mode 100644 drivers/net/virtio/virtio_ring.h create mode 100644 drivers/net/virtio/virtio_rxtx.c create mode 100644 drivers/net/virtio/virtqueue.c create mode 100644 drivers/net/virtio/virtqueue.h delete mode 100644 lib/librte_pmd_virtio/Makefile delete mode 100644 lib/librte_pmd_virtio/rte_pmd_virtio_version.map delete mode 100644 lib/librte_pmd_virtio/virtio_ethdev.c delete mode 100644 lib/librte_pmd_virtio/virtio_ethdev.h delete mode 100644 lib/librte_pmd_virtio/virtio_logs.h delete mode 100644 lib/librte_pmd_virtio/virtio_pci.c delete mode 100644 lib/librte_pmd_virtio/virtio_pci.h delete mode 100644 lib/librte_pmd_virtio/virtio_ring.h delete mode 100644 lib/librte_pmd_virtio/virtio_rxtx.c delete mode 100644 lib/librte_pmd_virtio/virtqueue.c delete mode 100644 lib/librte_pmd_virtio/virtqueue.h
drivers/net/Makefile +1 -1
@@ -42,7 +42,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring -#DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio +DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio #DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
drivers/net/virtio/Makefile new file +60 -0
60 lines not on this page · raw message
drivers/net/virtio/rte_pmd_virtio_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + + local: *; +};
drivers/net/virtio/virtio_ethdev.c new file +1504 -0
1,504 lines not on this page · raw message
drivers/net/virtio/virtio_ethdev.h new file +124 -0
124 lines not on this page · raw message
drivers/net/virtio/virtio_logs.h new file +70 -0
70 lines not on this page · raw message
drivers/net/virtio/virtio_pci.c new file +147 -0
147 lines not on this page · raw message
drivers/net/virtio/virtio_pci.h new file +270 -0
270 lines not on this page · raw message
drivers/net/virtio/virtio_ring.h new file +163 -0
163 lines not on this page · raw message
drivers/net/virtio/virtio_rxtx.c new file +815 -0
650 lines not on this page · raw message
drivers/net/virtio/virtqueue.c new file +70 -0
70 lines not on this page · raw message
drivers/net/virtio/virtqueue.h new file +325 -0
325 lines not on this page · raw message
lib/librte_pmd_virtio/Makefile deleted +0 -60
60 lines not on this page · raw message
lib/librte_pmd_virtio/rte_pmd_virtio_version.map deleted +0 -4
Lines of this file are not shown. View the raw message.
lib/librte_pmd_virtio/virtio_ethdev.c deleted +0 -1504
1,504 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_ethdev.h deleted +0 -124
124 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_logs.h deleted +0 -70
70 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_pci.c deleted +0 -147
147 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_pci.h deleted +0 -270
270 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_ring.h deleted +0 -163
163 lines not on this page · raw message
lib/librte_pmd_virtio/virtio_rxtx.c deleted +0 -815
815 lines not on this page · raw message
lib/librte_pmd_virtio/virtqueue.c deleted +0 -70
70 lines not on this page · raw message
lib/librte_pmd_virtio/virtqueue.h deleted +0 -325
325 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
PATCH v2 15/19 xmvnet3: move vmxnet3 PMD to drivers/net
In reply to Bruce RichardsonMove vmxnet3 PMD to drivers/net directory.
As part of the move, rename the "vmxnet3" subdirectory, containing the original FreeBSD drivers, from "vmxnet3" to the more standard name "base", to indicate it contains the base drivers used for the implementation.
--- drivers/net/Makefile | 2 +- drivers/net/vmxnet3/Makefile | 84 ++ drivers/net/vmxnet3/base/README | 50 + drivers/net/vmxnet3/base/includeCheck.h | 40 + drivers/net/vmxnet3/base/upt1_defs.h | 117 +++ drivers/net/vmxnet3/base/vmware_pack_begin.h | 32 + drivers/net/vmxnet3/base/vmware_pack_end.h | 32 + drivers/net/vmxnet3/base/vmxnet3_defs.h | 751 ++++++++++++++ drivers/net/vmxnet3/base/vmxnet3_osdep.h | 48 + drivers/net/vmxnet3/rte_pmd_vmxnet3_version.map | 4 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 779 ++++++++++++++ drivers/net/vmxnet3/vmxnet3_ethdev.h | 183 ++++ drivers/net/vmxnet3/vmxnet3_logs.h | 74 ++ drivers/net/vmxnet3/vmxnet3_ring.h | 183 ++++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 1068 ++++++++++++++++++++ lib/Makefile | 1 - lib/librte_pmd_vmxnet3/Makefile | 84 -- lib/librte_pmd_vmxnet3/rte_pmd_vmxnet3_version.map | 4 - lib/librte_pmd_vmxnet3/vmxnet3/README | 50 - lib/librte_pmd_vmxnet3/vmxnet3/includeCheck.h | 40 - lib/librte_pmd_vmxnet3/vmxnet3/upt1_defs.h | 117 --- lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_begin.h | 32 - lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_end.h | 32 - lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_defs.h | 751 -------------- lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_osdep.h | 48 - lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 779 -------------- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 183 ---- lib/librte_pmd_vmxnet3/vmxnet3_logs.h | 74 -- lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 183 ---- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1068 -------------------- 30 files changed, 3446 insertions(+), 3447 deletions(-) create mode 100644 drivers/net/vmxnet3/Makefile create mode 100644 drivers/net/vmxnet3/base/README create mode 100644 drivers/net/vmxnet3/base/includeCheck.h create mode 100644 drivers/net/vmxnet3/base/upt1_defs.h create mode 100644 drivers/net/vmxnet3/base/vmware_pack_begin.h create mode 100644 drivers/net/vmxnet3/base/vmware_pack_end.h create mode 100644 drivers/net/vmxnet3/base/vmxnet3_defs.h create mode 100644 drivers/net/vmxnet3/base/vmxnet3_osdep.h create mode 100644 drivers/net/vmxnet3/rte_pmd_vmxnet3_version.map create mode 100644 drivers/net/vmxnet3/vmxnet3_ethdev.c create mode 100644 drivers/net/vmxnet3/vmxnet3_ethdev.h create mode 100644 drivers/net/vmxnet3/vmxnet3_logs.h create mode 100644 drivers/net/vmxnet3/vmxnet3_ring.h create mode 100644 drivers/net/vmxnet3/vmxnet3_rxtx.c delete mode 100644 lib/librte_pmd_vmxnet3/Makefile delete mode 100644 lib/librte_pmd_vmxnet3/rte_pmd_vmxnet3_version.map delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/README delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/includeCheck.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/upt1_defs.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_begin.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_end.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_defs.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_osdep.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3_logs.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3_ring.h delete mode 100644 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
drivers/net/Makefile +1 -1
@@ -43,7 +43,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio -#DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 +DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 #DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt include $(RTE_SDK)/mk/rte.sharelib.mk
drivers/net/vmxnet3/Makefile new file +84 -0
84 lines not on this page · raw message
drivers/net/vmxnet3/base/README new file +50 -0
50 lines not on this page · raw message
drivers/net/vmxnet3/base/includeCheck.h new file +40 -0
@@ -0,0 +1,40 @@ +/*- +* BSD LICENSE +* +* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _INCLUDECHECK_H +#define _INCLUDECHECK_H + +#include "vmxnet3_osdep.h" + +#endif /* _INCLUDECHECK_H */ +
drivers/net/vmxnet3/base/upt1_defs.h new file +117 -0
117 lines not on this page · raw message
drivers/net/vmxnet3/base/vmware_pack_begin.h new file +32 -0
@@ -0,0 +1,32 @@ +/*- +* BSD LICENSE +* +* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/
drivers/net/vmxnet3/base/vmware_pack_end.h new file +32 -0
@@ -0,0 +1,32 @@ +/*- +* BSD LICENSE +* +* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/
drivers/net/vmxnet3/base/vmxnet3_defs.h new file +751 -0
751 lines not on this page · raw message
drivers/net/vmxnet3/base/vmxnet3_osdep.h new file +48 -0
48 lines not on this page · raw message
drivers/net/vmxnet3/rte_pmd_vmxnet3_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + + local: *; +};
drivers/net/vmxnet3/vmxnet3_ethdev.c new file +779 -0
779 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethdev.h new file +183 -0
183 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_logs.h new file +74 -0
74 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ring.h new file +183 -0
183 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_rxtx.c new file +1068 -0
615 lines not on this page · raw message
lib/librte_pmd_vmxnet3/Makefile deleted +0 -84
84 lines not on this page · raw message
lib/librte_pmd_vmxnet3/rte_pmd_vmxnet3_version.map deleted +0 -4
Lines of this file are not shown. View the raw message.
lib/librte_pmd_vmxnet3/vmxnet3/README deleted +0 -50
50 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/includeCheck.h deleted +0 -40
Lines of this file are not shown. View the raw message.
lib/librte_pmd_vmxnet3/vmxnet3/upt1_defs.h deleted +0 -117
117 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_begin.h deleted +0 -32
Lines of this file are not shown. View the raw message.
lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_end.h deleted +0 -32
Lines of this file are not shown. View the raw message.
lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_defs.h deleted +0 -751
751 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_osdep.h deleted +0 -48
48 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c deleted +0 -779
779 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h deleted +0 -183
183 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_logs.h deleted +0 -74
74 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_ring.h deleted +0 -183
183 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c deleted +0 -1068
1,068 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
PATCH v2 16/19 xenvirt: move xenvirt PMD to drivers/net
In reply to Bruce RichardsonMove xenvirt PMD to drivers/net directory
--- drivers/net/Makefile | 2 +- drivers/net/xenvirt/Makefile | 62 ++ drivers/net/xenvirt/rte_eth_xenvirt.c | 714 +++++++++++++++++++++ drivers/net/xenvirt/rte_eth_xenvirt.h | 62 ++ drivers/net/xenvirt/rte_eth_xenvirt_version.map | 7 + drivers/net/xenvirt/rte_mempool_gntalloc.c | 298 +++++++++ drivers/net/xenvirt/rte_xen_lib.c | 428 ++++++++++++ drivers/net/xenvirt/rte_xen_lib.h | 113 ++++ drivers/net/xenvirt/virtio_logs.h | 70 ++ drivers/net/xenvirt/virtqueue.h | 280 ++++++++ lib/Makefile | 1 - lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_pmd_xenvirt/Makefile | 62 -- lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 714 --------------------- lib/librte_pmd_xenvirt/rte_eth_xenvirt.h | 62 -- lib/librte_pmd_xenvirt/rte_eth_xenvirt_version.map | 7 - lib/librte_pmd_xenvirt/rte_mempool_gntalloc.c | 298 --------- lib/librte_pmd_xenvirt/rte_xen_lib.c | 428 ------------ lib/librte_pmd_xenvirt/rte_xen_lib.h | 113 ---- lib/librte_pmd_xenvirt/virtio_logs.h | 70 -- lib/librte_pmd_xenvirt/virtqueue.h | 280 -------- 21 files changed, 2036 insertions(+), 2037 deletions(-) create mode 100644 drivers/net/xenvirt/Makefile create mode 100644 drivers/net/xenvirt/rte_eth_xenvirt.c create mode 100644 drivers/net/xenvirt/rte_eth_xenvirt.h create mode 100644 drivers/net/xenvirt/rte_eth_xenvirt_version.map create mode 100644 drivers/net/xenvirt/rte_mempool_gntalloc.c create mode 100644 drivers/net/xenvirt/rte_xen_lib.c create mode 100644 drivers/net/xenvirt/rte_xen_lib.h create mode 100644 drivers/net/xenvirt/virtio_logs.h create mode 100644 drivers/net/xenvirt/virtqueue.h delete mode 100644 lib/librte_pmd_xenvirt/Makefile delete mode 100644 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c delete mode 100644 lib/librte_pmd_xenvirt/rte_eth_xenvirt.h delete mode 100644 lib/librte_pmd_xenvirt/rte_eth_xenvirt_version.map delete mode 100644 lib/librte_pmd_xenvirt/rte_mempool_gntalloc.c delete mode 100644 lib/librte_pmd_xenvirt/rte_xen_lib.c delete mode 100644 lib/librte_pmd_xenvirt/rte_xen_lib.h delete mode 100644 lib/librte_pmd_xenvirt/virtio_logs.h delete mode 100644 lib/librte_pmd_xenvirt/virtqueue.h
drivers/net/Makefile +1 -1
@@ -44,7 +44,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 -#DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt +DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt include $(RTE_SDK)/mk/rte.sharelib.mk include $(RTE_SDK)/mk/rte.subdir.mk
drivers/net/xenvirt/Makefile new file +62 -0
62 lines not on this page · raw message
drivers/net/xenvirt/rte_eth_xenvirt.c new file +714 -0
714 lines not on this page · raw message
drivers/net/xenvirt/rte_eth_xenvirt.h new file +62 -0
62 lines not on this page · raw message
drivers/net/xenvirt/rte_eth_xenvirt_version.map new file +7 -0
@@ -0,0 +1,7 @@ +DPDK_2.0 { + global: + + rte_mempool_gntalloc_create; + + local: *; +};
drivers/net/xenvirt/rte_mempool_gntalloc.c new file +298 -0
298 lines not on this page · raw message
drivers/net/xenvirt/rte_xen_lib.c new file +428 -0
428 lines not on this page · raw message
drivers/net/xenvirt/rte_xen_lib.h new file +113 -0
113 lines not on this page · raw message
drivers/net/xenvirt/virtio_logs.h new file +70 -0
70 lines not on this page · raw message
drivers/net/xenvirt/virtqueue.h new file +280 -0
280 lines not on this page · raw message
lib/Makefile +0 -1
@@ -41,7 +41,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether -DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
lib/librte_eal/linuxapp/eal/Makefile +1 -1
@@ -50,7 +50,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem CFLAGS += -I$(RTE_SDK)/drivers/net/ring CFLAGS += -I$(RTE_SDK)/drivers/net/pcap CFLAGS += -I$(RTE_SDK)/drivers/net/af_packet -CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt +CFLAGS += -I$(RTE_SDK)/drivers/net/xenvirt CFLAGS += $(WERROR_FLAGS) -O3 # specific to linuxapp exec-env
lib/librte_pmd_xenvirt/Makefile deleted +0 -62
62 lines not on this page · raw message
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c deleted +0 -714
714 lines not on this page · raw message
lib/librte_pmd_xenvirt/rte_eth_xenvirt.h deleted +0 -62
62 lines not on this page · raw message
lib/librte_pmd_xenvirt/rte_eth_xenvirt_version.map deleted +0 -7
@@ -1,7 +0,0 @@ -DPDK_2.0 { - global: - - rte_mempool_gntalloc_create; - - local: *; -};
lib/librte_pmd_xenvirt/rte_mempool_gntalloc.c deleted +0 -298
98 lines not on this page · raw message
lib/librte_pmd_xenvirt/rte_xen_lib.c deleted +0 -428
428 lines not on this page · raw message
lib/librte_pmd_xenvirt/rte_xen_lib.h deleted +0 -113
113 lines not on this page · raw message
lib/librte_pmd_xenvirt/virtio_logs.h deleted +0 -70
70 lines not on this page · raw message
lib/librte_pmd_xenvirt/virtqueue.h deleted +0 -280
280 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
PATCH v2 17/19 maintainers: update maintainers with driver paths
In reply to Bruce RichardsonFollowing the move of the PMDs to the drivers directory, update the maintainers file appropriately.
--- MAINTAINERS | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
MAINTAINERS +14 -14
@@ -132,7 +132,7 @@ F: lib/librte_eal/linuxapp/xen_dom0/ F: lib/librte_eal/linuxapp/eal/*xen* F: lib/librte_eal/linuxapp/eal/include/exec-env/rte_dom0_common.h F: lib/librte_mempool/rte_dom0_mempool.c -F: lib/librte_pmd_xenvirt/ +F: drivers/net/xenvirt/ F: doc/guides/xen/ F: app/test-pmd/mempool_* F: examples/vhost_xen/
@@ -192,7 +192,7 @@ Drivers Link bonding M: Declan Doherty <[email protected]> -F: lib/librte_pmd_bond/ +F: drivers/net/bonding/ F: doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst F: app/test/test_link_bonding* F: examples/bond/
@@ -208,40 +208,40 @@ F: doc/guides/sample_app_ug/kernel_nic_interface.rst Linux AF_PACKET M: John W. Linville <[email protected]> -F: lib/librte_pmd_af_packet/ +F: drivers/net/af_packet/ Cisco enic -F: lib/librte_pmd_enic/ +F: drivers/net/enic/ Intel e1000 -F: lib/librte_pmd_e1000/ +F: drivers/net/e1000/ F: doc/guides/nics/e1000em.rst F: doc/guides/nics/intel_vf.rst Intel ixgbe M: Helin Zhang <[email protected]> M: Konstantin Ananyev <[email protected]> -F: lib/librte_pmd_ixgbe/ +F: drivers/net/ixgbe/ F: doc/guides/nics/ixgbe.rst F: doc/guides/nics/intel_vf.rst Intel i40e M: Helin Zhang <[email protected]> -F: lib/librte_pmd_i40e/ +F: drivers/net/i40e/ F: doc/guides/nics/intel_vf.rst Intel fm10k M: Jing Chen <[email protected]> -F: lib/librte_pmd_fm10k/ +F: drivers/net/fm10k/ Mellanox mlx4 M: Adrien Mazarguil <[email protected]> -F: lib/librte_pmd_mlx4/ +F: drivers/net/mlx4/ F: doc/guides/nics/mlx4.rst RedHat virtio M: Changchun Ouyang <[email protected]> -F: lib/librte_pmd_virtio/ +F: drivers/net/virtio/ F: doc/guides/nics/virtio.rst F: lib/librte_vhost/ F: doc/guides/prog_guide/vhost_lib.rst
@@ -250,24 +250,24 @@ F: doc/guides/sample_app_ug/vhost.rst VMware vmxnet3 M: Yong Wang <[email protected]> -F: lib/librte_pmd_vmxnet3/ +F: drivers/net/vmxnet3/ F: doc/guides/nics/vmxnet3.rst PCAP PMD M: Nicolás Pernas Maradei <[email protected]> M: John McNamara <[email protected]> -F: lib/librte_pmd_pcap/ +F: drivers/net/pcap/ F: doc/guides/nics/pcap_ring.rst Ring PMD M: Bruce Richardson <[email protected]> -F: lib/librte_pmd_ring/ +F: drivers/net/ring/ F: doc/guides/nics/pcap_ring.rst F: app/test/test_pmd_ring.c Null PMD M: Tetsuya Mukawa <[email protected]> -F: lib/librte_pmd_null/ +F: drivers/net/null/ Packet processing
Signature · 1 line
2.1.0
PATCH v2 18/19 doc: update GSG doc for new drivers subdirectory
In reply to Bruce RichardsonUpdate the directory list in the GSG to reflect recent changes of PMDs to the drivers directory
--- doc/guides/linux_gsg/build_dpdk.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
doc/guides/linux_gsg/build_dpdk.rst +5 -3
@@ -45,12 +45,14 @@ First, uncompress the archive and move to the uncompressed DPDK source directory user@host:~$ unzip DPDK-<version>.zip user@host:~$ cd DPDK-<version> user@host:~/DPDK-<version>$ ls - app/ config/ examples/ lib/ LICENSE.GPL LICENSE.LGPL Makefile mk/ scripts/ tools/ + app/ config/ drivers/ examples/ lib/ LICENSE.GPL LICENSE.LGPL Makefile mk/ scripts/ tools/ The DPDK is composed of several directories: * lib: Source code of DPDK libraries +* drivers: Source code of DPDK poll-mode drivers + * app: Source code of DPDK applications (automatic tests) * examples: Source code of DPDK application examples
@@ -153,9 +155,9 @@ In addition, the make clean command can be used to remove any existing compiled Browsing the Installed DPDK Environment Target ---------------------------------------------- -Once a target is created it contains all libraries and header files for the DPDK environment that are required to build customer applications. +Once a target is created it contains all libraries, including poll-mode drivers, and header files for the DPDK environment that are required to build customer applications. In addition, the test and testpmd applications are built under the build/app directory, which may be used for testing. -A kmod directory is also present that contains kernel modules which may be loaded if needed: +A kmod directory is also present that contains kernel modules which may be loaded if needed. .. code-block:: console
Signature · 1 line
2.1.0
PATCH v2 19/19 doc: update source organisation text for drivers
In reply to Bruce RichardsonSince the PMDs have moved to the drivers directory, update the docs that cover the source code organisation of DPDK
--- doc/guides/prog_guide/source_org.rst | 37 +++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
doc/guides/prog_guide/source_org.rst +26 -11
@@ -79,22 +79,37 @@ The lib directory contains:: +-- librte_mempool # memory pool manager (fixedsized objects) +-- librte_meter # QoS metering library +-- librte_net # various IP-related headers - +-- librte_pmd_bond # bonding poll mode driver - +-- librte_pmd_e1000 # 1GbE poll mode drivers (igb and em) - +-- librte_pmd_fm10k # Host interface PMD driver for FM10000 Series - +-- librte_pmd_ixgbe # 10GbE poll mode driver - +-- librte_pmd_i40e # 40GbE poll mode driver - +-- librte_pmd_mlx4 # Mellanox ConnectX-3 poll mode driver - +-- librte_pmd_pcap # PCAP poll mode driver - +-- librte_pmd_ring # ring poll mode driver - +-- librte_pmd_virtio # virtio poll mode driver - +-- librte_pmd_vmxnet3 # VMXNET3 poll mode driver - +-- librte_pmd_xenvirt # Xen virtio poll mode driver +-- librte_power # power management library +-- librte_ring # software rings (act as lockless FIFOs) +-- librte_sched # QoS scheduler and dropper library +-- librte_timer # timer library +Drivers +------- + +Drivers are special libraries which provide poll-mode driver implementations for +devices - either hardware devices or pseudo/virtual devices. They are contained +in the "drivers" subdirectory, classified by type, and each compiles to a +library with the format "librte_pmd_X.a" where "X" is the driver name. + +The drivers directory has a net subdirectory which contains:: + + drivers/net + +-- af_packet # poll mode driver based on linux af_packet + +-- bonding # bonding poll mode driver + +-- e1000 # 1GbE poll mode drivers (igb and em) + +-- enic # Cisco VIC Ethernet NIC Poll-mode Driver + +-- fm10k # Host interface PMD driver for FM10000 Series + +-- i40e # 40GbE poll mode driver + +-- ixgbe # 10GbE poll mode driver + +-- mlx4 # Mellanox ConnectX-3 poll mode driver + +-- null # NULL poll mode driver for testing + +-- pcap # PCAP poll mode driver + +-- ring # ring poll mode driver + +-- virtio # virtio poll mode driver + +-- vmxnet3 # VMXNET3 poll mode driver + +-- xenvirt # Xen virtio poll mode driver + Applications ------------
Signature · 1 line
2.1.0
Re: [PATCH v2 00/19] Move PMDs to drivers directory
In reply to Bruce RichardsonQuoted 5 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, May 15, 2015 4:57 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 00/19] Move PMDs to drivers directory
Series Acked-by: John McNamara <[email protected]>
Note, due to 2 commits to i40e/base that were merged last night patch 08/19 fails on HEAD.
If we are going to apply this patchset, and I think we should, then we should probably do it sooner rather than later since almost any change to the files in lib will require a respin of the patchset and it is quite large.
John.
Re: [PATCH v2 00/19] Move PMDs to drivers directory
Quoted 6 lines · John
Quoted 5 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, May 15, 2015 4:57 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 00/19] Move PMDs to drivers directory
Quoted 9 lines
Series Acked-by: John McNamara <[email protected]>
Note, due to 2 commits to i40e/base that were merged last night patch 08/19 fails on HEAD.
If we are going to apply this patchset, and I think we should, then we should probably do it sooner rather than later since almost any change to the files in lib will require a respin of the patchset and it is quite large.
John.
Thomas, assuming there are no objections to this patchset, let me know when you are merging this in if you need another respin of patch 8 (or any other patches) in the set. I'm not going to respin for every driver change that causes issues, simply due to the patch sizes.
/Bruce
Re: [PATCH v2 00/19] Move PMDs to drivers directory
2015-05-19 12:24, Bruce Richardson:
Quoted 7 lines · John
Quoted 6 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Series Acked-by: John McNamara <[email protected]>
Note, due to 2 commits to i40e/base that were merged last night patch 08/19 fails on HEAD.
Quoted 7 lines
Quoted 3 lines
If we are going to apply this patchset, and I think we should, then we should probably do it sooner rather than later since almost any change to the files in lib will require a respin of the patchset and it is quite large.
John.
Thomas, assuming there are no objections to this patchset, let me know when you are merging this in if you need another respin of patch 8 (or any other patches) in the set. I'm not going to respin for every driver change that causes issues, simply due to the patch sizes.
I'm going to look at applying it shortly.
Don't worry for the rebase, I can manage it.
Re: [PATCH v2 00/19] Move PMDs to drivers directory
Quoted 10 lines · Thomas Monjalon
2015-05-19 12:24, Bruce Richardson:
Quoted 9 lines · John
Quoted 8 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Series Acked-by: John McNamara <[email protected]>
Note, due to 2 commits to i40e/base that were merged last night patch 08/19 fails on HEAD.
If we are going to apply this patchset, and I think we should, then we should probably do it sooner rather than later since almost any change to the files in lib will require a respin of the patchset and it is quite large.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
John.
Thomas, assuming there are no objections to this patchset, let me know when you are merging this in if you need another respin of patch 8 (or any other patches) in the set. I'm not going to respin for every driver change that causes issues, simply due to the patch sizes.
I'm going to look at applying it shortly.
Don't worry for the rebase, I can manage it.
I wasn't able to apply 05/19. However, since it is simple as it is just moving files and is likely to have been corrupted in transit. I think the patch is a good idea and I am confident your rebasing will catch any problems.
--TFH
Quoted 1 line
Signature · 2 lines
Thomas F Herbert Red Hat
Thomas Monjalon
Acked-byRe: [PATCH v2 00/19] Move PMDs to drivers directory
In reply to Mcnamara, JohnQuoted 1 line
Series Acked-by: John McNamara <[email protected]>
Applied with the changes discussed in this thread.
Some patches were split/merge to make each driver move more atomic.
Re: [PATCH v2 00/19] Move PMDs to drivers directory
Quoted 7 lines · Thomas Monjalon
Quoted 1 line
Series Acked-by: John McNamara <[email protected]>
Acked-by Thomas Monjalon <[email protected]>Applied with the changes discussed in this thread.
Some patches were split/merge to make each driver move more atomic.
Thanks Thomas.