]> git.droids-corp.org - dpdk.git/commitdiff
mem: fix segment fd API error code for external segment
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 13 Dec 2018 11:43:15 +0000 (11:43 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 20 Dec 2018 21:51:49 +0000 (22:51 +0100)
Segment fd API does not support getting segment fd's from
externally allocated memory, so return proper error code
on any attempts to do so. This changes API behavior, so
document the change as well.

Fixes: 5282bb1c3695 ("mem: allow memseg lists to be marked as external")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
doc/guides/rel_notes/release_19_02.rst
lib/librte_eal/common/eal_common_memory.c

index c1fa8843e29b5144aea4f91aba7b8ef5be1a273a..63e84fef780650499c9051e39be30627e10ed706 100644 (file)
@@ -109,6 +109,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
+* eal: Segment fd API on Linux now sets error code to ``ENOTSUP`` in more cases
+  where segment fd API is not expected to be supported:
+
+  - On attempt to get segment fd for an externally allocated memory segment
+
 * pdump: The ``rte_pdump_set_socket_dir()``, the parameter ``path`` of
   ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated
   since 18.05 and are removed in this release.
index 051159f8035432c98e06f042487f7b6851c8bb9b..c9da69b16434d06477de92efba9cb864ebefdb4a 100644 (file)
@@ -705,6 +705,12 @@ rte_memseg_get_fd_thread_unsafe(const struct rte_memseg *ms)
                return -1;
        }
 
+       /* segment fd API is not supported for external segments */
+       if (msl->external) {
+               rte_errno = ENOTSUP;
+               return -1;
+       }
+
        ret = eal_memalloc_get_seg_fd(msl_idx, seg_idx);
        if (ret < 0) {
                rte_errno = -ret;
@@ -755,6 +761,12 @@ rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,
                return -1;
        }
 
+       /* segment fd API is not supported for external segments */
+       if (msl->external) {
+               rte_errno = ENOTSUP;
+               return -1;
+       }
+
        ret = eal_memalloc_get_seg_fd_offset(msl_idx, seg_idx, offset);
        if (ret < 0) {
                rte_errno = -ret;