"bsize=1024", "Size of single packet buffer", "2048", "uint16_t"
"rsize=11", "Log2 of ring size. If rsize is 10, actual ring size is 1024", "10", "1-14"
"socket=/tmp/memif.sock", "Socket filename", "/tmp/memif.sock", "string len 108"
+ "socket-abstract=no", "Set usage of abstract socket address", "yes", "yes|no"
"mac=01:23:45:ab:cd:ef", "Mac address", "01:ab:23:cd:45:ef", ""
"secret=abc123", "Secret is an optional security option, which if specified, must be matched by peer", "", "string len 24"
"zero-copy=yes", "Enable/disable zero-copy slave mode. Only relevant to slave, requires '--single-file-segments' eal argument", "no", "yes|no"
Updated the Intel qat driver to use write combining stores.
+* **Updated Memif PMD.**
+
+ * Added support for abstract socket address.
+ * Changed default socket address type to abstract.
+
* **Added Ice Lake (Gen4) support for Intel NTB.**
Added NTB device support (4th generation) for Intel Ice Lake platform.
}
static struct memif_socket *
-memif_socket_create(char *key, uint8_t listener)
+memif_socket_create(char *key, uint8_t listener, bool is_abstract)
{
struct memif_socket *sock;
- struct sockaddr_un un;
+ struct sockaddr_un un = { 0 };
int sockfd;
int ret;
int on = 1;
goto error;
un.sun_family = AF_UNIX;
- strlcpy(un.sun_path, sock->filename, MEMIF_SOCKET_UN_SIZE);
+ if (is_abstract) {
+ /* abstract address */
+ un.sun_path[0] = '\0';
+ strlcpy(un.sun_path + 1, sock->filename, MEMIF_SOCKET_UN_SIZE - 1);
+ } else {
+ strlcpy(un.sun_path, sock->filename, MEMIF_SOCKET_UN_SIZE);
+ }
ret = setsockopt(sockfd, SOL_SOCKET, SO_PASSCRED, &on,
sizeof(on));
ret = rte_hash_lookup_data(hash, key, (void **)&socket);
if (ret < 0) {
socket = memif_socket_create(key,
- (pmd->role == MEMIF_ROLE_SLAVE) ? 0 : 1);
+ (pmd->role == MEMIF_ROLE_SLAVE) ? 0 : 1,
+ pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT);
if (socket == NULL)
return -1;
ret = rte_hash_add_key_data(hash, key, socket);
/* remove socket, if this was the last device using it */
if (TAILQ_EMPTY(&socket->dev_queue)) {
rte_hash_del_key(hash, socket->filename);
- if (socket->listener) {
+ if (socket->listener && !(pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT)) {
/* remove listener socket file,
* so we can create new one later.
*/
{
int sockfd;
int ret;
- struct sockaddr_un sun;
+ struct sockaddr_un sun = { 0 };
struct pmd_internals *pmd = dev->data->dev_private;
memset(pmd->local_disc_string, 0, ETH_MEMIF_DISC_STRING_SIZE);
}
sun.sun_family = AF_UNIX;
-
- memcpy(sun.sun_path, pmd->socket_filename, sizeof(sun.sun_path) - 1);
+ if (pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT) {
+ /* abstract address */
+ sun.sun_path[0] = '\0';
+ strlcpy(sun.sun_path + 1, pmd->socket_filename, MEMIF_SOCKET_UN_SIZE - 1);
+ } else {
+ strlcpy(sun.sun_path, pmd->socket_filename, MEMIF_SOCKET_UN_SIZE);
+ }
ret = connect(sockfd, (struct sockaddr *)&sun,
sizeof(struct sockaddr_un));
#define ETH_MEMIF_PKT_BUFFER_SIZE_ARG "bsize"
#define ETH_MEMIF_RING_SIZE_ARG "rsize"
#define ETH_MEMIF_SOCKET_ARG "socket"
+#define ETH_MEMIF_SOCKET_ABSTRACT_ARG "socket-abstract"
#define ETH_MEMIF_MAC_ARG "mac"
#define ETH_MEMIF_ZC_ARG "zero-copy"
#define ETH_MEMIF_SECRET_ARG "secret"
ETH_MEMIF_PKT_BUFFER_SIZE_ARG,
ETH_MEMIF_RING_SIZE_ARG,
ETH_MEMIF_SOCKET_ARG,
+ ETH_MEMIF_SOCKET_ABSTRACT_ARG,
ETH_MEMIF_MAC_ARG,
ETH_MEMIF_ZC_ARG,
ETH_MEMIF_SECRET_ARG,
const char **socket_filename = (const char **)extra_args;
*socket_filename = value;
- return memif_check_socket_filename(*socket_filename);
+ return 0;
+}
+
+static int
+memif_set_is_socket_abstract(const char *key __rte_unused, const char *value, void *extra_args)
+{
+ uint32_t *flags = (uint32_t *)extra_args;
+
+ if (strstr(value, "yes") != NULL) {
+ *flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
+ } else if (strstr(value, "no") != NULL) {
+ *flags &= ~ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
+ } else {
+ MIF_LOG(ERR, "Failed to parse socket-abstract param: %s.", value);
+ return -EINVAL;
+ }
+ return 0;
}
static int
MIF_LOG(WARNING, "Failed to register mp action callback: %s",
strerror(rte_errno));
+ /* use abstract address by default */
+ flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
+
kvlist = rte_kvargs_parse(rte_vdev_device_args(vdev), valid_arguments);
/* parse parameters */
(void *)(&socket_filename));
if (ret < 0)
goto exit;
+ ret = rte_kvargs_process(kvlist, ETH_MEMIF_SOCKET_ABSTRACT_ARG,
+ &memif_set_is_socket_abstract, &flags);
+ if (ret < 0)
+ goto exit;
ret = rte_kvargs_process(kvlist, ETH_MEMIF_MAC_ARG,
&memif_set_mac, ether_addr);
if (ret < 0)
goto exit;
}
+ if (!(flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT)) {
+ ret = memif_check_socket_filename(socket_filename);
+ if (ret < 0)
+ goto exit;
+ }
+
/* create interface */
ret = memif_create(vdev, role, id, flags, socket_filename,
log2_ring_size, pkt_buffer_size, secret, ether_addr);
ETH_MEMIF_PKT_BUFFER_SIZE_ARG "=<int>"
ETH_MEMIF_RING_SIZE_ARG "=<int>"
ETH_MEMIF_SOCKET_ARG "=<string>"
+ ETH_MEMIF_SOCKET_ABSTRACT_ARG "=yes|no"
ETH_MEMIF_MAC_ARG "=xx:xx:xx:xx:xx:xx"
ETH_MEMIF_ZC_ARG "=yes|no"
ETH_MEMIF_SECRET_ARG "=<string>");
memif_interface_id_t id; /**< unique id */
enum memif_role_t role; /**< device role */
uint32_t flags; /**< device status flags */
-#define ETH_MEMIF_FLAG_CONNECTING (1 << 0)
+#define ETH_MEMIF_FLAG_CONNECTING (1 << 0)
/**< device is connecting */
-#define ETH_MEMIF_FLAG_CONNECTED (1 << 1)
+#define ETH_MEMIF_FLAG_CONNECTED (1 << 1)
/**< device is connected */
-#define ETH_MEMIF_FLAG_ZERO_COPY (1 << 2)
+#define ETH_MEMIF_FLAG_ZERO_COPY (1 << 2)
/**< device is zero-copy enabled */
-#define ETH_MEMIF_FLAG_DISABLED (1 << 3)
+#define ETH_MEMIF_FLAG_DISABLED (1 << 3)
/**< device has not been configured and can not accept connection requests */
+#define ETH_MEMIF_FLAG_SOCKET_ABSTRACT (1 << 4)
+/**< use abstract socket address */
char *socket_filename; /**< pointer to socket filename */
char secret[ETH_MEMIF_SECRET_SIZE]; /**< secret (optional security parameter) */