git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/ixgbe: fix mask bits register set error for FDIR
[dpdk.git]
/
drivers
/
net
/
mlx5
/
mlx5_socket.c
diff --git
a/drivers/net/mlx5/mlx5_socket.c
b/drivers/net/mlx5/mlx5_socket.c
index
6e2d971
..
99297d5
100644
(file)
--- a/
drivers/net/mlx5/mlx5_socket.c
+++ b/
drivers/net/mlx5/mlx5_socket.c
@@
-1,5
+1,6
@@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2016 6WIND S.A.
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2016 6WIND S.A.
+ * Copyright 2016 Mellanox Technologies, Ltd
*/
#define _GNU_SOURCE
*/
#define _GNU_SOURCE
@@
-33,7
+34,6
@@
mlx5_socket_init(struct rte_eth_dev *dev)
};
int ret;
int flags;
};
int ret;
int flags;
- struct stat file_stat;
/*
* Initialise the socket to communicate with the secondary
/*
* Initialise the socket to communicate with the secondary
@@
-42,7
+42,8
@@
mlx5_socket_init(struct rte_eth_dev *dev)
ret = socket(AF_UNIX, SOCK_STREAM, 0);
if (ret < 0) {
rte_errno = errno;
ret = socket(AF_UNIX, SOCK_STREAM, 0);
if (ret < 0) {
rte_errno = errno;
- WARN("secondary process not supported: %s", strerror(errno));
+ DRV_LOG(WARNING, "port %u secondary process not supported: %s",
+ dev->data->port_id, strerror(errno));
goto error;
}
priv->primary_socket = ret;
goto error;
}
priv->primary_socket = ret;
@@
-58,21
+59,22
@@
mlx5_socket_init(struct rte_eth_dev *dev)
}
snprintf(sun.sun_path, sizeof(sun.sun_path), "/var/tmp/%s_%d",
MLX5_DRIVER_NAME, priv->primary_socket);
}
snprintf(sun.sun_path, sizeof(sun.sun_path), "/var/tmp/%s_%d",
MLX5_DRIVER_NAME, priv->primary_socket);
- ret = stat(sun.sun_path, &file_stat);
- if (!ret)
- claim_zero(remove(sun.sun_path));
+ remove(sun.sun_path);
ret = bind(priv->primary_socket, (const struct sockaddr *)&sun,
sizeof(sun));
if (ret < 0) {
rte_errno = errno;
ret = bind(priv->primary_socket, (const struct sockaddr *)&sun,
sizeof(sun));
if (ret < 0) {
rte_errno = errno;
- WARN("cannot bind socket, secondary process not supported: %s",
- strerror(errno));
+ DRV_LOG(WARNING,
+ "port %u cannot bind socket, secondary process not"
+ " supported: %s",
+ dev->data->port_id, strerror(errno));
goto close;
}
ret = listen(priv->primary_socket, 0);
if (ret < 0) {
rte_errno = errno;
goto close;
}
ret = listen(priv->primary_socket, 0);
if (ret < 0) {
rte_errno = errno;
- WARN("Secondary process not supported: %s", strerror(errno));
+ DRV_LOG(WARNING, "port %u secondary process not supported: %s",
+ dev->data->port_id, strerror(errno));
goto close;
}
return 0;
goto close;
}
return 0;
@@
-131,26
+133,29
@@
mlx5_socket_handle(struct rte_eth_dev *dev)
/* Accept the connection from the client. */
conn_sock = accept(priv->primary_socket, NULL, NULL);
if (conn_sock < 0) {
/* Accept the connection from the client. */
conn_sock = accept(priv->primary_socket, NULL, NULL);
if (conn_sock < 0) {
- WARN("connection failed: %s", strerror(errno));
+ DRV_LOG(WARNING, "port %u connection failed: %s",
+ dev->data->port_id, strerror(errno));
return;
}
ret = setsockopt(conn_sock, SOL_SOCKET, SO_PASSCRED, &(int){1},
sizeof(int));
if (ret < 0) {
ret = errno;
return;
}
ret = setsockopt(conn_sock, SOL_SOCKET, SO_PASSCRED, &(int){1},
sizeof(int));
if (ret < 0) {
ret = errno;
- WARN("cannot change socket options: %s", strerror(rte_errno));
+ DRV_LOG(WARNING, "port %u cannot change socket options: %s",
+ dev->data->port_id, strerror(rte_errno));
goto error;
}
ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
if (ret < 0) {
ret = errno;
goto error;
}
ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
if (ret < 0) {
ret = errno;
- WARN("received an empty message: %s", strerror(rte_errno));
+ DRV_LOG(WARNING, "port %u received an empty message: %s",
+ dev->data->port_id, strerror(rte_errno));
goto error;
}
/* Expect to receive credentials only. */
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
goto error;
}
/* Expect to receive credentials only. */
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
-
WARN("no message"
);
+
DRV_LOG(WARNING, "port %u no message", dev->data->port_id
);
goto error;
}
if ((cmsg->cmsg_type == SCM_CREDENTIALS) &&
goto error;
}
if ((cmsg->cmsg_type == SCM_CREDENTIALS) &&
@@
-160,13
+165,15
@@
mlx5_socket_handle(struct rte_eth_dev *dev)
}
cmsg = CMSG_NXTHDR(&msg, cmsg);
if (cmsg != NULL) {
}
cmsg = CMSG_NXTHDR(&msg, cmsg);
if (cmsg != NULL) {
- WARN("Message wrongly formatted");
+ DRV_LOG(WARNING, "port %u message wrongly formatted",
+ dev->data->port_id);
goto error;
}
/* Make sure all the ancillary data was received and valid. */
if ((cred == NULL) || (cred->uid != getuid()) ||
(cred->gid != getgid())) {
goto error;
}
/* Make sure all the ancillary data was received and valid. */
if ((cred == NULL) || (cred->uid != getuid()) ||
(cred->gid != getgid())) {
- WARN("wrong credentials");
+ DRV_LOG(WARNING, "port %u wrong credentials",
+ dev->data->port_id);
goto error;
}
/* Set-up the ancillary data. */
goto error;
}
/* Set-up the ancillary data. */
@@
-179,7
+186,8
@@
mlx5_socket_handle(struct rte_eth_dev *dev)
*fd = priv->ctx->cmd_fd;
ret = sendmsg(conn_sock, &msg, 0);
if (ret < 0)
*fd = priv->ctx->cmd_fd;
ret = sendmsg(conn_sock, &msg, 0);
if (ret < 0)
- WARN("cannot send response");
+ DRV_LOG(WARNING, "port %u cannot send response",
+ dev->data->port_id);
error:
close(conn_sock);
}
error:
close(conn_sock);
}
@@
-221,7
+229,8
@@
mlx5_socket_connect(struct rte_eth_dev *dev)
ret = socket(AF_UNIX, SOCK_STREAM, 0);
if (ret < 0) {
rte_errno = errno;
ret = socket(AF_UNIX, SOCK_STREAM, 0);
if (ret < 0) {
rte_errno = errno;
- WARN("cannot connect to primary");
+ DRV_LOG(WARNING, "port %u cannot connect to primary",
+ dev->data->port_id);
goto error;
}
socket_fd = ret;
goto error;
}
socket_fd = ret;
@@
-230,13
+239,15
@@
mlx5_socket_connect(struct rte_eth_dev *dev)
ret = connect(socket_fd, (const struct sockaddr *)&sun, sizeof(sun));
if (ret < 0) {
rte_errno = errno;
ret = connect(socket_fd, (const struct sockaddr *)&sun, sizeof(sun));
if (ret < 0) {
rte_errno = errno;
- WARN("cannot connect to primary");
+ DRV_LOG(WARNING, "port %u cannot connect to primary",
+ dev->data->port_id);
goto error;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
rte_errno = EINVAL;
goto error;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
rte_errno = EINVAL;
- DEBUG("cannot get first message");
+ DRV_LOG(DEBUG, "port %u cannot get first message",
+ dev->data->port_id);
goto error;
}
cmsg->cmsg_level = SOL_SOCKET;
goto error;
}
cmsg->cmsg_level = SOL_SOCKET;
@@
-245,7
+256,8
@@
mlx5_socket_connect(struct rte_eth_dev *dev)
cred = (struct ucred *)CMSG_DATA(cmsg);
if (cred == NULL) {
rte_errno = EINVAL;
cred = (struct ucred *)CMSG_DATA(cmsg);
if (cred == NULL) {
rte_errno = EINVAL;
- DEBUG("no credentials received");
+ DRV_LOG(DEBUG, "port %u no credentials received",
+ dev->data->port_id);
goto error;
}
cred->pid = getpid();
goto error;
}
cred->pid = getpid();
@@
-254,31
+266,35
@@
mlx5_socket_connect(struct rte_eth_dev *dev)
ret = sendmsg(socket_fd, &msg, MSG_DONTWAIT);
if (ret < 0) {
rte_errno = errno;
ret = sendmsg(socket_fd, &msg, MSG_DONTWAIT);
if (ret < 0) {
rte_errno = errno;
- WARN("cannot send credentials to primary: %s",
- strerror(errno));
+ DRV_LOG(WARNING,
+ "port %u cannot send credentials to primary: %s",
+ dev->data->port_id, strerror(errno));
goto error;
}
ret = recvmsg(socket_fd, &msg, MSG_WAITALL);
if (ret <= 0) {
rte_errno = errno;
goto error;
}
ret = recvmsg(socket_fd, &msg, MSG_WAITALL);
if (ret <= 0) {
rte_errno = errno;
- WARN("no message from primary: %s", strerror(errno));
+ DRV_LOG(WARNING, "port %u no message from primary: %s",
+ dev->data->port_id, strerror(errno));
goto error;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
rte_errno = EINVAL;
goto error;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
rte_errno = EINVAL;
- WARN("No file descriptor received");
+ DRV_LOG(WARNING, "port %u no file descriptor received",
+ dev->data->port_id);
goto error;
}
fd = (int *)CMSG_DATA(cmsg);
if (*fd < 0) {
goto error;
}
fd = (int *)CMSG_DATA(cmsg);
if (*fd < 0) {
- WARN("no file descriptor received: %s", strerror(errno));
+ DRV_LOG(WARNING, "port %u no file descriptor received: %s",
+ dev->data->port_id, strerror(errno));
rte_errno = *fd;
goto error;
}
ret = *fd;
close(socket_fd);
rte_errno = *fd;
goto error;
}
ret = *fd;
close(socket_fd);
- return
0
;
+ return
ret
;
error:
if (socket_fd != -1)
close(socket_fd);
error:
if (socket_fd != -1)
close(socket_fd);