MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memif_socket_remove_device

Function memif_socket_remove_device

dpdk/drivers/net/memif/memif_socket.c:1060–1104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1058}
1059
1060void
1061memif_socket_remove_device(struct rte_eth_dev *dev)
1062{
1063 struct pmd_internals *pmd = dev->data->dev_private;
1064 struct memif_socket *socket = NULL;
1065 struct memif_socket_dev_list_elt *elt, *next;
1066 struct rte_hash *hash;
1067 int ret;
1068
1069 hash = rte_hash_find_existing(MEMIF_SOCKET_HASH_NAME);
1070 if (hash == NULL)
1071 return;
1072
1073 if (pmd->socket_filename == NULL)
1074 return;
1075
1076 if (rte_hash_lookup_data(hash, pmd->socket_filename, (void **)&socket) < 0)
1077 return;
1078
1079 for (elt = TAILQ_FIRST(&socket->dev_queue); elt != NULL; elt = next) {
1080 next = TAILQ_NEXT(elt, next);
1081 if (elt->dev == dev) {
1082 TAILQ_REMOVE(&socket->dev_queue, elt, next);
1083 rte_free(elt);
1084 pmd->socket_filename = NULL;
1085 }
1086 }
1087
1088 /* remove socket, if this was the last device using it */
1089 if (TAILQ_EMPTY(&socket->dev_queue)) {
1090 rte_hash_del_key(hash, socket->filename);
1091 if (socket->listener && !(pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT)) {
1092 /* remove listener socket file,
1093 * so we can create new one later.
1094 */
1095 ret = remove(socket->filename);
1096 if (ret < 0)
1097 MIF_LOG(ERR, "Failed to remove socket file: %s",
1098 socket->filename);
1099 }
1100 if (pmd->role != MEMIF_ROLE_CLIENT)
1101 rte_intr_instance_free(socket->intr_handle);
1102 rte_free(socket);
1103 }
1104}
1105
1106int
1107memif_connect_server(struct rte_eth_dev *dev)

Callers 1

memif_dev_closeFunction · 0.85

Calls 5

rte_hash_find_existingFunction · 0.85
rte_hash_lookup_dataFunction · 0.85
rte_freeFunction · 0.85
rte_hash_del_keyFunction · 0.85
rte_intr_instance_freeFunction · 0.85

Tested by

no test coverage detected