RDMA deadcode
cover RDMA deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
A small collection of function deadcoding, for functions that haven't been used for between 5 and 20 years.
These are all entire function removals, and are build tested only.
Dr. David Alan Gilbert (4):
RDMA/core: Remove unused ib_ud_header_unpack RDMA/core: Remove unused ib_find_exact_cached_pkey RDMA/core: Remove unused ibdev_printk RDMA/core: Remove unused ib_copy_path_rec_from_user
drivers/infiniband/core/cache.c | 35 ---------- drivers/infiniband/core/device.c | 17 ----- drivers/infiniband/core/ud_header.c | 83 ----------------------- drivers/infiniband/core/uverbs_marshall.c | 42 ------------ include/rdma/ib_cache.h | 16 ----- include/rdma/ib_marshall.h | 3 - include/rdma/ib_pack.h | 3 - include/rdma/ib_verbs.h | 3 - 8 files changed, 202 deletions(-)
Signature · 1 line
2.47.1
PATCH 1/4 RDMA/core: Remove unused ib_ud_header_unpack
From: "Dr. David Alan Gilbert" <[email protected]>
ib_ud_header_unpack() is unused, and I can't see any sign of it ever having been used in git. The only reference I can find is from December 2004 BKrev: 41d30034XNbBUl0XnyC6ig9V61Nf-A when it looks like it was added.
Remove it.
--- drivers/infiniband/core/ud_header.c | 83 ----------------------------- include/rdma/ib_pack.h | 3 -- 2 files changed, 86 deletions(-)
drivers/infiniband/core/ud_header.c +0 -83
@@ -462,86 +462,3 @@ int ib_ud_header_pack(struct ib_ud_header *header,return len; }EXPORT_SYMBOL (ib_ud_header_pack); - -/** -* ib_ud_header_unpack - Unpack UD header struct from wire format -* @header:UD header struct -* @buf:Buffer to pack into -* -* ib_ud_header_pack() unpacks the UD header structure @header from wire -* format in the buffer @buf. -*/ -int ib_ud_header_unpack (void *buf, -struct ib_ud_header *header) -{ -ib_unpack (lrh_table,ARRAY_SIZE (lrh_table), - buf, &header->lrh); - buf +=IB_LRH_BYTES ; - -if (header->lrh.link_version !=0 ) { -pr_warn ("Invalid LRH.link_version %u\n" , - header->lrh.link_version); -return -EINVAL ; - } - -switch (header->lrh.link_next_header) { -case IB_LNH_IBA_LOCAL : - header->grh_present =0 ; -break ; - -case IB_LNH_IBA_GLOBAL : - header->grh_present =1 ; -ib_unpack (grh_table,ARRAY_SIZE (grh_table), - buf, &header->grh); - buf +=IB_GRH_BYTES ; - -if (header->grh.ip_version !=6 ) { -pr_warn ("Invalid GRH.ip_version %u\n" , - header->grh.ip_version); -return -EINVAL ; - } -if (header->grh.next_header !=0x1b ) { -pr_warn ("Invalid GRH.next_header 0x%02x\n" , - header->grh.next_header); -return -EINVAL ; - } -break ; - -default : -pr_warn ("Invalid LRH.link_next_header %u\n" , - header->lrh.link_next_header); -return -EINVAL ; - } - -ib_unpack (bth_table,ARRAY_SIZE (bth_table), - buf, &header->bth); - buf +=IB_BTH_BYTES ; - -switch (header->bth.opcode) { -case IB_OPCODE_UD_SEND_ONLY : - header->immediate_present =0 ; -break ; -case IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE : - header->immediate_present =1 ; -break ; -default : -pr_warn ("Invalid BTH.opcode 0x%02x\n" , header->bth.opcode); -return -EINVAL ; - } - -if (header->bth.transport_header_version !=0 ) { -pr_warn ("Invalid BTH.transport_header_version %u\n" , - header->bth.transport_header_version); -return -EINVAL ; - } - -ib_unpack (deth_table,ARRAY_SIZE (deth_table), - buf, &header->deth); - buf +=IB_DETH_BYTES ; - -if (header->immediate_present) -memcpy (&header->immediate_data, buf,sizeof header->immediate_data); - -return 0 ; -} -EXPORT_SYMBOL (ib_ud_header_unpack);
include/rdma/ib_pack.h +0 -3
@@ -283,7 +283,4 @@ int ib_ud_header_init(int payload_bytes,int ib_ud_header_pack (struct ib_ud_header *header,void *buf); -int ib_ud_header_unpack (void *buf, -struct ib_ud_header *header); -#endif /* IB_PACK_H */
Signature · 1 line
2.47.1
Re: [PATCH 1/4] RDMA/core: Remove unused ib_ud_header_unpack
Quoted 21 lines · On Sat, Dec 21, 2024 at 7:11 AM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
ib_ud_header_unpack()is unused, and I can't see any sign of it ever having been used in git. The only reference I can find is from December 2004 BKrev: 41d30034XNbBUl0XnyC6ig9V61Nf-A when it looks like it was added.Remove it.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- drivers/infiniband/core/ud_header.c | 83 ----------------------------- include/rdma/ib_pack.h | 3 -- 2 files changed, 86 deletions(-)drivers/infiniband/core/ud_header.c +0
-0
drivers/infiniband/core/ud_header.c int ib_ud_header_pack(struct ib_ud_header *header, · line 462
Quoted 1 line
drivers/infiniband/core/ud_header.c +0
-0@@ -462,86 +462,3 @@ int ib_ud_header_pack(struct ib_ud_header *header,return len;
LGTM,
Signature · 2 lines
Regards, Kalesh AP
PATCH 2/4 RDMA/core: Remove unused ib_find_exact_cached_pkey
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
The last use of ib_find_exact_cached_pkey() was removed in 2012 by commit 2c75d2ccb6e5 ("IB/mlx4: Fix QP1 P_Key processing in the Primary Physical Function (PPF)")
Remove it.
--- drivers/infiniband/core/cache.c | 35 --------------------------------- include/rdma/ib_cache.h | 16 --------------- 2 files changed, 51 deletions(-)
drivers/infiniband/core/cache.c +0 -35
@@ -1127,41 +1127,6 @@ int ib_find_cached_pkey(struct ib_device *device, u32 port_num, }EXPORT_SYMBOL (ib_find_cached_pkey); -int ib_find_exact_cached_pkey (struct ib_device *device,u32 port_num, -u16 pkey,u16 *index) -{ -struct ib_pkey_cache *cache; -unsigned long flags; -int i; -int ret = -ENOENT ; - -if (!rdma_is_port_valid (device, port_num)) -return -EINVAL ; - -read_lock_irqsave (&device->cache_lock, flags); - - cache = device->port_data[port_num].cache.pkey; -if (!cache) { - ret = -EINVAL ; - goto err; - } - - *index =-1 ; - -for (i =0 ; i < cache->table_len; ++i) -if (cache->table[i] == pkey) { - *index = i; - ret =0 ; -break ; - } - -err: -read_unlock_irqrestore (&device->cache_lock, flags); - -return ret; -} -EXPORT_SYMBOL (ib_find_exact_cached_pkey); -int ib_get_cached_lmc (struct ib_device *device,u32 port_num,u8 *lmc) {unsigned long flags;
include/rdma/ib_cache.h +0 -16
@@ -63,22 +63,6 @@ int ib_find_cached_pkey(struct ib_device *device,u16 pkey, u16 *index); -/** -* ib_find_exact_cached_pkey - Returns the PKey table index where a specified -* PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit) -* @device: The device to query. -* @port_num: The port number of the device to search for the PKey. -* @pkey: The PKey value to search for. -* @index: The index into the cached PKey table where the PKey was found. -* -* ib_find_exact_cached_pkey() searches the specified PKey table in -* the local software cache. -*/ -int ib_find_exact_cached_pkey (struct ib_device *device, -u32 port_num, -u16 pkey, -u16 *index); -/** * ib_get_cached_lmc - Returns a cached lmc table entry * @device: The device to query.
Signature · 1 line
2.47.1
Re: [PATCH 2/4] RDMA/core: Remove unused ib_find_exact_cached_pkey
Quoted 10 lines · On Sat, Dec 21, 2024 at 7:10 AM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The last use of
ib_find_exact_cached_pkey()was removed in 2012 by commit2c75d2ccb6e5("IB/mlx4: Fix QP1P_Keyprocessing in the Primary Physical Function (PPF)")Remove it.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh AP
PATCH 3/4 RDMA/core: Remove unused ibdev_printk
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
The last use of ibdev_printk() was removed in 2019 by commit b2299e83815c ("RDMA: Delete DEBUG code")
Remove it.
Note: The __ibdev_printk() is still used in the idev_err etc functions so leave that.
--- drivers/infiniband/core/device.c | 17 ----------------- include/rdma/ib_verbs.h | 3 --- 2 files changed, 20 deletions(-)
drivers/infiniband/core/device.c +0 -17
@@ -209,23 +209,6 @@ static void __ibdev_printk(const char *level, const struct ib_device *ibdev,printk ("%s(NULL ib_device): %pV" , level, vaf); } -void ibdev_printk (const char *level,const struct ib_device *ibdev, -const char *format, ...) -{ -struct va_format vaf; -va_list args; - -va_start (args, format); - - vaf.fmt = format; - vaf.va = &args; - -__ibdev_printk (level, ibdev, &vaf); - -va_end (args); -} -EXPORT_SYMBOL (ibdev_printk); -#define define_ibdev_printk_level (func, level) \ void func(const struct ib_device *ibdev, const char *fmt, ...) \ { \
include/rdma/ib_verbs.h +0 -3
@@ -59,9 +59,6 @@ extern struct workqueue_struct *ib_comp_unbound_wq;struct ib_ucq_object ; -__printf(3, 4) __cold -void ibdev_printk (const char *level,const struct ib_device *ibdev, -const char *format, ...); __printf(2, 3) __coldvoid ibdev_emerg (const struct ib_device *ibdev,const char *format, ...);__printf (2 ,3 )__cold
Signature · 1 line
2.47.1
PATCH 4/4 RDMA/core: Remove unused ib_copy_path_rec_from_user
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
ib_copy_path_rec_from_user() has been unused since 2019's commit a1a8e4a85cf7 ("rdma: Delete the ib_ucm module")
Remove it.
--- drivers/infiniband/core/uverbs_marshall.c | 42 ----------------------- include/rdma/ib_marshall.h | 3 -- 2 files changed, 45 deletions(-)
drivers/infiniband/core/uverbs_marshall.c +0 -42
@@ -171,45 +171,3 @@ void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,__ib_copy_path_rec_to_user (dst, src); }EXPORT_SYMBOL (ib_copy_path_rec_to_user); - -void ib_copy_path_rec_from_user (struct sa_path_rec *dst, -struct ib_user_path_rec *src) -{ -u32 slid, dlid; - -memset (dst,0 ,sizeof (*dst)); -if ((ib_is_opa_gid ((union ib_gid *)src->sgid)) || - (ib_is_opa_gid ((union ib_gid *)src->dgid))) { - dst->rec_type =SA_PATH_REC_TYPE_OPA ; - slid =opa_get_lid_from_gid ((union ib_gid *)src->sgid); - dlid =opa_get_lid_from_gid ((union ib_gid *)src->dgid); - }else { - dst->rec_type =SA_PATH_REC_TYPE_IB ; - slid =ntohs (src->slid); - dlid =ntohs (src->dlid); - } -memcpy (dst->dgid.raw, src->dgid,sizeof dst->dgid); -memcpy (dst->sgid.raw, src->sgid,sizeof dst->sgid); - -sa_path_set_dlid (dst, dlid); -sa_path_set_slid (dst, slid); -sa_path_set_raw_traffic (dst, src->raw_traffic); - dst->flow_label = src->flow_label; - dst->hop_limit = src->hop_limit; - dst->traffic_class = src->traffic_class; - dst->reversible = src->reversible; - dst->numb_path = src->numb_path; - dst->pkey = src->pkey; - dst->sl = src->sl; - dst->mtu_selector = src->mtu_selector; - dst->mtu = src->mtu; - dst->rate_selector = src->rate_selector; - dst->rate = src->rate; - dst->packet_life_time = src->packet_life_time; - dst->preference = src->preference; - dst->packet_life_time_selector = src->packet_life_time_selector; - -/* TODO: No need to set this */ -sa_path_set_dmac_zero (dst); -} -EXPORT_SYMBOL (ib_copy_path_rec_from_user);
include/rdma/ib_marshall.h +0 -3
@@ -22,7 +22,4 @@ void ib_copy_ah_attr_to_user(struct ib_device *device,void ib_copy_path_rec_to_user (struct ib_user_path_rec *dst,struct sa_path_rec *src); -void ib_copy_path_rec_from_user (struct sa_path_rec *dst, -struct ib_user_path_rec *src); -#endif /* IB_USER_MARSHALL_H */
Signature · 1 line
2.47.1
Re: [PATCH 4/4] RDMA/core: Remove unused ib_copy_path_rec_from_user
Quoted 9 lines · On Sat, Dec 21, 2024 at 7:11 AM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
ib_copy_path_rec_from_user()has been unused since 2019's commita1a8e4a85cf7("rdma: Delete theib_ucmmodule")Remove it.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh AP
Leon Romanovsky
AppliedQuoted 9 lines · On Sat, 21 Dec 2024 01:40:17 +0000, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
A small collection of function deadcoding, for functions that haven't been used for between 5 and 20 years.
These are all entire function removals, and are build tested only.
[...]
Applied, thanks!
[1/4] RDMA/core: Remove unused ib_ud_header_unpack
https://git.kernel.org/rdma/rdma/c/30dd62fa3954cb [2/4] RDMA/core: Remove unused ib_find_exact_cached_pkey https://git.kernel.org/rdma/rdma/c/ddc8fab40b9ae3 [3/4] RDMA/core: Remove unused ibdev_printk https://git.kernel.org/rdma/rdma/c/750efbb9c307f7 [4/4] RDMA/core: Remove unused ib_copy_path_rec_from_user https://git.kernel.org/rdma/rdma/c/2028c2958775c4
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>