Skip to content

Commit 017d8ea

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/cm: Delete unused CM LAP functions
Clean the code by deleting LAP functions, which are not called anyway. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 04db158 commit 017d8ea

File tree

2 files changed

+0
-168
lines changed

2 files changed

+0
-168
lines changed

drivers/infiniband/core/cm.c

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,104 +3029,6 @@ static int cm_mra_handler(struct cm_work *work)
30293029
return -EINVAL;
30303030
}
30313031

3032-
static void cm_format_lap(struct cm_lap_msg *lap_msg,
3033-
struct cm_id_private *cm_id_priv,
3034-
struct sa_path_rec *alternate_path,
3035-
const void *private_data,
3036-
u8 private_data_len)
3037-
{
3038-
bool alt_ext = false;
3039-
3040-
if (alternate_path->rec_type == SA_PATH_REC_TYPE_OPA)
3041-
alt_ext = opa_is_extended_lid(alternate_path->opa.dlid,
3042-
alternate_path->opa.slid);
3043-
cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID,
3044-
cm_form_tid(cm_id_priv));
3045-
lap_msg->local_comm_id = cm_id_priv->id.local_id;
3046-
lap_msg->remote_comm_id = cm_id_priv->id.remote_id;
3047-
cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn);
3048-
/* todo: need remote CM response timeout */
3049-
cm_lap_set_remote_resp_timeout(lap_msg, 0x1F);
3050-
lap_msg->alt_local_lid =
3051-
htons(ntohl(sa_path_get_slid(alternate_path)));
3052-
lap_msg->alt_remote_lid =
3053-
htons(ntohl(sa_path_get_dlid(alternate_path)));
3054-
lap_msg->alt_local_gid = alternate_path->sgid;
3055-
lap_msg->alt_remote_gid = alternate_path->dgid;
3056-
if (alt_ext) {
3057-
lap_msg->alt_local_gid.global.interface_id
3058-
= OPA_MAKE_ID(be32_to_cpu(alternate_path->opa.slid));
3059-
lap_msg->alt_remote_gid.global.interface_id
3060-
= OPA_MAKE_ID(be32_to_cpu(alternate_path->opa.dlid));
3061-
}
3062-
cm_lap_set_flow_label(lap_msg, alternate_path->flow_label);
3063-
cm_lap_set_traffic_class(lap_msg, alternate_path->traffic_class);
3064-
lap_msg->alt_hop_limit = alternate_path->hop_limit;
3065-
cm_lap_set_packet_rate(lap_msg, alternate_path->rate);
3066-
cm_lap_set_sl(lap_msg, alternate_path->sl);
3067-
cm_lap_set_subnet_local(lap_msg, 1); /* local only... */
3068-
cm_lap_set_local_ack_timeout(lap_msg,
3069-
cm_ack_timeout(cm_id_priv->av.port->cm_dev->ack_delay,
3070-
alternate_path->packet_life_time));
3071-
3072-
if (private_data && private_data_len)
3073-
memcpy(lap_msg->private_data, private_data, private_data_len);
3074-
}
3075-
3076-
int ib_send_cm_lap(struct ib_cm_id *cm_id,
3077-
struct sa_path_rec *alternate_path,
3078-
const void *private_data,
3079-
u8 private_data_len)
3080-
{
3081-
struct cm_id_private *cm_id_priv;
3082-
struct ib_mad_send_buf *msg;
3083-
unsigned long flags;
3084-
int ret;
3085-
3086-
if (private_data && private_data_len > IB_CM_LAP_PRIVATE_DATA_SIZE)
3087-
return -EINVAL;
3088-
3089-
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
3090-
spin_lock_irqsave(&cm_id_priv->lock, flags);
3091-
if (cm_id->state != IB_CM_ESTABLISHED ||
3092-
(cm_id->lap_state != IB_CM_LAP_UNINIT &&
3093-
cm_id->lap_state != IB_CM_LAP_IDLE)) {
3094-
ret = -EINVAL;
3095-
goto out;
3096-
}
3097-
3098-
ret = cm_init_av_by_path(alternate_path, NULL, &cm_id_priv->alt_av,
3099-
cm_id_priv);
3100-
if (ret)
3101-
goto out;
3102-
cm_id_priv->alt_av.timeout =
3103-
cm_ack_timeout(cm_id_priv->target_ack_delay,
3104-
cm_id_priv->alt_av.timeout - 1);
3105-
3106-
ret = cm_alloc_msg(cm_id_priv, &msg);
3107-
if (ret)
3108-
goto out;
3109-
3110-
cm_format_lap((struct cm_lap_msg *) msg->mad, cm_id_priv,
3111-
alternate_path, private_data, private_data_len);
3112-
msg->timeout_ms = cm_id_priv->timeout_ms;
3113-
msg->context[1] = (void *) (unsigned long) IB_CM_ESTABLISHED;
3114-
3115-
ret = ib_post_send_mad(msg, NULL);
3116-
if (ret) {
3117-
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3118-
cm_free_msg(msg);
3119-
return ret;
3120-
}
3121-
3122-
cm_id->lap_state = IB_CM_LAP_SENT;
3123-
cm_id_priv->msg = msg;
3124-
3125-
out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3126-
return ret;
3127-
}
3128-
EXPORT_SYMBOL(ib_send_cm_lap);
3129-
31303032
static void cm_format_path_lid_from_lap(struct cm_lap_msg *lap_msg,
31313033
struct sa_path_rec *path)
31323034
{

drivers/infiniband/core/cm_msgs.h

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -651,101 +651,31 @@ struct cm_lap_msg {
651651
u8 private_data[IB_CM_LAP_PRIVATE_DATA_SIZE];
652652
} __packed;
653653

654-
static inline __be32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg)
655-
{
656-
return cpu_to_be32(be32_to_cpu(lap_msg->offset12) >> 8);
657-
}
658-
659-
static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, __be32 qpn)
660-
{
661-
lap_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
662-
(be32_to_cpu(lap_msg->offset12) &
663-
0x000000FF));
664-
}
665-
666-
static inline u8 cm_lap_get_remote_resp_timeout(struct cm_lap_msg *lap_msg)
667-
{
668-
return (u8) ((be32_to_cpu(lap_msg->offset12) & 0xF8) >> 3);
669-
}
670-
671-
static inline void cm_lap_set_remote_resp_timeout(struct cm_lap_msg *lap_msg,
672-
u8 resp_timeout)
673-
{
674-
lap_msg->offset12 = cpu_to_be32((resp_timeout << 3) |
675-
(be32_to_cpu(lap_msg->offset12) &
676-
0xFFFFFF07));
677-
}
678-
679654
static inline __be32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg)
680655
{
681656
return cpu_to_be32(be32_to_cpu(lap_msg->offset56) >> 12);
682657
}
683658

684-
static inline void cm_lap_set_flow_label(struct cm_lap_msg *lap_msg,
685-
__be32 flow_label)
686-
{
687-
lap_msg->offset56 = cpu_to_be32(
688-
(be32_to_cpu(lap_msg->offset56) & 0x00000FFF) |
689-
(be32_to_cpu(flow_label) << 12));
690-
}
691-
692659
static inline u8 cm_lap_get_traffic_class(struct cm_lap_msg *lap_msg)
693660
{
694661
return (u8) be32_to_cpu(lap_msg->offset56);
695662
}
696663

697-
static inline void cm_lap_set_traffic_class(struct cm_lap_msg *lap_msg,
698-
u8 traffic_class)
699-
{
700-
lap_msg->offset56 = cpu_to_be32(traffic_class |
701-
(be32_to_cpu(lap_msg->offset56) &
702-
0xFFFFFF00));
703-
}
704-
705664
static inline u8 cm_lap_get_packet_rate(struct cm_lap_msg *lap_msg)
706665
{
707666
return lap_msg->offset61 & 0x3F;
708667
}
709668

710-
static inline void cm_lap_set_packet_rate(struct cm_lap_msg *lap_msg,
711-
u8 packet_rate)
712-
{
713-
lap_msg->offset61 = (packet_rate & 0x3F) | (lap_msg->offset61 & 0xC0);
714-
}
715-
716669
static inline u8 cm_lap_get_sl(struct cm_lap_msg *lap_msg)
717670
{
718671
return lap_msg->offset62 >> 4;
719672
}
720673

721-
static inline void cm_lap_set_sl(struct cm_lap_msg *lap_msg, u8 sl)
722-
{
723-
lap_msg->offset62 = (sl << 4) | (lap_msg->offset62 & 0x0F);
724-
}
725-
726-
static inline u8 cm_lap_get_subnet_local(struct cm_lap_msg *lap_msg)
727-
{
728-
return (lap_msg->offset62 >> 3) & 0x1;
729-
}
730-
731-
static inline void cm_lap_set_subnet_local(struct cm_lap_msg *lap_msg,
732-
u8 subnet_local)
733-
{
734-
lap_msg->offset62 = ((subnet_local & 0x1) << 3) |
735-
(lap_msg->offset61 & 0xF7);
736-
}
737674
static inline u8 cm_lap_get_local_ack_timeout(struct cm_lap_msg *lap_msg)
738675
{
739676
return lap_msg->offset63 >> 3;
740677
}
741678

742-
static inline void cm_lap_set_local_ack_timeout(struct cm_lap_msg *lap_msg,
743-
u8 local_ack_timeout)
744-
{
745-
lap_msg->offset63 = (local_ack_timeout << 3) |
746-
(lap_msg->offset63 & 0x07);
747-
}
748-
749679
struct cm_apr_msg {
750680
struct ib_mad_hdr hdr;
751681

0 commit comments

Comments
 (0)