diff options
Diffstat (limited to 'test')
152 files changed, 2461 insertions, 9763 deletions
diff --git a/test/Makefile b/test/Makefile index e996fd8c..6656374f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,33 +1,5 @@ -# BSD LICENSE -# -# Copyright(c) 2017 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk diff --git a/test/cmdline_test/Makefile b/test/cmdline_test/Makefile index e9eafd2d..3e742190 100644 --- a/test/cmdline_test/Makefile +++ b/test/cmdline_test/Makefile @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk diff --git a/test/cmdline_test/cmdline_test.c b/test/cmdline_test/cmdline_test.c index 716b5f16..3e406331 100644 --- a/test/cmdline_test/cmdline_test.c +++ b/test/cmdline_test/cmdline_test.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> diff --git a/test/cmdline_test/cmdline_test.h b/test/cmdline_test/cmdline_test.h index 1c9af122..13af4f3d 100644 --- a/test/cmdline_test/cmdline_test.h +++ b/test/cmdline_test/cmdline_test.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef _CMDLINE_TEST_H_ diff --git a/test/cmdline_test/cmdline_test.py b/test/cmdline_test/cmdline_test.py index 229f71f3..3a8fac42 100755 --- a/test/cmdline_test/cmdline_test.py +++ b/test/cmdline_test/cmdline_test.py @@ -1,35 +1,6 @@ #!/usr/bin/env python - -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # Script that runs cmdline_test app and feeds keystrokes into it. from __future__ import print_function diff --git a/test/cmdline_test/cmdline_test_data.py b/test/cmdline_test/cmdline_test_data.py index 28dfefe1..114d2cb6 100644 --- a/test/cmdline_test/cmdline_test_data.py +++ b/test/cmdline_test/cmdline_test_data.py @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # collection of static data diff --git a/test/cmdline_test/commands.c b/test/cmdline_test/commands.c index 404f51af..d81da966 100644 --- a/test/cmdline_test/commands.c +++ b/test/cmdline_test/commands.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 00000000..3ad11b34 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation + +subdir('test') diff --git a/test/test-acl/Makefile b/test/test-acl/Makefile index 29de80a3..5f26294c 100644 --- a/test/test-acl/Makefile +++ b/test/test-acl/Makefile @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk diff --git a/test/test-acl/main.c b/test/test-acl/main.c index 1b2b1760..648525af 100644 --- a/test/test-acl/main.c +++ b/test/test-acl/main.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_acl.h> diff --git a/test/test-pipeline/Makefile b/test/test-pipeline/Makefile index 520a319f..fc3a5044 100644 --- a/test/test-pipeline/Makefile +++ b/test/test-pipeline/Makefile @@ -1,33 +1,5 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2015 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2015 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk diff --git a/test/test-pipeline/config.c b/test/test-pipeline/config.c index 741bd307..28ac9fcc 100644 --- a/test/test-pipeline/config.c +++ b/test/test-pipeline/config.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/init.c b/test/test-pipeline/init.c index 79536609..19cf04a6 100644 --- a/test/test-pipeline/init.c +++ b/test/test-pipeline/init.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/main.c b/test/test-pipeline/main.c index a710173b..0be02ac2 100644 --- a/test/test-pipeline/main.c +++ b/test/test-pipeline/main.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/main.h b/test/test-pipeline/main.h index 26395a35..f844e941 100644 --- a/test/test-pipeline/main.h +++ b/test/test-pipeline/main.h @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #ifndef _MAIN_H_ diff --git a/test/test-pipeline/pipeline_acl.c b/test/test-pipeline/pipeline_acl.c index 22d5f362..524d2212 100644 --- a/test/test-pipeline/pipeline_acl.c +++ b/test/test-pipeline/pipeline_acl.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index edc1663c..11e2402d 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/pipeline_lpm.c b/test/test-pipeline/pipeline_lpm.c index ecea6b3b..8add5e71 100644 --- a/test/test-pipeline/pipeline_lpm.c +++ b/test/test-pipeline/pipeline_lpm.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/pipeline_lpm_ipv6.c b/test/test-pipeline/pipeline_lpm_ipv6.c index 3352e89d..26b32518 100644 --- a/test/test-pipeline/pipeline_lpm_ipv6.c +++ b/test/test-pipeline/pipeline_lpm_ipv6.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/pipeline_stub.c b/test/test-pipeline/pipeline_stub.c index ba710ca6..b6750d51 100644 --- a/test/test-pipeline/pipeline_stub.c +++ b/test/test-pipeline/pipeline_stub.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <stdio.h> diff --git a/test/test-pipeline/runtime.c b/test/test-pipeline/runtime.c index c7c45379..159192bc 100644 --- a/test/test-pipeline/runtime.c +++ b/test/test-pipeline/runtime.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/Makefile b/test/test/Makefile index bb54c980..a88cc38b 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -1,33 +1,5 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2017 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2017 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk @@ -89,12 +61,15 @@ SRCS-y += test_prefetch.c SRCS-y += test_byteorder.c SRCS-y += test_per_lcore.c SRCS-y += test_atomic.c +SRCS-y += test_barrier.c SRCS-y += test_malloc.c SRCS-y += test_cycles.c SRCS-y += test_spinlock.c SRCS-y += test_memory.c SRCS-y += test_memzone.c SRCS-y += test_bitmap.c +SRCS-y += test_reciprocal_division.c +SRCS-y += test_reciprocal_division_perf.c SRCS-y += test_ring.c SRCS-y += test_ring_perf.c @@ -210,12 +185,16 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c +endif + +ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) +SRCS-y += test_rawdev.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c +CFLAGS += -DALLOW_EXPERIMENTAL_API + CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/test/test/autotest.py b/test/test/autotest.py index 5c19a022..1cfd8cf2 100644 --- a/test/test/autotest.py +++ b/test/test/autotest.py @@ -1,35 +1,6 @@ #!/usr/bin/env python - -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # Script that uses either test app or qemu controlled by python-pexpect from __future__ import print_function diff --git a/test/test/autotest_data.py b/test/test/autotest_data.py index 165ed6c5..aacfe0a6 100644 --- a/test/test/autotest_data.py +++ b/test/test/autotest_data.py @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # Test data for autotests diff --git a/test/test/autotest_runner.py b/test/test/autotest_runner.py index fc882ec0..a692f069 100644 --- a/test/test/autotest_runner.py +++ b/test/test/autotest_runner.py @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # The main logic behind running autotests in parallel diff --git a/test/test/autotest_test_funcs.py b/test/test/autotest_test_funcs.py index 15fcb7cf..65fe3353 100644 --- a/test/test/autotest_test_funcs.py +++ b/test/test/autotest_test_funcs.py @@ -1,33 +1,5 @@ -# 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. +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation # Test functions diff --git a/test/test/commands.c b/test/test/commands.c index 4097a331..cf0b726b 100644 --- a/test/test/commands.c +++ b/test/test/commands.c @@ -1,35 +1,6 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * Copyright(c) 2014 6WIND S.A. - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation. + * Copyright(c) 2014 6WIND S.A. */ #include <stdio.h> @@ -62,6 +33,7 @@ #include <rte_atomic.h> #include <rte_branch_prediction.h> #include <rte_ring.h> +#include <rte_malloc.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_devargs.h> @@ -103,8 +75,11 @@ static void cmd_autotest_parsed(void *parsed_result, ret = t->callback(); } + last_test_result = ret; if (ret == 0) printf("Test OK\n"); + else if (ret == TEST_SKIPPED) + printf("Test Skipped\n"); else printf("Test Failed\n"); fflush(stdout); @@ -160,13 +135,20 @@ static void cmd_dump_parsed(void *parsed_result, rte_eal_devargs_dump(stdout); else if (!strcmp(res->dump, "dump_log_types")) rte_log_dump(stdout); + else if (!strcmp(res->dump, "dump_malloc_stats")) + rte_malloc_dump_stats(stdout, NULL); } cmdline_parse_token_string_t cmd_dump_dump = TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump, - "dump_physmem#dump_memzone#" - "dump_struct_sizes#dump_ring#dump_mempool#" - "dump_devargs#dump_log_types"); + "dump_physmem#" + "dump_memzone#" + "dump_struct_sizes#" + "dump_ring#" + "dump_mempool#" + "dump_malloc_stats#" + "dump_devargs#" + "dump_log_types"); cmdline_parse_inst_t cmd_dump = { .f = cmd_dump_parsed, /* function to call */ diff --git a/test/test/meson.build b/test/test/meson.build new file mode 100644 index 00000000..eb3d87a4 --- /dev/null +++ b/test/test/meson.build @@ -0,0 +1,268 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation + +test_sources = files('commands.c', + 'packet_burst_generator.c', + 'test.c', + 'test_acl.c', + 'test_alarm.c', + 'test_atomic.c', + 'test_barrier.c', + 'test_byteorder.c', + 'test_cmdline.c', + 'test_cmdline_cirbuf.c', + 'test_cmdline_etheraddr.c', + 'test_cmdline_ipaddr.c', + 'test_cmdline_lib.c', + 'test_cmdline_num.c', + 'test_cmdline_portlist.c', + 'test_cmdline_string.c', + 'test_common.c', + 'test_cpuflags.c', + 'test_crc.c', + 'test_cryptodev.c', + 'test_cryptodev_blockcipher.c', + 'test_cycles.c', + 'test_debug.c', + 'test_devargs.c', + 'test_distributor.c', + 'test_distributor_perf.c', + 'test_eal_flags.c', + 'test_eal_fs.c', + 'test_efd.c', + 'test_efd_perf.c', + 'test_errno.c', + 'test_event_ring.c', + 'test_eventdev.c', + 'test_func_reentrancy.c', + 'test_flow_classify.c', + 'test_hash.c', + 'test_hash_functions.c', + 'test_hash_multiwriter.c', + 'test_hash_perf.c', + 'test_hash_scaling.c', + 'test_interrupts.c', + 'test_kni.c', + 'test_kvargs.c', + 'test_link_bonding.c', + 'test_link_bonding_mode4.c', + 'test_logs.c', + 'test_lpm.c', + 'test_lpm6.c', + 'test_lpm6_perf.c', + 'test_lpm_perf.c', + 'test_malloc.c', + 'test_mbuf.c', + 'test_member.c', + 'test_member_perf.c', + 'test_memcpy.c', + 'test_memcpy_perf.c', + 'test_memory.c', + 'test_mempool.c', + 'test_mempool_perf.c', + 'test_memzone.c', + 'test_meter.c', + 'test_mp_secondary.c', + 'test_per_lcore.c', + 'test_pmd_perf.c', + 'test_pmd_ring.c', + 'test_pmd_ring_perf.c', + 'test_power.c', + 'test_power_acpi_cpufreq.c', + 'test_power_kvm_vm.c', + 'test_prefetch.c', + 'test_reciprocal_division.c', + 'test_reciprocal_division_perf.c', + 'test_red.c', + 'test_reorder.c', + 'test_ring.c', + 'test_ring_perf.c', + 'test_rwlock.c', + 'test_sched.c', + 'test_service_cores.c', + 'test_spinlock.c', + 'test_string_fns.c', + 'test_table.c', + 'test_table_acl.c', + 'test_table_combined.c', + 'test_table_pipeline.c', + 'test_table_ports.c', + 'test_table_tables.c', + 'test_tailq.c', + 'test_thash.c', + 'test_timer.c', + 'test_timer_perf.c', + 'test_timer_racecond.c', + 'test_version.c', + 'virtual_pmd.c' +) + +test_deps = ['acl', + 'cfgfile', + 'cmdline', + 'cryptodev', + 'distributor', + 'efd', + 'ethdev', + 'eventdev', + 'flow_classify', + 'hash', + 'lpm', + 'member', + 'pipeline', + 'port', + 'reorder', + 'ring', + 'timer' +] + +test_names = [ + 'acl_autotest', + 'alarm_autotest', + 'atomic_autotest', + 'barrier_autotest', + 'byteorder_autotest', + 'cmdline_autotest', + 'common_autotest', + 'cpuflags_autotest', + 'crc_autotest', + 'cryptodev_qat_autotest', + 'cryptodev_aesni_mb_autotest', + 'cryptodev_openssl_autotest', + 'cryptodev_aesni_gcm_autotest', + 'cryptodev_null_autotest', + 'cryptodev_sw_snow3g_autotest', + 'cryptodev_sw_kasumi_autotest', + 'cryptodev_sw_zuc_autotest', + 'cryptodev_sw_armv8_autotest', + 'cryptodev_sw_mrvl_autotest', + 'cryptodev_dpaa2_sec_autotest', + 'cryptodev_dpaa_sec_autotest', + 'cycles_autotest', + 'debug_autotest', + 'devargs_autotest', + 'distributor_autotest', + 'distributor_perf_autotest', + 'eal_flags_autotest', + 'eal_fs_autotest', + 'efd_autotest', + 'efd_perf_autotest', + 'errno_autotest', + 'event_ring_autotest', + 'eventdev_common_autotest', + 'eventdev_octeontx_autotest', + 'eventdev_sw_autotest', + 'func_reentrancy_autotest', + 'flow_classify_autotest', + 'hash_scaling_autotest', + 'hash_autotest', + 'hash_functions_autotest', + 'hash_multiwriter_autotest', + 'hash_perf_autotest', + 'interrupt_autotest', + 'kni_autotest', + 'kvargs_autotest', + 'link_bonding_autotest', + 'link_bonding_mode4_autotest', + 'logs_autotest', + 'lpm6_autotest', + 'lpm6_perf_autotest', + 'lpm_autotest', + 'lpm_perf_autotest', + 'malloc_autotest', + 'mbuf_autotest', + 'member_autotest', + 'member_perf_autotest', + 'memcpy_autotest', + 'memcpy_perf_autotest', + 'memory_autotest', + 'mempool_autotest', + 'mempool_perf_autotest', + 'memzone_autotest', + 'meter_autotest', + 'multiprocess_autotest', + 'per_lcore_autotest', + 'pmd_perf_autotest', + 'power_acpi_cpufreq_autotest', + 'power_autotest', + 'power_kvm_vm_autotest', + 'prefetch_autotest', + 'reciprocal_division', + 'reciprocal_division_perf', + 'red_all', + 'red_autotest', + 'red_perf', + 'reorder_autotest', + 'ring_autotest', + 'ring_perf_autotest', + 'ring_pmd_autotest', + 'ring_pmd_perf_autotest', + 'rwlock_autotest', + 'sched_autotest', + 'service_autotest', + 'spinlock_autotest', + 'string_autotest', + 'table_autotest', + 'tailq_autotest', + 'thash_autotest', + 'timer_autotest', + 'timer_perf__autotest', + 'timer_racecond_autotest', + 'user_delay_us', + 'version_autotest', +] + +if dpdk_conf.has('RTE_LIBRTE_PDUMP') + test_deps += 'pdump' +endif +if dpdk_conf.has('RTE_LIBRTE_I40E_PMD') + test_deps += 'pmd_i40e' +endif +if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD') + test_deps += 'pmd_ixgbe' +endif +if dpdk_conf.has('RTE_LIBRTE_BOND_PMD') + test_deps += 'pmd_bond' +endif +if dpdk_conf.has('RTE_LIBRTE_RING_PMD') + test_deps += 'pmd_ring' +endif +if dpdk_conf.has('RTE_LIBRTE_POWER') + test_deps += 'power' +endif +if dpdk_conf.has('RTE_LIBRTE_KNI') + test_deps += 'kni' +endif + +test_dep_objs = [] +foreach d:test_deps + def_lib = get_option('default_library') + test_dep_objs += get_variable(def_lib + '_rte_' + d) +endforeach +test_dep_objs += cc.find_library('execinfo', required: false) + +link_libs = [] +if get_option('default_library') == 'static' + link_libs = dpdk_drivers +endif + +if get_option('tests') + dpdk_test = executable('dpdk-test', + test_sources, + link_whole: link_libs, + dependencies: test_dep_objs, + c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'], + install_rpath: driver_install_path, + install: false) + + # some perf tests (eg: memcpy perf autotest)take very long + # to complete, so timeout to 10 minutes + timeout_seconds = 600 + + foreach t:test_names + test(t, dpdk_test, + env : ['DPDK_TEST='+t], + timeout : timeout_seconds, + is_parallel : false) + endforeach +endif diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 8f4ddcc4..e894dc76 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_byteorder.h> diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 3315bfa6..c20cea6e 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef PACKET_BURST_GENERATOR_H_ diff --git a/test/test/process.h b/test/test/process.h index 51ced122..11986d5c 100644 --- a/test/test/process.h +++ b/test/test/process.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef _PROCESS_H_ diff --git a/test/test/test.c b/test/test/test.c index 0e6ff7ce..44dfe20e 100644 --- a/test/test/test.c +++ b/test/test/test.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -102,6 +73,8 @@ do_recursive_call(void) return -1; } +int last_test_result; + int main(int argc, char **argv) { @@ -140,6 +113,20 @@ main(int argc, char **argv) if (cl == NULL) { return -1; } + + char *dpdk_test = getenv("DPDK_TEST"); + if (dpdk_test && strlen(dpdk_test)) { + char buf[1024]; + snprintf(buf, sizeof(buf), "%s\n", dpdk_test); + if (cmdline_in(cl, buf, strlen(buf)) < 0) { + printf("error on cmdline input\n"); + return -1; + } + + cmdline_stdin_exit(cl); + return last_test_result; + } + /* if no DPDK_TEST env variable, go interactive */ cmdline_interact(cl); cmdline_stdin_exit(cl); #endif @@ -162,8 +149,20 @@ unit_test_suite_runner(struct unit_test_suite *suite) } if (suite->setup) - if (suite->setup() != 0) + if (suite->setup() != 0) { + /* + * setup failed, so count all enabled tests and mark + * them as failed + */ + while (suite->unit_test_cases[total].testcase) { + if (!suite->unit_test_cases[total].enabled) + skipped++; + else + failed++; + total++; + } goto suite_summary; + } printf(" + ------------------------------------------------------- +\n"); @@ -231,6 +230,8 @@ suite_summary: printf(" + Tests Failed : %2d\n", failed); printf(" + ------------------------------------------------------- +\n"); + last_test_result = failed; + if (failed) return -1; diff --git a/test/test/test.h b/test/test/test.h index 08ffe949..7c244323 100644 --- a/test/test/test.h +++ b/test/test/test.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef _TEST_H_ @@ -37,11 +8,12 @@ #include <stddef.h> #include <sys/queue.h> +#include <rte_hexdump.h> #include <rte_common.h> -#include <rte_log.h> -#define TEST_SUCCESS (0) -#define TEST_FAILED (-1) +#define TEST_SUCCESS EXIT_SUCCESS +#define TEST_FAILED -1 +#define TEST_SKIPPED 77 /* Before including test.h file you can define * TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test @@ -50,23 +22,13 @@ # define TEST_TRACE_FAILURE(_file, _line, _func) #endif -#define TEST_ASSERT(cond, msg, ...) do { \ - if (!(cond)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define RTE_TEST_TRACE_FAILURE TEST_TRACE_FAILURE -#define TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ - if (!(a == b)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#include <rte_test.h> + +#define TEST_ASSERT RTE_TEST_ASSERT + +#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL /* Compare two buffers (length in bytes) */ #define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len, msg, ...) do { \ @@ -134,52 +96,15 @@ } \ } while (0) -#define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ - if (!(a != b)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NOT_EQUAL RTE_TEST_ASSERT_NOT_EQUAL -#define TEST_ASSERT_SUCCESS(val, msg, ...) do { \ - typeof(val) _val = (val); \ - if (!(_val == 0)) { \ - printf("TestCase %s() line %d failed (err %d): " \ - msg "\n", __func__, __LINE__, _val, \ - ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_SUCCESS RTE_TEST_ASSERT_SUCCESS -#define TEST_ASSERT_FAIL(val, msg, ...) do { \ - if (!(val != 0)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_FAIL RTE_TEST_ASSERT_FAIL -#define TEST_ASSERT_NULL(val, msg, ...) do { \ - if (!(val == NULL)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NULL RTE_TEST_ASSERT_NULL -#define TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ - if (!(val != NULL)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NOT_NULL RTE_TEST_ASSERT_NOT_NULL struct unit_test_case { int (*setup)(void); @@ -204,11 +129,12 @@ struct unit_test_case { #define TEST_CASES_END() { NULL, NULL, NULL, NULL, 0 } -#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG -#define TEST_HEXDUMP(file, title, buf, len) rte_hexdump(file, title, buf, len) -#else -#define TEST_HEXDUMP(file, title, buf, len) do {} while (0) -#endif +static inline void +debug_hexdump(FILE *file, const char *title, const void *buf, size_t len) +{ + if (rte_log_get_global_level() == RTE_LOG_DEBUG) + rte_hexdump(file, title, buf, len); +} struct unit_test_suite { const char *suite_name; @@ -218,6 +144,7 @@ struct unit_test_suite { }; int unit_test_suite_runner(struct unit_test_suite *suite); +extern int last_test_result; #define RECURSIVE_ENV_VAR "RTE_TEST_RECURSIVE" diff --git a/test/test/test_acl.c b/test/test/test_acl.c index c6b511fb..b1f75d1b 100644 --- a/test/test/test_acl.c +++ b/test/test/test_acl.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> diff --git a/test/test/test_acl.h b/test/test/test_acl.h index 421f3109..c4811c8f 100644 --- a/test/test/test_acl.h +++ b/test/test/test_acl.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef TEST_ACL_H_ diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index 2d16d6ff..f566947f 100644 --- a/test/test/test_alarm.c +++ b/test/test/test_alarm.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_atomic.c b/test/test/test_atomic.c index 39c9a595..43be30ec 100644 --- a/test/test/test_atomic.c +++ b/test/test/test_atomic.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_barrier.c b/test/test/test_barrier.c new file mode 100644 index 00000000..82b572c3 --- /dev/null +++ b/test/test/test_barrier.c @@ -0,0 +1,286 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2018 Intel Corporation + */ + + /* + * This is a simple functional test for rte_smp_mb() implementation. + * I.E. make sure that LOAD and STORE operations that precede the + * rte_smp_mb() call are globally visible across the lcores + * before the the LOAD and STORE operations that follows it. + * The test uses simple implementation of Peterson's lock algorithm + * (https://en.wikipedia.org/wiki/Peterson%27s_algorithm) + * for two execution units to make sure that rte_smp_mb() prevents + * store-load reordering to happen. + * Also when executed on a single lcore could be used as a approxiamate + * estimation of number of cycles particular implementation of rte_smp_mb() + * will take. + */ + +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include <inttypes.h> + +#include <rte_memory.h> +#include <rte_per_lcore.h> +#include <rte_launch.h> +#include <rte_atomic.h> +#include <rte_eal.h> +#include <rte_lcore.h> +#include <rte_pause.h> +#include <rte_random.h> +#include <rte_cycles.h> +#include <rte_vect.h> +#include <rte_debug.h> + +#include "test.h" + +#define ADD_MAX 8 +#define ITER_MAX 0x1000000 + +enum plock_use_type { + USE_MB, + USE_SMP_MB, + USE_NUM +}; + +struct plock { + volatile uint32_t flag[2]; + volatile uint32_t victim; + enum plock_use_type utype; +}; + +/* + * Lock plus protected by it two counters. + */ +struct plock_test { + struct plock lock; + uint32_t val; + uint32_t iter; +}; + +/* + * Each active lcore shares plock_test struct with it's left and right + * neighbours. + */ +struct lcore_plock_test { + struct plock_test *pt[2]; /* shared, lock-protected data */ + uint32_t sum[2]; /* local copy of the shared data */ + uint32_t iter; /* number of iterations to perfom */ + uint32_t lc; /* given lcore id */ +}; + +static inline void +store_load_barrier(uint32_t utype) +{ + if (utype == USE_MB) + rte_mb(); + else if (utype == USE_SMP_MB) + rte_smp_mb(); + else + RTE_VERIFY(0); +} + +/* + * Peterson lock implementation. + */ +static void +plock_lock(struct plock *l, uint32_t self) +{ + uint32_t other; + + other = self ^ 1; + + l->flag[self] = 1; + l->victim = self; + + store_load_barrier(l->utype); + + while (l->flag[other] == 1 && l->victim == self) + rte_pause(); +} + +static void +plock_unlock(struct plock *l, uint32_t self) +{ + rte_smp_wmb(); + l->flag[self] = 0; +} + +static void +plock_reset(struct plock *l, enum plock_use_type utype) +{ + memset(l, 0, sizeof(*l)); + l->utype = utype; +} + +/* + * grab the lock, update both counters, release the lock. + */ +static void +plock_add(struct plock_test *pt, uint32_t self, uint32_t n) +{ + plock_lock(&pt->lock, self); + pt->iter++; + pt->val += n; + plock_unlock(&pt->lock, self); +} + +static int +plock_test1_lcore(void *data) +{ + uint64_t tm; + uint32_t i, lc, ln, n; + struct lcore_plock_test *lpt; + + lpt = data; + lc = rte_lcore_id(); + + /* find lcore_plock_test struct for given lcore */ + for (ln = rte_lcore_count(); ln != 0 && lpt->lc != lc; lpt++, ln--) + ; + + if (ln == 0) { + printf("%s(%u) error at init\n", __func__, lc); + return -1; + } + + n = rte_rand() % ADD_MAX; + tm = rte_get_timer_cycles(); + + /* + * for each iteration: + * - update shared, locked protected data in a safe manner + * - update local copy of the shared data + */ + for (i = 0; i != lpt->iter; i++) { + + plock_add(lpt->pt[0], 0, n); + plock_add(lpt->pt[1], 1, n); + + lpt->sum[0] += n; + lpt->sum[1] += n; + + n = (n + 1) % ADD_MAX; + } + + tm = rte_get_timer_cycles() - tm; + + printf("%s(%u): %u iterations finished, in %" PRIu64 + " cycles, %#Lf cycles/iteration, " + "local sum={%u, %u}\n", + __func__, lc, i, tm, (long double)tm / i, + lpt->sum[0], lpt->sum[1]); + return 0; +} + +/* + * For N active lcores we allocate N+1 lcore_plock_test structures. + * Each active lcore shares one lcore_plock_test structure with its + * left lcore neighbor and one lcore_plock_test structure with its + * right lcore neighbor. + * During the test each lcore updates data in both shared structures and + * its local copies. Then at validation phase we check that our shared + * and local data are the same. + */ +static int +plock_test(uint32_t iter, enum plock_use_type utype) +{ + int32_t rc; + uint32_t i, lc, n; + uint32_t *sum; + struct plock_test *pt; + struct lcore_plock_test *lpt; + + /* init phase, allocate and initialize shared data */ + + n = rte_lcore_count(); + pt = calloc(n + 1, sizeof(*pt)); + lpt = calloc(n, sizeof(*lpt)); + sum = calloc(n + 1, sizeof(*sum)); + + printf("%s(iter=%u, utype=%u) started on %u lcores\n", + __func__, iter, utype, n); + + if (pt == NULL || lpt == NULL) { + printf("%s: failed to allocate memory for %u lcores\n", + __func__, n); + free(pt); + free(lpt); + free(sum); + return -ENOMEM; + } + + for (i = 0; i != n + 1; i++) + plock_reset(&pt[i].lock, utype); + + i = 0; + RTE_LCORE_FOREACH(lc) { + + lpt[i].lc = lc; + lpt[i].iter = iter; + lpt[i].pt[0] = pt + i; + lpt[i].pt[1] = pt + i + 1; + i++; + } + + lpt[i - 1].pt[1] = pt; + + for (i = 0; i != n; i++) + printf("lpt[%u]={lc=%u, pt={%p, %p},};\n", + i, lpt[i].lc, lpt[i].pt[0], lpt[i].pt[1]); + + + /* test phase - start and wait for completion on each active lcore */ + + rte_eal_mp_remote_launch(plock_test1_lcore, lpt, CALL_MASTER); + rte_eal_mp_wait_lcore(); + + /* validation phase - make sure that shared and local data match */ + + for (i = 0; i != n; i++) { + sum[i] += lpt[i].sum[0]; + sum[i + 1] += lpt[i].sum[1]; + } + + sum[0] += sum[i]; + + rc = 0; + for (i = 0; i != n; i++) { + printf("%s: sum[%u]=%u, pt[%u].val=%u, pt[%u].iter=%u;\n", + __func__, i, sum[i], i, pt[i].val, i, pt[i].iter); + + /* race condition occurred, lock doesn't work properly */ + if (sum[i] != pt[i].val || 2 * iter != pt[i].iter) { + printf("error: local and shared sums don't much\n"); + rc = -1; + } + } + + free(pt); + free(lpt); + free(sum); + + printf("%s(utype=%u) returns %d\n", __func__, utype, rc); + return rc; +} + +static int +test_barrier(void) +{ + int32_t i, ret, rc[USE_NUM]; + + for (i = 0; i != RTE_DIM(rc); i++) + rc[i] = plock_test(ITER_MAX, i); + + ret = 0; + for (i = 0; i != RTE_DIM(rc); i++) { + printf("%s for utype=%d %s\n", + __func__, i, rc[i] == 0 ? "passed" : "failed"); + ret |= rc[i]; + } + + return ret; +} + +REGISTER_TEST_COMMAND(barrier_autotest, test_barrier); diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c index 5c9eee96..c3169e9d 100644 --- a/test/test/test_bitmap.c +++ b/test/test/test_bitmap.c @@ -1,33 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright (C) Cavium, Inc. 2017. - * - * 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 Cavium, Inc 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc */ #include <stdio.h> @@ -186,6 +158,9 @@ test_bitmap(void) if (test_bitmap_scan_operations(bmp) < 0) return TEST_FAILED; + rte_bitmap_free(bmp); + rte_free(mem); + return TEST_SUCCESS; } diff --git a/test/test/test_byteorder.c b/test/test/test_byteorder.c index 8ae31142..03c08d9a 100644 --- a/test/test/test_byteorder.c +++ b/test/test/test_byteorder.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline.c b/test/test/test_cmdline.c index 38c7256f..115bee96 100644 --- a/test/test/test_cmdline.c +++ b/test/test/test_cmdline.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline.h b/test/test/test_cmdline.h index 0ee91c17..1854caf8 100644 --- a/test/test/test_cmdline.h +++ b/test/test/test_cmdline.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef TEST_CMDLINE_H_ diff --git a/test/test/test_cmdline_cirbuf.c b/test/test/test_cmdline_cirbuf.c index 2c321457..e9193f66 100644 --- a/test/test/test_cmdline_cirbuf.c +++ b/test/test/test_cmdline_cirbuf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline_etheraddr.c b/test/test/test_cmdline_etheraddr.c index e4f42317..6ceba4b2 100644 --- a/test/test/test_cmdline_etheraddr.c +++ b/test/test/test_cmdline_etheraddr.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline_ipaddr.c b/test/test/test_cmdline_ipaddr.c index 471d2ff1..2eb5a774 100644 --- a/test/test/test_cmdline_ipaddr.c +++ b/test/test/test_cmdline_ipaddr.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline_lib.c b/test/test/test_cmdline_lib.c index 65b823a7..a856a971 100644 --- a/test/test/test_cmdline_lib.c +++ b/test/test/test_cmdline_lib.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> diff --git a/test/test/test_cmdline_num.c b/test/test/test_cmdline_num.c index e8f60cfa..ea6b9f1e 100644 --- a/test/test/test_cmdline_num.c +++ b/test/test/test_cmdline_num.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline_portlist.c b/test/test/test_cmdline_portlist.c index b9664b0e..0dc6d003 100644 --- a/test/test/test_cmdline_portlist.c +++ b/test/test/test_cmdline_portlist.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cmdline_string.c b/test/test/test_cmdline_string.c index c5bb9c0c..0461a85b 100644 --- a/test/test/test_cmdline_string.c +++ b/test/test/test_cmdline_string.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_common.c b/test/test/test_common.c index ae3482da..d0342430 100644 --- a/test/test/test_common.c +++ b/test/test/test_common.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_cpuflags.c b/test/test/test_cpuflags.c index 08c16613..06718631 100644 --- a/test/test/test_cpuflags.c +++ b/test/test/test_cpuflags.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_crc.c b/test/test/test_crc.c index 9f2a17d4..f8a74e04 100644 --- a/test/test/test_crc.c +++ b/test/test/test_crc.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Intel Corporation. - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include "test.h" @@ -86,7 +57,7 @@ crc_calc(const uint8_t *vec, uint32_t ret = rte_net_crc_calc(vec, vec_len, type); /* dump data on console */ - TEST_HEXDUMP(stdout, NULL, vec, vec_len); + debug_hexdump(stdout, NULL, vec, vec_len); return ret; } diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 1bed65da..1417482c 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -1,35 +1,9 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015-2017 Intel Corporation */ +#include <time.h> + #include <rte_common.h> #include <rte_hexdump.h> #include <rte_mbuf.h> @@ -2052,7 +2026,7 @@ create_wireless_algo_hash_session(uint8_t dev_id, memcpy(hash_key, key, key_len); - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Setup Authentication Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; @@ -2099,7 +2073,7 @@ create_wireless_algo_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; ut_params->cipher_xform.cipher.iv.length = iv_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Create Crypto session */ ut_params->sess = rte_cryptodev_sym_session_create( @@ -2215,7 +2189,7 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id, ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; ut_params->cipher_xform.cipher.iv.length = cipher_iv_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create( @@ -2274,7 +2248,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id, ut_params->cipher_xform.cipher.iv.length = cipher_iv_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create( @@ -2336,7 +2310,7 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; ut_params->cipher_xform.cipher.iv.length = cipher_iv_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create( @@ -2393,7 +2367,7 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, auth_tag_len); @@ -2449,7 +2423,7 @@ create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, auth_tag_len); @@ -2516,7 +2490,7 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, auth_tag_len); @@ -2572,7 +2546,7 @@ create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len, memset(sym_op->auth.digest.data, 0, auth_tag_len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, auth_tag_len); @@ -3005,7 +2979,7 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create KASUMI operation */ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data, @@ -3025,7 +2999,7 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata) else ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); const uint8_t *reference_ciphertext = tdata->ciphertext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -3105,7 +3079,7 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata) plaintext_len, buffer); /* Validate obuf */ - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); const uint8_t *reference_ciphertext = tdata->ciphertext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -3154,7 +3128,7 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata) rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create KASUMI operation */ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data, @@ -3174,7 +3148,7 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata) else ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); const uint8_t *reference_ciphertext = tdata->ciphertext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -3301,7 +3275,7 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata) rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len); /* Create KASUMI operation */ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data, @@ -3321,7 +3295,7 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata) else plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len); + debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len); const uint8_t *reference_plaintext = tdata->plaintext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -3368,7 +3342,7 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len); /* Create KASUMI operation */ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data, @@ -3388,7 +3362,7 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata) else plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len); + debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len); const uint8_t *reference_plaintext = tdata->plaintext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -3435,7 +3409,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data, @@ -3455,7 +3429,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) else ciphertext = plaintext; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -3508,7 +3482,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data, @@ -3528,7 +3502,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) else ciphertext = plaintext; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -3606,7 +3580,7 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata) ciphertext = rte_pktmbuf_read(ut_params->ibuf, 0, plaintext_len, buffer); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -3764,7 +3738,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data, @@ -3783,7 +3757,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) else plaintext = ciphertext; - TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len); + debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext, @@ -3837,7 +3811,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data, @@ -3856,7 +3830,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) else plaintext = ciphertext; - TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len); + debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext, @@ -3916,7 +3890,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create ZUC operation */ retval = create_zuc_cipher_hash_generate_operation(tdata); @@ -3932,7 +3906,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata) else ciphertext = plaintext; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( ciphertext, @@ -3989,7 +3963,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data, @@ -4014,7 +3988,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata) else ciphertext = plaintext; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( ciphertext, @@ -4071,7 +4045,7 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create SNOW 3G operation */ retval = create_wireless_algo_auth_cipher_operation( @@ -4098,7 +4072,7 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata) ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + plaintext_pad_len; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -4154,7 +4128,7 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create KASUMI operation */ retval = create_wireless_algo_auth_cipher_operation(tdata->digest.len, @@ -4240,7 +4214,7 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create KASUMI operation */ retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data, @@ -4332,7 +4306,7 @@ test_zuc_encryption(const struct wireless_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, plaintext_len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len); + debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); /* Create ZUC operation */ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data, @@ -4352,7 +4326,7 @@ test_zuc_encryption(const struct wireless_test_data *tdata) else ciphertext = plaintext; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -4439,7 +4413,7 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata) 0, plaintext_len, ciphertext_buffer); /* Validate obuf */ - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len); + debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( @@ -5083,7 +5057,7 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo, ut_params->aead_xform.aead.digest_length = auth_len; ut_params->aead_xform.aead.aad_length = aad_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create( @@ -5122,7 +5096,7 @@ create_aead_xform(struct rte_crypto_op *op, sym_op->xform->aead.digest_length = auth_len; sym_op->xform->aead.aad_length = aad_len; - TEST_HEXDUMP(stdout, "key:", key, key_len); + debug_hexdump(stdout, "key:", key, key_len); return 0; } @@ -5157,7 +5131,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, rte_pktmbuf_iova(ut_params->ibuf); /* Copy AAD 18 bytes after the AAD pointer, according to the API */ memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len); - TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data, + debug_hexdump(stdout, "aad:", sym_op->aead.aad.data, tdata->aad.len); /* Append IV at the end of the crypto operation*/ @@ -5166,7 +5140,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, /* Copy IV 1 byte after the IV pointer, according to the API */ rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, + debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len); } else { aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16); @@ -5178,7 +5152,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, sym_op->aead.aad.phys_addr = rte_pktmbuf_iova(ut_params->ibuf); memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len); - TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data, + debug_hexdump(stdout, "aad:", sym_op->aead.aad.data, tdata->aad.len); /* Append IV at the end of the crypto operation*/ @@ -5186,7 +5160,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, uint8_t *, IV_OFFSET); rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, + debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len); } @@ -5198,7 +5172,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext"); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, + debug_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); if (ut_params->obuf) { @@ -5220,7 +5194,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len); - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, + debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); if (ut_params->obuf) { @@ -5260,7 +5234,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data, tdata->auth_tag.len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->aead.digest.data, tdata->auth_tag.len); } @@ -5334,8 +5308,8 @@ test_authenticated_encryption(const struct aead_test_data *tdata) auth_tag = ciphertext + plaintext_pad_len; } - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); - TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); + debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5548,7 +5522,7 @@ test_authenticated_decryption(const struct aead_test_data *tdata) uint8_t *, ut_params->op->sym->cipher.data.offset); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len); + debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5753,8 +5727,8 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata) ut_params->op->sym->cipher.data.offset); auth_tag = ciphertext + plaintext_pad_len; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); - TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); + debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5827,7 +5801,7 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata) plaintext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *, ut_params->op->sym->cipher.data.offset); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len); + debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5903,8 +5877,8 @@ test_authenticated_encryption_sessionless( ut_params->op->sym->cipher.data.offset); auth_tag = ciphertext + plaintext_pad_len; - TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); - TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); + debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5981,7 +5955,7 @@ test_authenticated_decryption_sessionless( plaintext = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *, ut_params->op->sym->cipher.data.offset); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len); + debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -6609,17 +6583,29 @@ test_null_cipher_only_operation(void) return TEST_SUCCESS; } - +uint8_t orig_data[] = {0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab}; static int test_null_auth_only_operation(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; + uint8_t *digest; /* Generate test mbuf data and space for digest */ ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, catch_22_quote, QUOTE_512_BYTES, 0); + /* create a pointer for digest, but don't expect anything to be written + * here in a NULL auth algo so no mbuf append done. + */ + digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *, + QUOTE_512_BYTES); + /* prefill the memory pointed to by digest */ + memcpy(digest, orig_data, sizeof(orig_data)); + /* Setup HMAC Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -6651,6 +6637,9 @@ test_null_auth_only_operation(void) sym_op->auth.data.offset = 0; sym_op->auth.data.length = QUOTE_512_BYTES; + sym_op->auth.digest.data = digest; + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf, + QUOTE_512_BYTES); /* Process crypto operation */ ut_params->op = process_crypto_request(ts_params->valid_devs[0], @@ -6659,20 +6648,36 @@ test_null_auth_only_operation(void) TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "crypto operation processing failed"); + /* Make sure memory pointed to by digest hasn't been overwritten */ + TEST_ASSERT_BUFFERS_ARE_EQUAL( + orig_data, + digest, + sizeof(orig_data), + "Memory at digest ptr overwritten unexpectedly"); return TEST_SUCCESS; } + static int test_null_cipher_auth_operation(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; + uint8_t *digest; /* Generate test mbuf data and space for digest */ ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, catch_22_quote, QUOTE_512_BYTES, 0); + /* create a pointer for digest, but don't expect anything to be written + * here in a NULL auth algo so no mbuf append done. + */ + digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *, + QUOTE_512_BYTES); + /* prefill the memory pointed to by digest */ + memcpy(digest, orig_data, sizeof(orig_data)); + /* Setup Cipher Parameters */ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; ut_params->cipher_xform.next = &ut_params->auth_xform; @@ -6714,6 +6719,9 @@ test_null_cipher_auth_operation(void) sym_op->auth.data.offset = 0; sym_op->auth.data.length = QUOTE_512_BYTES; + sym_op->auth.digest.data = digest; + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf, + QUOTE_512_BYTES); /* Process crypto operation */ ut_params->op = process_crypto_request(ts_params->valid_devs[0], @@ -6729,6 +6737,12 @@ test_null_cipher_auth_operation(void) catch_22_quote, QUOTE_512_BYTES, "Ciphertext data not as expected"); + /* Make sure memory pointed to by digest hasn't been overwritten */ + TEST_ASSERT_BUFFERS_ARE_EQUAL( + orig_data, + digest, + sizeof(orig_data), + "Memory at digest ptr overwritten unexpectedly"); return TEST_SUCCESS; } @@ -6738,11 +6752,20 @@ test_null_auth_cipher_operation(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; + uint8_t *digest; - /* Generate test mbuf data and space for digest */ + /* Generate test mbuf data */ ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, catch_22_quote, QUOTE_512_BYTES, 0); + /* create a pointer for digest, but don't expect anything to be written + * here in a NULL auth algo so no mbuf append done. + */ + digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *, + QUOTE_512_BYTES); + /* prefill the memory pointed to by digest */ + memcpy(digest, orig_data, sizeof(orig_data)); + /* Setup Cipher Parameters */ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; ut_params->cipher_xform.next = NULL; @@ -6784,6 +6807,9 @@ test_null_auth_cipher_operation(void) sym_op->auth.data.offset = 0; sym_op->auth.data.length = QUOTE_512_BYTES; + sym_op->auth.digest.data = digest; + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf, + QUOTE_512_BYTES); /* Process crypto operation */ ut_params->op = process_crypto_request(ts_params->valid_devs[0], @@ -6799,6 +6825,12 @@ test_null_auth_cipher_operation(void) catch_22_quote, QUOTE_512_BYTES, "Ciphertext data not as expected"); + /* Make sure memory pointed to by digest hasn't been overwritten */ + TEST_ASSERT_BUFFERS_ARE_EQUAL( + orig_data, + digest, + sizeof(orig_data), + "Memory at digest ptr overwritten unexpectedly"); return TEST_SUCCESS; } @@ -6969,7 +7001,7 @@ create_gmac_operation(enum rte_crypto_auth_operation op, if (op == RTE_CRYPTO_AUTH_OP_VERIFY) { rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data, tdata->gmac_tag.len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, tdata->gmac_tag.len); } @@ -6979,7 +7011,7 @@ create_gmac_operation(enum rte_crypto_auth_operation op, rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, tdata->iv.len); + debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len); sym_op->cipher.data.length = 0; sym_op->cipher.data.offset = 0; @@ -7069,7 +7101,7 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata) TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext"); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, + debug_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_GENERATE, @@ -7095,7 +7127,7 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata) auth_tag = plaintext + plaintext_pad_len; } - TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len); + debug_hexdump(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, @@ -7173,7 +7205,7 @@ test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata) TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext"); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, + debug_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_VERIFY, @@ -7495,7 +7527,7 @@ create_auth_operation(struct crypto_testsuite_params *ts_params, reference->digest.data, reference->digest.len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, reference->digest.len); @@ -7542,7 +7574,7 @@ create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params, reference->digest.data, reference->digest.len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, reference->digest.len); @@ -7595,7 +7627,7 @@ create_cipher_auth_operation(struct crypto_testsuite_params *ts_params, reference->digest.data, reference->digest.len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->auth.digest.data, reference->digest.len); @@ -7668,7 +7700,8 @@ test_authentication_verify_fail_when_data_corruption( TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext"); memcpy(plaintext, reference->plaintext.data, reference->plaintext.len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, reference->plaintext.len); + debug_hexdump(stdout, "plaintext:", plaintext, + reference->plaintext.len); /* Create operation */ retval = create_auth_verify_operation(ts_params, ut_params, reference); @@ -7726,7 +7759,8 @@ test_authentication_verify_GMAC_fail_when_corruption( TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext"); memcpy(plaintext, reference->plaintext.data, reference->plaintext.len); - TEST_HEXDUMP(stdout, "plaintext:", plaintext, reference->plaintext.len); + debug_hexdump(stdout, "plaintext:", plaintext, + reference->plaintext.len); /* Create operation */ retval = create_auth_verify_GMAC_operation(ts_params, @@ -7845,7 +7879,7 @@ create_aead_operation_SGL(enum rte_crypto_aead_operation op, if (op == RTE_CRYPTO_AEAD_OP_DECRYPT) { rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data, auth_tag_len); - TEST_HEXDUMP(stdout, "digest:", + debug_hexdump(stdout, "digest:", sym_op->aead.digest.data, auth_tag_len); } @@ -7871,8 +7905,8 @@ create_aead_operation_SGL(enum rte_crypto_aead_operation op, /* Copy AAD 18 bytes after the AAD pointer, according to the API */ rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len); - TEST_HEXDUMP(stdout, "aad:", + debug_hexdump(stdout, "iv:", iv_ptr, iv_len); + debug_hexdump(stdout, "aad:", sym_op->aead.aad.data, aad_len); } else { uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, @@ -7890,8 +7924,8 @@ create_aead_operation_SGL(enum rte_crypto_aead_operation op, memset(sym_op->aead.aad.data, 0, aad_len); rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len); - TEST_HEXDUMP(stdout, "aad:", + debug_hexdump(stdout, "iv:", iv_ptr, iv_len); + debug_hexdump(stdout, "aad:", sym_op->aead.aad.data, aad_len); } @@ -8746,6 +8780,18 @@ static struct unit_test_suite cryptodev_aesni_mb_testsuite = { test_DES_cipheronly_mb_all), TEST_CASE_ST(ut_setup, ut_teardown, test_DES_docsis_mb_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_3), TEST_CASES_END() /**< NULL terminate unit test array */ } @@ -9377,6 +9423,16 @@ static struct unit_test_suite cryptodev_dpaa_sec_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_authenticated_decryption_oop_test_case_1), + /** Scatter-Gather */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_in_place_1500B), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B), + TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -9504,6 +9560,16 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_authenticated_decryption_oop_test_case_1), + /** Scatter-Gather */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_in_place_1500B), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B), + TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -9591,7 +9657,7 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_QAT is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_qat_testsuite); @@ -9607,7 +9673,7 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite); @@ -9623,7 +9689,7 @@ test_cryptodev_openssl(void) RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_openssl_testsuite); @@ -9639,7 +9705,7 @@ test_cryptodev_aesni_gcm(void) RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite); @@ -9655,7 +9721,7 @@ test_cryptodev_null(void) RTE_LOG(ERR, USER1, "NULL PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_NULL is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_null_testsuite); @@ -9671,7 +9737,7 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite); @@ -9687,7 +9753,7 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_KASUMI is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite); @@ -9703,7 +9769,7 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_ZUC is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite); @@ -9719,7 +9785,7 @@ test_cryptodev_armv8(void) RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_armv8_testsuite); @@ -9735,7 +9801,7 @@ test_cryptodev_mrvl(void) RTE_LOG(ERR, USER1, "MRVL PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_mrvl_testsuite); @@ -9753,14 +9819,14 @@ test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "SCHEDULER PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_SCHEDULER is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } if (rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) { RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" " enabled in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_scheduler_testsuite); } @@ -9779,7 +9845,7 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite); @@ -9795,7 +9861,7 @@ test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/) RTE_LOG(ERR, USER1, "DPAA SEC PMD must be loaded. Check if " "CONFIG_RTE_LIBRTE_PMD_DPAA_SEC is enabled " "in config file to run this testsuite.\n"); - return TEST_FAILED; + return TEST_SKIPPED; } return unit_test_suite_runner(&cryptodev_dpaa_sec_testsuite); diff --git a/test/test/test_cryptodev.h b/test/test/test_cryptodev.h index 26bfbe60..8cdc0874 100644 --- a/test/test/test_cryptodev.h +++ b/test/test/test_cryptodev.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_H_ #define TEST_CRYPTODEV_H_ diff --git a/test/test/test_cryptodev_aead_test_vectors.h b/test/test/test_cryptodev_aead_test_vectors.h index e760ef93..a4a3a25c 100644 --- a/test/test/test_cryptodev_aead_test_vectors.h +++ b/test/test/test_cryptodev_aead_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_aes_test_vectors.h b/test/test/test_cryptodev_aes_test_vectors.h index 9c13041d..3577ef4b 100644 --- a/test/test/test_cryptodev_aes_test_vectors.h +++ b/test/test/test_cryptodev_aes_test_vectors.h @@ -1,33 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_AES_TEST_VECTORS_H_ @@ -1297,7 +1269,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER + BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -1315,6 +1289,15 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " + "Verify Scatter Gather", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " "Verify (short buffers)", .test_data = &aes_test_data_13, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, @@ -1419,6 +1402,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER }, { @@ -1572,7 +1557,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC }, { .test_descr = "AES-192-CBC Decryption", @@ -1586,6 +1573,14 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { + .test_descr = "AES-192-CBC Decryption Scatter Gather", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC + }, + { .test_descr = "AES-256-CBC Encryption", .test_data = &aes_test_data_11, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c index 20f3296d..ed066180 100644 --- a/test/test/test_cryptodev_blockcipher.c +++ b/test/test/test_cryptodev_blockcipher.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015-2017 Intel Corporation */ #include <rte_common.h> @@ -362,12 +334,12 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, rte_crypto_op_attach_sym_session(op, sess); } - TEST_HEXDUMP(stdout, "m_src(before):", + debug_hexdump(stdout, "m_src(before):", sym_op->m_src->buf_addr, sym_op->m_src->buf_len); rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr, sym_op->m_src->buf_len); if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) { - TEST_HEXDUMP(stdout, "m_dst(before):", + debug_hexdump(stdout, "m_dst(before):", sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len); rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len); @@ -395,10 +367,10 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, goto error_exit; } - TEST_HEXDUMP(stdout, "m_src(after):", + debug_hexdump(stdout, "m_src(after):", sym_op->m_src->buf_addr, sym_op->m_src->buf_len); if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) - TEST_HEXDUMP(stdout, "m_dst(after):", + debug_hexdump(stdout, "m_dst(after):", sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len); /* Verify results */ diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h index 67c78d47..edbdaabe 100644 --- a/test/test/test_cryptodev_blockcipher.h +++ b/test/test/test_cryptodev_blockcipher.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_BLOCKCIPHER_H_ diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h index d09e23de..0be809e3 100644 --- a/test/test/test_cryptodev_des_test_vectors.h +++ b/test/test/test_cryptodev_des_test_vectors.h @@ -1,33 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2016 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016 Intel Corporation */ #ifndef TEST_CRYPTODEV_DES_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h index 3b840ce6..93dacb7b 100644 --- a/test/test/test_cryptodev_hash_test_vectors.h +++ b/test/test/test_cryptodev_hash_test_vectors.h @@ -1,33 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ @@ -406,6 +378,14 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { + .test_descr = "HMAC-SHA1 Digest Scatter Gather", + .test_data = &hmac_sha1_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC + }, + { .test_descr = "HMAC-SHA1 Digest Verify", .test_data = &hmac_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, @@ -417,6 +397,14 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { + .test_descr = "HMAC-SHA1 Digest Verify Scatter Gather", + .test_data = &hmac_sha1_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC + }, + { .test_descr = "SHA224 Digest", .test_data = &sha224_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, diff --git a/test/test/test_cryptodev_hmac_test_vectors.h b/test/test/test_cryptodev_hmac_test_vectors.h index d30215fd..77153a5c 100644 --- a/test/test/test_cryptodev_hmac_test_vectors.h +++ b/test/test/test_cryptodev_hmac_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016 Intel Corporation */ #ifndef APP_TEST_TEST_CRYPTODEV_HMAC_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_kasumi_hash_test_vectors.h b/test/test/test_cryptodev_kasumi_hash_test_vectors.h index a6dd4f5c..5033d183 100644 --- a/test/test/test_cryptodev_kasumi_hash_test_vectors.h +++ b/test/test/test_cryptodev_kasumi_hash_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_KASUMI_HASH_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_kasumi_test_vectors.h b/test/test/test_cryptodev_kasumi_test_vectors.h index 0d042d0b..58a696a3 100644 --- a/test/test/test_cryptodev_kasumi_test_vectors.h +++ b/test/test/test_cryptodev_kasumi_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_KASUMI_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_snow3g_hash_test_vectors.h b/test/test/test_cryptodev_snow3g_hash_test_vectors.h index 0bb274d1..e9fb2147 100644 --- a/test/test/test_cryptodev_snow3g_hash_test_vectors.h +++ b/test/test/test_cryptodev_snow3g_hash_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_SNOW3G_HASH_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_snow3g_test_vectors.h b/test/test/test_cryptodev_snow3g_test_vectors.h index fed50dc2..cb9dc4b3 100644 --- a/test/test/test_cryptodev_snow3g_test_vectors.h +++ b/test/test/test_cryptodev_snow3g_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ diff --git a/test/test/test_cryptodev_zuc_test_vectors.h b/test/test/test_cryptodev_zuc_test_vectors.h index a22e1edb..9ff821a1 100644 --- a/test/test/test_cryptodev_zuc_test_vectors.h +++ b/test/test/test_cryptodev_zuc_test_vectors.h @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_ZUC_TEST_VECTORS_H_ diff --git a/test/test/test_cycles.c b/test/test/test_cycles.c index f1897979..149f60b0 100644 --- a/test/test/test_cycles.c +++ b/test/test/test_cycles.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_debug.c b/test/test/test_debug.c index 0a3b2c46..faf2cf55 100644 --- a/test/test/test_debug.c +++ b/test/test/test_debug.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -39,6 +10,7 @@ #include <rte_debug.h> #include <rte_common.h> #include <rte_eal.h> +#include <rte_service_component.h> #include "test.h" @@ -79,6 +51,11 @@ test_exit_val(int exit_val) int pid; int status; + /* manually cleanup EAL memory, as the fork() below would otherwise + * cause the same hugepages to be free()-ed multiple times. + */ + rte_service_finalize(); + pid = fork(); if (pid == 0) diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c index 18f54edc..b8f3146f 100644 --- a/test/test/test_devargs.c +++ b/test/test/test_devargs.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright 2014 6WIND S.A. - * - * 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 6WIND S.A 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2014 6WIND S.A. */ #include <stdio.h> diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c index 9fae688b..98919ec0 100644 --- a/test/test/test_distributor.c +++ b/test/test/test_distributor.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2017 Intel Corporation */ #include "test.h" diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c index 7d69887b..557715e1 100644 --- a/test/test/test_distributor_perf.c +++ b/test/test/test_distributor_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2017 Intel Corporation */ #include "test.h" diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c index 310109e6..37c42efe 100644 --- a/test/test/test_eal_flags.c +++ b/test/test/test_eal_flags.c @@ -1,36 +1,8 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * Copyright(c) 2014 6WIND S.A. - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation. + * Copyright(c) 2014 6WIND S.A. */ + #include <stdio.h> #include "test.h" diff --git a/test/test/test_eal_fs.c b/test/test/test_eal_fs.c index 78978120..7ca21641 100644 --- a/test/test/test_eal_fs.c +++ b/test/test/test_eal_fs.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include "test.h" diff --git a/test/test/test_efd.c b/test/test/test_efd.c index 54430616..ced091aa 100644 --- a/test/test/test_efd.c +++ b/test/test/test_efd.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #include <rte_memcpy.h> diff --git a/test/test/test_efd_perf.c b/test/test/test_efd_perf.c index 2b8a8eac..1dcb992c 100644 --- a/test/test/test_efd_perf.c +++ b/test/test/test_efd_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_errno.c b/test/test/test_errno.c index 388decbb..920a2cf8 100644 --- a/test/test/test_errno.c +++ b/test/test/test_errno.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdint.h> diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c index 90a5c646..006ed314 100644 --- a/test/test/test_event_eth_rx_adapter.c +++ b/test/test/test_event_eth_rx_adapter.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include <string.h> #include <rte_common.h> diff --git a/test/test/test_event_ring.c b/test/test/test_event_ring.c index c158c9b0..70eb9845 100644 --- a/test/test/test_event_ring.c +++ b/test/test/test_event_ring.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2017 Intel Corporation */ #include <string.h> diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index ba39cbac..04bdc6b6 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016 Cavium, Inc. 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 Cavium, Inc 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016 Cavium, Inc */ #include <rte_common.h> @@ -581,6 +553,15 @@ test_eventdev_port_setup(void) ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); + if (!(info.event_dev_cap & + RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE)) { + pconf.enqueue_depth = info.max_event_port_enqueue_depth; + pconf.disable_implicit_release = 1; + ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); + TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); + pconf.disable_implicit_release = 0; + } + ret = rte_event_port_setup(TEST_DEV_ID, info.max_event_ports, &pconf); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); @@ -839,6 +820,9 @@ test_eventdev_unlink(void) for (i = 0; i < nb_queues; i++) queues[i] = i; + ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0); + TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d", + TEST_DEV_ID); ret = rte_event_port_unlink(TEST_DEV_ID, 0, queues, nb_queues); TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d", @@ -899,9 +883,9 @@ test_eventdev_link_get(void) ret = rte_event_port_links_get(TEST_DEV_ID, 0, queues, priorities); TEST_ASSERT(ret == 1, "(%d)Wrong link get ret=%d expected=%d", TEST_DEV_ID, ret, 1); - /* unlink all*/ + /* unlink the queue */ ret = rte_event_port_unlink(TEST_DEV_ID, 0, NULL, 0); - TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d", + TEST_ASSERT(ret == 1, "Failed to unlink(device%d) ret=%d", TEST_DEV_ID, ret); /* 4links and 2 unlinks */ @@ -1006,4 +990,26 @@ test_eventdev_common(void) return unit_test_suite_runner(&eventdev_common_testsuite); } +static int +test_eventdev_selftest_impl(const char *pmd, const char *opts) +{ + rte_vdev_init(pmd, opts); + return rte_event_dev_selftest(rte_event_dev_get_dev_id(pmd)); +} + +static int +test_eventdev_selftest_sw(void) +{ + return test_eventdev_selftest_impl("event_sw", ""); +} + +static int +test_eventdev_selftest_octeontx(void) +{ + return test_eventdev_selftest_impl("event_octeontx", ""); +} + REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); +REGISTER_TEST_COMMAND(eventdev_selftest_sw, test_eventdev_selftest_sw); +REGISTER_TEST_COMMAND(eventdev_selftest_octeontx, + test_eventdev_selftest_octeontx); diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c deleted file mode 100644 index dbc36d94..00000000 --- a/test/test/test_eventdev_octeontx.c +++ /dev/null @@ -1,1474 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. - */ - -#include <rte_atomic.h> -#include <rte_common.h> -#include <rte_cycles.h> -#include <rte_debug.h> -#include <rte_eal.h> -#include <rte_ethdev.h> -#include <rte_eventdev.h> -#include <rte_hexdump.h> -#include <rte_mbuf.h> -#include <rte_malloc.h> -#include <rte_memcpy.h> -#include <rte_launch.h> -#include <rte_lcore.h> -#include <rte_per_lcore.h> -#include <rte_random.h> -#include <rte_bus_vdev.h> - -#include "test.h" - -#define NUM_PACKETS (1 << 18) -#define MAX_EVENTS (16 * 1024) - -static int evdev; -static struct rte_mempool *eventdev_test_mempool; - -struct event_attr { - uint32_t flow_id; - uint8_t event_type; - uint8_t sub_event_type; - uint8_t sched_type; - uint8_t queue; - uint8_t port; -}; - -static uint32_t seqn_list_index; -static int seqn_list[NUM_PACKETS]; - -static inline void -seqn_list_init(void) -{ - RTE_BUILD_BUG_ON(NUM_PACKETS < MAX_EVENTS); - memset(seqn_list, 0, sizeof(seqn_list)); - seqn_list_index = 0; -} - -static inline int -seqn_list_update(int val) -{ - if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; - - seqn_list[seqn_list_index++] = val; - rte_smp_wmb(); - return TEST_SUCCESS; -} - -static inline int -seqn_list_check(int limit) -{ - int i; - - for (i = 0; i < limit; i++) { - if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; - } - } - return TEST_SUCCESS; -} - -struct test_core_param { - rte_atomic32_t *total_events; - uint64_t dequeue_tmo_ticks; - uint8_t port; - uint8_t sched_type; -}; - -static int -testsuite_setup(void) -{ - const char *eventdev_name = "event_octeontx"; - - evdev = rte_event_dev_get_dev_id(eventdev_name); - if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", - __LINE__, eventdev_name); - if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; - } - evdev = rte_event_dev_get_dev_id(eventdev_name); - if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; - } - } - - return TEST_SUCCESS; -} - -static void -testsuite_teardown(void) -{ - rte_event_dev_close(evdev); -} - -static inline void -devconf_set_default_sane_values(struct rte_event_dev_config *dev_conf, - struct rte_event_dev_info *info) -{ - memset(dev_conf, 0, sizeof(struct rte_event_dev_config)); - dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns; - dev_conf->nb_event_ports = info->max_event_ports; - dev_conf->nb_event_queues = info->max_event_queues; - dev_conf->nb_event_queue_flows = info->max_event_queue_flows; - dev_conf->nb_event_port_dequeue_depth = - info->max_event_port_dequeue_depth; - dev_conf->nb_event_port_enqueue_depth = - info->max_event_port_enqueue_depth; - dev_conf->nb_event_port_enqueue_depth = - info->max_event_port_enqueue_depth; - dev_conf->nb_events_limit = - info->max_num_events; -} - -enum { - TEST_EVENTDEV_SETUP_DEFAULT, - TEST_EVENTDEV_SETUP_PRIORITY, - TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT, -}; - -static inline int -_eventdev_setup(int mode) -{ - int i, ret; - struct rte_event_dev_config dev_conf; - struct rte_event_dev_info info; - const char *pool_name = "evdev_octeontx_test_pool"; - - /* Create and destrory pool for each test case to make it standalone */ - eventdev_test_mempool = rte_pktmbuf_pool_create(pool_name, - MAX_EVENTS, - 0 /*MBUF_CACHE_SIZE*/, - 0, - 512, /* Use very small mbufs */ - rte_socket_id()); - if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; - } - - ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); - - devconf_set_default_sane_values(&dev_conf, &info); - if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) - dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; - - ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); - - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - - if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { - if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); - return -ENOTSUP; - } - - /* Configure event queues(0 to n) with - * RTE_EVENT_DEV_PRIORITY_HIGHEST to - * RTE_EVENT_DEV_PRIORITY_LOWEST - */ - uint8_t step = (RTE_EVENT_DEV_PRIORITY_LOWEST + 1) / - queue_count; - for (i = 0; i < (int)queue_count; i++) { - struct rte_event_queue_conf queue_conf; - - ret = rte_event_queue_default_conf_get(evdev, i, - &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); - queue_conf.priority = i * step; - ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); - } - - } else { - /* Configure event queues with default priority */ - for (i = 0; i < (int)queue_count; i++) { - ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); - } - } - /* Configure event ports */ - uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &port_count), "Port count get failed"); - for (i = 0; i < (int)port_count; i++) { - ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); - ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); - } - - ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); - - return TEST_SUCCESS; -} - -static inline int -eventdev_setup(void) -{ - return _eventdev_setup(TEST_EVENTDEV_SETUP_DEFAULT); -} - -static inline int -eventdev_setup_priority(void) -{ - return _eventdev_setup(TEST_EVENTDEV_SETUP_PRIORITY); -} - -static inline int -eventdev_setup_dequeue_timeout(void) -{ - return _eventdev_setup(TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT); -} - -static inline void -eventdev_teardown(void) -{ - rte_event_dev_stop(evdev); - rte_mempool_free(eventdev_test_mempool); -} - -static inline void -update_event_and_validation_attr(struct rte_mbuf *m, struct rte_event *ev, - uint32_t flow_id, uint8_t event_type, - uint8_t sub_event_type, uint8_t sched_type, - uint8_t queue, uint8_t port) -{ - struct event_attr *attr; - - /* Store the event attributes in mbuf for future reference */ - attr = rte_pktmbuf_mtod(m, struct event_attr *); - attr->flow_id = flow_id; - attr->event_type = event_type; - attr->sub_event_type = sub_event_type; - attr->sched_type = sched_type; - attr->queue = queue; - attr->port = port; - - ev->flow_id = flow_id; - ev->sub_event_type = sub_event_type; - ev->event_type = event_type; - /* Inject the new event */ - ev->op = RTE_EVENT_OP_NEW; - ev->sched_type = sched_type; - ev->queue_id = queue; - ev->mbuf = m; -} - -static inline int -inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, - uint8_t sched_type, uint8_t queue, uint8_t port, - unsigned int events) -{ - struct rte_mbuf *m; - unsigned int i; - - for (i = 0; i < events; i++) { - struct rte_event ev = {.event = 0, .u64 = 0}; - - m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - - m->seqn = i; - update_event_and_validation_attr(m, &ev, flow_id, event_type, - sub_event_type, sched_type, queue, port); - rte_event_enqueue_burst(evdev, port, &ev, 1); - } - return 0; -} - -static inline int -check_excess_events(uint8_t port) -{ - int i; - uint16_t valid_event; - struct rte_event ev; - - /* Check for excess events, try for a few times and exit */ - for (i = 0; i < 32; i++) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); - } - return 0; -} - -static inline int -generate_random_events(const unsigned int total_events) -{ - struct rte_event_dev_info info; - unsigned int i; - int ret; - - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - - ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - for (i = 0; i < total_events; i++) { - ret = inject_events( - rte_rand() % info.max_event_queue_flows /*flow_id */, - rte_rand() % (RTE_EVENT_TYPE_CPU + 1) /* event_type */, - rte_rand() % 256 /* sub_event_type */, - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1), - rte_rand() % queue_count /* queue */, - 0 /* port */, - 1 /* events */); - if (ret) - return TEST_FAILED; - } - return ret; -} - - -static inline int -validate_event(struct rte_event *ev) -{ - struct event_attr *attr; - - attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, - "flow_id mismatch enq=%d deq =%d", - attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, - "event_type mismatch enq=%d deq =%d", - attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, - "sub_event_type mismatch enq=%d deq =%d", - attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, - "sched_type mismatch enq=%d deq =%d", - attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, - "queue mismatch enq=%d deq =%d", - attr->queue, ev->queue_id); - return 0; -} - -typedef int (*validate_event_cb)(uint32_t index, uint8_t port, - struct rte_event *ev); - -static inline int -consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) -{ - int ret; - uint16_t valid_event; - uint32_t events = 0, forward_progress_cnt = 0, index = 0; - struct rte_event ev; - - while (1) { - if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; - } - - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - if (!valid_event) - continue; - - forward_progress_cnt = 0; - ret = validate_event(&ev); - if (ret) - return TEST_FAILED; - - if (fn != NULL) { - ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, - "Failed to validate test specific event"); - } - - ++index; - - rte_pktmbuf_free(ev.mbuf); - if (++events >= total_events) - break; - } - - return check_excess_events(port); -} - -static int -validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) -{ - RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, - ev->mbuf->seqn); - return 0; -} - -static inline int -test_simple_enqdeq(uint8_t sched_type) -{ - int ret; - - ret = inject_events(0 /*flow_id */, - RTE_EVENT_TYPE_CPU /* event_type */, - 0 /* sub_event_type */, - sched_type, - 0 /* queue */, - 0 /* port */, - MAX_EVENTS); - if (ret) - return TEST_FAILED; - - return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); -} - -static int -test_simple_enqdeq_ordered(void) -{ - return test_simple_enqdeq(RTE_SCHED_TYPE_ORDERED); -} - -static int -test_simple_enqdeq_atomic(void) -{ - return test_simple_enqdeq(RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_simple_enqdeq_parallel(void) -{ - return test_simple_enqdeq(RTE_SCHED_TYPE_PARALLEL); -} - -/* - * Generate a prescribed number of events and spread them across available - * queues. On dequeue, using single event port(port 0) verify the enqueued - * event attributes - */ -static int -test_multi_queue_enq_single_port_deq(void) -{ - int ret; - - ret = generate_random_events(MAX_EVENTS); - if (ret) - return TEST_FAILED; - - return consume_events(0 /* port */, MAX_EVENTS, NULL); -} - -/* - * Inject 0..MAX_EVENTS events over 0..queue_count with modulus - * operation - * - * For example, Inject 32 events over 0..7 queues - * enqueue events 0, 8, 16, 24 in queue 0 - * enqueue events 1, 9, 17, 25 in queue 1 - * .. - * .. - * enqueue events 7, 15, 23, 31 in queue 7 - * - * On dequeue, Validate the events comes in 0,8,16,24,1,9,17,25..,7,15,23,31 - * order from queue0(highest priority) to queue7(lowest_priority) - */ -static int -validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) -{ - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - uint32_t range = MAX_EVENTS / queue_count; - uint32_t expected_val = (index % range) * queue_count; - - expected_val += ev->queue_id; - RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, - "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", - ev->mbuf->seqn, index, expected_val, range, - queue_count, MAX_EVENTS); - return 0; -} - -static int -test_multi_queue_priority(void) -{ - uint8_t queue; - struct rte_mbuf *m; - int i, max_evts_roundoff; - - /* See validate_queue_priority() comments for priority validate logic */ - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - max_evts_roundoff = MAX_EVENTS / queue_count; - max_evts_roundoff *= queue_count; - - for (i = 0; i < max_evts_roundoff; i++) { - struct rte_event ev = {.event = 0, .u64 = 0}; - - m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - - m->seqn = i; - queue = i % queue_count; - update_event_and_validation_attr(m, &ev, 0, RTE_EVENT_TYPE_CPU, - 0, RTE_SCHED_TYPE_PARALLEL, queue, 0); - rte_event_enqueue_burst(evdev, 0, &ev, 1); - } - - return consume_events(0, max_evts_roundoff, validate_queue_priority); -} - -static int -worker_multi_port_fn(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - rte_atomic32_t *total_events = param->total_events; - int ret; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - if (!valid_event) - continue; - - ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } - return 0; -} - -static inline int -wait_workers_to_join(int lcore, const rte_atomic32_t *count) -{ - uint64_t cycles, print_cycles; - - print_cycles = cycles = rte_get_timer_cycles(); - while (rte_eal_get_lcore_state(lcore) != FINISHED) { - uint64_t new_cycles = rte_get_timer_cycles(); - - if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, - rte_atomic32_read(count)); - print_cycles = new_cycles; - } - if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", - __func__, - rte_atomic32_read(count)); - rte_event_dev_dump(evdev, stdout); - cycles = new_cycles; - return TEST_FAILED; - } - } - rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; -} - - -static inline int -launch_workers_and_wait(int (*master_worker)(void *), - int (*slave_workers)(void *), uint32_t total_events, - uint8_t nb_workers, uint8_t sched_type) -{ - uint8_t port = 0; - int w_lcore; - int ret; - struct test_core_param *param; - rte_atomic32_t atomic_total_events; - uint64_t dequeue_tmo_ticks; - - if (!nb_workers) - return 0; - - rte_atomic32_set(&atomic_total_events, total_events); - seqn_list_init(); - - param = malloc(sizeof(struct test_core_param) * nb_workers); - if (!param) - return TEST_FAILED; - - ret = rte_event_dequeue_timeout_ticks(evdev, - rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); - if (ret) - return TEST_FAILED; - - param[0].total_events = &atomic_total_events; - param[0].sched_type = sched_type; - param[0].port = 0; - param[0].dequeue_tmo_ticks = dequeue_tmo_ticks; - rte_smp_wmb(); - - w_lcore = rte_get_next_lcore( - /* start core */ -1, - /* skip master */ 1, - /* wrap */ 0); - rte_eal_remote_launch(master_worker, ¶m[0], w_lcore); - - for (port = 1; port < nb_workers; port++) { - param[port].total_events = &atomic_total_events; - param[port].sched_type = sched_type; - param[port].port = port; - param[port].dequeue_tmo_ticks = dequeue_tmo_ticks; - rte_smp_wmb(); - w_lcore = rte_get_next_lcore(w_lcore, 1, 0); - rte_eal_remote_launch(slave_workers, ¶m[port], w_lcore); - } - - ret = wait_workers_to_join(w_lcore, &atomic_total_events); - free(param); - return ret; -} - -/* - * Generate a prescribed number of events and spread them across available - * queues. Dequeue the events through multiple ports and verify the enqueued - * event attributes - */ -static int -test_multi_queue_enq_multi_port_deq(void) -{ - const unsigned int total_events = MAX_EVENTS; - uint32_t nr_ports; - int ret; - - ret = generate_random_events(total_events); - if (ret) - return TEST_FAILED; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - - if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, - nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; - } - - return launch_workers_and_wait(worker_multi_port_fn, - worker_multi_port_fn, total_events, - nr_ports, 0xff /* invalid */); -} - -static int -validate_queue_to_port_single_link(uint32_t index, uint8_t port, - struct rte_event *ev) -{ - RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, - "queue mismatch enq=%d deq =%d", - port, ev->queue_id); - return 0; -} - -/* - * Link queue x to port x and check correctness of link by checking - * queue_id == x on dequeue on the specific port x - */ -static int -test_queue_to_port_single_link(void) -{ - int i, nr_links, ret; - - uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &port_count), "Port count get failed"); - - /* Unlink all connections that created in eventdev_setup */ - for (i = 0; i < (int)port_count; i++) { - ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); - } - - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - - nr_links = RTE_MIN(port_count, queue_count); - const unsigned int total_events = MAX_EVENTS / nr_links; - - /* Link queue x to port x and inject events to queue x through port x */ - for (i = 0; i < nr_links; i++) { - uint8_t queue = (uint8_t)i; - - ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); - - ret = inject_events( - 0x100 /*flow_id */, - rte_rand() % (RTE_EVENT_TYPE_CPU + 1) /* event_type */, - rte_rand() % 256 /* sub_event_type */, - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1), - queue /* queue */, - i /* port */, - total_events /* events */); - if (ret) - return TEST_FAILED; - } - - /* Verify the events generated from correct queue */ - for (i = 0; i < nr_links; i++) { - ret = consume_events(i /* port */, total_events, - validate_queue_to_port_single_link); - if (ret) - return TEST_FAILED; - } - - return TEST_SUCCESS; -} - -static int -validate_queue_to_port_multi_link(uint32_t index, uint8_t port, - struct rte_event *ev) -{ - RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), - "queue mismatch enq=%d deq =%d", - port, ev->queue_id); - return 0; -} - -/* - * Link all even number of queues to port 0 and all odd number of queues to - * port 1 and verify the link connection on dequeue - */ -static int -test_queue_to_port_multi_link(void) -{ - int ret, port0_events = 0, port1_events = 0; - uint8_t queue, port; - uint32_t nr_queues = 0; - uint32_t nr_ports = 0; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &nr_queues), "Queue count get failed"); - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - - if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", - __func__, nr_ports); - return TEST_SUCCESS; - } - - /* Unlink all connections that created in eventdev_setup */ - for (port = 0; port < nr_ports; port++) { - ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", - port); - } - - const unsigned int total_events = MAX_EVENTS / nr_queues; - - /* Link all even number of queues to port0 and odd numbers to port 1*/ - for (queue = 0; queue < nr_queues; queue++) { - port = queue & 0x1; - ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", - queue, port); - - ret = inject_events( - 0x100 /*flow_id */, - rte_rand() % (RTE_EVENT_TYPE_CPU + 1) /* event_type */, - rte_rand() % 256 /* sub_event_type */, - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1), - queue /* queue */, - port /* port */, - total_events /* events */); - if (ret) - return TEST_FAILED; - - if (port == 0) - port0_events += total_events; - else - port1_events += total_events; - } - - ret = consume_events(0 /* port */, port0_events, - validate_queue_to_port_multi_link); - if (ret) - return TEST_FAILED; - ret = consume_events(1 /* port */, port1_events, - validate_queue_to_port_multi_link); - if (ret) - return TEST_FAILED; - - return TEST_SUCCESS; -} - -static int -worker_flow_based_pipeline(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - uint8_t new_sched_type = param->sched_type; - rte_atomic32_t *total_events = param->total_events; - uint64_t dequeue_tmo_ticks = param->dequeue_tmo_ticks; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, - dequeue_tmo_ticks); - if (!valid_event) - continue; - - /* Events from stage 0 */ - if (ev.sub_event_type == 0) { - /* Move to atomic flow to maintain the ordering */ - ev.flow_id = 0x2; - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.sub_event_type = 1; /* stage 1 */ - ev.sched_type = new_sched_type; - ev.op = RTE_EVENT_OP_FORWARD; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; - } - } else { - printf("Invalid ev.sub_event_type = %d\n", - ev.sub_event_type); - return TEST_FAILED; - } - } - return 0; -} - -static int -test_multiport_flow_sched_type_test(uint8_t in_sched_type, - uint8_t out_sched_type) -{ - const unsigned int total_events = MAX_EVENTS; - uint32_t nr_ports; - int ret; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - - if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, - nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; - } - - /* Injects events with m->seqn=0 to total_events */ - ret = inject_events( - 0x1 /*flow_id */, - RTE_EVENT_TYPE_CPU /* event_type */, - 0 /* sub_event_type (stage 0) */, - in_sched_type, - 0 /* queue */, - 0 /* port */, - total_events /* events */); - if (ret) - return TEST_FAILED; - - ret = launch_workers_and_wait(worker_flow_based_pipeline, - worker_flow_based_pipeline, - total_events, nr_ports, out_sched_type); - if (ret) - return TEST_FAILED; - - if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && - out_sched_type == RTE_SCHED_TYPE_ATOMIC) { - /* Check the events order maintained or not */ - return seqn_list_check(total_events); - } - return TEST_SUCCESS; -} - - -/* Multi port ordered to atomic transaction */ -static int -test_multi_port_flow_ordered_to_atomic(void) -{ - /* Ingress event order test */ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_flow_ordered_to_ordered(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_flow_ordered_to_parallel(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -test_multi_port_flow_atomic_to_atomic(void) -{ - /* Ingress event order test */ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_flow_atomic_to_ordered(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_flow_atomic_to_parallel(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -test_multi_port_flow_parallel_to_atomic(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_flow_parallel_to_ordered(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_flow_parallel_to_parallel(void) -{ - return test_multiport_flow_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -worker_group_based_pipeline(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - uint8_t new_sched_type = param->sched_type; - rte_atomic32_t *total_events = param->total_events; - uint64_t dequeue_tmo_ticks = param->dequeue_tmo_ticks; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, - dequeue_tmo_ticks); - if (!valid_event) - continue; - - /* Events from stage 0(group 0) */ - if (ev.queue_id == 0) { - /* Move to atomic flow to maintain the ordering */ - ev.flow_id = 0x2; - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.sched_type = new_sched_type; - ev.queue_id = 1; /* Stage 1*/ - ev.op = RTE_EVENT_OP_FORWARD; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; - } - } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; - } - } - - - return 0; -} - -static int -test_multiport_queue_sched_type_test(uint8_t in_sched_type, - uint8_t out_sched_type) -{ - const unsigned int total_events = MAX_EVENTS; - uint32_t nr_ports; - int ret; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - - nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", - __func__, queue_count, nr_ports, - rte_lcore_count() - 1); - return TEST_SUCCESS; - } - - /* Injects events with m->seqn=0 to total_events */ - ret = inject_events( - 0x1 /*flow_id */, - RTE_EVENT_TYPE_CPU /* event_type */, - 0 /* sub_event_type (stage 0) */, - in_sched_type, - 0 /* queue */, - 0 /* port */, - total_events /* events */); - if (ret) - return TEST_FAILED; - - ret = launch_workers_and_wait(worker_group_based_pipeline, - worker_group_based_pipeline, - total_events, nr_ports, out_sched_type); - if (ret) - return TEST_FAILED; - - if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && - out_sched_type == RTE_SCHED_TYPE_ATOMIC) { - /* Check the events order maintained or not */ - return seqn_list_check(total_events); - } - return TEST_SUCCESS; -} - -static int -test_multi_port_queue_ordered_to_atomic(void) -{ - /* Ingress event order test */ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_queue_ordered_to_ordered(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_queue_ordered_to_parallel(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ORDERED, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -test_multi_port_queue_atomic_to_atomic(void) -{ - /* Ingress event order test */ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_queue_atomic_to_ordered(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_queue_atomic_to_parallel(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_ATOMIC, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -test_multi_port_queue_parallel_to_atomic(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_ATOMIC); -} - -static int -test_multi_port_queue_parallel_to_ordered(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_ORDERED); -} - -static int -test_multi_port_queue_parallel_to_parallel(void) -{ - return test_multiport_queue_sched_type_test(RTE_SCHED_TYPE_PARALLEL, - RTE_SCHED_TYPE_PARALLEL); -} - -static int -worker_flow_based_pipeline_max_stages_rand_sched_type(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - rte_atomic32_t *total_events = param->total_events; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - if (!valid_event) - continue; - - if (ev.sub_event_type == 255) { /* last stage */ - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } else { - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.sub_event_type++; - ev.sched_type = - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1); - ev.op = RTE_EVENT_OP_FORWARD; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } - } - return 0; -} - -static int -launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) -{ - uint32_t nr_ports; - int ret; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - - if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, - nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; - } - - /* Injects events with m->seqn=0 to total_events */ - ret = inject_events( - 0x1 /*flow_id */, - RTE_EVENT_TYPE_CPU /* event_type */, - 0 /* sub_event_type (stage 0) */, - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1) /* sched_type */, - 0 /* queue */, - 0 /* port */, - MAX_EVENTS /* events */); - if (ret) - return TEST_FAILED; - - return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, - 0xff /* invalid */); -} - -/* Flow based pipeline with maximum stages with random sched type */ -static int -test_multi_port_flow_max_stages_random_sched_type(void) -{ - return launch_multi_port_max_stages_random_sched_type( - worker_flow_based_pipeline_max_stages_rand_sched_type); -} - -static int -worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - uint8_t nr_queues = queue_count; - rte_atomic32_t *total_events = param->total_events; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - if (!valid_event) - continue; - - if (ev.queue_id == nr_queues - 1) { /* last stage */ - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } else { - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.queue_id++; - ev.sched_type = - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1); - ev.op = RTE_EVENT_OP_FORWARD; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } - } - return 0; -} - -/* Queue based pipeline with maximum stages with random sched type */ -static int -test_multi_port_queue_max_stages_random_sched_type(void) -{ - return launch_multi_port_max_stages_random_sched_type( - worker_queue_based_pipeline_max_stages_rand_sched_type); -} - -static int -worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) -{ - struct test_core_param *param = arg; - struct rte_event ev; - uint16_t valid_event; - uint8_t port = param->port; - uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_QUEUE_COUNT, - &queue_count), "Queue count get failed"); - uint8_t nr_queues = queue_count; - rte_atomic32_t *total_events = param->total_events; - - while (rte_atomic32_read(total_events) > 0) { - valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - if (!valid_event) - continue; - - if (ev.queue_id == nr_queues - 1) { /* Last stage */ - rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); - } else { - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.queue_id++; - ev.sub_event_type = rte_rand() % 256; - ev.sched_type = - rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1); - ev.op = RTE_EVENT_OP_FORWARD; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } - } - return 0; -} - -/* Queue and flow based pipeline with maximum stages with random sched type */ -static int -test_multi_port_mixed_max_stages_random_sched_type(void) -{ - return launch_multi_port_max_stages_random_sched_type( - worker_mixed_pipeline_max_stages_rand_sched_type); -} - -static int -worker_ordered_flow_producer(void *arg) -{ - struct test_core_param *param = arg; - uint8_t port = param->port; - struct rte_mbuf *m; - int counter = 0; - - while (counter < NUM_PACKETS) { - m = rte_pktmbuf_alloc(eventdev_test_mempool); - if (m == NULL) - continue; - - m->seqn = counter++; - - struct rte_event ev = {.event = 0, .u64 = 0}; - - ev.flow_id = 0x1; /* Generate a fat flow */ - ev.sub_event_type = 0; - /* Inject the new event */ - ev.op = RTE_EVENT_OP_NEW; - ev.event_type = RTE_EVENT_TYPE_CPU; - ev.sched_type = RTE_SCHED_TYPE_ORDERED; - ev.queue_id = 0; - ev.mbuf = m; - rte_event_enqueue_burst(evdev, port, &ev, 1); - } - - return 0; -} - -static inline int -test_producer_consumer_ingress_order_test(int (*fn)(void *)) -{ - uint32_t nr_ports; - - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, - RTE_EVENT_DEV_ATTR_PORT_COUNT, - &nr_ports), "Port count get failed"); - nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - - if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; - } - - launch_workers_and_wait(worker_ordered_flow_producer, fn, - NUM_PACKETS, nr_ports, RTE_SCHED_TYPE_ATOMIC); - /* Check the events order maintained or not */ - return seqn_list_check(NUM_PACKETS); -} - -/* Flow based producer consumer ingress order test */ -static int -test_flow_producer_consumer_ingress_order_test(void) -{ - return test_producer_consumer_ingress_order_test( - worker_flow_based_pipeline); -} - -/* Queue based producer consumer ingress order test */ -static int -test_queue_producer_consumer_ingress_order_test(void) -{ - return test_producer_consumer_ingress_order_test( - worker_group_based_pipeline); -} - -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static int -test_eventdev_octeontx(void) -{ - return unit_test_suite_runner(&eventdev_octeontx_testsuite); -} - -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c deleted file mode 100644 index f524b6f8..00000000 --- a/test/test/test_eventdev_sw.c +++ /dev/null @@ -1,3261 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 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. - */ - -#include <stdio.h> -#include <string.h> -#include <stdint.h> -#include <errno.h> -#include <unistd.h> -#include <sys/queue.h> - -#include <rte_memory.h> -#include <rte_launch.h> -#include <rte_eal.h> -#include <rte_per_lcore.h> -#include <rte_lcore.h> -#include <rte_debug.h> -#include <rte_ethdev.h> -#include <rte_cycles.h> -#include <rte_eventdev.h> -#include <rte_pause.h> -#include <rte_service.h> -#include <rte_service_component.h> -#include <rte_bus_vdev.h> - -#include "test.h" - -#define MAX_PORTS 16 -#define MAX_QIDS 16 -#define NUM_PACKETS (1<<18) - -static int evdev; - -struct test { - struct rte_mempool *mbuf_pool; - uint8_t port[MAX_PORTS]; - uint8_t qid[MAX_QIDS]; - int nb_qids; - uint32_t service_id; -}; - -static struct rte_event release_ev; - -static inline struct rte_mbuf * -rte_gen_arp(int portid, struct rte_mempool *mp) -{ - /* - * len = 14 + 46 - * ARP, Request who-has 10.0.0.1 tell 10.0.0.2, length 46 - */ - static const uint8_t arp_request[] = { - /*0x0000:*/ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xec, 0xa8, - 0x6b, 0xfd, 0x02, 0x29, 0x08, 0x06, 0x00, 0x01, - /*0x0010:*/ 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0xec, 0xa8, - 0x6b, 0xfd, 0x02, 0x29, 0x0a, 0x00, 0x00, 0x01, - /*0x0020:*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /*0x0030:*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - struct rte_mbuf *m; - int pkt_len = sizeof(arp_request) - 1; - - m = rte_pktmbuf_alloc(mp); - if (!m) - return 0; - - memcpy((void *)((uintptr_t)m->buf_addr + m->data_off), - arp_request, pkt_len); - rte_pktmbuf_pkt_len(m) = pkt_len; - rte_pktmbuf_data_len(m) = pkt_len; - - RTE_SET_USED(portid); - - return m; -} - -static void -xstats_print(void) -{ - const uint32_t XSTATS_MAX = 1024; - uint32_t i; - uint32_t ids[XSTATS_MAX]; - uint64_t values[XSTATS_MAX]; - struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX]; - - for (i = 0; i < XSTATS_MAX; i++) - ids[i] = i; - - /* Device names / values */ - int ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, 0, - xstats_names, ids, XSTATS_MAX); - if (ret < 0) { - printf("%d: xstats names get() returned error\n", - __LINE__); - return; - } - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, ids, values, ret); - if (ret > (signed int)XSTATS_MAX) - printf("%s %d: more xstats available than space\n", - __func__, __LINE__); - for (i = 0; (signed int)i < ret; i++) { - printf("%d : %s : %"PRIu64"\n", - i, xstats_names[i].name, values[i]); - } - - /* Port names / values */ - ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, 0, - xstats_names, ids, XSTATS_MAX); - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, 1, - ids, values, ret); - if (ret > (signed int)XSTATS_MAX) - printf("%s %d: more xstats available than space\n", - __func__, __LINE__); - for (i = 0; (signed int)i < ret; i++) { - printf("%d : %s : %"PRIu64"\n", - i, xstats_names[i].name, values[i]); - } - - /* Queue names / values */ - ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, 0, - xstats_names, ids, XSTATS_MAX); - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - 1, ids, values, ret); - if (ret > (signed int)XSTATS_MAX) - printf("%s %d: more xstats available than space\n", - __func__, __LINE__); - for (i = 0; (signed int)i < ret; i++) { - printf("%d : %s : %"PRIu64"\n", - i, xstats_names[i].name, values[i]); - } -} - -/* initialization and config */ -static inline int -init(struct test *t, int nb_queues, int nb_ports) -{ - struct rte_event_dev_config config = { - .nb_event_queues = nb_queues, - .nb_event_ports = nb_ports, - .nb_event_queue_flows = 1024, - .nb_events_limit = 4096, - .nb_event_port_dequeue_depth = 128, - .nb_event_port_enqueue_depth = 128, - }; - int ret; - - void *temp = t->mbuf_pool; /* save and restore mbuf pool */ - - memset(t, 0, sizeof(*t)); - t->mbuf_pool = temp; - - ret = rte_event_dev_configure(evdev, &config); - if (ret < 0) - printf("%d: Error configuring device\n", __LINE__); - return ret; -}; - -static inline int -create_ports(struct test *t, int num_ports) -{ - int i; - static const struct rte_event_port_conf conf = { - .new_event_threshold = 1024, - .dequeue_depth = 32, - .enqueue_depth = 64, - }; - if (num_ports > MAX_PORTS) - return -1; - - for (i = 0; i < num_ports; i++) { - if (rte_event_port_setup(evdev, i, &conf) < 0) { - printf("Error setting up port %d\n", i); - return -1; - } - t->port[i] = i; - } - - return 0; -} - -static inline int -create_lb_qids(struct test *t, int num_qids, uint32_t flags) -{ - int i; - - /* Q creation */ - const struct rte_event_queue_conf conf = { - .schedule_type = flags, - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, - }; - - for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) { - if (rte_event_queue_setup(evdev, i, &conf) < 0) { - printf("%d: error creating qid %d\n", __LINE__, i); - return -1; - } - t->qid[i] = i; - } - t->nb_qids += num_qids; - if (t->nb_qids > MAX_QIDS) - return -1; - - return 0; -} - -static inline int -create_atomic_qids(struct test *t, int num_qids) -{ - return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ATOMIC); -} - -static inline int -create_ordered_qids(struct test *t, int num_qids) -{ - return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ORDERED); -} - - -static inline int -create_unordered_qids(struct test *t, int num_qids) -{ - return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_PARALLEL); -} - -static inline int -create_directed_qids(struct test *t, int num_qids, const uint8_t ports[]) -{ - int i; - - /* Q creation */ - static const struct rte_event_queue_conf conf = { - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK, - }; - - for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) { - if (rte_event_queue_setup(evdev, i, &conf) < 0) { - printf("%d: error creating qid %d\n", __LINE__, i); - return -1; - } - t->qid[i] = i; - - if (rte_event_port_link(evdev, ports[i - t->nb_qids], - &t->qid[i], NULL, 1) != 1) { - printf("%d: error creating link for qid %d\n", - __LINE__, i); - return -1; - } - } - t->nb_qids += num_qids; - if (t->nb_qids > MAX_QIDS) - return -1; - - return 0; -} - -/* destruction */ -static inline int -cleanup(struct test *t __rte_unused) -{ - rte_event_dev_stop(evdev); - rte_event_dev_close(evdev); - return 0; -}; - -struct test_event_dev_stats { - uint64_t rx_pkts; /**< Total packets received */ - uint64_t rx_dropped; /**< Total packets dropped (Eg Invalid QID) */ - uint64_t tx_pkts; /**< Total packets transmitted */ - - /** Packets received on this port */ - uint64_t port_rx_pkts[MAX_PORTS]; - /** Packets dropped on this port */ - uint64_t port_rx_dropped[MAX_PORTS]; - /** Packets inflight on this port */ - uint64_t port_inflight[MAX_PORTS]; - /** Packets transmitted on this port */ - uint64_t port_tx_pkts[MAX_PORTS]; - /** Packets received on this qid */ - uint64_t qid_rx_pkts[MAX_QIDS]; - /** Packets dropped on this qid */ - uint64_t qid_rx_dropped[MAX_QIDS]; - /** Packets transmitted on this qid */ - uint64_t qid_tx_pkts[MAX_QIDS]; -}; - -static inline int -test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats) -{ - static uint32_t i; - static uint32_t total_ids[3]; /* rx, tx and drop */ - static uint32_t port_rx_pkts_ids[MAX_PORTS]; - static uint32_t port_rx_dropped_ids[MAX_PORTS]; - static uint32_t port_inflight_ids[MAX_PORTS]; - static uint32_t port_tx_pkts_ids[MAX_PORTS]; - static uint32_t qid_rx_pkts_ids[MAX_QIDS]; - static uint32_t qid_rx_dropped_ids[MAX_QIDS]; - static uint32_t qid_tx_pkts_ids[MAX_QIDS]; - - - stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id, - "dev_rx", &total_ids[0]); - stats->rx_dropped = rte_event_dev_xstats_by_name_get(dev_id, - "dev_drop", &total_ids[1]); - stats->tx_pkts = rte_event_dev_xstats_by_name_get(dev_id, - "dev_tx", &total_ids[2]); - for (i = 0; i < MAX_PORTS; i++) { - char name[32]; - snprintf(name, sizeof(name), "port_%u_rx", i); - stats->port_rx_pkts[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &port_rx_pkts_ids[i]); - snprintf(name, sizeof(name), "port_%u_drop", i); - stats->port_rx_dropped[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &port_rx_dropped_ids[i]); - snprintf(name, sizeof(name), "port_%u_inflight", i); - stats->port_inflight[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &port_inflight_ids[i]); - snprintf(name, sizeof(name), "port_%u_tx", i); - stats->port_tx_pkts[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &port_tx_pkts_ids[i]); - } - for (i = 0; i < MAX_QIDS; i++) { - char name[32]; - snprintf(name, sizeof(name), "qid_%u_rx", i); - stats->qid_rx_pkts[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &qid_rx_pkts_ids[i]); - snprintf(name, sizeof(name), "qid_%u_drop", i); - stats->qid_rx_dropped[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &qid_rx_dropped_ids[i]); - snprintf(name, sizeof(name), "qid_%u_tx", i); - stats->qid_tx_pkts[i] = rte_event_dev_xstats_by_name_get( - dev_id, name, &qid_tx_pkts_ids[i]); - } - - return 0; -} - -/* run_prio_packet_test - * This performs a basic packet priority check on the test instance passed in. - * It is factored out of the main priority tests as the same tests must be - * performed to ensure prioritization of each type of QID. - * - * Requirements: - * - An initialized test structure, including mempool - * - t->port[0] is initialized for both Enq / Deq of packets to the QID - * - t->qid[0] is the QID to be tested - * - if LB QID, the CQ must be mapped to the QID. - */ -static int -run_prio_packet_test(struct test *t) -{ - int err; - const uint32_t MAGIC_SEQN[] = {4711, 1234}; - const uint32_t PRIORITY[] = { - RTE_EVENT_DEV_PRIORITY_NORMAL, - RTE_EVENT_DEV_PRIORITY_HIGHEST - }; - unsigned int i; - for (i = 0; i < RTE_DIM(MAGIC_SEQN); i++) { - /* generate pkt and enqueue */ - struct rte_event ev; - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - arp->seqn = MAGIC_SEQN[i]; - - ev = (struct rte_event){ - .priority = PRIORITY[i], - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0], - .mbuf = arp - }; - err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); - if (err < 0) { - printf("%d: error failed to enqueue\n", __LINE__); - return -1; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - struct test_event_dev_stats stats; - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: error failed to get stats\n", __LINE__); - return -1; - } - - if (stats.port_rx_pkts[t->port[0]] != 2) { - printf("%d: error stats incorrect for directed port\n", - __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - - struct rte_event ev, ev2; - uint32_t deq_pkts; - deq_pkts = rte_event_dequeue_burst(evdev, t->port[0], &ev, 1, 0); - if (deq_pkts != 1) { - printf("%d: error failed to deq\n", __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - if (ev.mbuf->seqn != MAGIC_SEQN[1]) { - printf("%d: first packet out not highest priority\n", - __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - rte_pktmbuf_free(ev.mbuf); - - deq_pkts = rte_event_dequeue_burst(evdev, t->port[0], &ev2, 1, 0); - if (deq_pkts != 1) { - printf("%d: error failed to deq\n", __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - if (ev2.mbuf->seqn != MAGIC_SEQN[0]) { - printf("%d: second packet out not lower priority\n", - __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - rte_pktmbuf_free(ev2.mbuf); - - cleanup(t); - return 0; -} - -static int -test_single_directed_packet(struct test *t) -{ - const int rx_enq = 0; - const int wrk_enq = 2; - int err; - - /* Create instance with 3 directed QIDs going to 3 ports */ - if (init(t, 3, 3) < 0 || - create_ports(t, 3) < 0 || - create_directed_qids(t, 3, t->port) < 0) - return -1; - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /************** FORWARD ****************/ - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = wrk_enq, - .mbuf = arp, - }; - - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - - const uint32_t MAGIC_SEQN = 4711; - arp->seqn = MAGIC_SEQN; - - /* generate pkt and enqueue */ - err = rte_event_enqueue_burst(evdev, rx_enq, &ev, 1); - if (err < 0) { - printf("%d: error failed to enqueue\n", __LINE__); - return -1; - } - - /* Run schedule() as dir packets may need to be re-ordered */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - struct test_event_dev_stats stats; - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: error failed to get stats\n", __LINE__); - return -1; - } - - if (stats.port_rx_pkts[rx_enq] != 1) { - printf("%d: error stats incorrect for directed port\n", - __LINE__); - return -1; - } - - uint32_t deq_pkts; - deq_pkts = rte_event_dequeue_burst(evdev, wrk_enq, &ev, 1, 0); - if (deq_pkts != 1) { - printf("%d: error failed to deq\n", __LINE__); - return -1; - } - - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_rx_pkts[wrk_enq] != 0 && - stats.port_rx_pkts[wrk_enq] != 1) { - printf("%d: error directed stats post-dequeue\n", __LINE__); - return -1; - } - - if (ev.mbuf->seqn != MAGIC_SEQN) { - printf("%d: error magic sequence number not dequeued\n", - __LINE__); - return -1; - } - - rte_pktmbuf_free(ev.mbuf); - cleanup(t); - return 0; -} - -static int -test_directed_forward_credits(struct test *t) -{ - uint32_t i; - int32_t err; - - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0 || - create_directed_qids(t, 1, t->port) < 0) - return -1; - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = 0, - }; - - for (i = 0; i < 1000; i++) { - err = rte_event_enqueue_burst(evdev, 0, &ev, 1); - if (err < 0) { - printf("%d: error failed to enqueue\n", __LINE__); - return -1; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - uint32_t deq_pkts; - deq_pkts = rte_event_dequeue_burst(evdev, 0, &ev, 1, 0); - if (deq_pkts != 1) { - printf("%d: error failed to deq\n", __LINE__); - return -1; - } - - /* re-write event to be a forward, and continue looping it */ - ev.op = RTE_EVENT_OP_FORWARD; - } - - cleanup(t); - return 0; -} - - -static int -test_priority_directed(struct test *t) -{ - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0 || - create_directed_qids(t, 1, t->port) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - return run_prio_packet_test(t); -} - -static int -test_priority_atomic(struct test *t) -{ - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* map the QID */ - if (rte_event_port_link(evdev, t->port[0], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping qid to port\n", __LINE__); - return -1; - } - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - return run_prio_packet_test(t); -} - -static int -test_priority_ordered(struct test *t) -{ - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0 || - create_ordered_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* map the QID */ - if (rte_event_port_link(evdev, t->port[0], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping qid to port\n", __LINE__); - return -1; - } - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - return run_prio_packet_test(t); -} - -static int -test_priority_unordered(struct test *t) -{ - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0 || - create_unordered_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* map the QID */ - if (rte_event_port_link(evdev, t->port[0], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping qid to port\n", __LINE__); - return -1; - } - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - return run_prio_packet_test(t); -} - -static int -burst_packets(struct test *t) -{ - /************** CONFIG ****************/ - uint32_t i; - int err; - int ret; - - /* Create instance with 2 ports and 2 queues */ - if (init(t, 2, 2) < 0 || - create_ports(t, 2) < 0 || - create_atomic_qids(t, 2) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - ret = rte_event_port_link(evdev, t->port[0], &t->qid[0], NULL, 1); - if (ret != 1) { - printf("%d: error mapping lb qid0\n", __LINE__); - return -1; - } - ret = rte_event_port_link(evdev, t->port[1], &t->qid[1], NULL, 1); - if (ret != 1) { - printf("%d: error mapping lb qid1\n", __LINE__); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /************** FORWARD ****************/ - const uint32_t rx_port = 0; - const uint32_t NUM_PKTS = 2; - - for (i = 0; i < NUM_PKTS; i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: error generating pkt\n", __LINE__); - return -1; - } - - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = i % 2, - .flow_id = i % 3, - .mbuf = arp, - }; - /* generate pkt and enqueue */ - err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* Check stats for all NUM_PKTS arrived to sched core */ - struct test_event_dev_stats stats; - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - if (stats.rx_pkts != NUM_PKTS || stats.tx_pkts != NUM_PKTS) { - printf("%d: Sched core didn't receive all %d pkts\n", - __LINE__, NUM_PKTS); - rte_event_dev_dump(evdev, stdout); - return -1; - } - - uint32_t deq_pkts; - int p; - - deq_pkts = 0; - /******** DEQ QID 1 *******/ - do { - struct rte_event ev; - p = rte_event_dequeue_burst(evdev, t->port[0], &ev, 1, 0); - deq_pkts += p; - rte_pktmbuf_free(ev.mbuf); - } while (p); - - if (deq_pkts != NUM_PKTS/2) { - printf("%d: Half of NUM_PKTS didn't arrive at port 1\n", - __LINE__); - return -1; - } - - /******** DEQ QID 2 *******/ - deq_pkts = 0; - do { - struct rte_event ev; - p = rte_event_dequeue_burst(evdev, t->port[1], &ev, 1, 0); - deq_pkts += p; - rte_pktmbuf_free(ev.mbuf); - } while (p); - if (deq_pkts != NUM_PKTS/2) { - printf("%d: Half of NUM_PKTS didn't arrive at port 2\n", - __LINE__); - return -1; - } - - cleanup(t); - return 0; -} - -static int -abuse_inflights(struct test *t) -{ - const int rx_enq = 0; - const int wrk_enq = 2; - int err; - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[wrk_enq], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /* Enqueue op only */ - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &release_ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - - /* schedule */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - struct test_event_dev_stats stats; - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - - if (stats.rx_pkts != 0 || - stats.tx_pkts != 0 || - stats.port_inflight[wrk_enq] != 0) { - printf("%d: Sched core didn't handle pkt as expected\n", - __LINE__); - return -1; - } - - cleanup(t); - return 0; -} - -static int -xstats_tests(struct test *t) -{ - const int wrk_enq = 2; - int err; - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[wrk_enq], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - const uint32_t XSTATS_MAX = 1024; - - uint32_t i; - uint32_t ids[XSTATS_MAX]; - uint64_t values[XSTATS_MAX]; - struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX]; - - for (i = 0; i < XSTATS_MAX; i++) - ids[i] = i; - - /* Device names / values */ - int ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, xstats_names, ids, XSTATS_MAX); - if (ret != 6) { - printf("%d: expected 6 stats, got return %d\n", __LINE__, ret); - return -1; - } - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, ids, values, ret); - if (ret != 6) { - printf("%d: expected 6 stats, got return %d\n", __LINE__, ret); - return -1; - } - - /* Port names / values */ - ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, 0, - xstats_names, ids, XSTATS_MAX); - if (ret != 21) { - printf("%d: expected 21 stats, got return %d\n", __LINE__, ret); - return -1; - } - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, 0, - ids, values, ret); - if (ret != 21) { - printf("%d: expected 21 stats, got return %d\n", __LINE__, ret); - return -1; - } - - /* Queue names / values */ - ret = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - 0, xstats_names, ids, XSTATS_MAX); - if (ret != 17) { - printf("%d: expected 17 stats, got return %d\n", __LINE__, ret); - return -1; - } - - /* NEGATIVE TEST: with wrong queue passed, 0 stats should be returned */ - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - 1, ids, values, ret); - if (ret != -EINVAL) { - printf("%d: expected 0 stats, got return %d\n", __LINE__, ret); - return -1; - } - - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - 0, ids, values, ret); - if (ret != 17) { - printf("%d: expected 17 stats, got return %d\n", __LINE__, ret); - return -1; - } - - /* enqueue packets to check values */ - for (i = 0; i < 3; i++) { - struct rte_event ev; - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - ev.queue_id = t->qid[i]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - ev.flow_id = 7; - arp->seqn = i; - - int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* Device names / values */ - int num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, 0, - xstats_names, ids, XSTATS_MAX); - if (num_stats < 0) - goto fail; - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, ids, values, num_stats); - static const uint64_t expected[] = {3, 3, 0, 1, 0, 0}; - for (i = 0; (signed int)i < ret; i++) { - if (expected[i] != values[i]) { - printf( - "%d Error xstat %d (id %d) %s : %"PRIu64 - ", expect %"PRIu64"\n", - __LINE__, i, ids[i], xstats_names[i].name, - values[i], expected[i]); - goto fail; - } - } - - ret = rte_event_dev_xstats_reset(evdev, RTE_EVENT_DEV_XSTATS_DEVICE, - 0, NULL, 0); - - /* ensure reset statistics are zero-ed */ - static const uint64_t expected_zero[] = {0, 0, 0, 0, 0, 0}; - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, ids, values, num_stats); - for (i = 0; (signed int)i < ret; i++) { - if (expected_zero[i] != values[i]) { - printf( - "%d Error, xstat %d (id %d) %s : %"PRIu64 - ", expect %"PRIu64"\n", - __LINE__, i, ids[i], xstats_names[i].name, - values[i], expected_zero[i]); - goto fail; - } - } - - /* port reset checks */ - num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, 0, - xstats_names, ids, XSTATS_MAX); - if (num_stats < 0) - goto fail; - ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_PORT, - 0, ids, values, num_stats); - - static const uint64_t port_expected[] = { - 3 /* rx */, - 0 /* tx */, - 0 /* drop */, - 0 /* inflights */, - 0 /* avg pkt cycles */, - 29 /* credits */, - 0 /* rx ring used */, - 4096 /* rx ring free */, - 0 /* cq ring used */, - 32 /* cq ring free */, - 0 /* dequeue calls */, - /* 10 dequeue burst buckets */ - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }; - if (ret != RTE_DIM(port_expected)) { - printf( - "%s %d: wrong number of port stats (%d), expected %zu\n", - __func__, __LINE__, ret, RTE_DIM(port_expected)); - } - - for (i = 0; (signed int)i < ret; i++) { - if (port_expected[i] != values[i]) { - printf( - "%s : %d: Error stat %s is %"PRIu64 - ", expected %"PRIu64"\n", - __func__, __LINE__, xstats_names[i].name, - values[i], port_expected[i]); - goto fail; - } - } - - ret = rte_event_dev_xstats_reset(evdev, RTE_EVENT_DEV_XSTATS_PORT, - 0, NULL, 0); - - /* ensure reset statistics are zero-ed */ - static const uint64_t port_expected_zero[] = { - 0 /* rx */, - 0 /* tx */, - 0 /* drop */, - 0 /* inflights */, - 0 /* avg pkt cycles */, - 29 /* credits */, - 0 /* rx ring used */, - 4096 /* rx ring free */, - 0 /* cq ring used */, - 32 /* cq ring free */, - 0 /* dequeue calls */, - /* 10 dequeue burst buckets */ - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }; - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, - 0, ids, values, num_stats); - for (i = 0; (signed int)i < ret; i++) { - if (port_expected_zero[i] != values[i]) { - printf( - "%d, Error, xstat %d (id %d) %s : %"PRIu64 - ", expect %"PRIu64"\n", - __LINE__, i, ids[i], xstats_names[i].name, - values[i], port_expected_zero[i]); - goto fail; - } - } - - /* QUEUE STATS TESTS */ - num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, 0, - xstats_names, ids, XSTATS_MAX); - ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_QUEUE, - 0, ids, values, num_stats); - if (ret < 0) { - printf("xstats get returned %d\n", ret); - goto fail; - } - if ((unsigned int)ret > XSTATS_MAX) - printf("%s %d: more xstats available than space\n", - __func__, __LINE__); - - static const uint64_t queue_expected[] = { - 3 /* rx */, - 3 /* tx */, - 0 /* drop */, - 3 /* inflights */, - 512 /* iq size */, - 0, 0, 0, 0, /* iq 0, 1, 2, 3 used */ - /* QID-to-Port: pinned_flows, packets */ - 0, 0, - 0, 0, - 1, 3, - 0, 0, - }; - for (i = 0; (signed int)i < ret; i++) { - if (queue_expected[i] != values[i]) { - printf( - "%d, Error, xstat %d (id %d) %s : %"PRIu64 - ", expect %"PRIu64"\n", - __LINE__, i, ids[i], xstats_names[i].name, - values[i], queue_expected[i]); - goto fail; - } - } - - /* Reset the queue stats here */ - ret = rte_event_dev_xstats_reset(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, 0, - NULL, - 0); - - /* Verify that the resetable stats are reset, and others are not */ - static const uint64_t queue_expected_zero[] = { - 0 /* rx */, - 0 /* tx */, - 0 /* drop */, - 3 /* inflight */, - 512 /* iq size */, - 0, 0, 0, 0, /* 4 iq used */ - /* QID-to-Port: pinned_flows, packets */ - 0, 0, - 0, 0, - 1, 0, - 0, 0, - }; - - ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_QUEUE, 0, - ids, values, num_stats); - int fails = 0; - for (i = 0; (signed int)i < ret; i++) { - if (queue_expected_zero[i] != values[i]) { - printf( - "%d, Error, xstat %d (id %d) %s : %"PRIu64 - ", expect %"PRIu64"\n", - __LINE__, i, ids[i], xstats_names[i].name, - values[i], queue_expected_zero[i]); - fails++; - } - } - if (fails) { - printf("%d : %d of values were not as expected above\n", - __LINE__, fails); - goto fail; - } - - cleanup(t); - return 0; - -fail: - rte_event_dev_dump(0, stdout); - cleanup(t); - return -1; -} - - -static int -xstats_id_abuse_tests(struct test *t) -{ - int err; - const uint32_t XSTATS_MAX = 1024; - const uint32_t link_port = 2; - - uint32_t ids[XSTATS_MAX]; - struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX]; - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - goto fail; - } - - err = rte_event_port_link(evdev, t->port[link_port], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - goto fail; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto fail; - } - - /* no test for device, as it ignores the port/q number */ - int num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, - UINT8_MAX-1, xstats_names, ids, - XSTATS_MAX); - if (num_stats != 0) { - printf("%d: expected %d stats, got return %d\n", __LINE__, - 0, num_stats); - goto fail; - } - - num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - UINT8_MAX-1, xstats_names, ids, - XSTATS_MAX); - if (num_stats != 0) { - printf("%d: expected %d stats, got return %d\n", __LINE__, - 0, num_stats); - goto fail; - } - - cleanup(t); - return 0; -fail: - cleanup(t); - return -1; -} - -static int -port_reconfig_credits(struct test *t) -{ - if (init(t, 1, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - uint32_t i; - const uint32_t NUM_ITERS = 32; - for (i = 0; i < NUM_ITERS; i++) { - const struct rte_event_queue_conf conf = { - .schedule_type = RTE_SCHED_TYPE_ATOMIC, - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, - }; - if (rte_event_queue_setup(evdev, 0, &conf) < 0) { - printf("%d: error creating qid\n", __LINE__); - return -1; - } - t->qid[0] = 0; - - static const struct rte_event_port_conf port_conf = { - .new_event_threshold = 128, - .dequeue_depth = 32, - .enqueue_depth = 64, - }; - if (rte_event_port_setup(evdev, 0, &port_conf) < 0) { - printf("%d Error setting up port\n", __LINE__); - return -1; - } - - int links = rte_event_port_link(evdev, 0, NULL, NULL, 0); - if (links != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - goto fail; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto fail; - } - - const uint32_t NPKTS = 1; - uint32_t j; - for (j = 0; j < NPKTS; j++) { - struct rte_event ev; - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - goto fail; - } - ev.queue_id = t->qid[0]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - int err = rte_event_enqueue_burst(evdev, 0, &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - rte_event_dev_dump(0, stdout); - goto fail; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - struct rte_event ev[NPKTS]; - int deq = rte_event_dequeue_burst(evdev, t->port[0], ev, - NPKTS, 0); - if (deq != 1) - printf("%d error; no packet dequeued\n", __LINE__); - - /* let cleanup below stop the device on last iter */ - if (i != NUM_ITERS-1) - rte_event_dev_stop(evdev); - } - - cleanup(t); - return 0; -fail: - cleanup(t); - return -1; -} - -static int -port_single_lb_reconfig(struct test *t) -{ - if (init(t, 2, 2) < 0) { - printf("%d: Error initializing device\n", __LINE__); - goto fail; - } - - static const struct rte_event_queue_conf conf_lb_atomic = { - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .schedule_type = RTE_SCHED_TYPE_ATOMIC, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, - }; - if (rte_event_queue_setup(evdev, 0, &conf_lb_atomic) < 0) { - printf("%d: error creating qid\n", __LINE__); - goto fail; - } - - static const struct rte_event_queue_conf conf_single_link = { - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK, - }; - if (rte_event_queue_setup(evdev, 1, &conf_single_link) < 0) { - printf("%d: error creating qid\n", __LINE__); - goto fail; - } - - struct rte_event_port_conf port_conf = { - .new_event_threshold = 128, - .dequeue_depth = 32, - .enqueue_depth = 64, - }; - if (rte_event_port_setup(evdev, 0, &port_conf) < 0) { - printf("%d Error setting up port\n", __LINE__); - goto fail; - } - if (rte_event_port_setup(evdev, 1, &port_conf) < 0) { - printf("%d Error setting up port\n", __LINE__); - goto fail; - } - - /* link port to lb queue */ - uint8_t queue_id = 0; - if (rte_event_port_link(evdev, 0, &queue_id, NULL, 1) != 1) { - printf("%d: error creating link for qid\n", __LINE__); - goto fail; - } - - int ret = rte_event_port_unlink(evdev, 0, &queue_id, 1); - if (ret != 1) { - printf("%d: Error unlinking lb port\n", __LINE__); - goto fail; - } - - queue_id = 1; - if (rte_event_port_link(evdev, 0, &queue_id, NULL, 1) != 1) { - printf("%d: error creating link for qid\n", __LINE__); - goto fail; - } - - queue_id = 0; - int err = rte_event_port_link(evdev, 1, &queue_id, NULL, 1); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - goto fail; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto fail; - } - - cleanup(t); - return 0; -fail: - cleanup(t); - return -1; -} - -static int -xstats_brute_force(struct test *t) -{ - uint32_t i; - const uint32_t XSTATS_MAX = 1024; - uint32_t ids[XSTATS_MAX]; - uint64_t values[XSTATS_MAX]; - struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX]; - - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - int err = rte_event_port_link(evdev, t->port[0], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - goto fail; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto fail; - } - - for (i = 0; i < XSTATS_MAX; i++) - ids[i] = i; - - for (i = 0; i < 3; i++) { - uint32_t mode = RTE_EVENT_DEV_XSTATS_DEVICE + i; - uint32_t j; - for (j = 0; j < UINT8_MAX; j++) { - rte_event_dev_xstats_names_get(evdev, mode, - j, xstats_names, ids, XSTATS_MAX); - - rte_event_dev_xstats_get(evdev, mode, j, ids, - values, XSTATS_MAX); - } - } - - cleanup(t); - return 0; -fail: - cleanup(t); - return -1; -} - -static int -xstats_id_reset_tests(struct test *t) -{ - const int wrk_enq = 2; - int err; - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[wrk_enq], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - goto fail; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto fail; - } - -#define XSTATS_MAX 1024 - int ret; - uint32_t i; - uint32_t ids[XSTATS_MAX]; - uint64_t values[XSTATS_MAX]; - struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX]; - - for (i = 0; i < XSTATS_MAX; i++) - ids[i] = i; - -#define NUM_DEV_STATS 6 - /* Device names / values */ - int num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, xstats_names, ids, XSTATS_MAX); - if (num_stats != NUM_DEV_STATS) { - printf("%d: expected %d stats, got return %d\n", __LINE__, - NUM_DEV_STATS, num_stats); - goto fail; - } - ret = rte_event_dev_xstats_get(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, - 0, ids, values, num_stats); - if (ret != NUM_DEV_STATS) { - printf("%d: expected %d stats, got return %d\n", __LINE__, - NUM_DEV_STATS, ret); - goto fail; - } - -#define NPKTS 7 - for (i = 0; i < NPKTS; i++) { - struct rte_event ev; - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - goto fail; - } - ev.queue_id = t->qid[i]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - arp->seqn = i; - - int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - goto fail; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - static const char * const dev_names[] = { - "dev_rx", "dev_tx", "dev_drop", "dev_sched_calls", - "dev_sched_no_iq_enq", "dev_sched_no_cq_enq", - }; - uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0}; - for (i = 0; (int)i < ret; i++) { - unsigned int id; - uint64_t val = rte_event_dev_xstats_by_name_get(evdev, - dev_names[i], - &id); - if (id != i) { - printf("%d: %s id incorrect, expected %d got %d\n", - __LINE__, dev_names[i], i, id); - goto fail; - } - if (val != dev_expected[i]) { - printf("%d: %s value incorrect, expected %" - PRIu64" got %d\n", __LINE__, dev_names[i], - dev_expected[i], id); - goto fail; - } - /* reset to zero */ - int reset_ret = rte_event_dev_xstats_reset(evdev, - RTE_EVENT_DEV_XSTATS_DEVICE, 0, - &id, - 1); - if (reset_ret) { - printf("%d: failed to reset successfully\n", __LINE__); - goto fail; - } - dev_expected[i] = 0; - /* check value again */ - val = rte_event_dev_xstats_by_name_get(evdev, dev_names[i], 0); - if (val != dev_expected[i]) { - printf("%d: %s value incorrect, expected %"PRIu64 - " got %"PRIu64"\n", __LINE__, dev_names[i], - dev_expected[i], val); - goto fail; - } - }; - -/* 48 is stat offset from start of the devices whole xstats. - * This WILL break every time we add a statistic to a port - * or the device, but there is no other way to test - */ -#define PORT_OFF 48 -/* num stats for the tested port. CQ size adds more stats to a port */ -#define NUM_PORT_STATS 21 -/* the port to test. */ -#define PORT 2 - num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_PORT, PORT, - xstats_names, ids, XSTATS_MAX); - if (num_stats != NUM_PORT_STATS) { - printf("%d: expected %d stats, got return %d\n", - __LINE__, NUM_PORT_STATS, num_stats); - goto fail; - } - ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_PORT, PORT, - ids, values, num_stats); - - if (ret != NUM_PORT_STATS) { - printf("%d: expected %d stats, got return %d\n", - __LINE__, NUM_PORT_STATS, ret); - goto fail; - } - static const char * const port_names[] = { - "port_2_rx", - "port_2_tx", - "port_2_drop", - "port_2_inflight", - "port_2_avg_pkt_cycles", - "port_2_credits", - "port_2_rx_ring_used", - "port_2_rx_ring_free", - "port_2_cq_ring_used", - "port_2_cq_ring_free", - "port_2_dequeue_calls", - "port_2_dequeues_returning_0", - "port_2_dequeues_returning_1-4", - "port_2_dequeues_returning_5-8", - "port_2_dequeues_returning_9-12", - "port_2_dequeues_returning_13-16", - "port_2_dequeues_returning_17-20", - "port_2_dequeues_returning_21-24", - "port_2_dequeues_returning_25-28", - "port_2_dequeues_returning_29-32", - "port_2_dequeues_returning_33-36", - }; - uint64_t port_expected[] = { - 0, /* rx */ - NPKTS, /* tx */ - 0, /* drop */ - NPKTS, /* inflight */ - 0, /* avg pkt cycles */ - 0, /* credits */ - 0, /* rx ring used */ - 4096, /* rx ring free */ - NPKTS, /* cq ring used */ - 25, /* cq ring free */ - 0, /* dequeue zero calls */ - 0, 0, 0, 0, 0, /* 10 dequeue buckets */ - 0, 0, 0, 0, 0, - }; - uint64_t port_expected_zero[] = { - 0, /* rx */ - 0, /* tx */ - 0, /* drop */ - NPKTS, /* inflight */ - 0, /* avg pkt cycles */ - 0, /* credits */ - 0, /* rx ring used */ - 4096, /* rx ring free */ - NPKTS, /* cq ring used */ - 25, /* cq ring free */ - 0, /* dequeue zero calls */ - 0, 0, 0, 0, 0, /* 10 dequeue buckets */ - 0, 0, 0, 0, 0, - }; - if (RTE_DIM(port_expected) != NUM_PORT_STATS || - RTE_DIM(port_names) != NUM_PORT_STATS) { - printf("%d: port array of wrong size\n", __LINE__); - goto fail; - } - - int failed = 0; - for (i = 0; (int)i < ret; i++) { - unsigned int id; - uint64_t val = rte_event_dev_xstats_by_name_get(evdev, - port_names[i], - &id); - if (id != i + PORT_OFF) { - printf("%d: %s id incorrect, expected %d got %d\n", - __LINE__, port_names[i], i+PORT_OFF, - id); - failed = 1; - } - if (val != port_expected[i]) { - printf("%d: %s value incorrect, expected %"PRIu64 - " got %d\n", __LINE__, port_names[i], - port_expected[i], id); - failed = 1; - } - /* reset to zero */ - int reset_ret = rte_event_dev_xstats_reset(evdev, - RTE_EVENT_DEV_XSTATS_PORT, PORT, - &id, - 1); - if (reset_ret) { - printf("%d: failed to reset successfully\n", __LINE__); - failed = 1; - } - /* check value again */ - val = rte_event_dev_xstats_by_name_get(evdev, port_names[i], 0); - if (val != port_expected_zero[i]) { - printf("%d: %s value incorrect, expected %"PRIu64 - " got %"PRIu64"\n", __LINE__, port_names[i], - port_expected_zero[i], val); - failed = 1; - } - }; - if (failed) - goto fail; - -/* num queue stats */ -#define NUM_Q_STATS 17 -/* queue offset from start of the devices whole xstats. - * This will break every time we add a statistic to a device/port/queue - */ -#define QUEUE_OFF 90 - const uint32_t queue = 0; - num_stats = rte_event_dev_xstats_names_get(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, queue, - xstats_names, ids, XSTATS_MAX); - if (num_stats != NUM_Q_STATS) { - printf("%d: expected %d stats, got return %d\n", - __LINE__, NUM_Q_STATS, num_stats); - goto fail; - } - ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_QUEUE, - queue, ids, values, num_stats); - if (ret != NUM_Q_STATS) { - printf("%d: expected 21 stats, got return %d\n", __LINE__, ret); - goto fail; - } - static const char * const queue_names[] = { - "qid_0_rx", - "qid_0_tx", - "qid_0_drop", - "qid_0_inflight", - "qid_0_iq_size", - "qid_0_iq_0_used", - "qid_0_iq_1_used", - "qid_0_iq_2_used", - "qid_0_iq_3_used", - "qid_0_port_0_pinned_flows", - "qid_0_port_0_packets", - "qid_0_port_1_pinned_flows", - "qid_0_port_1_packets", - "qid_0_port_2_pinned_flows", - "qid_0_port_2_packets", - "qid_0_port_3_pinned_flows", - "qid_0_port_3_packets", - }; - uint64_t queue_expected[] = { - 7, /* rx */ - 7, /* tx */ - 0, /* drop */ - 7, /* inflight */ - 512, /* iq size */ - 0, /* iq 0 used */ - 0, /* iq 1 used */ - 0, /* iq 2 used */ - 0, /* iq 3 used */ - /* QID-to-Port: pinned_flows, packets */ - 0, 0, - 0, 0, - 1, 7, - 0, 0, - }; - uint64_t queue_expected_zero[] = { - 0, /* rx */ - 0, /* tx */ - 0, /* drop */ - 7, /* inflight */ - 512, /* iq size */ - 0, /* iq 0 used */ - 0, /* iq 1 used */ - 0, /* iq 2 used */ - 0, /* iq 3 used */ - /* QID-to-Port: pinned_flows, packets */ - 0, 0, - 0, 0, - 1, 0, - 0, 0, - }; - if (RTE_DIM(queue_expected) != NUM_Q_STATS || - RTE_DIM(queue_expected_zero) != NUM_Q_STATS || - RTE_DIM(queue_names) != NUM_Q_STATS) { - printf("%d : queue array of wrong size\n", __LINE__); - goto fail; - } - - failed = 0; - for (i = 0; (int)i < ret; i++) { - unsigned int id; - uint64_t val = rte_event_dev_xstats_by_name_get(evdev, - queue_names[i], - &id); - if (id != i + QUEUE_OFF) { - printf("%d: %s id incorrect, expected %d got %d\n", - __LINE__, queue_names[i], i+QUEUE_OFF, - id); - failed = 1; - } - if (val != queue_expected[i]) { - printf("%d: %d: %s value , expected %"PRIu64 - " got %"PRIu64"\n", i, __LINE__, - queue_names[i], queue_expected[i], val); - failed = 1; - } - /* reset to zero */ - int reset_ret = rte_event_dev_xstats_reset(evdev, - RTE_EVENT_DEV_XSTATS_QUEUE, - queue, &id, 1); - if (reset_ret) { - printf("%d: failed to reset successfully\n", __LINE__); - failed = 1; - } - /* check value again */ - val = rte_event_dev_xstats_by_name_get(evdev, queue_names[i], - 0); - if (val != queue_expected_zero[i]) { - printf("%d: %s value incorrect, expected %"PRIu64 - " got %"PRIu64"\n", __LINE__, queue_names[i], - queue_expected_zero[i], val); - failed = 1; - } - }; - - if (failed) - goto fail; - - cleanup(t); - return 0; -fail: - cleanup(t); - return -1; -} - -static int -ordered_reconfigure(struct test *t) -{ - if (init(t, 1, 1) < 0 || - create_ports(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - const struct rte_event_queue_conf conf = { - .schedule_type = RTE_SCHED_TYPE_ORDERED, - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, - }; - - if (rte_event_queue_setup(evdev, 0, &conf) < 0) { - printf("%d: error creating qid\n", __LINE__); - goto failed; - } - - if (rte_event_queue_setup(evdev, 0, &conf) < 0) { - printf("%d: error creating qid, for 2nd time\n", __LINE__); - goto failed; - } - - rte_event_port_link(evdev, t->port[0], NULL, NULL, 0); - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - cleanup(t); - return 0; -failed: - cleanup(t); - return -1; -} - -static int -qid_priorities(struct test *t) -{ - /* Test works by having a CQ with enough empty space for all packets, - * and enqueueing 3 packets to 3 QIDs. They must return based on the - * priority of the QID, not the ingress order, to pass the test - */ - unsigned int i; - /* Create instance with 1 ports, and 3 qids */ - if (init(t, 3, 1) < 0 || - create_ports(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - for (i = 0; i < 3; i++) { - /* Create QID */ - const struct rte_event_queue_conf conf = { - .schedule_type = RTE_SCHED_TYPE_ATOMIC, - /* increase priority (0 == highest), as we go */ - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL - i, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, - }; - - if (rte_event_queue_setup(evdev, i, &conf) < 0) { - printf("%d: error creating qid %d\n", __LINE__, i); - return -1; - } - t->qid[i] = i; - } - t->nb_qids = i; - /* map all QIDs to port */ - rte_event_port_link(evdev, t->port[0], NULL, NULL, 0); - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /* enqueue 3 packets, setting seqn and QID to check priority */ - for (i = 0; i < 3; i++) { - struct rte_event ev; - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - ev.queue_id = t->qid[i]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - arp->seqn = i; - - int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* dequeue packets, verify priority was upheld */ - struct rte_event ev[32]; - uint32_t deq_pkts = - rte_event_dequeue_burst(evdev, t->port[0], ev, 32, 0); - if (deq_pkts != 3) { - printf("%d: failed to deq packets\n", __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - for (i = 0; i < 3; i++) { - if (ev[i].mbuf->seqn != 2-i) { - printf( - "%d: qid priority test: seqn %d incorrectly prioritized\n", - __LINE__, i); - } - } - - cleanup(t); - return 0; -} - -static int -load_balancing(struct test *t) -{ - const int rx_enq = 0; - int err; - uint32_t i; - - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - for (i = 0; i < 3; i++) { - /* map port 1 - 3 inclusive */ - if (rte_event_port_link(evdev, t->port[i+1], &t->qid[0], - NULL, 1) != 1) { - printf("%d: error mapping qid to port %d\n", - __LINE__, i); - return -1; - } - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /************** FORWARD ****************/ - /* - * Create a set of flows that test the load-balancing operation of the - * implementation. Fill CQ 0 and 1 with flows 0 and 1, and test - * with a new flow, which should be sent to the 3rd mapped CQ - */ - static uint32_t flows[] = {0, 1, 1, 0, 0, 2, 2, 0, 2}; - - for (i = 0; i < RTE_DIM(flows); i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0], - .flow_id = flows[i], - .mbuf = arp, - }; - /* generate pkt and enqueue */ - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - struct test_event_dev_stats stats; - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - - if (stats.port_inflight[1] != 4) { - printf("%d:%s: port 1 inflight not correct\n", __LINE__, - __func__); - return -1; - } - if (stats.port_inflight[2] != 2) { - printf("%d:%s: port 2 inflight not correct\n", __LINE__, - __func__); - return -1; - } - if (stats.port_inflight[3] != 3) { - printf("%d:%s: port 3 inflight not correct\n", __LINE__, - __func__); - return -1; - } - - cleanup(t); - return 0; -} - -static int -load_balancing_history(struct test *t) -{ - struct test_event_dev_stats stats = {0}; - const int rx_enq = 0; - int err; - uint32_t i; - - /* Create instance with 1 atomic QID going to 3 ports + 1 prod port */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) - return -1; - - /* CQ mapping to QID */ - if (rte_event_port_link(evdev, t->port[1], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping port 1 qid\n", __LINE__); - return -1; - } - if (rte_event_port_link(evdev, t->port[2], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping port 2 qid\n", __LINE__); - return -1; - } - if (rte_event_port_link(evdev, t->port[3], &t->qid[0], NULL, 1) != 1) { - printf("%d: error mapping port 3 qid\n", __LINE__); - return -1; - } - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /* - * Create a set of flows that test the load-balancing operation of the - * implementation. Fill CQ 0, 1 and 2 with flows 0, 1 and 2, drop - * the packet from CQ 0, send in a new set of flows. Ensure that: - * 1. The new flow 3 gets into the empty CQ0 - * 2. packets for existing flow gets added into CQ1 - * 3. Next flow 0 pkt is now onto CQ2, since CQ0 and CQ1 now contain - * more outstanding pkts - * - * This test makes sure that when a flow ends (i.e. all packets - * have been completed for that flow), that the flow can be moved - * to a different CQ when new packets come in for that flow. - */ - static uint32_t flows1[] = {0, 1, 1, 2}; - - for (i = 0; i < RTE_DIM(flows1); i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - struct rte_event ev = { - .flow_id = flows1[i], - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0], - .event_type = RTE_EVENT_TYPE_CPU, - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .mbuf = arp - }; - - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - arp->hash.rss = flows1[i]; - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - /* call the scheduler */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* Dequeue the flow 0 packet from port 1, so that we can then drop */ - struct rte_event ev; - if (!rte_event_dequeue_burst(evdev, t->port[1], &ev, 1, 0)) { - printf("%d: failed to dequeue\n", __LINE__); - return -1; - } - if (ev.mbuf->hash.rss != flows1[0]) { - printf("%d: unexpected flow received\n", __LINE__); - return -1; - } - - /* drop the flow 0 packet from port 1 */ - rte_event_enqueue_burst(evdev, t->port[1], &release_ev, 1); - - /* call the scheduler */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* - * Set up the next set of flows, first a new flow to fill up - * CQ 0, so that the next flow 0 packet should go to CQ2 - */ - static uint32_t flows2[] = { 3, 3, 3, 1, 1, 0 }; - - for (i = 0; i < RTE_DIM(flows2); i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - struct rte_event ev = { - .flow_id = flows2[i], - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0], - .event_type = RTE_EVENT_TYPE_CPU, - .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .mbuf = arp - }; - - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - arp->hash.rss = flows2[i]; - - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - /* schedule */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d:failed to get stats\n", __LINE__); - return -1; - } - - /* - * Now check the resulting inflights on each port. - */ - if (stats.port_inflight[1] != 3) { - printf("%d:%s: port 1 inflight not correct\n", __LINE__, - __func__); - printf("Inflights, ports 1, 2, 3: %u, %u, %u\n", - (unsigned int)stats.port_inflight[1], - (unsigned int)stats.port_inflight[2], - (unsigned int)stats.port_inflight[3]); - return -1; - } - if (stats.port_inflight[2] != 4) { - printf("%d:%s: port 2 inflight not correct\n", __LINE__, - __func__); - printf("Inflights, ports 1, 2, 3: %u, %u, %u\n", - (unsigned int)stats.port_inflight[1], - (unsigned int)stats.port_inflight[2], - (unsigned int)stats.port_inflight[3]); - return -1; - } - if (stats.port_inflight[3] != 2) { - printf("%d:%s: port 3 inflight not correct\n", __LINE__, - __func__); - printf("Inflights, ports 1, 2, 3: %u, %u, %u\n", - (unsigned int)stats.port_inflight[1], - (unsigned int)stats.port_inflight[2], - (unsigned int)stats.port_inflight[3]); - return -1; - } - - for (i = 1; i <= 3; i++) { - struct rte_event ev; - while (rte_event_dequeue_burst(evdev, i, &ev, 1, 0)) - rte_event_enqueue_burst(evdev, i, &release_ev, 1); - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - cleanup(t); - return 0; -} - -static int -invalid_qid(struct test *t) -{ - struct test_event_dev_stats stats; - const int rx_enq = 0; - int err; - uint32_t i; - - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - for (i = 0; i < 4; i++) { - err = rte_event_port_link(evdev, t->port[i], &t->qid[0], - NULL, 1); - if (err != 1) { - printf("%d: error mapping port 1 qid\n", __LINE__); - return -1; - } - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /* - * Send in a packet with an invalid qid to the scheduler. - * We should see the packed enqueued OK, but the inflights for - * that packet should not be incremented, and the rx_dropped - * should be incremented. - */ - static uint32_t flows1[] = {20}; - - for (i = 0; i < RTE_DIM(flows1); i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0] + flows1[i], - .flow_id = i, - .mbuf = arp, - }; - /* generate pkt and enqueue */ - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - - /* call the scheduler */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - - /* - * Now check the resulting inflights on the port, and the rx_dropped. - */ - if (stats.port_inflight[0] != 0) { - printf("%d:%s: port 1 inflight count not correct\n", __LINE__, - __func__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - if (stats.port_rx_dropped[0] != 1) { - printf("%d:%s: port 1 drops\n", __LINE__, __func__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - /* each packet drop should only be counted in one place - port or dev */ - if (stats.rx_dropped != 0) { - printf("%d:%s: port 1 dropped count not correct\n", __LINE__, - __func__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - - cleanup(t); - return 0; -} - -static int -single_packet(struct test *t) -{ - const uint32_t MAGIC_SEQN = 7321; - struct rte_event ev; - struct test_event_dev_stats stats; - const int rx_enq = 0; - const int wrk_enq = 2; - int err; - - /* Create instance with 4 ports */ - if (init(t, 1, 4) < 0 || - create_ports(t, 4) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[wrk_enq], NULL, NULL, 0); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /************** Gen pkt and enqueue ****************/ - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - - ev.op = RTE_EVENT_OP_NEW; - ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL; - ev.mbuf = arp; - ev.queue_id = 0; - ev.flow_id = 3; - arp->seqn = MAGIC_SEQN; - - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - - if (stats.rx_pkts != 1 || - stats.tx_pkts != 1 || - stats.port_inflight[wrk_enq] != 1) { - printf("%d: Sched core didn't handle pkt as expected\n", - __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - - uint32_t deq_pkts; - - deq_pkts = rte_event_dequeue_burst(evdev, t->port[wrk_enq], &ev, 1, 0); - if (deq_pkts < 1) { - printf("%d: Failed to deq\n", __LINE__); - return -1; - } - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - return -1; - } - - err = test_event_dev_stats_get(evdev, &stats); - if (ev.mbuf->seqn != MAGIC_SEQN) { - printf("%d: magic sequence number not dequeued\n", __LINE__); - return -1; - } - - rte_pktmbuf_free(ev.mbuf); - err = rte_event_enqueue_burst(evdev, t->port[wrk_enq], &release_ev, 1); - if (err < 0) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_inflight[wrk_enq] != 0) { - printf("%d: port inflight not correct\n", __LINE__); - return -1; - } - - cleanup(t); - return 0; -} - -static int -inflight_counts(struct test *t) -{ - struct rte_event ev; - struct test_event_dev_stats stats; - const int rx_enq = 0; - const int p1 = 1; - const int p2 = 2; - int err; - int i; - - /* Create instance with 4 ports */ - if (init(t, 2, 3) < 0 || - create_ports(t, 3) < 0 || - create_atomic_qids(t, 2) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[p1], &t->qid[0], NULL, 1); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - err = rte_event_port_link(evdev, t->port[p2], &t->qid[1], NULL, 1); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /************** FORWARD ****************/ -#define QID1_NUM 5 - for (i = 0; i < QID1_NUM; i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - goto err; - } - - ev.queue_id = t->qid[0]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - goto err; - } - } -#define QID2_NUM 3 - for (i = 0; i < QID2_NUM; i++) { - struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool); - - if (!arp) { - printf("%d: gen of pkt failed\n", __LINE__); - goto err; - } - ev.queue_id = t->qid[1]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = arp; - err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - goto err; - } - } - - /* schedule */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (err) { - printf("%d: failed to get stats\n", __LINE__); - goto err; - } - - if (stats.rx_pkts != QID1_NUM + QID2_NUM || - stats.tx_pkts != QID1_NUM + QID2_NUM) { - printf("%d: Sched core didn't handle pkt as expected\n", - __LINE__); - goto err; - } - - if (stats.port_inflight[p1] != QID1_NUM) { - printf("%d: %s port 1 inflight not correct\n", __LINE__, - __func__); - goto err; - } - if (stats.port_inflight[p2] != QID2_NUM) { - printf("%d: %s port 2 inflight not correct\n", __LINE__, - __func__); - goto err; - } - - /************** DEQUEUE INFLIGHT COUNT CHECKS ****************/ - /* port 1 */ - struct rte_event events[QID1_NUM + QID2_NUM]; - uint32_t deq_pkts = rte_event_dequeue_burst(evdev, t->port[p1], events, - RTE_DIM(events), 0); - - if (deq_pkts != QID1_NUM) { - printf("%d: Port 1: DEQUEUE inflight failed\n", __LINE__); - goto err; - } - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_inflight[p1] != QID1_NUM) { - printf("%d: port 1 inflight decrement after DEQ != 0\n", - __LINE__); - goto err; - } - for (i = 0; i < QID1_NUM; i++) { - err = rte_event_enqueue_burst(evdev, t->port[p1], &release_ev, - 1); - if (err != 1) { - printf("%d: %s rte enqueue of inf release failed\n", - __LINE__, __func__); - goto err; - } - } - - /* - * As the scheduler core decrements inflights, it needs to run to - * process packets to act on the drop messages - */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_inflight[p1] != 0) { - printf("%d: port 1 inflight NON NULL after DROP\n", __LINE__); - goto err; - } - - /* port2 */ - deq_pkts = rte_event_dequeue_burst(evdev, t->port[p2], events, - RTE_DIM(events), 0); - if (deq_pkts != QID2_NUM) { - printf("%d: Port 2: DEQUEUE inflight failed\n", __LINE__); - goto err; - } - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_inflight[p2] != QID2_NUM) { - printf("%d: port 1 inflight decrement after DEQ != 0\n", - __LINE__); - goto err; - } - for (i = 0; i < QID2_NUM; i++) { - err = rte_event_enqueue_burst(evdev, t->port[p2], &release_ev, - 1); - if (err != 1) { - printf("%d: %s rte enqueue of inf release failed\n", - __LINE__, __func__); - goto err; - } - } - - /* - * As the scheduler core decrements inflights, it needs to run to - * process packets to act on the drop messages - */ - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - err = test_event_dev_stats_get(evdev, &stats); - if (stats.port_inflight[p2] != 0) { - printf("%d: port 2 inflight NON NULL after DROP\n", __LINE__); - goto err; - } - cleanup(t); - return 0; - -err: - rte_event_dev_dump(evdev, stdout); - cleanup(t); - return -1; -} - -static int -parallel_basic(struct test *t, int check_order) -{ - const uint8_t rx_port = 0; - const uint8_t w1_port = 1; - const uint8_t w3_port = 3; - const uint8_t tx_port = 4; - int err; - int i; - uint32_t deq_pkts, j; - struct rte_mbuf *mbufs[3]; - struct rte_mbuf *mbufs_out[3] = { 0 }; - const uint32_t MAGIC_SEQN = 1234; - - /* Create instance with 4 ports */ - if (init(t, 2, tx_port + 1) < 0 || - create_ports(t, tx_port + 1) < 0 || - (check_order ? create_ordered_qids(t, 1) : - create_unordered_qids(t, 1)) < 0 || - create_directed_qids(t, 1, &tx_port)) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* - * CQ mapping to QID - * We need three ports, all mapped to the same ordered qid0. Then we'll - * take a packet out to each port, re-enqueue in reverse order, - * then make sure the reordering has taken place properly when we - * dequeue from the tx_port. - * - * Simplified test setup diagram: - * - * rx_port w1_port - * \ / \ - * qid0 - w2_port - qid1 - * \ / \ - * w3_port tx_port - */ - /* CQ mapping to QID for LB ports (directed mapped on create) */ - for (i = w1_port; i <= w3_port; i++) { - err = rte_event_port_link(evdev, t->port[i], &t->qid[0], NULL, - 1); - if (err != 1) { - printf("%d: error mapping lb qid\n", __LINE__); - cleanup(t); - return -1; - } - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - /* Enqueue 3 packets to the rx port */ - for (i = 0; i < 3; i++) { - struct rte_event ev; - mbufs[i] = rte_gen_arp(0, t->mbuf_pool); - if (!mbufs[i]) { - printf("%d: gen of pkt failed\n", __LINE__); - return -1; - } - - ev.queue_id = t->qid[0]; - ev.op = RTE_EVENT_OP_NEW; - ev.mbuf = mbufs[i]; - mbufs[i]->seqn = MAGIC_SEQN + i; - - /* generate pkt and enqueue */ - err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); - if (err != 1) { - printf("%d: Failed to enqueue pkt %u, retval = %u\n", - __LINE__, i, err); - return -1; - } - } - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* use extra slot to make logic in loops easier */ - struct rte_event deq_ev[w3_port + 1]; - - /* Dequeue the 3 packets, one from each worker port */ - for (i = w1_port; i <= w3_port; i++) { - deq_pkts = rte_event_dequeue_burst(evdev, t->port[i], - &deq_ev[i], 1, 0); - if (deq_pkts != 1) { - printf("%d: Failed to deq\n", __LINE__); - rte_event_dev_dump(evdev, stdout); - return -1; - } - } - - /* Enqueue each packet in reverse order, flushing after each one */ - for (i = w3_port; i >= w1_port; i--) { - - deq_ev[i].op = RTE_EVENT_OP_FORWARD; - deq_ev[i].queue_id = t->qid[1]; - err = rte_event_enqueue_burst(evdev, t->port[i], &deq_ev[i], 1); - if (err != 1) { - printf("%d: Failed to enqueue\n", __LINE__); - return -1; - } - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* dequeue from the tx ports, we should get 3 packets */ - deq_pkts = rte_event_dequeue_burst(evdev, t->port[tx_port], deq_ev, - 3, 0); - - /* Check to see if we've got all 3 packets */ - if (deq_pkts != 3) { - printf("%d: expected 3 pkts at tx port got %d from port %d\n", - __LINE__, deq_pkts, tx_port); - rte_event_dev_dump(evdev, stdout); - return 1; - } - - /* Check to see if the sequence numbers are in expected order */ - if (check_order) { - for (j = 0 ; j < deq_pkts ; j++) { - if (deq_ev[j].mbuf->seqn != MAGIC_SEQN + j) { - printf( - "%d: Incorrect sequence number(%d) from port %d\n", - __LINE__, mbufs_out[j]->seqn, tx_port); - return -1; - } - } - } - - /* Destroy the instance */ - cleanup(t); - return 0; -} - -static int -ordered_basic(struct test *t) -{ - return parallel_basic(t, 1); -} - -static int -unordered_basic(struct test *t) -{ - return parallel_basic(t, 0); -} - -static int -holb(struct test *t) /* test to check we avoid basic head-of-line blocking */ -{ - const struct rte_event new_ev = { - .op = RTE_EVENT_OP_NEW - /* all other fields zero */ - }; - struct rte_event ev = new_ev; - unsigned int rx_port = 0; /* port we get the first flow on */ - char rx_port_used_stat[64]; - char rx_port_free_stat[64]; - char other_port_used_stat[64]; - - if (init(t, 1, 2) < 0 || - create_ports(t, 2) < 0 || - create_atomic_qids(t, 1) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - int nb_links = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0); - if (rte_event_port_link(evdev, t->port[0], NULL, NULL, 0) != 1 || - nb_links != 1) { - printf("%d: Error links queue to ports\n", __LINE__); - goto err; - } - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - goto err; - } - - /* send one packet and see where it goes, port 0 or 1 */ - if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) { - printf("%d: Error doing first enqueue\n", __LINE__); - goto err; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - if (rte_event_dev_xstats_by_name_get(evdev, "port_0_cq_ring_used", NULL) - != 1) - rx_port = 1; - - snprintf(rx_port_used_stat, sizeof(rx_port_used_stat), - "port_%u_cq_ring_used", rx_port); - snprintf(rx_port_free_stat, sizeof(rx_port_free_stat), - "port_%u_cq_ring_free", rx_port); - snprintf(other_port_used_stat, sizeof(other_port_used_stat), - "port_%u_cq_ring_used", rx_port ^ 1); - if (rte_event_dev_xstats_by_name_get(evdev, rx_port_used_stat, NULL) - != 1) { - printf("%d: Error, first event not scheduled\n", __LINE__); - goto err; - } - - /* now fill up the rx port's queue with one flow to cause HOLB */ - do { - ev = new_ev; - if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) { - printf("%d: Error with enqueue\n", __LINE__); - goto err; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - } while (rte_event_dev_xstats_by_name_get(evdev, - rx_port_free_stat, NULL) != 0); - - /* one more packet, which needs to stay in IQ - i.e. HOLB */ - ev = new_ev; - if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) { - printf("%d: Error with enqueue\n", __LINE__); - goto err; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - /* check that the other port still has an empty CQ */ - if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL) - != 0) { - printf("%d: Error, second port CQ is not empty\n", __LINE__); - goto err; - } - /* check IQ now has one packet */ - if (rte_event_dev_xstats_by_name_get(evdev, "qid_0_iq_0_used", NULL) - != 1) { - printf("%d: Error, QID does not have exactly 1 packet\n", - __LINE__); - goto err; - } - - /* send another flow, which should pass the other IQ entry */ - ev = new_ev; - ev.flow_id = 1; - if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) { - printf("%d: Error with enqueue\n", __LINE__); - goto err; - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL) - != 1) { - printf("%d: Error, second flow did not pass out first\n", - __LINE__); - goto err; - } - - if (rte_event_dev_xstats_by_name_get(evdev, "qid_0_iq_0_used", NULL) - != 1) { - printf("%d: Error, QID does not have exactly 1 packet\n", - __LINE__); - goto err; - } - cleanup(t); - return 0; -err: - rte_event_dev_dump(evdev, stdout); - cleanup(t); - return -1; -} - -static int -worker_loopback_worker_fn(void *arg) -{ - struct test *t = arg; - uint8_t port = t->port[1]; - int count = 0; - int enqd; - - /* - * Takes packets from the input port and then loops them back through - * the Eventdev. Each packet gets looped through QIDs 0-8, 16 times - * so each packet goes through 8*16 = 128 times. - */ - printf("%d: \tWorker function started\n", __LINE__); - while (count < NUM_PACKETS) { -#define BURST_SIZE 32 - struct rte_event ev[BURST_SIZE]; - uint16_t i, nb_rx = rte_event_dequeue_burst(evdev, port, ev, - BURST_SIZE, 0); - if (nb_rx == 0) { - rte_pause(); - continue; - } - - for (i = 0; i < nb_rx; i++) { - ev[i].queue_id++; - if (ev[i].queue_id != 8) { - ev[i].op = RTE_EVENT_OP_FORWARD; - enqd = rte_event_enqueue_burst(evdev, port, - &ev[i], 1); - if (enqd != 1) { - printf("%d: Can't enqueue FWD!!\n", - __LINE__); - return -1; - } - continue; - } - - ev[i].queue_id = 0; - ev[i].mbuf->udata64++; - if (ev[i].mbuf->udata64 != 16) { - ev[i].op = RTE_EVENT_OP_FORWARD; - enqd = rte_event_enqueue_burst(evdev, port, - &ev[i], 1); - if (enqd != 1) { - printf("%d: Can't enqueue FWD!!\n", - __LINE__); - return -1; - } - continue; - } - /* we have hit 16 iterations through system - drop */ - rte_pktmbuf_free(ev[i].mbuf); - count++; - ev[i].op = RTE_EVENT_OP_RELEASE; - enqd = rte_event_enqueue_burst(evdev, port, &ev[i], 1); - if (enqd != 1) { - printf("%d drop enqueue failed\n", __LINE__); - return -1; - } - } - } - - return 0; -} - -static int -worker_loopback_producer_fn(void *arg) -{ - struct test *t = arg; - uint8_t port = t->port[0]; - uint64_t count = 0; - - printf("%d: \tProducer function started\n", __LINE__); - while (count < NUM_PACKETS) { - struct rte_mbuf *m = 0; - do { - m = rte_pktmbuf_alloc(t->mbuf_pool); - } while (m == NULL); - - m->udata64 = 0; - - struct rte_event ev = { - .op = RTE_EVENT_OP_NEW, - .queue_id = t->qid[0], - .flow_id = (uintptr_t)m & 0xFFFF, - .mbuf = m, - }; - - if (rte_event_enqueue_burst(evdev, port, &ev, 1) != 1) { - while (rte_event_enqueue_burst(evdev, port, &ev, 1) != - 1) - rte_pause(); - } - - count++; - } - - return 0; -} - -static int -worker_loopback(struct test *t) -{ - /* use a single producer core, and a worker core to see what happens - * if the worker loops packets back multiple times - */ - struct test_event_dev_stats stats; - uint64_t print_cycles = 0, cycles = 0; - uint64_t tx_pkts = 0; - int err; - int w_lcore, p_lcore; - - if (init(t, 8, 2) < 0 || - create_atomic_qids(t, 8) < 0) { - printf("%d: Error initializing device\n", __LINE__); - return -1; - } - - /* RX with low max events */ - static struct rte_event_port_conf conf = { - .dequeue_depth = 32, - .enqueue_depth = 64, - }; - /* beware: this cannot be initialized in the static above as it would - * only be initialized once - and this needs to be set for multiple runs - */ - conf.new_event_threshold = 512; - - if (rte_event_port_setup(evdev, 0, &conf) < 0) { - printf("Error setting up RX port\n"); - return -1; - } - t->port[0] = 0; - /* TX with higher max events */ - conf.new_event_threshold = 4096; - if (rte_event_port_setup(evdev, 1, &conf) < 0) { - printf("Error setting up TX port\n"); - return -1; - } - t->port[1] = 1; - - /* CQ mapping to QID */ - err = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0); - if (err != 8) { /* should have mapped all queues*/ - printf("%d: error mapping port 2 to all qids\n", __LINE__); - return -1; - } - - if (rte_event_dev_start(evdev) < 0) { - printf("%d: Error with start call\n", __LINE__); - return -1; - } - - p_lcore = rte_get_next_lcore( - /* start core */ -1, - /* skip master */ 1, - /* wrap */ 0); - w_lcore = rte_get_next_lcore(p_lcore, 1, 0); - - rte_eal_remote_launch(worker_loopback_producer_fn, t, p_lcore); - rte_eal_remote_launch(worker_loopback_worker_fn, t, w_lcore); - - print_cycles = cycles = rte_get_timer_cycles(); - while (rte_eal_get_lcore_state(p_lcore) != FINISHED || - rte_eal_get_lcore_state(w_lcore) != FINISHED) { - - rte_service_run_iter_on_app_lcore(t->service_id, 1); - - uint64_t new_cycles = rte_get_timer_cycles(); - - if (new_cycles - print_cycles > rte_get_timer_hz()) { - test_event_dev_stats_get(evdev, &stats); - printf( - "%d: \tSched Rx = %"PRIu64", Tx = %"PRIu64"\n", - __LINE__, stats.rx_pkts, stats.tx_pkts); - - print_cycles = new_cycles; - } - if (new_cycles - cycles > rte_get_timer_hz() * 3) { - test_event_dev_stats_get(evdev, &stats); - if (stats.tx_pkts == tx_pkts) { - rte_event_dev_dump(evdev, stdout); - printf("Dumping xstats:\n"); - xstats_print(); - printf( - "%d: No schedules for seconds, deadlock\n", - __LINE__); - return -1; - } - tx_pkts = stats.tx_pkts; - cycles = new_cycles; - } - } - rte_service_run_iter_on_app_lcore(t->service_id, 1); - /* ensure all completions are flushed */ - - rte_eal_mp_wait_lcore(); - - cleanup(t); - return 0; -} - -static struct rte_mempool *eventdev_func_mempool; - -static int -test_sw_eventdev(void) -{ - struct test *t = malloc(sizeof(struct test)); - int ret; - - /* manually initialize the op, older gcc's complain on static - * initialization of struct elements that are a bitfield. - */ - release_ev.op = RTE_EVENT_OP_RELEASE; - - const char *eventdev_name = "event_sw0"; - evdev = rte_event_dev_get_dev_id(eventdev_name); - if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", - __LINE__, eventdev_name); - if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev\n"); - return -1; - } - evdev = rte_event_dev_get_dev_id(eventdev_name); - if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return -1; - } - } - - if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { - printf("Failed to get service ID for software event dev\n"); - return -1; - } - - rte_service_runstate_set(t->service_id, 1); - rte_service_set_runstate_mapped_check(t->service_id, 0); - - /* Only create mbuf pool once, reuse for each test run */ - if (!eventdev_func_mempool) { - eventdev_func_mempool = rte_pktmbuf_pool_create( - "EVENTDEV_SW_SA_MBUF_POOL", - (1<<12), /* 4k buffers */ - 32 /*MBUF_CACHE_SIZE*/, - 0, - 512, /* use very small mbufs */ - rte_socket_id()); - if (!eventdev_func_mempool) { - printf("ERROR creating mempool\n"); - return -1; - } - } - t->mbuf_pool = eventdev_func_mempool; - printf("*** Running Single Directed Packet test...\n"); - ret = test_single_directed_packet(t); - if (ret != 0) { - printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; - } - printf("*** Running Directed Forward Credit test...\n"); - ret = test_directed_forward_credits(t); - if (ret != 0) { - printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; - } - printf("*** Running Single Load Balanced Packet test...\n"); - ret = single_packet(t); - if (ret != 0) { - printf("ERROR - Single Packet test FAILED.\n"); - return ret; - } - printf("*** Running Unordered Basic test...\n"); - ret = unordered_basic(t); - if (ret != 0) { - printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; - } - printf("*** Running Ordered Basic test...\n"); - ret = ordered_basic(t); - if (ret != 0) { - printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; - } - printf("*** Running Burst Packets test...\n"); - ret = burst_packets(t); - if (ret != 0) { - printf("ERROR - Burst Packets test FAILED.\n"); - return ret; - } - printf("*** Running Load Balancing test...\n"); - ret = load_balancing(t); - if (ret != 0) { - printf("ERROR - Load Balancing test FAILED.\n"); - return ret; - } - printf("*** Running Prioritized Directed test...\n"); - ret = test_priority_directed(t); - if (ret != 0) { - printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; - } - printf("*** Running Prioritized Atomic test...\n"); - ret = test_priority_atomic(t); - if (ret != 0) { - printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; - } - - printf("*** Running Prioritized Ordered test...\n"); - ret = test_priority_ordered(t); - if (ret != 0) { - printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; - } - printf("*** Running Prioritized Unordered test...\n"); - ret = test_priority_unordered(t); - if (ret != 0) { - printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; - } - printf("*** Running Invalid QID test...\n"); - ret = invalid_qid(t); - if (ret != 0) { - printf("ERROR - Invalid QID test FAILED.\n"); - return ret; - } - printf("*** Running Load Balancing History test...\n"); - ret = load_balancing_history(t); - if (ret != 0) { - printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; - } - printf("*** Running Inflight Count test...\n"); - ret = inflight_counts(t); - if (ret != 0) { - printf("ERROR - Inflight Count test FAILED.\n"); - return ret; - } - printf("*** Running Abuse Inflights test...\n"); - ret = abuse_inflights(t); - if (ret != 0) { - printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; - } - printf("*** Running XStats test...\n"); - ret = xstats_tests(t); - if (ret != 0) { - printf("ERROR - XStats test FAILED.\n"); - return ret; - } - printf("*** Running XStats ID Reset test...\n"); - ret = xstats_id_reset_tests(t); - if (ret != 0) { - printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; - } - printf("*** Running XStats Brute Force test...\n"); - ret = xstats_brute_force(t); - if (ret != 0) { - printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; - } - printf("*** Running XStats ID Abuse test...\n"); - ret = xstats_id_abuse_tests(t); - if (ret != 0) { - printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; - } - printf("*** Running QID Priority test...\n"); - ret = qid_priorities(t); - if (ret != 0) { - printf("ERROR - QID Priority test FAILED.\n"); - return ret; - } - printf("*** Running Ordered Reconfigure test...\n"); - ret = ordered_reconfigure(t); - if (ret != 0) { - printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; - } - printf("*** Running Port LB Single Reconfig test...\n"); - ret = port_single_lb_reconfig(t); - if (ret != 0) { - printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; - } - printf("*** Running Port Reconfig Credits test...\n"); - ret = port_reconfig_credits(t); - if (ret != 0) { - printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; - } - printf("*** Running Head-of-line-blocking test...\n"); - ret = holb(t); - if (ret != 0) { - printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; - } - if (rte_lcore_count() >= 3) { - printf("*** Running Worker loopback test...\n"); - ret = worker_loopback(t); - if (ret != 0) { - printf("ERROR - Worker loopback test FAILED.\n"); - return ret; - } - } else { - printf("### Not enough cores for worker loopback test.\n"); - printf("### Need at least 3 cores for test.\n"); - } - /* - * Free test instance, leaving mempool initialized, and a pointer to it - * in static eventdev_func_mempool, as it is re-used on re-runs - */ - free(t); - - return 0; -} - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 9f331cd8..fc83b69a 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include <string.h> @@ -51,16 +22,198 @@ #define FLOW_CLASSIFY_MAX_RULE_NUM 100 -struct flow_classifier *cls; +#define MAX_PKT_BURST 32 +#define NB_SOCKETS 1 +#define MEMPOOL_CACHE_SIZE 256 +#define MBUF_SIZE 512 +#define NB_MBUF 512 + +/* test UDP, TCP and SCTP packets */ +static struct rte_mempool *mbufpool[NB_SOCKETS]; +static struct rte_mbuf *bufs[MAX_PKT_BURST]; + +static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { + /* first input field - always one byte long. */ + { + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint8_t), + .field_index = PROTO_FIELD_IPV4, + .input_index = PROTO_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, next_proto_id), + }, + /* next input field (IPv4 source address) - 4 consecutive bytes. */ + { + /* rte_flow uses a bit mask for IPv4 addresses */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint32_t), + .field_index = SRC_FIELD_IPV4, + .input_index = SRC_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, src_addr), + }, + /* next input field (IPv4 destination address) - 4 consecutive bytes. */ + { + /* rte_flow uses a bit mask for IPv4 addresses */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint32_t), + .field_index = DST_FIELD_IPV4, + .input_index = DST_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, dst_addr), + }, + /* + * Next 2 fields (src & dst ports) form 4 consecutive bytes. + * They share the same input index. + */ + { + /* rte_flow uses a bit mask for protocol ports */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint16_t), + .field_index = SRCP_FIELD_IPV4, + .input_index = SRCP_DESTP_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + sizeof(struct ipv4_hdr) + + offsetof(struct tcp_hdr, src_port), + }, + { + /* rte_flow uses a bit mask for protocol ports */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint16_t), + .field_index = DSTP_FIELD_IPV4, + .input_index = SRCP_DESTP_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + sizeof(struct ipv4_hdr) + + offsetof(struct tcp_hdr, dst_port), + }, +}; -struct flow_classifier { - struct rte_flow_classifier *cls; - uint32_t table_id[RTE_FLOW_CLASSIFY_TABLE_MAX]; - uint32_t n_tables; +/* parameters for rte_flow_classify_validate and rte_flow_classify_create */ + +/* test UDP pattern: + * "eth / ipv4 src spec 2.2.2.3 src mask 255.255.255.00 dst spec 2.2.2.7 + * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" + */ +static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} +}; +static const struct rte_flow_item_ipv4 ipv4_mask_24 = { + .hdr = { + .next_proto_id = 0xff, + .src_addr = 0xffffff00, + .dst_addr = 0xffffff00, + }, +}; +static struct rte_flow_item_udp udp_spec_1 = { + { 32, 33, 0, 0 } +}; + +static struct rte_flow_item eth_item = { RTE_FLOW_ITEM_TYPE_ETH, + 0, 0, 0 }; +static struct rte_flow_item eth_item_bad = { -1, 0, 0, 0 }; + +static struct rte_flow_item ipv4_udp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_udp_spec_1, 0, &ipv4_mask_24}; +static struct rte_flow_item ipv4_udp_item_bad = { RTE_FLOW_ITEM_TYPE_IPV4, + NULL, 0, NULL}; + +static struct rte_flow_item udp_item_1 = { RTE_FLOW_ITEM_TYPE_UDP, + &udp_spec_1, 0, &rte_flow_item_udp_mask}; +static struct rte_flow_item udp_item_bad = { RTE_FLOW_ITEM_TYPE_UDP, + NULL, 0, NULL}; + +static struct rte_flow_item end_item = { RTE_FLOW_ITEM_TYPE_END, + 0, 0, 0 }; +static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; + +/* test TCP pattern: + * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 + * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" + */ +static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} +}; + +static struct rte_flow_item_tcp tcp_spec_1 = { + { 16, 17, 0, 0, 0, 0, 0, 0, 0} +}; + +static struct rte_flow_item ipv4_tcp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_tcp_spec_1, 0, &ipv4_mask_24}; + +static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, + &tcp_spec_1, 0, &rte_flow_item_tcp_mask}; + +/* test SCTP pattern: + * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 + * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" + */ +static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), + IPv4(15, 16, 17, 18)} +}; + +static struct rte_flow_item_sctp sctp_spec_1 = { + { 10, 11, 0, 0} }; +static struct rte_flow_item ipv4_sctp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_sctp_spec_1, 0, &ipv4_mask_24}; + +static struct rte_flow_item sctp_item_1 = { RTE_FLOW_ITEM_TYPE_SCTP, + &sctp_spec_1, 0, &rte_flow_item_sctp_mask}; + + +/* test actions: + * "actions count / end" + */ +static struct rte_flow_query_count count = { + .reset = 1, + .hits_set = 1, + .bytes_set = 1, + .hits = 0, + .bytes = 0, +}; +static struct rte_flow_action count_action = { RTE_FLOW_ACTION_TYPE_COUNT, + &count}; +static struct rte_flow_action count_action_bad = { -1, 0}; + +static struct rte_flow_action end_action = { RTE_FLOW_ACTION_TYPE_END, 0}; +static struct rte_flow_action end_action_bad = { -1, 0}; + +static struct rte_flow_action actions[2]; + +/* test attributes */ +static struct rte_flow_attr attr; + +/* test error */ +static struct rte_flow_error error; + +/* test pattern */ +static struct rte_flow_item pattern[4]; + +/* flow classify data for UDP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats udp_ntuple_stats; +static struct rte_flow_classify_stats udp_classify_stats = { + .stats = (void *)&udp_ntuple_stats +}; + +/* flow classify data for TCP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats tcp_ntuple_stats; +static struct rte_flow_classify_stats tcp_classify_stats = { + .stats = (void *)&tcp_ntuple_stats +}; + +/* flow classify data for SCTP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats sctp_ntuple_stats; +static struct rte_flow_classify_stats sctp_classify_stats = { + .stats = (void *)&sctp_ntuple_stats +}; + +struct flow_classifier_acl *cls; + struct flow_classifier_acl { - struct flow_classifier cls; + struct rte_flow_classifier *cls; } __rte_cache_aligned; /* @@ -73,7 +226,15 @@ test_invalid_parameters(void) struct rte_flow_classify_rule *rule; int ret; - rule = rte_flow_classify_table_entry_add(NULL, 1, NULL, NULL, NULL, + ret = rte_flow_classify_validate(NULL, NULL, NULL, NULL, NULL); + if (!ret) { + printf("Line %i: rte_flow_classify_validate", + __LINE__); + printf(" with NULL param should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL, NULL, NULL); if (rule) { printf("Line %i: flow_classifier_table_entry_add", __LINE__); @@ -81,7 +242,7 @@ test_invalid_parameters(void) return -1; } - ret = rte_flow_classify_table_entry_delete(NULL, 1, NULL); + ret = rte_flow_classify_table_entry_delete(NULL, NULL); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -89,14 +250,14 @@ test_invalid_parameters(void) return -1; } - ret = rte_flow_classifier_query(NULL, 1, NULL, 0, NULL, NULL); + ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL); if (!ret) { printf("Line %i: flow_classifier_query", __LINE__); printf(" with NULL param should have failed!\n"); return -1; } - rule = rte_flow_classify_table_entry_add(NULL, 1, NULL, NULL, NULL, + rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL, NULL, &error); if (rule) { printf("Line %i: flow_classify_table_entry_add ", __LINE__); @@ -104,7 +265,7 @@ test_invalid_parameters(void) return -1; } - ret = rte_flow_classify_table_entry_delete(NULL, 1, NULL); + ret = rte_flow_classify_table_entry_delete(NULL, NULL); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -112,7 +273,7 @@ test_invalid_parameters(void) return -1; } - ret = rte_flow_classifier_query(NULL, 1, NULL, 0, NULL, NULL); + ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL); if (!ret) { printf("Line %i: flow_classifier_query", __LINE__); printf(" with NULL param should have failed!\n"); @@ -129,7 +290,8 @@ test_valid_parameters(void) int key_found; /* - * set up parameters for rte_flow_classify_table_entry_add and + * set up parameters for rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -142,15 +304,24 @@ test_valid_parameters(void) actions[0] = count_action; actions[1] = end_action; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (ret) { + printf("Line %i: rte_flow_classify_validate", + __LINE__); + printf(" should not have failed!\n"); + return -1; + } + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); + if (!rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should not have failed!\n"); return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -168,7 +339,8 @@ test_invalid_patterns(void) int key_found; /* - * set up parameters for rte_flow_classify_table_entry_add and + * set up parameters for rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -183,15 +355,24 @@ test_invalid_patterns(void) pattern[0] = eth_item; pattern[1] = ipv4_udp_item_bad; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (!ret) { + printf("Line %i: rte_flow_classify_validate", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should have failed!\n"); return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -202,15 +383,24 @@ test_invalid_patterns(void) pattern[1] = ipv4_udp_item_1; pattern[2] = udp_item_bad; pattern[3] = end_item_bad; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (!ret) { + printf("Line %i: rte_flow_classify_validate", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should have failed!\n"); return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -228,7 +418,8 @@ test_invalid_actions(void) int key_found; /* - * set up parameters for rte_flow_classify_table_entry_add and + * set up parameters for rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -241,15 +432,23 @@ test_invalid_actions(void) actions[0] = count_action_bad; actions[1] = end_action; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (!ret) { + printf("Line %i: rte_flow_classify_validate", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should have failed!\n"); return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -260,15 +459,23 @@ test_invalid_actions(void) actions[0] = count_action; actions[1] = end_action_bad; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (!ret) { + printf("Line %i: rte_flow_classify_validate", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should have failed!\n"); return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (!ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -449,7 +656,8 @@ test_query_udp(void) bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; /* - * set up parameters for rte_flow_classify_table_entry_add and + * set up parameters for rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -462,15 +670,23 @@ test_query_udp(void) actions[0] = count_action; actions[1] = end_action; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (ret) { + printf("Line %i: rte_flow_classify_validate", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (!rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should not have failed!\n"); return -1; } - ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST, rule, &udp_classify_stats); if (ret) { printf("Line %i: flow_classifier_query", __LINE__); @@ -478,7 +694,7 @@ test_query_udp(void) return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -507,7 +723,8 @@ test_query_tcp(void) bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; /* - * set up parameters for rte_flow_classify_table_entry_add and + * set up parameters for rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -520,15 +737,23 @@ test_query_tcp(void) actions[0] = count_action; actions[1] = end_action; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (!rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should not have failed!\n"); return -1; } - ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST, rule, &tcp_classify_stats); if (ret) { printf("Line %i: flow_classifier_query", __LINE__); @@ -536,7 +761,7 @@ test_query_tcp(void) return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -565,7 +790,8 @@ test_query_sctp(void) bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; /* - * set up parameters rte_flow_classify_table_entry_add and + * set up parameters rte_flow_classify_validate, + * rte_flow_classify_table_entry_add and * rte_flow_classify_table_entry_delete */ @@ -578,15 +804,23 @@ test_query_sctp(void) actions[0] = count_action; actions[1] = end_action; - rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, - &attr, pattern, actions, &error); + ret = rte_flow_classify_validate(cls->cls, &attr, pattern, + actions, &error); + if (ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern, + actions, &key_found, &error); if (!rule) { printf("Line %i: flow_classify_table_entry_add", __LINE__); printf(" should not have failed!\n"); return -1; } - ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST, rule, &sctp_classify_stats); if (ret) { printf("Line %i: flow_classifier_query", __LINE__); @@ -594,7 +828,7 @@ test_query_sctp(void) return -1; } - ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + ret = rte_flow_classify_table_entry_delete(cls->cls, rule); if (ret) { printf("Line %i: rte_flow_classify_table_entry_delete", __LINE__); @@ -610,19 +844,15 @@ test_flow_classify(void) struct rte_table_acl_params table_acl_params; struct rte_flow_classify_table_params cls_table_params; struct rte_flow_classifier_params cls_params; - int socket_id; int ret; uint32_t size; - socket_id = rte_eth_dev_socket_id(0); - /* Memory allocation */ size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct flow_classifier_acl)); cls = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE); cls_params.name = "flow_classifier"; - cls_params.socket_id = socket_id; - cls_params.type = RTE_FLOW_CLASSIFY_TABLE_TYPE_ACL; + cls_params.socket_id = 0; cls->cls = rte_flow_classifier_create(&cls_params); /* initialise ACL table params */ @@ -632,11 +862,11 @@ test_flow_classify(void) memcpy(table_acl_params.field_format, ipv4_defs, sizeof(ipv4_defs)); /* initialise table create params */ - cls_table_params.ops = &rte_table_acl_ops, - cls_table_params.arg_create = &table_acl_params, + cls_table_params.ops = &rte_table_acl_ops; + cls_table_params.arg_create = &table_acl_params; + cls_table_params.type = RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; - ret = rte_flow_classify_table_create(cls->cls, &cls_table_params, - &cls->table_id[0]); + ret = rte_flow_classify_table_create(cls->cls, &cls_table_params); if (ret) { printf("Line %i: f_create has failed!\n", __LINE__); rte_flow_classifier_free(cls->cls); diff --git a/test/test/test_flow_classify.h b/test/test/test_flow_classify.h index 39535cfc..6bd10ec9 100644 --- a/test/test/test_flow_classify.h +++ b/test/test/test_flow_classify.h @@ -1,49 +1,10 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #ifndef TEST_FLOW_CLASSIFY_H_ #define TEST_FLOW_CLASSIFY_H_ -#define MAX_PKT_BURST (32) -#define NB_SOCKETS (1) -#define MEMPOOL_CACHE_SIZE (256) -#define MBUF_SIZE (512) -#define NB_MBUF (512) - -/* test UDP, TCP and SCTP packets */ -static struct rte_mempool *mbufpool[NB_SOCKETS]; -static struct rte_mbuf *bufs[MAX_PKT_BURST]; - /* ACL field definitions for IPv4 5 tuple rule */ enum { @@ -62,173 +23,4 @@ enum { SRCP_DESTP_INPUT_IPV4 }; -static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { - /* first input field - always one byte long. */ - { - .type = RTE_ACL_FIELD_TYPE_BITMASK, - .size = sizeof(uint8_t), - .field_index = PROTO_FIELD_IPV4, - .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), - }, - /* next input field (IPv4 source address) - 4 consecutive bytes. */ - { - /* rte_flow uses a bit mask for IPv4 addresses */ - .type = RTE_ACL_FIELD_TYPE_BITMASK, - .size = sizeof(uint32_t), - .field_index = SRC_FIELD_IPV4, - .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), - }, - /* next input field (IPv4 destination address) - 4 consecutive bytes. */ - { - /* rte_flow uses a bit mask for IPv4 addresses */ - .type = RTE_ACL_FIELD_TYPE_BITMASK, - .size = sizeof(uint32_t), - .field_index = DST_FIELD_IPV4, - .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), - }, - /* - * Next 2 fields (src & dst ports) form 4 consecutive bytes. - * They share the same input index. - */ - { - /* rte_flow uses a bit mask for protocol ports */ - .type = RTE_ACL_FIELD_TYPE_BITMASK, - .size = sizeof(uint16_t), - .field_index = SRCP_FIELD_IPV4, - .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + - sizeof(struct ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), - }, - { - /* rte_flow uses a bit mask for protocol ports */ - .type = RTE_ACL_FIELD_TYPE_BITMASK, - .size = sizeof(uint16_t), - .field_index = DSTP_FIELD_IPV4, - .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + - sizeof(struct ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), - }, -}; - -/* parameters for rte_flow_classify_validate and rte_flow_classify_create */ - -/* test UDP pattern: - * "eth / ipv4 src spec 2.2.2.3 src mask 255.255.255.00 dst spec 2.2.2.7 - * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" - */ -static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} -}; -static const struct rte_flow_item_ipv4 ipv4_mask_24 = { - .hdr = { - .next_proto_id = 0xff, - .src_addr = 0xffffff00, - .dst_addr = 0xffffff00, - }, -}; -static struct rte_flow_item_udp udp_spec_1 = { - { 32, 33, 0, 0 } -}; - -static struct rte_flow_item eth_item = { RTE_FLOW_ITEM_TYPE_ETH, - 0, 0, 0 }; -static struct rte_flow_item eth_item_bad = { -1, 0, 0, 0 }; - -static struct rte_flow_item ipv4_udp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, - &ipv4_udp_spec_1, 0, &ipv4_mask_24}; -static struct rte_flow_item ipv4_udp_item_bad = { RTE_FLOW_ITEM_TYPE_IPV4, - NULL, 0, NULL}; - -static struct rte_flow_item udp_item_1 = { RTE_FLOW_ITEM_TYPE_UDP, - &udp_spec_1, 0, &rte_flow_item_udp_mask}; -static struct rte_flow_item udp_item_bad = { RTE_FLOW_ITEM_TYPE_UDP, - NULL, 0, NULL}; - -static struct rte_flow_item end_item = { RTE_FLOW_ITEM_TYPE_END, - 0, 0, 0 }; -static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; - -/* test TCP pattern: - * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 - * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" - */ -static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} -}; - -static struct rte_flow_item_tcp tcp_spec_1 = { - { 16, 17, 0, 0, 0, 0, 0, 0, 0} -}; - -static struct rte_flow_item ipv4_tcp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, - &ipv4_tcp_spec_1, 0, &ipv4_mask_24}; - -static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, - &tcp_spec_1, 0, &rte_flow_item_tcp_mask}; - -/* test SCTP pattern: - * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 - * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" - */ -static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} -}; - -static struct rte_flow_item_sctp sctp_spec_1 = { - { 10, 11, 0, 0} -}; - -static struct rte_flow_item ipv4_sctp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, - &ipv4_sctp_spec_1, 0, &ipv4_mask_24}; - -static struct rte_flow_item sctp_item_1 = { RTE_FLOW_ITEM_TYPE_SCTP, - &sctp_spec_1, 0, &rte_flow_item_sctp_mask}; - - -/* test actions: - * "actions count / end" - */ -static struct rte_flow_action count_action = { RTE_FLOW_ACTION_TYPE_COUNT, 0}; -static struct rte_flow_action count_action_bad = { -1, 0}; - -static struct rte_flow_action end_action = { RTE_FLOW_ACTION_TYPE_END, 0}; -static struct rte_flow_action end_action_bad = { -1, 0}; - -static struct rte_flow_action actions[2]; - -/* test attributes */ -static struct rte_flow_attr attr; - -/* test error */ -static struct rte_flow_error error; - -/* test pattern */ -static struct rte_flow_item pattern[4]; - -/* flow classify data for UDP burst */ -static struct rte_flow_classify_ipv4_5tuple_stats udp_ntuple_stats; -static struct rte_flow_classify_stats udp_classify_stats = { - .stats = (void *)&udp_ntuple_stats -}; - -/* flow classify data for TCP burst */ -static struct rte_flow_classify_ipv4_5tuple_stats tcp_ntuple_stats; -static struct rte_flow_classify_stats tcp_classify_stats = { - .stats = (void *)&tcp_ntuple_stats -}; - -/* flow classify data for SCTP burst */ -static struct rte_flow_classify_ipv4_5tuple_stats sctp_ntuple_stats; -static struct rte_flow_classify_stats sctp_classify_stats = { - .stats = (void *)&sctp_ntuple_stats -}; #endif /* TEST_FLOW_CLASSIFY_H_ */ diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c index 514c8761..a0ed19d7 100644 --- a/test/test/test_func_reentrancy.c +++ b/test/test/test_func_reentrancy.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -110,6 +81,22 @@ test_eal_init_once(__attribute__((unused)) void *arg) /* * ring create/lookup reentrancy test */ +static void +ring_clean(unsigned int lcore_id) +{ + struct rte_ring *rp; + char ring_name[MAX_STRING_SIZE]; + int i; + + for (i = 0; i < MAX_ITER_TIMES; i++) { + snprintf(ring_name, sizeof(ring_name), + "fr_test_%d_%d", lcore_id, i); + rp = rte_ring_lookup(ring_name); + if (rp != NULL) + rte_ring_free(rp); + } +} + static int ring_create_lookup(__attribute__((unused)) void *arg) { @@ -156,6 +143,23 @@ my_obj_init(struct rte_mempool *mp, __attribute__((unused)) void *arg, *objnum = i; } +static void +mempool_clean(unsigned int lcore_id) +{ + struct rte_mempool *mp; + char mempool_name[MAX_STRING_SIZE]; + int i; + + /* verify all ring created successful */ + for (i = 0; i < MAX_ITER_TIMES; i++) { + snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", + lcore_id, i); + mp = rte_mempool_lookup(mempool_name); + if (mp != NULL) + rte_mempool_free(mp); + } +} + static int mempool_create_lookup(__attribute__((unused)) void *arg) { @@ -341,7 +345,7 @@ fbk_create_free(__attribute__((unused)) void *arg) #ifdef RTE_LIBRTE_LPM static void -lpm_clean(unsigned lcore_id) +lpm_clean(unsigned int lcore_id) { char lpm_name[MAX_STRING_SIZE]; struct rte_lpm *lpm; @@ -412,8 +416,9 @@ struct test_case{ /* All test cases in the test suite */ struct test_case test_cases[] = { { test_eal_init_once, NULL, NULL, "eal init once" }, - { ring_create_lookup, NULL, NULL, "ring create/lookup" }, - { mempool_create_lookup, NULL, NULL, "mempool create/lookup" }, + { ring_create_lookup, NULL, ring_clean, "ring create/lookup" }, + { mempool_create_lookup, NULL, mempool_clean, + "mempool create/lookup" }, #ifdef RTE_LIBRTE_HASH { hash_create_free, NULL, hash_clean, "hash create/free" }, { fbk_create_free, NULL, fbk_clean, "fbk create/free" }, diff --git a/test/test/test_hash.c b/test/test/test_hash.c index 4668cf1a..edf41f5a 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2015 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_hash_functions.c b/test/test/test_hash_functions.c index 9652b04d..c1fc9492 100644 --- a/test/test/test_hash_functions.c +++ b/test/test/test_hash_functions.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2015 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c index 4dcbd9d5..ef5fce3d 100644 --- a/test/test/test_hash_multiwriter.c +++ b/test/test/test_hash_multiwriter.c @@ -1,35 +1,7 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016 Intel Corporation */ + #include <inttypes.h> #include <locale.h> diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c index c0051b20..a81d0c79 100644 --- a/test/test/test_hash_perf.c +++ b/test/test/test_hash_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2015 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_hash_scaling.c b/test/test/test_hash_scaling.c index 46c48e54..07765a7e 100644 --- a/test/test/test_hash_scaling.c +++ b/test/test/test_hash_scaling.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_interrupts.c b/test/test/test_interrupts.c index e0cd8a82..31a70a0c 100644 --- a/test/test/test_interrupts.c +++ b/test/test/test_interrupts.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_kni.c b/test/test/test_kni.c index b9567275..e4839cdb 100644 --- a/test/test/test_kni.c +++ b/test/test/test_kni.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -39,6 +10,17 @@ #include "test.h" +#ifndef RTE_LIBRTE_KNI + +static int +test_kni(void) +{ + printf("KNI not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else + #include <rte_string_fns.h> #include <rte_mempool.h> #include <rte_ethdev.h> @@ -52,8 +34,8 @@ #define PKT_BURST_SZ 32 #define MEMPOOL_CACHE_SZ PKT_BURST_SZ #define SOCKET 0 -#define NB_RXD 128 -#define NB_TXD 512 +#define NB_RXD 1024 +#define NB_TXD 1024 #define KNI_TIMEOUT_MS 5000 /* ms */ #define IFCONFIG "/sbin/ifconfig " @@ -103,6 +85,8 @@ static const struct rte_eth_conf port_conf = { static struct rte_kni_ops kni_ops = { .change_mtu = NULL, .config_network_if = NULL, + .config_mac_address = NULL, + .config_promiscusity = NULL, }; static unsigned lcore_master, lcore_ingress, lcore_egress; @@ -260,6 +244,8 @@ test_kni_register_handler_mp(void) struct rte_kni_ops ops = { .change_mtu = kni_change_mtu, .config_network_if = NULL, + .config_mac_address = NULL, + .config_promiscusity = NULL, }; if (!kni) { @@ -634,4 +620,6 @@ fail: return ret; } +#endif + REGISTER_TEST_COMMAND(kni_autotest, test_kni); diff --git a/test/test/test_kvargs.c b/test/test/test_kvargs.c index 4d9e805b..e6738624 100644 --- a/test/test/test_kvargs.c +++ b/test/test/test_kvargs.c @@ -1,34 +1,5 @@ -/* +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2014 6WIND S.A. - * - * 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 6WIND S.A. 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. */ #include <stdlib.h> diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index c6e3a725..0ffd6509 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include "unistd.h" @@ -46,6 +17,7 @@ #include <rte_common.h> #include <rte_debug.h> #include <rte_ethdev.h> +#include <rte_ethdev_driver.h> #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h> @@ -59,13 +31,13 @@ #define TEST_MAX_NUMBER_OF_PORTS (6) -#define RX_RING_SIZE 128 +#define RX_RING_SIZE 1024 #define RX_FREE_THRESH 32 #define RX_PTHRESH 8 #define RX_HTHRESH 8 #define RX_WTHRESH 0 -#define TX_RING_SIZE 512 +#define TX_RING_SIZE 1024 #define TX_FREE_THRESH 32 #define TX_PTHRESH 32 #define TX_HTHRESH 0 diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index a7a3f8e2..426877a2 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -62,8 +33,8 @@ #define SLAVE_COUNT (4) -#define RX_RING_SIZE 128 -#define TX_RING_SIZE 512 +#define RX_RING_SIZE 1024 +#define TX_RING_SIZE 1024 #define MBUF_CACHE_SIZE (250) #define BURST_SIZE (32) diff --git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c index 54cbf128..4cc08f5a 100644 --- a/test/test/test_link_bonding_rssconf.c +++ b/test/test/test_link_bonding_rssconf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Intel Corporation */ #include <string.h> @@ -534,6 +505,7 @@ test_setup(void) int port_id; char name[256]; struct slave_conf *port; + struct ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { @@ -565,6 +537,10 @@ test_setup(void) TEST_ASSERT_SUCCESS(retval, "Failed to configure virtual ethdev %s\n", name); + /* assign a non-zero MAC */ + mac_addr.addr_bytes[5] = 0x10 + port->port_id; + rte_eth_dev_default_mac_addr_set(port->port_id, &mac_addr); + rte_eth_dev_info_get(port->port_id, &port->dev_info); } diff --git a/test/test/test_logs.c b/test/test/test_logs.c index d6e4973a..425ae03c 100644 --- a/test/test/test_logs.c +++ b/test/test/test_logs.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -45,6 +16,7 @@ #include "test.h" +/* for legacy log test */ #define RTE_LOGTYPE_TESTAPP1 RTE_LOGTYPE_USER1 #define RTE_LOGTYPE_TESTAPP2 RTE_LOGTYPE_USER2 @@ -56,10 +28,11 @@ * - Set log level. * - Send logs with different types and levels, some should not be displayed. */ - static int -test_logs(void) +test_legacy_logs(void) { + printf("== static log types\n"); + /* set logtype level low to so we can test global level */ rte_log_set_level(RTE_LOGTYPE_TESTAPP1, RTE_LOG_DEBUG); rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_DEBUG); @@ -85,4 +58,52 @@ test_logs(void) return 0; } +static int +test_logs(void) +{ + int logtype1, logtype2; + int ret; + + printf("== dynamic log types\n"); + + logtype1 = rte_log_register("logtype1"); + if (logtype1 < 0) { + printf("Cannot register logtype1\n"); + return -1; + } + logtype2 = rte_log_register("logtype2"); + if (logtype2 < 0) { + printf("Cannot register logtype2\n"); + return -1; + } + + /* set logtype level low to so we can test global level */ + rte_log_set_level(logtype1, RTE_LOG_DEBUG); + rte_log_set_level(logtype2, RTE_LOG_DEBUG); + + /* log in error level */ + rte_log_set_global_level(RTE_LOG_ERR); + rte_log(RTE_LOG_ERR, logtype1, "error message\n"); + rte_log(RTE_LOG_CRIT, logtype1, "critical message\n"); + + /* log in critical level */ + rte_log_set_global_level(RTE_LOG_CRIT); + rte_log(RTE_LOG_ERR, logtype2, "error message (not displayed)\n"); + rte_log(RTE_LOG_CRIT, logtype2, "critical message\n"); + + /* bump up single log type level above global to test it */ + rte_log_set_level(logtype2, RTE_LOG_EMERG); + + /* log in error level */ + rte_log_set_global_level(RTE_LOG_ERR); + rte_log(RTE_LOG_ERR, logtype1, "error message\n"); + rte_log(RTE_LOG_ERR, logtype2, "error message (not displayed)\n"); + + ret = test_legacy_logs(); + if (ret < 0) + return ret; + + return 0; +} + REGISTER_TEST_COMMAND(logs_autotest, test_logs); diff --git a/test/test/test_lpm.c b/test/test/test_lpm.c index 41ae80fe..5d697dd0 100644 --- a/test/test/test_lpm.c +++ b/test/test/test_lpm.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_lpm6.c b/test/test/test_lpm6.c index e0e7bf02..670aadb4 100644 --- a/test/test/test_lpm6.c +++ b/test/test/test_lpm6.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_lpm6_data.h b/test/test/test_lpm6_data.h index c3573b2b..565138a3 100644 --- a/test/test/test_lpm6_data.h +++ b/test/test/test_lpm6_data.h @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #ifndef _TEST_LPM_ROUTES_H_ #define _TEST_LPM_ROUTES_H_ diff --git a/test/test/test_lpm6_perf.c b/test/test/test_lpm6_perf.c index 30be430f..0b43ad82 100644 --- a/test/test/test_lpm6_perf.c +++ b/test/test/test_lpm6_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_lpm_perf.c b/test/test/test_lpm_perf.c index e7e1281b..3b98ce0c 100644 --- a/test/test/test_lpm_perf.c +++ b/test/test/test_lpm_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c index 4572cafb..d23192cf 100644 --- a/test/test/test_malloc.c +++ b/test/test/test_malloc.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_mbuf.c b/test/test/test_mbuf.c index 414509b2..9e82a20b 100644 --- a/test/test/test_mbuf.c +++ b/test/test/test_mbuf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> diff --git a/test/test/test_member.c b/test/test/test_member.c index 02375fdc..e2a3932f 100644 --- a/test/test/test_member.c +++ b/test/test/test_member.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ /* This test is for membership library's simple feature test */ diff --git a/test/test/test_member_perf.c b/test/test/test_member_perf.c index e13066f1..564a2b3c 100644 --- a/test/test/test_member_perf.c +++ b/test/test/test_member_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_memcpy.c b/test/test/test_memcpy.c index 1d93dd53..2c69ad96 100644 --- a/test/test/test_memcpy.c +++ b/test/test/test_memcpy.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdint.h> diff --git a/test/test/test_memcpy_perf.c b/test/test/test_memcpy_perf.c index f1084ca1..6f436f3e 100644 --- a/test/test/test_memcpy_perf.c +++ b/test/test/test_memcpy_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdint.h> diff --git a/test/test/test_memory.c b/test/test/test_memory.c index 921bdc88..972321f1 100644 --- a/test/test/test_memory.c +++ b/test/test/test_memory.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c index 37ead503..63f921e2 100644 --- a/test/test/test_mempool.c +++ b/test/test/test_mempool.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -54,6 +25,7 @@ #include <rte_mempool.h> #include <rte_spinlock.h> #include <rte_malloc.h> +#include <rte_mbuf_pool_ops.h> #include "test.h" @@ -514,6 +486,7 @@ test_mempool(void) struct rte_mempool *mp_nocache = NULL; struct rte_mempool *mp_stack = NULL; struct rte_mempool *default_pool = NULL; + const char *default_pool_ops = rte_mbuf_best_mempool_ops(); rte_atomic32_init(&synchro); @@ -564,8 +537,7 @@ test_mempool(void) rte_mempool_obj_iter(mp_stack, my_obj_init, NULL); /* Create a mempool based on Default handler */ - printf("Testing %s mempool handler\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + printf("Testing %s mempool handler\n", default_pool_ops); default_pool = rte_mempool_create_empty("default_pool", MEMPOOL_SIZE, MEMPOOL_ELT_SIZE, @@ -577,14 +549,12 @@ test_mempool(void) goto err; } if (rte_mempool_set_ops_byname(default_pool, - RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) { - printf("cannot set %s handler\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + default_pool_ops, NULL) < 0) { + printf("cannot set %s handler\n", default_pool_ops); goto err; } if (rte_mempool_populate_default(default_pool) < 0) { - printf("cannot populate %s mempool\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + printf("cannot populate %s mempool\n", default_pool_ops); goto err; } rte_mempool_obj_iter(default_pool, my_obj_init, NULL); diff --git a/test/test/test_mempool_perf.c b/test/test/test_mempool_perf.c index 749b364e..4c877834 100644 --- a/test/test/test_mempool_perf.c +++ b/test/test/test_mempool_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -54,6 +25,7 @@ #include <rte_mempool.h> #include <rte_spinlock.h> #include <rte_malloc.h> +#include <rte_mbuf_pool_ops.h> #include "test.h" @@ -313,6 +285,7 @@ test_mempool_perf(void) struct rte_mempool *mp_cache = NULL; struct rte_mempool *mp_nocache = NULL; struct rte_mempool *default_pool = NULL; + const char *default_pool_ops; int ret = -1; rte_atomic32_init(&synchro); @@ -336,6 +309,7 @@ test_mempool_perf(void) if (mp_cache == NULL) goto err; + default_pool_ops = rte_mbuf_best_mempool_ops(); /* Create a mempool based on Default handler */ default_pool = rte_mempool_create_empty("default_pool", MEMPOOL_SIZE, @@ -344,21 +318,18 @@ test_mempool_perf(void) SOCKET_ID_ANY, 0); if (default_pool == NULL) { - printf("cannot allocate %s mempool\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + printf("cannot allocate %s mempool\n", default_pool_ops); goto err; } - if (rte_mempool_set_ops_byname(default_pool, - RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) + if (rte_mempool_set_ops_byname(default_pool, default_pool_ops, NULL) < 0) { - printf("cannot set %s handler\n", RTE_MBUF_DEFAULT_MEMPOOL_OPS); + printf("cannot set %s handler\n", default_pool_ops); goto err; } if (rte_mempool_populate_default(default_pool) < 0) { - printf("cannot populate %s mempool\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + printf("cannot populate %s mempool\n", default_pool_ops); goto err; } @@ -378,7 +349,7 @@ test_mempool_perf(void) /* performance test with 1, 2 and max cores */ printf("start performance test for %s (without cache)\n", - RTE_MBUF_DEFAULT_MEMPOOL_OPS); + default_pool_ops); if (do_one_mempool_test(default_pool, 1) < 0) goto err; diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c index 1cf235a9..8ece1ac8 100644 --- a/test/test/test_memzone.c +++ b/test/test/test_memzone.c @@ -1,38 +1,10 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> #include <stdint.h> +#include <string.h> #include <inttypes.h> #include <sys/queue.h> @@ -76,6 +48,8 @@ * - Check flags for specific huge page size reservation */ +#define TEST_MEMZONE_NAME(suffix) "MZ_TEST_" suffix + /* Test if memory overlaps: return 1 if true, or 0 if false. */ static int is_memory_overlap(rte_iova_t ptr1, size_t len1, rte_iova_t ptr2, size_t len2) @@ -92,14 +66,14 @@ test_memzone_invalid_alignment(void) { const struct rte_memzone * mz; - mz = rte_memzone_lookup("invalid_alignment"); + mz = rte_memzone_lookup(TEST_MEMZONE_NAME("invalid_alignment")); if (mz != NULL) { printf("Zone with invalid alignment has been reserved\n"); return -1; } - mz = rte_memzone_reserve_aligned("invalid_alignment", 100, - SOCKET_ID_ANY, 0, 100); + mz = rte_memzone_reserve_aligned(TEST_MEMZONE_NAME("invalid_alignment"), + 100, SOCKET_ID_ANY, 0, 100); if (mz != NULL) { printf("Zone with invalid alignment has been reserved\n"); return -1; @@ -112,14 +86,16 @@ test_memzone_reserving_zone_size_bigger_than_the_maximum(void) { const struct rte_memzone * mz; - mz = rte_memzone_lookup("zone_size_bigger_than_the_maximum"); + mz = rte_memzone_lookup( + TEST_MEMZONE_NAME("zone_size_bigger_than_the_maximum")); if (mz != NULL) { printf("zone_size_bigger_than_the_maximum has been reserved\n"); return -1; } - mz = rte_memzone_reserve("zone_size_bigger_than_the_maximum", (size_t)-1, - SOCKET_ID_ANY, 0); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("zone_size_bigger_than_the_maximum"), + (size_t)-1, SOCKET_ID_ANY, 0); if (mz != NULL) { printf("It is impossible to reserve such big a memzone\n"); return -1; @@ -166,8 +142,8 @@ test_memzone_reserve_flags(void) * available page size (i.e 1GB ) when 2MB pages are unavailable. */ if (hugepage_2MB_avail) { - mz = rte_memzone_reserve("flag_zone_2M", size, SOCKET_ID_ANY, - RTE_MEMZONE_2MB); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_2M"), + size, SOCKET_ID_ANY, RTE_MEMZONE_2MB); if (mz == NULL) { printf("MEMZONE FLAG 2MB\n"); return -1; @@ -181,7 +157,8 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY, + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_2M_HINT"), + size, SOCKET_ID_ANY, RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 2MB\n"); @@ -200,7 +177,9 @@ test_memzone_reserve_flags(void) * HINT flag is indicated */ if (!hugepage_1GB_avail) { - mz = rte_memzone_reserve("flag_zone_1G_HINT", size, SOCKET_ID_ANY, + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_1G_HINT"), + size, SOCKET_ID_ANY, RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 1GB & HINT\n"); @@ -215,8 +194,9 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_1G", size, SOCKET_ID_ANY, - RTE_MEMZONE_1GB); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_1G"), size, + SOCKET_ID_ANY, RTE_MEMZONE_1GB); if (mz != NULL) { printf("MEMZONE FLAG 1GB\n"); return -1; @@ -226,8 +206,8 @@ test_memzone_reserve_flags(void) /*As with 2MB tests above for 1GB huge page requests*/ if (hugepage_1GB_avail) { - mz = rte_memzone_reserve("flag_zone_1G", size, SOCKET_ID_ANY, - RTE_MEMZONE_1GB); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_1G"), + size, SOCKET_ID_ANY, RTE_MEMZONE_1GB); if (mz == NULL) { printf("MEMZONE FLAG 1GB\n"); return -1; @@ -241,7 +221,8 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_1G_HINT", size, SOCKET_ID_ANY, + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_1G_HINT"), + size, SOCKET_ID_ANY, RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 1GB\n"); @@ -260,7 +241,9 @@ test_memzone_reserve_flags(void) * HINT flag is indicated */ if (!hugepage_2MB_avail) { - mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY, + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_2M_HINT"), + size, SOCKET_ID_ANY, RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL){ printf("MEMZONE FLAG 2MB & HINT\n"); @@ -274,25 +257,33 @@ test_memzone_reserve_flags(void) printf("Fail memzone free\n"); return -1; } - mz = rte_memzone_reserve("flag_zone_2M", size, SOCKET_ID_ANY, - RTE_MEMZONE_2MB); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_2M"), size, + SOCKET_ID_ANY, RTE_MEMZONE_2MB); if (mz != NULL) { printf("MEMZONE FLAG 2MB\n"); return -1; } - if (rte_memzone_free(mz)) { - printf("Fail memzone free\n"); - return -1; - } } if (hugepage_2MB_avail && hugepage_1GB_avail) { - mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY, - RTE_MEMZONE_2MB|RTE_MEMZONE_1GB); - if (mz != NULL) { + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_2M_HINT"), + size, SOCKET_ID_ANY, + RTE_MEMZONE_2MB|RTE_MEMZONE_1GB); + if (mz == NULL) { printf("BOTH SIZES SET\n"); return -1; } + if (mz->hugepage_sz != RTE_PGSIZE_1G && + mz->hugepage_sz != RTE_PGSIZE_2M) { + printf("Wrong size when both sizes set\n"); + return -1; + } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } } } /* @@ -303,8 +294,8 @@ test_memzone_reserve_flags(void) * page size (i.e 16GB ) when 16MB pages are unavailable. */ if (hugepage_16MB_avail) { - mz = rte_memzone_reserve("flag_zone_16M", size, SOCKET_ID_ANY, - RTE_MEMZONE_16MB); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_16M"), + size, SOCKET_ID_ANY, RTE_MEMZONE_16MB); if (mz == NULL) { printf("MEMZONE FLAG 16MB\n"); return -1; @@ -318,10 +309,12 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_16M_HINT", size, - SOCKET_ID_ANY, RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16M_HINT"), size, + SOCKET_ID_ANY, + RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { - printf("MEMZONE FLAG 2MB\n"); + printf("MEMZONE FLAG 16MB\n"); return -1; } if (mz->hugepage_sz != RTE_PGSIZE_16M) { @@ -337,9 +330,11 @@ test_memzone_reserve_flags(void) * unless HINT flag is indicated */ if (!hugepage_16GB_avail) { - mz = rte_memzone_reserve("flag_zone_16G_HINT", size, - SOCKET_ID_ANY, - RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16G_HINT"), + size, SOCKET_ID_ANY, + RTE_MEMZONE_16GB | + RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 16GB & HINT\n"); return -1; @@ -353,8 +348,10 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_16G", size, - SOCKET_ID_ANY, RTE_MEMZONE_16GB); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16G"), + size, + SOCKET_ID_ANY, RTE_MEMZONE_16GB); if (mz != NULL) { printf("MEMZONE FLAG 16GB\n"); return -1; @@ -363,8 +360,8 @@ test_memzone_reserve_flags(void) } /*As with 16MB tests above for 16GB huge page requests*/ if (hugepage_16GB_avail) { - mz = rte_memzone_reserve("flag_zone_16G", size, SOCKET_ID_ANY, - RTE_MEMZONE_16GB); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("flag_zone_16G"), + size, SOCKET_ID_ANY, RTE_MEMZONE_16GB); if (mz == NULL) { printf("MEMZONE FLAG 16GB\n"); return -1; @@ -378,8 +375,10 @@ test_memzone_reserve_flags(void) return -1; } - mz = rte_memzone_reserve("flag_zone_16G_HINT", size, - SOCKET_ID_ANY, RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16G_HINT"), size, + SOCKET_ID_ANY, + RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 16GB\n"); return -1; @@ -397,9 +396,11 @@ test_memzone_reserve_flags(void) * unless HINT flag is indicated */ if (!hugepage_16MB_avail) { - mz = rte_memzone_reserve("flag_zone_16M_HINT", size, - SOCKET_ID_ANY, - RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16M_HINT"), + size, SOCKET_ID_ANY, + RTE_MEMZONE_16MB | + RTE_MEMZONE_SIZE_HINT_ONLY); if (mz == NULL) { printf("MEMZONE FLAG 16MB & HINT\n"); return -1; @@ -412,8 +413,9 @@ test_memzone_reserve_flags(void) printf("Fail memzone free\n"); return -1; } - mz = rte_memzone_reserve("flag_zone_16M", size, - SOCKET_ID_ANY, RTE_MEMZONE_16MB); + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16M"), + size, SOCKET_ID_ANY, RTE_MEMZONE_16MB); if (mz != NULL) { printf("MEMZONE FLAG 16MB\n"); return -1; @@ -421,13 +423,23 @@ test_memzone_reserve_flags(void) } if (hugepage_16MB_avail && hugepage_16GB_avail) { - mz = rte_memzone_reserve("flag_zone_16M_HINT", size, - SOCKET_ID_ANY, - RTE_MEMZONE_16MB|RTE_MEMZONE_16GB); - if (mz != NULL) { + mz = rte_memzone_reserve( + TEST_MEMZONE_NAME("flag_zone_16M_HINT"), + size, SOCKET_ID_ANY, + RTE_MEMZONE_16MB|RTE_MEMZONE_16GB); + if (mz == NULL) { printf("BOTH SIZES SET\n"); return -1; } + if (mz->hugepage_sz != RTE_PGSIZE_16G && + mz->hugepage_sz != RTE_PGSIZE_16M) { + printf("Wrong size when both sizes set\n"); + return -1; + } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } } } return 0; @@ -470,7 +482,8 @@ test_memzone_reserve_max(void) return 0; } - mz = rte_memzone_reserve("max_zone", 0, SOCKET_ID_ANY, 0); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("max_zone"), 0, + SOCKET_ID_ANY, 0); if (mz == NULL){ printf("Failed to reserve a big chunk of memory - %s\n", rte_strerror(rte_errno)); @@ -512,8 +525,8 @@ test_memzone_reserve_max_aligned(void) return 0; } - mz = rte_memzone_reserve_aligned("max_zone_aligned", 0, - SOCKET_ID_ANY, 0, align); + mz = rte_memzone_reserve_aligned(TEST_MEMZONE_NAME("max_zone_aligned"), + 0, SOCKET_ID_ANY, 0, align); if (mz == NULL){ printf("Failed to reserve a big chunk of memory - %s\n", rte_strerror(rte_errno)); @@ -550,24 +563,29 @@ test_memzone_aligned(void) const struct rte_memzone *memzone_aligned_1024; /* memzone that should automatically be adjusted to align on 64 bytes */ - memzone_aligned_32 = rte_memzone_reserve_aligned("aligned_32", 100, - SOCKET_ID_ANY, 0, 32); + memzone_aligned_32 = rte_memzone_reserve_aligned( + TEST_MEMZONE_NAME("aligned_32"), 100, SOCKET_ID_ANY, 0, + 32); /* memzone that is supposed to be aligned on a 128 byte boundary */ - memzone_aligned_128 = rte_memzone_reserve_aligned("aligned_128", 100, - SOCKET_ID_ANY, 0, 128); + memzone_aligned_128 = rte_memzone_reserve_aligned( + TEST_MEMZONE_NAME("aligned_128"), 100, SOCKET_ID_ANY, 0, + 128); /* memzone that is supposed to be aligned on a 256 byte boundary */ - memzone_aligned_256 = rte_memzone_reserve_aligned("aligned_256", 100, - SOCKET_ID_ANY, 0, 256); + memzone_aligned_256 = rte_memzone_reserve_aligned( + TEST_MEMZONE_NAME("aligned_256"), 100, SOCKET_ID_ANY, 0, + 256); /* memzone that is supposed to be aligned on a 512 byte boundary */ - memzone_aligned_512 = rte_memzone_reserve_aligned("aligned_512", 100, - SOCKET_ID_ANY, 0, 512); + memzone_aligned_512 = rte_memzone_reserve_aligned( + TEST_MEMZONE_NAME("aligned_512"), 100, SOCKET_ID_ANY, 0, + 512); /* memzone that is supposed to be aligned on a 1024 byte boundary */ - memzone_aligned_1024 = rte_memzone_reserve_aligned("aligned_1024", 100, - SOCKET_ID_ANY, 0, 1024); + memzone_aligned_1024 = rte_memzone_reserve_aligned( + TEST_MEMZONE_NAME("aligned_1024"), 100, SOCKET_ID_ANY, + 0, 1024); printf("check alignments and lengths\n"); if (memzone_aligned_32 == NULL) { @@ -736,37 +754,46 @@ static int test_memzone_bounded(void) { const struct rte_memzone *memzone_err; - const char *name; int rc; /* should fail as boundary is not power of two */ - name = "bounded_error_31"; - if ((memzone_err = rte_memzone_reserve_bounded(name, - 100, SOCKET_ID_ANY, 0, 32, UINT32_MAX)) != NULL) { + memzone_err = rte_memzone_reserve_bounded( + TEST_MEMZONE_NAME("bounded_error_31"), 100, + SOCKET_ID_ANY, 0, 32, UINT32_MAX); + if (memzone_err != NULL) { printf("%s(%s)created a memzone with invalid boundary " "conditions\n", __func__, memzone_err->name); return -1; } /* should fail as len is greater then boundary */ - name = "bounded_error_32"; - if ((memzone_err = rte_memzone_reserve_bounded(name, - 100, SOCKET_ID_ANY, 0, 32, 32)) != NULL) { + memzone_err = rte_memzone_reserve_bounded( + TEST_MEMZONE_NAME("bounded_error_32"), 100, + SOCKET_ID_ANY, 0, 32, 32); + if (memzone_err != NULL) { printf("%s(%s)created a memzone with invalid boundary " "conditions\n", __func__, memzone_err->name); return -1; } - if ((rc = check_memzone_bounded("bounded_128", 100, 128, 128)) != 0) + rc = check_memzone_bounded(TEST_MEMZONE_NAME("bounded_128"), 100, 128, + 128); + if (rc != 0) return rc; - if ((rc = check_memzone_bounded("bounded_256", 100, 256, 128)) != 0) + rc = check_memzone_bounded(TEST_MEMZONE_NAME("bounded_256"), 100, 256, + 128); + if (rc != 0) return rc; - if ((rc = check_memzone_bounded("bounded_1K", 100, 64, 1024)) != 0) + rc = check_memzone_bounded(TEST_MEMZONE_NAME("bounded_1K"), 100, 64, + 1024); + if (rc != 0) return rc; - if ((rc = check_memzone_bounded("bounded_1K_MAX", 0, 64, 1024)) != 0) + rc = check_memzone_bounded(TEST_MEMZONE_NAME("bounded_1K_MAX"), 0, 64, + 1024); + if (rc != 0) return rc; return 0; @@ -775,29 +802,32 @@ test_memzone_bounded(void) static int test_memzone_free(void) { - const struct rte_memzone *mz[RTE_MAX_MEMZONE]; + const struct rte_memzone *mz[RTE_MAX_MEMZONE + 1]; int i; char name[20]; - mz[0] = rte_memzone_reserve("tempzone0", 2000, SOCKET_ID_ANY, 0); - mz[1] = rte_memzone_reserve("tempzone1", 4000, SOCKET_ID_ANY, 0); + mz[0] = rte_memzone_reserve(TEST_MEMZONE_NAME("tempzone0"), 2000, + SOCKET_ID_ANY, 0); + mz[1] = rte_memzone_reserve(TEST_MEMZONE_NAME("tempzone1"), 4000, + SOCKET_ID_ANY, 0); if (mz[0] > mz[1]) return -1; - if (!rte_memzone_lookup("tempzone0")) + if (!rte_memzone_lookup(TEST_MEMZONE_NAME("tempzone0"))) return -1; - if (!rte_memzone_lookup("tempzone1")) + if (!rte_memzone_lookup(TEST_MEMZONE_NAME("tempzone1"))) return -1; if (rte_memzone_free(mz[0])) { printf("Fail memzone free - tempzone0\n"); return -1; } - if (rte_memzone_lookup("tempzone0")) { + if (rte_memzone_lookup(TEST_MEMZONE_NAME("tempzone0"))) { printf("Found previously free memzone - tempzone0\n"); return -1; } - mz[2] = rte_memzone_reserve("tempzone2", 2000, SOCKET_ID_ANY, 0); + mz[2] = rte_memzone_reserve(TEST_MEMZONE_NAME("tempzone2"), 2000, + SOCKET_ID_ANY, 0); if (mz[2] > mz[1]) { printf("tempzone2 should have gotten the free entry from tempzone0\n"); @@ -807,7 +837,7 @@ test_memzone_free(void) printf("Fail memzone free - tempzone2\n"); return -1; } - if (rte_memzone_lookup("tempzone2")) { + if (rte_memzone_lookup(TEST_MEMZONE_NAME("tempzone2"))) { printf("Found previously free memzone - tempzone2\n"); return -1; } @@ -815,14 +845,15 @@ test_memzone_free(void) printf("Fail memzone free - tempzone1\n"); return -1; } - if (rte_memzone_lookup("tempzone1")) { + if (rte_memzone_lookup(TEST_MEMZONE_NAME("tempzone1"))) { printf("Found previously free memzone - tempzone1\n"); return -1; } i = 0; do { - snprintf(name, sizeof(name), "tempzone%u", i); + snprintf(name, sizeof(name), TEST_MEMZONE_NAME("tempzone%u"), + i); mz[i] = rte_memzone_reserve(name, 1, SOCKET_ID_ANY, 0); } while (mz[i++] != NULL); @@ -830,7 +861,8 @@ test_memzone_free(void) printf("Fail memzone free - tempzone0\n"); return -1; } - mz[0] = rte_memzone_reserve("tempzone0new", 0, SOCKET_ID_ANY, 0); + mz[0] = rte_memzone_reserve(TEST_MEMZONE_NAME("tempzone0new"), 0, + SOCKET_ID_ANY, 0); if (mz[0] == NULL) { printf("Fail to create memzone - tempzone0new - when MAX memzones were " @@ -856,23 +888,38 @@ test_memzone_basic(void) const struct rte_memzone *memzone3; const struct rte_memzone *memzone4; const struct rte_memzone *mz; + int memzone_cnt_after, memzone_cnt_expected; + int memzone_cnt_before = + rte_eal_get_configuration()->mem_config->memzone_cnt; - memzone1 = rte_memzone_reserve("testzone1", 100, + memzone1 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone1"), 100, SOCKET_ID_ANY, 0); - memzone2 = rte_memzone_reserve("testzone2", 1000, + memzone2 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone2"), 1000, 0, 0); - memzone3 = rte_memzone_reserve("testzone3", 1000, + memzone3 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone3"), 1000, 1, 0); - memzone4 = rte_memzone_reserve("testzone4", 1024, + memzone4 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone4"), 1024, SOCKET_ID_ANY, 0); /* memzone3 may be NULL if we don't have NUMA */ if (memzone1 == NULL || memzone2 == NULL || memzone4 == NULL) return -1; + /* check how many memzones we are expecting */ + memzone_cnt_expected = memzone_cnt_before + + (memzone1 != NULL) + (memzone2 != NULL) + + (memzone3 != NULL) + (memzone4 != NULL); + + memzone_cnt_after = + rte_eal_get_configuration()->mem_config->memzone_cnt; + + if (memzone_cnt_after != memzone_cnt_expected) + return -1; + + rte_memzone_dump(stdout); /* check cache-line alignments */ @@ -918,12 +965,12 @@ test_memzone_basic(void) return -1; printf("test zone lookup\n"); - mz = rte_memzone_lookup("testzone1"); + mz = rte_memzone_lookup(TEST_MEMZONE_NAME("testzone1")); if (mz != memzone1) return -1; printf("test duplcate zone name\n"); - mz = rte_memzone_reserve("testzone1", 100, + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone1"), 100, SOCKET_ID_ANY, 0); if (mz != NULL) return -1; @@ -945,19 +992,30 @@ test_memzone_basic(void) return -1; } + memzone_cnt_after = + rte_eal_get_configuration()->mem_config->memzone_cnt; + if (memzone_cnt_after != memzone_cnt_before) + return -1; + return 0; } -static int memzone_calk_called; -static void memzone_walk_clb(const struct rte_memzone *mz __rte_unused, +static int test_memzones_left; +static int memzone_walk_cnt; +static void memzone_walk_clb(const struct rte_memzone *mz, void *arg __rte_unused) { - memzone_calk_called = 1; + memzone_walk_cnt++; + if (!strncmp(TEST_MEMZONE_NAME(""), mz->name, RTE_MEMZONE_NAMESIZE)) + test_memzones_left++; } static int test_memzone(void) { + /* take note of how many memzones were allocated before running */ + int memzone_cnt = rte_eal_get_configuration()->mem_config->memzone_cnt; + printf("test basic memzone API\n"); if (test_memzone_basic() < 0) return -1; @@ -995,8 +1053,10 @@ test_memzone(void) return -1; printf("check memzone cleanup\n"); + memzone_walk_cnt = 0; + test_memzones_left = 0; rte_memzone_walk(memzone_walk_clb, NULL); - if (memzone_calk_called) { + if (memzone_walk_cnt != memzone_cnt || test_memzones_left > 0) { printf("there are some memzones left after test\n"); rte_memzone_dump(stdout); return -1; diff --git a/test/test/test_meter.c b/test/test/test_meter.c index 26b05657..9f6abf99 100644 --- a/test/test/test_meter.c +++ b/test/test/test_meter.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdlib.h> diff --git a/test/test/test_mp_secondary.c b/test/test/test_mp_secondary.c index 0b93a2de..cc46cf4d 100644 --- a/test/test/test_mp_secondary.c +++ b/test/test/test_mp_secondary.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_per_lcore.c b/test/test/test_per_lcore.c index 4eb7fe2c..19b55f26 100644 --- a/test/test/test_per_lcore.c +++ b/test/test/test_per_lcore.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index 255f2607..911dd762 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ @@ -48,8 +19,8 @@ #define NB_SOCKETS (2) #define MEMPOOL_CACHE_SIZE 250 #define MAX_PKT_BURST (32) -#define RTE_TEST_RX_DESC_DEFAULT (128) -#define RTE_TEST_TX_DESC_DEFAULT (512) +#define RTE_TEST_RX_DESC_DEFAULT (1024) +#define RTE_TEST_TX_DESC_DEFAULT (1024) #define RTE_PORT_ALL (~(uint16_t)0x0) /* how long test would take at full line rate */ @@ -321,10 +292,10 @@ alloc_lcore(uint16_t socketid) return (uint16_t)-1; } -volatile uint64_t stop; -uint64_t count; -uint64_t drop; -uint64_t idle; +static volatile uint64_t stop; +static uint64_t count; +static uint64_t drop; +static uint64_t idle; static void reset_count(void) @@ -557,7 +528,7 @@ main_loop(__rte_unused void *args) return 0; } -rte_atomic64_t start; +static rte_atomic64_t start; static inline int poll_burst(void *args) diff --git a/test/test/test_pmd_ring.c b/test/test/test_pmd_ring.c index 2cdf60d1..4b891014 100644 --- a/test/test/test_pmd_ring.c +++ b/test/test/test_pmd_ring.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2015 Intel Corporation */ #include "test.h" diff --git a/test/test/test_pmd_ring_perf.c b/test/test/test_pmd_ring_perf.c index 8e9cd331..ad5004a6 100644 --- a/test/test/test_pmd_ring_perf.c +++ b/test/test/test_pmd_ring_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Intel Corporation */ diff --git a/test/test/test_power.c b/test/test/test_power.c index b2e1344c..a0ee2198 100644 --- a/test/test/test_power.c +++ b/test/test/test_power.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -39,6 +10,17 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else + #include <rte_power.h> static int @@ -103,5 +85,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_autotest, test_power); diff --git a/test/test/test_power_acpi_cpufreq.c b/test/test/test_power_acpi_cpufreq.c index 64f5dd56..3bfd0335 100644 --- a/test/test/test_power_acpi_cpufreq.c +++ b/test/test/test_power_acpi_cpufreq.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -39,6 +10,16 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_acpi_cpufreq(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include <rte_power.h> #define TEST_POWER_LCORE_ID 2U @@ -536,5 +517,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_acpi_cpufreq_autotest, test_power_acpi_cpufreq); diff --git a/test/test/test_power_kvm_vm.c b/test/test/test_power_kvm_vm.c index 253a5f8b..91b31c44 100644 --- a/test/test/test_power_kvm_vm.c +++ b/test/test/test_power_kvm_vm.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -39,6 +10,16 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_kvm_vm(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include <rte_power.h> #define TEST_POWER_VM_LCORE_ID 0U @@ -299,5 +280,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_kvm_vm_autotest, test_power_kvm_vm); diff --git a/test/test/test_prefetch.c b/test/test/test_prefetch.c index 80afaaf3..41f219af 100644 --- a/test/test/test_prefetch.c +++ b/test/test/test_prefetch.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_rawdev.c b/test/test/test_rawdev.c new file mode 100644 index 00000000..043a38a1 --- /dev/null +++ b/test/test/test_rawdev.c @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 NXP + */ +#include <rte_common.h> +#include <rte_mbuf.h> +#include <rte_malloc.h> +#include <rte_memcpy.h> +#include <rte_dev.h> +#include <rte_rawdev.h> +#include <rte_bus_vdev.h> + +#include "test.h" + +static int +test_rawdev_selftest_impl(const char *pmd, const char *opts) +{ + rte_vdev_init(pmd, opts); + return rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd)); +} + +static int +test_rawdev_selftest_skeleton(void) +{ + return test_rawdev_selftest_impl("rawdev_skeleton", ""); +} + +REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton); diff --git a/test/test/test_reciprocal_division.c b/test/test/test_reciprocal_division.c new file mode 100644 index 00000000..8ea9b1d2 --- /dev/null +++ b/test/test/test_reciprocal_division.c @@ -0,0 +1,167 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc + */ + +#include "test.h" + +#include <stdio.h> +#include <unistd.h> +#include <inttypes.h> + +#include <rte_common.h> +#include <rte_cycles.h> +#include <rte_random.h> +#include <rte_reciprocal.h> + +#define MAX_ITERATIONS (1ULL << 32) +#define DIVIDE_ITER (100) + +static int +test_reciprocal(void) +{ + int result = 0; + uint32_t divisor_u32 = 0; + uint32_t dividend_u32; + uint32_t nresult_u32; + uint32_t rresult_u32; + uint64_t i, j; + uint64_t divisor_u64 = 0; + uint64_t dividend_u64; + uint64_t nresult_u64; + uint64_t rresult_u64; + struct rte_reciprocal reci_u32 = {0}; + struct rte_reciprocal_u64 reci_u64 = {0}; + + rte_srand(rte_rdtsc()); + printf("Validating unsigned 32bit division.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u32 = rte_rand(); + reci_u32 = rte_reciprocal_value(divisor_u32); + } + + dividend_u32 = rte_rand(); + nresult_u32 = dividend_u32 / divisor_u32; + rresult_u32 = rte_reciprocal_divide(dividend_u32, + reci_u32); + if (nresult_u32 != rresult_u32) { + printf("Division failed, %"PRIu32"/%"PRIu32" = " + "expected %"PRIu32" result %"PRIu32"\n", + dividend_u32, divisor_u32, + nresult_u32, rresult_u32); + result = 1; + break; + } + } + + printf("Validating unsigned 64bit division.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u64 = rte_rand(); + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + } + + dividend_u64 = rte_rand(); + nresult_u64 = dividend_u64 / divisor_u64; + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + if (nresult_u64 != rresult_u64) { + printf("Division failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + break; + } + } + + printf("Validating unsigned 64bit division with 32bit divisor.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u64 = rte_rand() >> 32; + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + } + + dividend_u64 = rte_rand(); + + nresult_u64 = dividend_u64 / divisor_u64; + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + + if (nresult_u64 != rresult_u64) { + printf("Division failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + break; + } + } + + printf("Validating division by power of 2.\n"); + for (i = 0; i < 32; i++) { + divisor_u64 = 1ull << i; + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + reci_u32 = rte_reciprocal_value((uint32_t)divisor_u64); + + for (j = 0; j < MAX_ITERATIONS >> 4; j++) { + dividend_u64 = rte_rand(); + + nresult_u64 = dividend_u64 / divisor_u64; + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + + if (nresult_u64 != rresult_u64) { + printf( + "Division 64 failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + } + + nresult_u32 = (dividend_u64 >> 32) / divisor_u64; + rresult_u32 = rte_reciprocal_divide( + (dividend_u64 >> 32), reci_u32); + + if (nresult_u32 != rresult_u32) { + printf( + "Division 32 failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64 >> 32, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + break; + } + } + } + + for (; i < 64; i++) { + divisor_u64 = 1ull << i; + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + + for (j = 0; j < MAX_ITERATIONS >> 4; j++) { + dividend_u64 = rte_rand(); + + nresult_u64 = dividend_u64 / divisor_u64; + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + + if (nresult_u64 != rresult_u64) { + printf("Division failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + break; + } + } + } + + return result; +} + +REGISTER_TEST_COMMAND(reciprocal_division, test_reciprocal); diff --git a/test/test/test_reciprocal_division_perf.c b/test/test/test_reciprocal_division_perf.c new file mode 100644 index 00000000..a7be8aa7 --- /dev/null +++ b/test/test/test_reciprocal_division_perf.c @@ -0,0 +1,201 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc + */ + +#include "test.h" + +#include <stdio.h> +#include <unistd.h> +#include <inttypes.h> + +#include <rte_common.h> +#include <rte_cycles.h> +#include <rte_random.h> +#include <rte_reciprocal.h> + +#define MAX_ITERATIONS (1ULL << 32) +#define DIVIDE_ITER (1ULL << 28) + +static int +test_reciprocal_division_perf(void) +{ + int result = 0; + uint32_t divisor_u32 = 0; + uint32_t dividend_u32; + uint64_t divisor_u64 = 0; + uint64_t dividend_u64; + volatile uint32_t nresult_u32; + volatile uint32_t rresult_u32; + volatile uint64_t nresult_u64; + volatile uint64_t rresult_u64; + uint64_t start_cyc; + uint64_t split_cyc; + uint64_t end_cyc; + uint64_t tot_cyc_n = 0; + uint64_t tot_cyc_r = 0; + uint64_t i; + struct rte_reciprocal reci_u32 = {0}; + struct rte_reciprocal_u64 reci_u64 = {0}; + + rte_srand(rte_rdtsc()); + + printf("Validating unsigned 32bit division.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u32 = rte_rand(); + reci_u32 = rte_reciprocal_value(divisor_u32); + } + + dividend_u32 = rte_rand(); + + start_cyc = rte_rdtsc(); + nresult_u32 = dividend_u32 / divisor_u32; + split_cyc = rte_rdtsc(); + rresult_u32 = rte_reciprocal_divide(dividend_u32, + reci_u32); + end_cyc = rte_rdtsc(); + + tot_cyc_n += split_cyc - start_cyc; + tot_cyc_r += end_cyc - split_cyc; + if (nresult_u32 != rresult_u32) { + printf("Division failed, expected %"PRIu32" " + "result %"PRIu32"", + nresult_u32, rresult_u32); + result = 1; + break; + } + } + printf("32bit Division results:\n"); + printf("Total number of cycles normal division : %"PRIu64"\n", + tot_cyc_n); + printf("Total number of cycles reciprocal division : %"PRIu64"\n", + tot_cyc_r); + printf("Cycles per division(normal) : %3.2f\n", + ((double)tot_cyc_n)/i); + printf("Cycles per division(reciprocal) : %3.2f\n\n", + ((double)tot_cyc_r)/i); + + tot_cyc_n = 0; + tot_cyc_r = 0; + + printf("Validating unsigned 64bit division.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u64 = rte_rand(); + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + } + + dividend_u64 = rte_rand(); + + start_cyc = rte_rdtsc(); + nresult_u64 = dividend_u64 / divisor_u64; + split_cyc = rte_rdtsc(); + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + end_cyc = rte_rdtsc(); + + tot_cyc_n += split_cyc - start_cyc; + tot_cyc_r += end_cyc - split_cyc; + if (nresult_u64 != rresult_u64) { + printf("Division failed, expected %"PRIu64" " + "result %"PRIu64"", + nresult_u64, rresult_u64); + result = 1; + break; + } + } + printf("64bit Division results:\n"); + printf("Total number of cycles normal division : %"PRIu64"\n", + tot_cyc_n); + printf("Total number of cycles reciprocal division : %"PRIu64"\n", + tot_cyc_r); + printf("Cycles per division(normal) : %3.2f\n", + ((double)tot_cyc_n)/i); + printf("Cycles per division(reciprocal) : %3.2f\n\n", + ((double)tot_cyc_r)/i); + + tot_cyc_n = 0; + tot_cyc_r = 0; + + printf("Validating unsigned 64bit division with 32bit divisor.\n"); + for (i = 0; i < MAX_ITERATIONS; i++) { + /* Change divisor every DIVIDE_ITER iterations. */ + if (i % DIVIDE_ITER == 0) { + divisor_u64 = rte_rand() >> 32; + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + } + + dividend_u64 = rte_rand(); + + start_cyc = rte_rdtsc(); + nresult_u64 = dividend_u64 / divisor_u64; + split_cyc = rte_rdtsc(); + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + end_cyc = rte_rdtsc(); + + tot_cyc_n += split_cyc - start_cyc; + tot_cyc_r += end_cyc - split_cyc; + if (nresult_u64 != rresult_u64) { + printf("Division failed, expected %"PRIu64" " + "result %"PRIu64"", + nresult_u64, rresult_u64); + result = 1; + break; + } + } + + printf("64bit Division results:\n"); + printf("Total number of cycles normal division : %"PRIu64"\n", + tot_cyc_n); + printf("Total number of cycles reciprocal division : %"PRIu64"\n", + tot_cyc_r); + printf("Cycles per division(normal) : %3.2f\n", + ((double)tot_cyc_n)/i); + printf("Cycles per division(reciprocal) : %3.2f\n\n", + ((double)tot_cyc_r)/i); + + tot_cyc_n = 0; + tot_cyc_r = 0; + + printf("Validating division by power of 2.\n"); + for (i = 0; i < 64; i++) { + divisor_u64 = 1ull << i; + reci_u64 = rte_reciprocal_value_u64(divisor_u64); + + dividend_u64 = rte_rand(); + + start_cyc = rte_rdtsc(); + nresult_u64 = dividend_u64 / divisor_u64; + split_cyc = rte_rdtsc(); + rresult_u64 = rte_reciprocal_divide_u64(dividend_u64, + &reci_u64); + end_cyc = rte_rdtsc(); + + tot_cyc_n += split_cyc - start_cyc; + tot_cyc_r += end_cyc - split_cyc; + if (nresult_u64 != rresult_u64) { + printf("Division 64 failed, %"PRIu64"/%"PRIu64" = " + "expected %"PRIu64" result %"PRIu64"\n", + dividend_u64, divisor_u64, + nresult_u64, rresult_u64); + result = 1; + break; + } + } + printf("64bit Division results:\n"); + printf("Total number of cycles normal division : %"PRIu64"\n", + tot_cyc_n); + printf("Total number of cycles reciprocal division : %"PRIu64"\n", + tot_cyc_r); + printf("Cycles per division(normal) : %3.2f\n", + ((double)tot_cyc_n)/i); + printf("Cycles per division(reciprocal) : %3.2f\n", + ((double)tot_cyc_r)/i); + + return result; +} + +REGISTER_TEST_COMMAND(reciprocal_division_perf, test_reciprocal_division_perf); diff --git a/test/test/test_red.c b/test/test/test_red.c index 348075dc..e973f313 100644 --- a/test/test/test_red.c +++ b/test/test/test_red.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdlib.h> diff --git a/test/test/test_reorder.c b/test/test/test_reorder.c index 4ec22aca..65e4f38b 100644 --- a/test/test/test_reorder.c +++ b/test/test/test_reorder.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> @@ -360,9 +331,20 @@ test_setup(void) return 0; } +static void +test_teardown(void) +{ + rte_reorder_free(test_params->b); + test_params->b = NULL; + rte_mempool_free(test_params->p); + test_params->p = NULL; +} + + static struct unit_test_suite reorder_test_suite = { .setup = test_setup, + .teardown = test_teardown, .suite_name = "Reorder Unit Test Suite", .unit_test_cases = { TEST_CASE(test_reorder_create), diff --git a/test/test/test_ring.c b/test/test/test_ring.c index 5eb40a0f..aaf1e70a 100644 --- a/test/test/test_ring.c +++ b/test/test/test_ring.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> @@ -86,8 +57,6 @@ static rte_atomic32_t synchro; -static struct rte_ring *r; - #define TEST_RING_VERIFY(exp) \ if (!(exp)) { \ printf("error at %s:%d\tcondition " #exp " failed\n", \ @@ -102,7 +71,7 @@ static struct rte_ring *r; * helper routine for test_ring_basic */ static int -test_ring_basic_full_empty(void * const src[], void *dst[]) +test_ring_basic_full_empty(struct rte_ring *r, void * const src[], void *dst[]) { unsigned i, rand; const unsigned rsz = RING_SIZE - 1; @@ -143,7 +112,7 @@ test_ring_basic_full_empty(void * const src[], void *dst[]) } static int -test_ring_basic(void) +test_ring_basic(struct rte_ring *r) { void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; int ret; @@ -279,7 +248,7 @@ test_ring_basic(void) goto fail; } - if (test_ring_basic_full_empty(src, dst) != 0) + if (test_ring_basic_full_empty(r, src, dst) != 0) goto fail; cur_src = src; @@ -346,7 +315,7 @@ test_ring_basic(void) } static int -test_ring_burst_basic(void) +test_ring_burst_basic(struct rte_ring *r) { void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; int ret; @@ -700,7 +669,7 @@ test_ring_basic_ex(void) { int ret = -1; unsigned i; - struct rte_ring * rp; + struct rte_ring *rp = NULL; void **obj = NULL; obj = rte_calloc("test_ring_basic_ex_malloc", RING_SIZE, sizeof(void *), 0); @@ -760,6 +729,7 @@ test_ring_basic_ex(void) ret = 0; fail_test: + rte_ring_free(rp); if (obj != NULL) rte_free(obj); @@ -840,61 +810,67 @@ end: static int test_ring(void) { + struct rte_ring *r = NULL; + /* some more basic operations */ if (test_ring_basic_ex() < 0) - return -1; + goto test_fail; rte_atomic32_init(&synchro); + r = rte_ring_create("test", RING_SIZE, SOCKET_ID_ANY, 0); if (r == NULL) - r = rte_ring_create("test", RING_SIZE, SOCKET_ID_ANY, 0); - if (r == NULL) - return -1; + goto test_fail; /* retrieve the ring from its name */ if (rte_ring_lookup("test") != r) { printf("Cannot lookup ring from its name\n"); - return -1; + goto test_fail; } /* burst operations */ - if (test_ring_burst_basic() < 0) - return -1; + if (test_ring_burst_basic(r) < 0) + goto test_fail; /* basic operations */ - if (test_ring_basic() < 0) - return -1; + if (test_ring_basic(r) < 0) + goto test_fail; /* basic operations */ if ( test_create_count_odd() < 0){ - printf ("Test failed to detect odd count\n"); - return -1; - } - else - printf ( "Test detected odd count\n"); + printf("Test failed to detect odd count\n"); + goto test_fail; + } else + printf("Test detected odd count\n"); if ( test_lookup_null() < 0){ - printf ("Test failed to detect NULL ring lookup\n"); - return -1; - } - else - printf ( "Test detected NULL ring lookup \n"); + printf("Test failed to detect NULL ring lookup\n"); + goto test_fail; + } else + printf("Test detected NULL ring lookup\n"); /* test of creating ring with wrong size */ if (test_ring_creation_with_wrong_size() < 0) - return -1; + goto test_fail; /* test of creation ring with an used name */ if (test_ring_creation_with_an_used_name() < 0) - return -1; + goto test_fail; if (test_ring_with_exact_size() < 0) - return -1; + goto test_fail; /* dump the ring status */ rte_ring_list_dump(stdout); + rte_ring_free(r); + return 0; + +test_fail: + rte_ring_free(r); + + return -1; } REGISTER_TEST_COMMAND(ring_autotest, test_ring); diff --git a/test/test/test_ring_perf.c b/test/test/test_ring_perf.c index 84d20033..ebb3939f 100644 --- a/test/test/test_ring_perf.c +++ b/test/test/test_ring_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ @@ -61,9 +32,6 @@ */ static const volatile unsigned bulk_sizes[] = { 8, 32 }; -/* The ring structure used for tests */ -static struct rte_ring *r; - struct lcore_pair { unsigned c1, c2; }; @@ -144,7 +112,7 @@ get_two_sockets(struct lcore_pair *lcp) /* Get cycle counts for dequeuing from an empty ring. Should be 2 or 3 cycles */ static void -test_empty_dequeue(void) +test_empty_dequeue(struct rte_ring *r) { const unsigned iter_shift = 26; const unsigned iterations = 1<<iter_shift; @@ -172,6 +140,7 @@ test_empty_dequeue(void) * and return two. Input = burst size, output = cycle average for sp/sc & mp/mc */ struct thread_params { + struct rte_ring *r; unsigned size; /* input value, the burst size */ double spsc, mpmc; /* output value, the single or multi timings */ }; @@ -186,6 +155,7 @@ enqueue_bulk(void *p) const unsigned iter_shift = 23; const unsigned iterations = 1<<iter_shift; struct thread_params *params = p; + struct rte_ring *r = params->r; const unsigned size = params->size; unsigned i; void *burst[MAX_BURST] = {0}; @@ -221,6 +191,7 @@ dequeue_bulk(void *p) const unsigned iter_shift = 23; const unsigned iterations = 1<<iter_shift; struct thread_params *params = p; + struct rte_ring *r = params->r; const unsigned size = params->size; unsigned i; void *burst[MAX_BURST] = {0}; @@ -251,7 +222,7 @@ dequeue_bulk(void *p) * used to measure ring perf between hyperthreads, cores and sockets. */ static void -run_on_core_pair(struct lcore_pair *cores, +run_on_core_pair(struct lcore_pair *cores, struct rte_ring *r, lcore_function_t f1, lcore_function_t f2) { struct thread_params param1 = {0}, param2 = {0}; @@ -259,6 +230,7 @@ run_on_core_pair(struct lcore_pair *cores, for (i = 0; i < sizeof(bulk_sizes)/sizeof(bulk_sizes[0]); i++) { lcore_count = 0; param1.size = param2.size = bulk_sizes[i]; + param1.r = param2.r = r; if (cores->c1 == rte_get_master_lcore()) { rte_eal_remote_launch(f2, ¶m2, cores->c2); f1(¶m1); @@ -281,7 +253,7 @@ run_on_core_pair(struct lcore_pair *cores, * takes on a single lcore. Result is for comparison with the bulk enq+deq. */ static void -test_single_enqueue_dequeue(void) +test_single_enqueue_dequeue(struct rte_ring *r) { const unsigned iter_shift = 24; const unsigned iterations = 1<<iter_shift; @@ -314,7 +286,7 @@ test_single_enqueue_dequeue(void) * as for the bulk function called on a single lcore. */ static void -test_burst_enqueue_dequeue(void) +test_burst_enqueue_dequeue(struct rte_ring *r) { const unsigned iter_shift = 23; const unsigned iterations = 1<<iter_shift; @@ -352,7 +324,7 @@ test_burst_enqueue_dequeue(void) /* Times enqueue and dequeue on a single lcore */ static void -test_bulk_enqueue_dequeue(void) +test_bulk_enqueue_dequeue(struct rte_ring *r) { const unsigned iter_shift = 23; const unsigned iterations = 1<<iter_shift; @@ -394,32 +366,35 @@ static int test_ring_perf(void) { struct lcore_pair cores; + struct rte_ring *r = NULL; + r = rte_ring_create(RING_NAME, RING_SIZE, rte_socket_id(), 0); - if (r == NULL && (r = rte_ring_lookup(RING_NAME)) == NULL) + if (r == NULL) return -1; printf("### Testing single element and burst enq/deq ###\n"); - test_single_enqueue_dequeue(); - test_burst_enqueue_dequeue(); + test_single_enqueue_dequeue(r); + test_burst_enqueue_dequeue(r); printf("\n### Testing empty dequeue ###\n"); - test_empty_dequeue(); + test_empty_dequeue(r); printf("\n### Testing using a single lcore ###\n"); - test_bulk_enqueue_dequeue(); + test_bulk_enqueue_dequeue(r); if (get_two_hyperthreads(&cores) == 0) { printf("\n### Testing using two hyperthreads ###\n"); - run_on_core_pair(&cores, enqueue_bulk, dequeue_bulk); + run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); } if (get_two_cores(&cores) == 0) { printf("\n### Testing using two physical cores ###\n"); - run_on_core_pair(&cores, enqueue_bulk, dequeue_bulk); + run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); } if (get_two_sockets(&cores) == 0) { printf("\n### Testing using two NUMA nodes ###\n"); - run_on_core_pair(&cores, enqueue_bulk, dequeue_bulk); + run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); } + rte_ring_free(r); return 0; } diff --git a/test/test/test_rwlock.c b/test/test/test_rwlock.c index 08685d32..29171c42 100644 --- a/test/test/test_rwlock.c +++ b/test/test/test_rwlock.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_sched.c b/test/test/test_sched.c index bd2776d3..32e500ba 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdlib.h> diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index 311c704e..86b4073d 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Intel Corporation. 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include <rte_common.h> @@ -266,6 +238,93 @@ service_name(void) return unregister_all(); } +/* verify service attr get */ +static int +service_attr_get(void) +{ + /* ensure all services unregistered so cycle counts are zero */ + unregister_all(); + + struct rte_service_spec service; + memset(&service, 0, sizeof(struct rte_service_spec)); + service.callback = dummy_cb; + snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME); + service.capabilities |= RTE_SERVICE_CAP_MT_SAFE; + uint32_t id; + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, &id), + "Register of service failed"); + rte_service_component_runstate_set(id, 1); + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(id, 1), + "Error: Service start returned non-zero"); + rte_service_set_stats_enable(id, 1); + + uint32_t attr_id = UINT32_MAX; + uint32_t attr_value = 0xdead; + /* check error return values */ + TEST_ASSERT_EQUAL(-EINVAL, rte_service_attr_get(id, attr_id, + &attr_value), + "Invalid attr_id didn't return -EINVAL"); + + attr_id = RTE_SERVICE_ATTR_CYCLES; + TEST_ASSERT_EQUAL(-EINVAL, rte_service_attr_get(UINT32_MAX, attr_id, + &attr_value), + "Invalid service id didn't return -EINVAL"); + + TEST_ASSERT_EQUAL(-EINVAL, rte_service_attr_get(id, attr_id, NULL), + "Invalid attr_value pointer id didn't return -EINVAL"); + + /* check correct (zero) return value and correct value (zero) */ + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_id, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, attr_value, + "attr_get() call didn't set correct cycles (zero)"); + /* check correct call count */ + const int attr_calls = RTE_SERVICE_ATTR_CALL_COUNT; + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, attr_value, + "attr_get() call didn't get call count (zero)"); + + /* Call service to increment cycle count */ + TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id), + "Service core add did not return zero"); + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(id, slcore_id, 1), + "Enabling valid service and core failed"); + TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id), + "Starting service core failed"); + + /* wait for the service lcore to run */ + rte_delay_ms(200); + + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_id, &attr_value), + "Valid attr_get() call didn't return success"); + int cycles_gt_zero = attr_value > 0; + TEST_ASSERT_EQUAL(1, cycles_gt_zero, + "attr_get() failed to get cycles (expected > zero)"); + + rte_service_lcore_stop(slcore_id); + + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(1, (attr_value > 0), + "attr_get() call didn't get call count (zero)"); + + TEST_ASSERT_EQUAL(0, rte_service_attr_reset_all(id), + "Valid attr_reset_all() return success"); + + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_id, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, attr_value, + "attr_get() call didn't set correct cycles (zero)"); + /* ensure call count > zero */ + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, (attr_value > 0), + "attr_get() call didn't get call count (zero)"); + + return unregister_all(); +} + /* verify service dump */ static int service_dump(void) @@ -348,6 +407,7 @@ service_lcore_en_dis_able(void) /* call remote_launch to verify that app can launch ex-service lcore */ service_remote_launch_flag = 0; + rte_eal_wait_lcore(slcore_id); int ret = rte_eal_remote_launch(service_remote_launch_func, NULL, slcore_id); TEST_ASSERT_EQUAL(0, ret, "Ex-service core remote launch failed."); @@ -362,7 +422,7 @@ static int service_lcore_running_check(void) { uint64_t tick = service_tick; - rte_delay_ms(SERVICE_DELAY * 10); + rte_delay_ms(SERVICE_DELAY * 100); /* if (tick != service_tick) we know the lcore as polled the service */ return tick != service_tick; } @@ -505,6 +565,10 @@ service_threaded_test(int mt_safe) if (!mt_safe) test_params[1] = 1; + /* wait for lcores before start() */ + rte_eal_wait_lcore(slcore_1); + rte_eal_wait_lcore(slcore_2); + rte_service_lcore_start(slcore_1); rte_service_lcore_start(slcore_2); @@ -518,6 +582,8 @@ service_threaded_test(int mt_safe) TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Failed to stop MT Safe service"); + rte_eal_wait_lcore(slcore_1); + rte_eal_wait_lcore(slcore_2); unregister_all(); /* return the value of the callback pass_test variable to caller */ @@ -611,6 +677,7 @@ service_app_lcore_poll_impl(const int mt_safe) rte_service_runstate_set(id, 1); uint32_t app_core2 = rte_get_next_lcore(slcore_id, 1, 1); + rte_eal_wait_lcore(app_core2); int app_core2_ret = rte_eal_remote_launch(service_run_on_app_core_func, &id, app_core2); @@ -713,6 +780,7 @@ static struct unit_test_suite service_tests = { TEST_CASE_ST(dummy_register, NULL, service_name), TEST_CASE_ST(dummy_register, NULL, service_get_by_name), TEST_CASE_ST(dummy_register, NULL, service_dump), + TEST_CASE_ST(dummy_register, NULL, service_attr_get), TEST_CASE_ST(dummy_register, NULL, service_probe_capability), TEST_CASE_ST(dummy_register, NULL, service_start_stop), TEST_CASE_ST(dummy_register, NULL, service_lcore_add_del), diff --git a/test/test/test_spinlock.c b/test/test/test_spinlock.c index bb34e0c6..73bff128 100644 --- a/test/test/test_spinlock.c +++ b/test/test/test_spinlock.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_string_fns.c b/test/test/test_string_fns.c index 8b4359aa..3f091ab9 100644 --- a/test/test/test_string_fns.c +++ b/test/test/test_string_fns.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_table.c b/test/test/test_table.c index db7d4e66..f01652dc 100644 --- a/test/test/test_table.c +++ b/test/test/test_table.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_byteorder.h> @@ -84,6 +55,14 @@ uint64_t pipeline_test_hash(void *key, } static void +app_free_resources(void) { + int i; + for (i = 0; i < N_PORTS; i++) + rte_ring_free(rings_rx[i]); + rte_mempool_free(pool); +} + +static void app_init_mbuf_pools(void) { /* Init the buffer pool */ @@ -142,18 +121,20 @@ app_init_rings(void) static int test_table(void) { - int status, failures; + int status, ret; unsigned i; - failures = 0; + ret = TEST_SUCCESS; app_init_rings(); app_init_mbuf_pools(); printf("\n\n\n\n************Pipeline tests************\n"); - if (test_table_pipeline() < 0) - return -1; + if (test_table_pipeline() < 0) { + ret = TEST_FAILED; + goto end; + } printf("\n\n\n\n************Port tests************\n"); for (i = 0; i < n_port_tests; i++) { @@ -161,8 +142,8 @@ test_table(void) if (status < 0) { printf("\nPort test number %d failed (%d).\n", i, status); - failures++; - return -1; + ret = TEST_FAILED; + goto end; } } @@ -172,8 +153,8 @@ test_table(void) if (status < 0) { printf("\nTable test number %d failed (%d).\n", i, status); - failures++; - return -1; + ret = TEST_FAILED; + goto end; } } @@ -183,21 +164,23 @@ test_table(void) if (status < 0) { printf("\nCombined table test number %d failed with " "reason number %d.\n", i, status); - failures++; - return -1; + ret = TEST_FAILED; + goto end; } } - if (failures) - return -1; - #ifdef RTE_LIBRTE_ACL printf("\n\n\n\n************ACL tests************\n"); - if (test_table_acl() < 0) - return -1; + if (test_table_acl() < 0) { + ret = TEST_FAILED; + goto end; + } #endif - return 0; +end: + app_free_resources(); + + return ret; } REGISTER_TEST_COMMAND(table_autotest, test_table); diff --git a/test/test/test_table.h b/test/test/test_table.h index 8c1df333..a4d3ca0c 100644 --- a/test/test/test_table.h +++ b/test/test/test_table.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_table_stub.h> diff --git a/test/test/test_table_acl.c b/test/test/test_table_acl.c index 08c100ff..33e2f6ee 100644 --- a/test/test/test_table_acl.c +++ b/test/test/test_table_acl.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_hexdump.h> @@ -532,6 +503,8 @@ setup_acl_pipeline(void) struct rte_pipeline_table_entry *table_entries[5]; int key_found[5]; + memset(table_entries, 0, sizeof(table_entries)); + for (n = 0; n < 5; n++) { memset(&keys[n], 0, sizeof(struct rte_table_acl_rule_delete_params)); key_array[n] = &keys[n]; diff --git a/test/test/test_table_acl.h b/test/test/test_table_acl.h index a64c3e6c..a6ae7d28 100644 --- a/test/test/test_table_acl.h +++ b/test/test/test_table_acl.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ /* Test prototypes */ diff --git a/test/test/test_table_combined.c b/test/test/test_table_combined.c index e8637884..5e8e119a 100644 --- a/test/test/test_table_combined.c +++ b/test/test/test_table_combined.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <string.h> diff --git a/test/test/test_table_combined.h b/test/test/test_table_combined.h index e1619f92..d0586624 100644 --- a/test/test/test_table_combined.h +++ b/test/test/test_table_combined.h @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ /* Test prototypes */ diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c index a6fef721..055a1a4e 100644 --- a/test/test/test_table_pipeline.c +++ b/test/test/test_table_pipeline.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <string.h> diff --git a/test/test/test_table_pipeline.h b/test/test/test_table_pipeline.h index b3f20ba3..d66d09d6 100644 --- a/test/test/test_table_pipeline.h +++ b/test/test/test_table_pipeline.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ /* Test prototypes */ diff --git a/test/test/test_table_ports.c b/test/test/test_table_ports.c index 39592ce1..d921b2e2 100644 --- a/test/test/test_table_ports.c +++ b/test/test/test_table_ports.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include "test_table_ports.h" diff --git a/test/test/test_table_ports.h b/test/test/test_table_ports.h index 512b77fe..dfa61193 100644 --- a/test/test/test_table_ports.h +++ b/test/test/test_table_ports.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ /* Test prototypes */ diff --git a/test/test/test_table_tables.c b/test/test/test_table_tables.c index a1b0c582..a7a69b85 100644 --- a/test/test/test_table_tables.c +++ b/test/test/test_table_tables.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ #include <string.h> diff --git a/test/test/test_table_tables.h b/test/test/test_table_tables.h index 35311362..7570e996 100644 --- a/test/test/test_table_tables.h +++ b/test/test/test_table_tables.h @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation */ /* Test prototypes */ diff --git a/test/test/test_tailq.c b/test/test/test_tailq.c index 33a3e8a9..a4ecea2d 100644 --- a/test/test/test_tailq.c +++ b/test/test/test_tailq.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_timer.c b/test/test/test_timer.c index 04c23989..e2aab530 100644 --- a/test/test/test_timer.c +++ b/test/test/test_timer.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include "test.h" diff --git a/test/test/test_timer_perf.c b/test/test/test_timer_perf.c index 467ae13d..0fe2b74c 100644 --- a/test/test/test_timer_perf.c +++ b/test/test/test_timer_perf.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include "test.h" @@ -156,6 +127,7 @@ test_timer_perf(void) printf("Time per rte_timer_manage with zero callbacks: %"PRIu64" cycles\n", (end_tsc - start_tsc + iterations/2) / iterations); + rte_free(tms); return 0; } diff --git a/test/test/test_version.c b/test/test/test_version.c index afc0d0b8..1e1ff186 100644 --- a/test/test/test_version.c +++ b/test/test/test_version.c @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <stdio.h> diff --git a/test/test/test_xmmt_ops.h b/test/test/test_xmmt_ops.h index 2d6d800a..8bcf0b26 100644 --- a/test/test/test_xmmt_ops.h +++ b/test/test/test_xmmt_ops.h @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015 Cavium, Inc. 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 Cavium, Inc 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Cavium, Inc */ #ifndef _TEST_XMMT_OPS_H_ diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c index b57a9493..2f5b31db 100644 --- a/test/test/virtual_pmd.c +++ b/test/test/virtual_pmd.c @@ -1,38 +1,10 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include <rte_mbuf.h> #include <rte_ethdev.h> +#include <rte_ethdev_driver.h> #include <rte_pci.h> #include <rte_bus_pci.h> #include <rte_malloc.h> @@ -244,6 +216,11 @@ static void virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) {} +static void +virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev, + __rte_unused struct ether_addr *addr) +{ +} static const struct eth_dev_ops virtual_ethdev_default_dev_ops = { .dev_configure = virtual_ethdev_configure_success, @@ -256,13 +233,13 @@ static const struct eth_dev_ops virtual_ethdev_default_dev_ops = { .rx_queue_release = virtual_ethdev_rx_queue_release, .tx_queue_release = virtual_ethdev_tx_queue_release, .link_update = virtual_ethdev_link_update_success, + .mac_addr_set = virtual_ethdev_mac_address_set, .stats_get = virtual_ethdev_stats_get, .stats_reset = virtual_ethdev_stats_reset, .promiscuous_enable = virtual_ethdev_promiscuous_mode_enable, .promiscuous_disable = virtual_ethdev_promiscuous_mode_disable }; - void virtual_ethdev_start_fn_set_success(uint16_t port_id, uint8_t success) { @@ -489,7 +466,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id, vrtl_eth_dev->data->dev_link.link_status = link_status; _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, - NULL, NULL); + NULL); } int diff --git a/test/test/virtual_pmd.h b/test/test/virtual_pmd.h index 7c53dd34..5ca02bb5 100644 --- a/test/test/virtual_pmd.h +++ b/test/test/virtual_pmd.h @@ -1,34 +1,5 @@ -/*- - * 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #ifndef __VIRTUAL_ETHDEV_H_ |