IB/hfi1: Optimize packet type comparison using 9B and bypass code paths
The packet type comparison used to find out if a packet is a bypass packet in the hot path is an expensive operation as seen in a profile. Determine packet's pkey and migration bit through the bypass and 9B code paths instead. Reviewed-by: Don Hiatt <don.hiatt@intel.com> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
f150e2736f
commit
6d6b8848c8
|
@ -1440,6 +1440,8 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet)
|
||||||
packet->extra_byte = 0;
|
packet->extra_byte = 0;
|
||||||
packet->fecn = ib_bth_get_fecn(packet->ohdr);
|
packet->fecn = ib_bth_get_fecn(packet->ohdr);
|
||||||
packet->becn = ib_bth_get_becn(packet->ohdr);
|
packet->becn = ib_bth_get_becn(packet->ohdr);
|
||||||
|
packet->pkey = ib_bth_get_pkey(packet->ohdr);
|
||||||
|
packet->migrated = ib_bth_is_migration(packet->ohdr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
drop:
|
drop:
|
||||||
|
@ -1506,6 +1508,8 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet)
|
||||||
packet->extra_byte = SIZE_OF_LT;
|
packet->extra_byte = SIZE_OF_LT;
|
||||||
packet->fecn = hfi1_16B_get_fecn(packet->hdr);
|
packet->fecn = hfi1_16B_get_fecn(packet->hdr);
|
||||||
packet->becn = hfi1_16B_get_becn(packet->hdr);
|
packet->becn = hfi1_16B_get_becn(packet->hdr);
|
||||||
|
packet->pkey = hfi1_16B_get_pkey(packet->hdr);
|
||||||
|
packet->migrated = opa_bth_is_migration(packet->ohdr);
|
||||||
|
|
||||||
if (hfi1_bypass_ingress_pkt_check(packet))
|
if (hfi1_bypass_ingress_pkt_check(packet))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
|
@ -341,6 +341,7 @@ struct hfi1_packet {
|
||||||
u32 slid;
|
u32 slid;
|
||||||
u16 tlen;
|
u16 tlen;
|
||||||
s16 etail;
|
s16 etail;
|
||||||
|
u16 pkey;
|
||||||
u8 hlen;
|
u8 hlen;
|
||||||
u8 numpkt;
|
u8 numpkt;
|
||||||
u8 rsize;
|
u8 rsize;
|
||||||
|
@ -353,6 +354,7 @@ struct hfi1_packet {
|
||||||
u8 opcode;
|
u8 opcode;
|
||||||
bool becn;
|
bool becn;
|
||||||
bool fecn;
|
bool fecn;
|
||||||
|
bool migrated;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Packet types */
|
/* Packet types */
|
||||||
|
|
|
@ -225,19 +225,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_packet *packet)
|
||||||
u32 dlid = packet->dlid;
|
u32 dlid = packet->dlid;
|
||||||
u32 slid = packet->slid;
|
u32 slid = packet->slid;
|
||||||
u32 sl = packet->sl;
|
u32 sl = packet->sl;
|
||||||
int migrated;
|
bool migrated = packet->migrated;
|
||||||
u32 bth0, bth1;
|
u16 pkey = packet->pkey;
|
||||||
u16 pkey;
|
|
||||||
|
|
||||||
bth0 = be32_to_cpu(packet->ohdr->bth[0]);
|
|
||||||
bth1 = be32_to_cpu(packet->ohdr->bth[1]);
|
|
||||||
if (packet->etype == RHF_RCV_TYPE_BYPASS) {
|
|
||||||
pkey = hfi1_16B_get_pkey(packet->hdr);
|
|
||||||
migrated = bth1 & OPA_BTH_MIG_REQ;
|
|
||||||
} else {
|
|
||||||
pkey = ib_bth_get_pkey(packet->ohdr);
|
|
||||||
migrated = bth0 & IB_BTH_MIG_REQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qp->s_mig_state == IB_MIG_ARMED && migrated) {
|
if (qp->s_mig_state == IB_MIG_ARMED && migrated) {
|
||||||
if (!packet->grh) {
|
if (!packet->grh) {
|
||||||
|
|
|
@ -405,6 +405,11 @@ static inline void cacheless_memcpy(void *dst, void *src, size_t n)
|
||||||
__copy_user_nocache(dst, (void __user *)src, n, 0);
|
__copy_user_nocache(dst, (void __user *)src, n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool opa_bth_is_migration(struct ib_other_headers *ohdr)
|
||||||
|
{
|
||||||
|
return ohdr->bth[1] & cpu_to_be32(OPA_BTH_MIG_REQ);
|
||||||
|
}
|
||||||
|
|
||||||
extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];
|
extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];
|
||||||
|
|
||||||
extern const u8 hdr_len_by_opcode[];
|
extern const u8 hdr_len_by_opcode[];
|
||||||
|
|
|
@ -335,4 +335,9 @@ static inline bool ib_bth_is_solicited(struct ib_other_headers *ohdr)
|
||||||
{
|
{
|
||||||
return ohdr->bth[0] & cpu_to_be32(IB_BTH_SOLICITED);
|
return ohdr->bth[0] & cpu_to_be32(IB_BTH_SOLICITED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool ib_bth_is_migration(struct ib_other_headers *ohdr)
|
||||||
|
{
|
||||||
|
return ohdr->bth[0] & cpu_to_be32(IB_BTH_MIG_REQ);
|
||||||
|
}
|
||||||
#endif /* IB_HDRS_H */
|
#endif /* IB_HDRS_H */
|
||||||
|
|
Loading…
Reference in New Issue