[dpdk-dev] [PATCH v2 36/41] net/mlx5: set file descriptor as non-blocking

Srikanth Kaka srikanth.k at oneconvergence.com
Thu Oct 7 20:43:45 CEST 2021


set file descriptor as non-blocking

Signed-off-by: Srikanth Kaka <srikanth.k at oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh at oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu at juniper.net>
---
 drivers/net/mlx5/freebsd/mlx5_os.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/mlx5/freebsd/mlx5_os.c b/drivers/net/mlx5/freebsd/mlx5_os.c
index 54bd32ee86..c05bf021d1 100644
--- a/drivers/net/mlx5/freebsd/mlx5_os.c
+++ b/drivers/net/mlx5/freebsd/mlx5_os.c
@@ -100,6 +100,27 @@ static struct mlx5_indexed_pool_config icfg[] = {
 	},
 };
 
+/**
+ * Set the completion channel file descriptor interrupt as non-blocking.
+ *
+ * @param[in] rxq_obj
+ *   Pointer to RQ channel object, which includes the channel fd
+ *
+ * @param[out] fd
+ *   The file descriptor (representing the intetrrupt) used in this channel.
+ *
+ * @return
+ *   0 on successfully setting the fd to non-blocking, non-zero otherwise.
+ */
+int
+mlx5_os_set_nonblock_channel_fd(int fd)
+{
+	int flags;
+
+	flags = fcntl(fd, F_GETFL);
+	return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+}
+
 /**
  * Get mlx5 device attributes. The glue function query_device_ex() is called
  * with out parameter of type 'struct ibv_device_attr_ex *'. Then fill in mlx5
-- 
2.30.2



More information about the dev mailing list