uint8_t addr_type;
};
-struct acm_port {
+struct acmp_port {
struct acm_device *dev;
DLIST_ENTRY ep_list;
lock_t lock;
uint64_t guid;
DLIST_ENTRY entry;
int port_cnt;
- struct acm_port port[0];
+ struct acmp_port port[0];
};
/* Maintain separate virtual send queues to avoid deadlock */
DLIST_ENTRY pending;
};
-struct acm_ep {
- struct acm_port *port;
+struct acmp_ep {
+ struct acmp_port *port;
struct ibv_cq *cq;
struct ibv_qp *qp;
struct ibv_mr *mr;
struct acm_send_msg {
DLIST_ENTRY entry;
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct acm_dest *dest;
struct ibv_ah *ah;
void *context;
PER_THREAD char log_data[ACM_MAX_ADDRESS];
static atomic_t counter[ACM_MAX_COUNTER];
+static struct acm_device *
+acm_get_device_from_gid(union ibv_gid *sgid, uint8_t *port);
+static struct acmp_ep *acm_find_ep(struct acmp_port *port, uint16_t pkey);
+static int acm_ep_insert_addr(struct acmp_ep *ep, uint8_t *addr,
+ size_t addr_len, uint8_t addr_type);
+
/*
* Service options - may be set through ibacm_opts.cfg file.
*/
/* Caller must hold ep lock. */
static struct acm_dest *
-acmp_get_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr)
+acmp_get_dest(struct acmp_ep *ep, uint8_t addr_type, uint8_t *addr)
{
struct acm_dest *dest, **tdest;
}
static struct acm_dest *
-acmp_acquire_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr)
+acmp_acquire_dest(struct acmp_ep *ep, uint8_t addr_type, uint8_t *addr)
{
struct acm_dest *dest;
}
static struct acm_dest *
-acmp_acquire_sa_dest(struct acm_port *port)
+acmp_acquire_sa_dest(struct acmp_port *port)
{
struct acm_dest *dest;
/* Caller must hold ep lock. */
//static void
-//acm_remove_dest(struct acm_ep *ep, struct acm_dest *dest)
+//acm_remove_dest(struct acmp_ep *ep, struct acm_dest *dest)
//{
// acm_log(2, "%s\n", dest->name);
// tdelete(dest->address, &ep->dest_map[dest->addr_type - 1], acmp_compare_dest);
}
static struct acm_send_msg *
-acmp_alloc_send(struct acm_ep *ep, struct acm_dest *dest, size_t size)
+acmp_alloc_send(struct acmp_ep *ep, struct acm_dest *dest, size_t size)
{
struct acm_send_msg *msg;
static void acmp_post_send(struct acm_send_queue *queue, struct acm_send_msg *msg)
{
- struct acm_ep *ep = msg->ep;
+ struct acmp_ep *ep = msg->ep;
struct ibv_send_wr *bad_wr;
msg->req_queue = queue;
lock_release(&ep->lock);
}
-static void acmp_post_recv(struct acm_ep *ep, uint64_t address)
+static void acmp_post_recv(struct acmp_ep *ep, uint64_t address)
{
struct ibv_recv_wr wr, *bad_wr;
struct ibv_sge sge;
}
/* Caller must hold ep lock */
-static void acmp_send_available(struct acm_ep *ep, struct acm_send_queue *queue)
+static void acmp_send_available(struct acmp_ep *ep, struct acm_send_queue *queue)
{
struct acm_send_msg *msg;
struct ibv_send_wr *bad_wr;
static void acmp_complete_send(struct acm_send_msg *msg)
{
- struct acm_ep *ep = msg->ep;
+ struct acmp_ep *ep = msg->ep;
lock_acquire(&ep->lock);
DListRemove(&msg->entry);
lock_release(&ep->lock);
}
-static struct acm_send_msg *acmp_get_request(struct acm_ep *ep, uint64_t tid, int *free)
+static struct acm_send_msg *acmp_get_request(struct acmp_ep *ep, uint64_t tid, int *free)
{
struct acm_send_msg *msg, *req = NULL;
struct acm_mad *mad;
return req;
}
-static uint8_t acm_gid_index(struct acm_port *port, union ibv_gid *gid)
+static uint8_t acm_gid_index(struct acmp_port *port, union ibv_gid *gid)
{
union ibv_gid cmp_gid;
uint8_t i;
return i;
}
-static int acmp_mc_index(struct acm_ep *ep, union ibv_gid *gid)
+static int acmp_mc_index(struct acmp_ep *ep, union ibv_gid *gid)
{
int i;
}
/* Multicast groups are ordered lowest to highest preference. */
-static int acmp_best_mc_index(struct acm_ep *ep, struct acm_resolve_rec *rec)
+static int acmp_best_mc_index(struct acmp_ep *ep, struct acm_resolve_rec *rec)
{
int i, index;
}
static void
-acmp_record_mc_av(struct acm_port *port, struct ib_mc_member_rec *mc_rec,
+acmp_record_mc_av(struct acmp_port *port, struct ib_mc_member_rec *mc_rec,
struct acm_dest *dest)
{
uint32_t sl_flow_hop;
/* Always send the GRH to transfer GID data to remote side */
static void
-acm_init_path_av(struct acm_port *port, struct acm_dest *dest)
+acm_init_path_av(struct acmp_port *port, struct acm_dest *dest)
{
uint32_t flow_hop;
dest->av.grh.traffic_class = dest->path.tclass;
}
-static void acmp_process_join_resp(struct acm_ep *ep, struct ib_user_mad *umad)
+static void acmp_process_join_resp(struct acmp_ep *ep, struct ib_user_mad *umad)
{
struct acm_dest *dest;
struct ib_mc_member_rec *mc_rec;
lock_release(&ep->lock);
}
-static void acm_mark_addr_invalid(struct acm_ep *ep,
+static void acm_mark_addr_invalid(struct acmp_ep *ep,
struct acm_ep_addr_data *data)
{
int i;
lock_release(&ep->lock);
}
-static int acm_addr_index(struct acm_ep *ep, uint8_t *addr, uint8_t addr_type)
+static int acm_addr_index(struct acmp_ep *ep, uint8_t *addr, uint8_t addr_type)
{
int i;
}
static uint8_t
-acmp_record_acm_route(struct acm_ep *ep, struct acm_dest *dest)
+acmp_record_acm_route(struct acmp_ep *ep, struct acm_dest *dest)
{
int i;
}
/* Caller must hold dest lock */
-static uint8_t acm_resolve_path(struct acm_ep *ep, struct acm_dest *dest,
+static uint8_t acm_resolve_path(struct acmp_ep *ep, struct acm_dest *dest,
void (*resp_handler)(struct acm_send_msg *req,
struct ibv_wc *wc, struct acm_mad *resp))
{
}
static uint8_t
-acmp_record_acm_addr(struct acm_ep *ep, struct acm_dest *dest, struct ibv_wc *wc,
+acmp_record_acm_addr(struct acmp_ep *ep, struct acm_dest *dest, struct ibv_wc *wc,
struct acm_resolve_rec *rec)
{
int index;
}
static void
-acmp_record_path_addr(struct acm_ep *ep, struct acm_dest *dest,
+acmp_record_path_addr(struct acmp_ep *ep, struct acm_dest *dest,
struct ibv_path_record *path)
{
acm_log(2, "%s\n", dest->name);
}
static void
-acmp_send_addr_resp(struct acm_ep *ep, struct acm_dest *dest)
+acmp_send_addr_resp(struct acmp_ep *ep, struct acm_dest *dest)
{
struct acm_resolve_rec *rec;
struct acm_send_msg *msg;
}
static void
-acmp_process_addr_req(struct acm_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
+acmp_process_addr_req(struct acmp_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
{
struct acm_resolve_rec *rec;
struct acm_dest *dest;
acmp_put_dest(dest);
}
-static void acmp_process_acm_recv(struct acm_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
+static void acmp_process_acm_recv(struct acmp_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
{
struct acm_send_msg *req;
struct acm_resolve_rec *rec;
acmp_free_req(req);
}
-static void acmp_process_sa_recv(struct acm_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
+static void acmp_process_sa_recv(struct acmp_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
{
struct ib_sa_mad *sa_mad = (struct ib_sa_mad *) mad;
struct acm_send_msg *req;
acmp_free_send(req);
}
-static void acmp_process_recv(struct acm_ep *ep, struct ibv_wc *wc)
+static void acmp_process_recv(struct acmp_ep *ep, struct ibv_wc *wc)
{
struct acm_mad *mad;
acmp_post_recv(ep, wc->wr_id);
}
-static void acmp_process_comp(struct acm_ep *ep, struct ibv_wc *wc)
+static void acmp_process_comp(struct acmp_ep *ep, struct ibv_wc *wc)
{
if (wc->status) {
acm_log(0, "ERROR - work completion error\n"
static void CDECL_FUNC acmp_comp_handler(void *context)
{
struct acm_device *dev = (struct acm_device *) context;
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct ibv_cq *cq;
struct ibv_wc wc;
int cnt;
mc_rec->scope_state = 0x51;
}
-static void acmp_join_group(struct acm_ep *ep, union ibv_gid *port_gid,
+static void acmp_join_group(struct acmp_ep *ep, union ibv_gid *port_gid,
uint8_t tos, uint8_t tclass, uint8_t sl, uint8_t rate, uint8_t mtu)
{
- struct acm_port *port;
+ struct acmp_port *port;
struct ib_sa_mad *mad;
struct ib_user_mad *umad;
struct ib_mc_member_rec *mc_rec;
free(umad);
}
-static void acmp_ep_join(struct acm_ep *ep)
+static void acmp_ep_join(struct acmp_ep *ep)
{
- struct acm_port *port;
+ struct acmp_port *port;
port = ep->port;
acm_log(1, "%s\n", ep->id_string);
acm_log(1, "join for %s complete\n", ep->id_string);
}
-static void acmp_port_join(struct acm_port *port)
+static void acmp_port_join(struct acmp_port *port)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
DLIST_ENTRY *ep_entry;
acm_log(1, "device %s port %d\n", port->dev->verbs->device->name,
for (ep_entry = port->ep_list.Next; ep_entry != &port->ep_list;
ep_entry = ep_entry->Next) {
- ep = container_of(ep_entry, struct acm_ep, entry);
+ ep = container_of(ep_entry, struct acmp_ep, entry);
acmp_ep_join(ep);
}
acm_log(1, "joins for device %s port %d complete\n",
}
}
-static void acmp_process_wait_queue(struct acm_ep *ep, uint64_t *next_expire)
+static void acmp_process_wait_queue(struct acmp_ep *ep, uint64_t *next_expire)
{
struct acm_send_msg *msg;
DLIST_ENTRY *entry, *next;
static void CDECL_FUNC acmp_retry_handler(void *context)
{
struct acm_device *dev;
- struct acm_port *port;
- struct acm_ep *ep;
+ struct acmp_port *port;
+ struct acmp_ep *ep;
DLIST_ENTRY *dev_entry, *ep_entry;
uint64_t next_expire;
int i, wait;
ep_entry != &port->ep_list;
ep_entry = ep_entry->Next) {
- ep = container_of(ep_entry, struct acm_ep, entry);
+ ep = container_of(ep_entry, struct acmp_ep, entry);
lock_acquire(&ep->lock);
if (!DListEmpty(&ep->wait_queue))
acmp_process_wait_queue(ep, &next_expire);
}
static int
-acm_is_path_from_port(struct acm_port *port, struct ibv_path_record *path)
+acm_is_path_from_port(struct acmp_port *port, struct ibv_path_record *path)
{
union ibv_gid gid;
uint8_t i;
return 0;
}
-static struct acm_ep *
-acm_get_port_ep(struct acm_port *port, struct acm_ep_addr_data *data)
+static struct acmp_ep *
+acm_get_port_ep(struct acmp_port *port, struct acm_ep_addr_data *data)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
DLIST_ENTRY *ep_entry;
if (port->state != IBV_PORT_ACTIVE)
for (ep_entry = port->ep_list.Next; ep_entry != &port->ep_list;
ep_entry = ep_entry->Next) {
- ep = container_of(ep_entry, struct acm_ep, entry);
+ ep = container_of(ep_entry, struct acmp_ep, entry);
if (ep->state != ACM_READY)
continue;
return NULL;
}
-static struct acm_ep *
+static struct acmp_ep *
acm_get_ep(struct acm_ep_addr_data *data)
{
struct acm_device *dev;
- struct acm_ep *ep;
+ struct acmp_ep *ep;
DLIST_ENTRY *dev_entry;
int i;
struct acm_request *req;
struct acm_send_msg *sa_msg;
struct ib_sa_mad *mad;
- struct acm_ep *ep;
+ struct acmp_ep *ep;
uint8_t status;
acm_log(2, "client %d\n", client->index);
}
static uint8_t
-acmp_send_resolve(struct acm_ep *ep, struct acm_dest *dest,
+acmp_send_resolve(struct acmp_ep *ep, struct acm_dest *dest,
struct acm_ep_addr_data *saddr)
{
struct acm_send_msg *msg;
static int
acm_svr_resolve_dest(struct acm_client *client, struct acm_msg *msg)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct acm_dest *dest;
struct acm_ep_addr_data *saddr, *daddr;
uint8_t status;
static int
acm_svr_resolve_path(struct acm_client *client, struct acm_msg *msg)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct acm_dest *dest;
struct ibv_path_record *path;
uint8_t *addr;
acm_disconnect_client(client);
}
-static struct acm_device *
-acm_get_device_from_gid(union ibv_gid *sgid, uint8_t *port);
-static struct acm_ep *acm_find_ep(struct acm_port *port, uint16_t pkey);
-static int
-acm_ep_insert_addr(struct acm_ep *ep, uint8_t *addr, size_t addr_len, uint8_t addr_type);
-
static int acm_nl_to_addr_data(struct acm_ep_addr_data *ad,
int af_family, uint8_t *addr, size_t addr_len)
{
static void acm_add_ep_ip(struct acm_ep_addr_data *data, char *ifname)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct acm_device *dev;
uint8_t port_num;
uint16_t pkey;
data->type, data->info.addr, sizeof data->info.addr);
acm_log(0, " %s\n", log_data);
- ep = acm_find_ep(&dev->port[port_num-1], pkey);
+ ep = acm_find_ep(&dev->port[port_num - 1], pkey);
if (ep) {
if (acm_ep_insert_addr(ep, data->info.addr, sizeof data->info.addr, data->type))
acm_log(0, "Failed to add '%s' to EP\n", log_data);
static void acm_rm_ep_ip(struct acm_ep_addr_data *data)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
ep = acm_get_ep(data);
if (ep) {
{
int ret = EINVAL;
struct acm_device *dev = NULL;
- struct acm_ep *ep = NULL;
+ struct acmp_ep *ep = NULL;
uint8_t port_num;
char gid_str[INET6_ADDRSTRLEN];
dev = acm_get_device_from_gid(gid, &port_num);
if (dev)
- ep = acm_find_ep(&dev->port[port_num-1], pkey);
+ ep = acm_find_ep(&dev->port[port_num - 1], pkey);
if (ep)
ret = acm_ep_insert_addr(ep, addr, addr_len, addr_type);
/* mark all IP's invalid */
for (dev_entry = dev_list.Next; dev_entry != &dev_list;
dev_entry = dev_entry->Next) {
- struct acm_ep *ep = NULL;
+ struct acmp_ep *ep = NULL;
DLIST_ENTRY *entry;
dev = container_of(dev_entry, struct acm_device, entry);
for (cnt = 0; cnt < dev->port_cnt; cnt++) {
- struct acm_port *port = &dev->port[cnt];
+ struct acmp_port *port = &dev->port[cnt];
for (entry = port->ep_list.Next; entry != &port->ep_list;
entry = entry->Next) {
int i;
- ep = container_of(entry, struct acm_ep, entry);
+ ep = container_of(entry, struct acmp_ep, entry);
for (i = 0; i < MAX_EP_ADDR; i++) {
if (ep->addr_type[i] == ACM_ADDRESS_IP
|| ep->addr_type[i] == ACM_ADDRESS_IP6)
}
}
-static int acmp_post_recvs(struct acm_ep *ep)
+static int acmp_post_recvs(struct acmp_ep *ep)
{
int i, size;
}
/* Parse 'opensm full v1' file to populate PR cache */
-static int acm_parse_osm_fullv1_paths(FILE *f, uint64_t *lid2guid, struct acm_ep *ep)
+static int acm_parse_osm_fullv1_paths(FILE *f, uint64_t *lid2guid, struct acmp_ep *ep)
{
union ibv_gid sgid, dgid;
struct ibv_port_attr attr = { 0 };
return ret;
}
-static int acm_parse_osm_fullv1(struct acm_ep *ep)
+static int acm_parse_osm_fullv1(struct acmp_ep *ep)
{
FILE *f;
uint64_t *lid2guid;
return ret;
}
-static void acm_parse_hosts_file(struct acm_ep *ep)
+static void acm_parse_hosts_file(struct acmp_ep *ep)
{
FILE *f;
char s[120];
}
static int
-acm_ep_insert_addr(struct acm_ep *ep, uint8_t *addr, size_t addr_len, uint8_t addr_type)
+acm_ep_insert_addr(struct acmp_ep *ep, uint8_t *addr, size_t addr_len, uint8_t addr_type)
{
int i;
int ret = ENOMEM;
{
uint8_t port_num;
struct acm_device *dev;
- struct acm_ep *ep = (struct acm_ep *)ctx;
+ struct acmp_ep *ep = (struct acmp_ep *)ctx;
dev = acm_get_device_from_gid(gid, &port_num);
if (dev && ep->port->dev == dev
}
}
-static int acm_get_system_ips(struct acm_ep *ep)
+static int acm_get_system_ips(struct acmp_ep *ep)
{
return acm_if_iter_sys(acm_ep_ip_iter_cb, (void *)ep);
}
-static int acm_assign_ep_names(struct acm_ep *ep)
+static int acm_assign_ep_names(struct acmp_ep *ep)
{
FILE *faddr;
char *dev_name;
* load the address data. This is backwards from normal operation, which
* usually resolves the address before the route.
*/
-static void acm_ep_preload(struct acm_ep *ep)
+static void acm_ep_preload(struct acmp_ep *ep)
{
switch (route_preload) {
case ACM_ROUTE_PRELOAD_OSM_FULL_V1:
}
}
-static int acmp_init_ep_loopback(struct acm_ep *ep)
+static int acmp_init_ep_loopback(struct acmp_ep *ep)
{
struct acm_dest *dest;
int i;
return 0;
}
-static struct acm_ep *acm_find_ep(struct acm_port *port, uint16_t pkey)
+static struct acmp_ep *acm_find_ep(struct acmp_port *port, uint16_t pkey)
{
- struct acm_ep *ep, *res = NULL;
+ struct acmp_ep *ep, *res = NULL;
DLIST_ENTRY *entry;
acm_log(2, "pkey 0x%x\n", pkey);
lock_acquire(&port->lock);
for (entry = port->ep_list.Next; entry != &port->ep_list; entry = entry->Next) {
- ep = container_of(entry, struct acm_ep, entry);
+ ep = container_of(entry, struct acmp_ep, entry);
if (ep->pkey == pkey) {
res = ep;
break;
return res;
}
-static struct acm_ep *
-acmp_alloc_ep(struct acm_port *port, uint16_t pkey, uint16_t pkey_index)
+static struct acmp_ep *
+acmp_alloc_ep(struct acmp_port *port, uint16_t pkey, uint16_t pkey_index)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
acm_log(1, "\n");
ep = calloc(1, sizeof *ep);
return ep;
}
-static void acmp_ep_up(struct acm_port *port, uint16_t pkey_index)
+static void acmp_ep_up(struct acmp_port *port, uint16_t pkey_index)
{
- struct acm_ep *ep;
+ struct acmp_ep *ep;
struct ibv_qp_init_attr init_attr;
struct ibv_qp_attr attr;
int ret, sq_size;
free(ep);
}
-static void acmp_port_up(struct acm_port *port)
+static void acmp_port_up(struct acmp_port *port)
{
struct ibv_port_attr attr;
union ibv_gid gid;
acm_log(1, "%s %d is up\n", port->dev->verbs->device->name, port->port_num);
}
-static void acmp_port_down(struct acm_port *port)
+static void acmp_port_down(struct acmp_port *port)
{
struct ibv_port_attr attr;
int ret;
}
}
-static void acmp_open_port(struct acm_port *port, struct acm_device *dev, uint8_t port_num)
+static void acmp_open_port(struct acmp_port *port, struct acm_device *dev, uint8_t port_num)
{
acm_log(1, "%s %d\n", dev->verbs->device->name, port_num);
port->dev = dev;
goto err1;
}
- size = sizeof(*dev) + sizeof(struct acm_port) * attr.phys_port_cnt;
+ size = sizeof(*dev) + sizeof(struct acmp_port) * attr.phys_port_cnt;
dev = (struct acm_device *) calloc(1, size);
if (!dev)
goto err1;