Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/core/sa_query: Remove unused function

ib_sa_service_rec_query() was introduced in kernel v2.6.13 by
commit cbae32c56314 ("[PATCH] IB: Add Service Record support to SA client")
in 2005. It was not used then and have never been used since.

Removing it and related functions/structs.

Link: https://lore.kernel.org/r/1628702736-12651-1-git-send-email-haakon.bugge@oracle.com
Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Håkon Bugge and committed by
Jason Gunthorpe
bfeababd 6ef793cb

-201
-177
drivers/infiniband/core/sa_query.c
··· 123 123 #define IB_SA_CANCEL 0x00000002 124 124 #define IB_SA_QUERY_OPA 0x00000004 125 125 126 - struct ib_sa_service_query { 127 - void (*callback)(int, struct ib_sa_service_rec *, void *); 128 - void *context; 129 - struct ib_sa_query sa_query; 130 - }; 131 - 132 126 struct ib_sa_path_query { 133 127 void (*callback)(int, struct sa_path_rec *, void *); 134 128 void *context; ··· 494 500 .offset_words = 12, 495 501 .offset_bits = 9, 496 502 .size_bits = 23 }, 497 - }; 498 - 499 - #define SERVICE_REC_FIELD(field) \ 500 - .struct_offset_bytes = offsetof(struct ib_sa_service_rec, field), \ 501 - .struct_size_bytes = sizeof_field(struct ib_sa_service_rec, field), \ 502 - .field_name = "sa_service_rec:" #field 503 - 504 - static const struct ib_field service_rec_table[] = { 505 - { SERVICE_REC_FIELD(id), 506 - .offset_words = 0, 507 - .offset_bits = 0, 508 - .size_bits = 64 }, 509 - { SERVICE_REC_FIELD(gid), 510 - .offset_words = 2, 511 - .offset_bits = 0, 512 - .size_bits = 128 }, 513 - { SERVICE_REC_FIELD(pkey), 514 - .offset_words = 6, 515 - .offset_bits = 0, 516 - .size_bits = 16 }, 517 - { SERVICE_REC_FIELD(lease), 518 - .offset_words = 7, 519 - .offset_bits = 0, 520 - .size_bits = 32 }, 521 - { SERVICE_REC_FIELD(key), 522 - .offset_words = 8, 523 - .offset_bits = 0, 524 - .size_bits = 128 }, 525 - { SERVICE_REC_FIELD(name), 526 - .offset_words = 12, 527 - .offset_bits = 0, 528 - .size_bits = 64*8 }, 529 - { SERVICE_REC_FIELD(data8), 530 - .offset_words = 28, 531 - .offset_bits = 0, 532 - .size_bits = 16*8 }, 533 - { SERVICE_REC_FIELD(data16), 534 - .offset_words = 32, 535 - .offset_bits = 0, 536 - .size_bits = 8*16 }, 537 - { SERVICE_REC_FIELD(data32), 538 - .offset_words = 36, 539 - .offset_bits = 0, 540 - .size_bits = 4*32 }, 541 - { SERVICE_REC_FIELD(data64), 542 - .offset_words = 40, 543 - .offset_bits = 0, 544 - .size_bits = 2*64 }, 545 503 }; 546 504 547 505 #define CLASSPORTINFO_REC_FIELD(field) \ ··· 1579 1633 return ret; 1580 1634 } 1581 1635 EXPORT_SYMBOL(ib_sa_path_rec_get); 1582 - 1583 - static void ib_sa_service_rec_callback(struct ib_sa_query *sa_query, 1584 - int status, 1585 - struct ib_sa_mad *mad) 1586 - { 1587 - struct ib_sa_service_query *query = 1588 - container_of(sa_query, struct ib_sa_service_query, sa_query); 1589 - 1590 - if (mad) { 1591 - struct ib_sa_service_rec rec; 1592 - 1593 - ib_unpack(service_rec_table, ARRAY_SIZE(service_rec_table), 1594 - mad->data, &rec); 1595 - query->callback(status, &rec, query->context); 1596 - } else 1597 - query->callback(status, NULL, query->context); 1598 - } 1599 - 1600 - static void ib_sa_service_rec_release(struct ib_sa_query *sa_query) 1601 - { 1602 - kfree(container_of(sa_query, struct ib_sa_service_query, sa_query)); 1603 - } 1604 - 1605 - /** 1606 - * ib_sa_service_rec_query - Start Service Record operation 1607 - * @client:SA client 1608 - * @device:device to send request on 1609 - * @port_num: port number to send request on 1610 - * @method:SA method - should be get, set, or delete 1611 - * @rec:Service Record to send in request 1612 - * @comp_mask:component mask to send in request 1613 - * @timeout_ms:time to wait for response 1614 - * @gfp_mask:GFP mask to use for internal allocations 1615 - * @callback:function called when request completes, times out or is 1616 - * canceled 1617 - * @context:opaque user context passed to callback 1618 - * @sa_query:request context, used to cancel request 1619 - * 1620 - * Send a Service Record set/get/delete to the SA to register, 1621 - * unregister or query a service record. 1622 - * The callback function will be called when the request completes (or 1623 - * fails); status is 0 for a successful response, -EINTR if the query 1624 - * is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error 1625 - * occurred sending the query. The resp parameter of the callback is 1626 - * only valid if status is 0. 1627 - * 1628 - * If the return value of ib_sa_service_rec_query() is negative, it is an 1629 - * error code. Otherwise it is a request ID that can be used to cancel 1630 - * the query. 1631 - */ 1632 - int ib_sa_service_rec_query(struct ib_sa_client *client, 1633 - struct ib_device *device, u32 port_num, u8 method, 1634 - struct ib_sa_service_rec *rec, 1635 - ib_sa_comp_mask comp_mask, 1636 - unsigned long timeout_ms, gfp_t gfp_mask, 1637 - void (*callback)(int status, 1638 - struct ib_sa_service_rec *resp, 1639 - void *context), 1640 - void *context, 1641 - struct ib_sa_query **sa_query) 1642 - { 1643 - struct ib_sa_service_query *query; 1644 - struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client); 1645 - struct ib_sa_port *port; 1646 - struct ib_mad_agent *agent; 1647 - struct ib_sa_mad *mad; 1648 - int ret; 1649 - 1650 - if (!sa_dev) 1651 - return -ENODEV; 1652 - 1653 - port = &sa_dev->port[port_num - sa_dev->start_port]; 1654 - agent = port->agent; 1655 - 1656 - if (method != IB_MGMT_METHOD_GET && 1657 - method != IB_MGMT_METHOD_SET && 1658 - method != IB_SA_METHOD_DELETE) 1659 - return -EINVAL; 1660 - 1661 - query = kzalloc(sizeof(*query), gfp_mask); 1662 - if (!query) 1663 - return -ENOMEM; 1664 - 1665 - query->sa_query.port = port; 1666 - ret = alloc_mad(&query->sa_query, gfp_mask); 1667 - if (ret) 1668 - goto err1; 1669 - 1670 - ib_sa_client_get(client); 1671 - query->sa_query.client = client; 1672 - query->callback = callback; 1673 - query->context = context; 1674 - 1675 - mad = query->sa_query.mad_buf->mad; 1676 - init_mad(&query->sa_query, agent); 1677 - 1678 - query->sa_query.callback = callback ? ib_sa_service_rec_callback : NULL; 1679 - query->sa_query.release = ib_sa_service_rec_release; 1680 - mad->mad_hdr.method = method; 1681 - mad->mad_hdr.attr_id = cpu_to_be16(IB_SA_ATTR_SERVICE_REC); 1682 - mad->sa_hdr.comp_mask = comp_mask; 1683 - 1684 - ib_pack(service_rec_table, ARRAY_SIZE(service_rec_table), 1685 - rec, mad->data); 1686 - 1687 - *sa_query = &query->sa_query; 1688 - 1689 - ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); 1690 - if (ret < 0) 1691 - goto err2; 1692 - 1693 - return ret; 1694 - 1695 - err2: 1696 - *sa_query = NULL; 1697 - ib_sa_client_put(query->sa_query.client); 1698 - free_mad(&query->sa_query); 1699 - 1700 - err1: 1701 - kfree(query); 1702 - return ret; 1703 - } 1704 - EXPORT_SYMBOL(ib_sa_service_rec_query); 1705 1636 1706 1637 static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query, 1707 1638 int status,
-24
include/rdma/ib_sa.h
··· 366 366 367 367 #define IB_DEFAULT_SERVICE_LEASE 0xFFFFFFFF 368 368 369 - struct ib_sa_service_rec { 370 - u64 id; 371 - union ib_gid gid; 372 - __be16 pkey; 373 - /* reserved */ 374 - u32 lease; 375 - u8 key[16]; 376 - u8 name[64]; 377 - u8 data8[16]; 378 - u16 data16[8]; 379 - u32 data32[4]; 380 - u64 data64[2]; 381 - }; 382 - 383 369 #define IB_SA_GUIDINFO_REC_LID IB_SA_COMP_MASK(0) 384 370 #define IB_SA_GUIDINFO_REC_BLOCK_NUM IB_SA_COMP_MASK(1) 385 371 #define IB_SA_GUIDINFO_REC_RES1 IB_SA_COMP_MASK(2) ··· 415 429 void (*callback)(int status, struct sa_path_rec *resp, 416 430 void *context), 417 431 void *context, struct ib_sa_query **query); 418 - 419 - int ib_sa_service_rec_query(struct ib_sa_client *client, 420 - struct ib_device *device, u32 port_num, u8 method, 421 - struct ib_sa_service_rec *rec, 422 - ib_sa_comp_mask comp_mask, unsigned long timeout_ms, 423 - gfp_t gfp_mask, 424 - void (*callback)(int status, 425 - struct ib_sa_service_rec *resp, 426 - void *context), 427 - void *context, struct ib_sa_query **sa_query); 428 432 429 433 struct ib_sa_multicast { 430 434 struct ib_sa_mcmember_rec rec;