提交 ca85bb1c 编写于 作者: S Sebastian Sanchez 提交者: Jason Gunthorpe

IB/hfi1: Remove unnecessary fecn and becn fields

packet->fecn and packet->becn are calculated in the hot path
and are never used. Remove these fields as they show to be
costly in a profile. Also, remove initialization for
becn and fecn in process_ecn() as they're unconditionally
assigned in the function and ensure fecn and becn variables
use a boolean type.
Reviewed-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: NSebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 bdaf96f6
...@@ -1440,8 +1440,6 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet) ...@@ -1440,8 +1440,6 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet)
packet->sc = hfi1_9B_get_sc5(hdr, packet->rhf); packet->sc = hfi1_9B_get_sc5(hdr, packet->rhf);
packet->pad = ib_bth_get_pad(packet->ohdr); packet->pad = ib_bth_get_pad(packet->ohdr);
packet->extra_byte = 0; packet->extra_byte = 0;
packet->fecn = ib_bth_get_fecn(packet->ohdr);
packet->becn = ib_bth_get_becn(packet->ohdr);
packet->pkey = ib_bth_get_pkey(packet->ohdr); packet->pkey = ib_bth_get_pkey(packet->ohdr);
packet->migrated = ib_bth_is_migration(packet->ohdr); packet->migrated = ib_bth_is_migration(packet->ohdr);
...@@ -1508,8 +1506,6 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet) ...@@ -1508,8 +1506,6 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet)
packet->sl = ibp->sc_to_sl[packet->sc]; packet->sl = ibp->sc_to_sl[packet->sc];
packet->pad = hfi1_16B_bth_get_pad(packet->ohdr); packet->pad = hfi1_16B_bth_get_pad(packet->ohdr);
packet->extra_byte = SIZE_OF_LT; packet->extra_byte = SIZE_OF_LT;
packet->fecn = hfi1_16B_get_fecn(packet->hdr);
packet->becn = hfi1_16B_get_becn(packet->hdr);
packet->pkey = hfi1_16B_get_pkey(packet->hdr); packet->pkey = hfi1_16B_get_pkey(packet->hdr);
packet->migrated = opa_bth_is_migration(packet->ohdr); packet->migrated = opa_bth_is_migration(packet->ohdr);
......
...@@ -352,8 +352,6 @@ struct hfi1_packet { ...@@ -352,8 +352,6 @@ struct hfi1_packet {
u8 sc; u8 sc;
u8 sl; u8 sl;
u8 opcode; u8 opcode;
bool becn;
bool fecn;
bool migrated; bool migrated;
}; };
...@@ -1781,19 +1779,15 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, ...@@ -1781,19 +1779,15 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt, static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt,
bool do_cnp) bool do_cnp)
{ {
struct ib_other_headers *ohdr = pkt->ohdr; bool becn;
bool fecn;
u32 bth1;
bool becn = false;
bool fecn = false;
if (pkt->etype == RHF_RCV_TYPE_BYPASS) { if (pkt->etype == RHF_RCV_TYPE_BYPASS) {
fecn = hfi1_16B_get_fecn(pkt->hdr); fecn = hfi1_16B_get_fecn(pkt->hdr);
becn = hfi1_16B_get_becn(pkt->hdr); becn = hfi1_16B_get_becn(pkt->hdr);
} else { } else {
bth1 = be32_to_cpu(ohdr->bth[1]); fecn = ib_bth_get_fecn(pkt->ohdr);
fecn = bth1 & IB_FECN_SMASK; becn = ib_bth_get_becn(pkt->ohdr);
becn = bth1 & IB_BECN_SMASK;
} }
if (unlikely(fecn || becn)) { if (unlikely(fecn || becn)) {
hfi1_process_ecn_slowpath(qp, pkt, do_cnp); hfi1_process_ecn_slowpath(qp, pkt, do_cnp);
...@@ -2419,7 +2413,7 @@ static inline void hfi1_make_ib_hdr(struct ib_header *hdr, ...@@ -2419,7 +2413,7 @@ static inline void hfi1_make_ib_hdr(struct ib_header *hdr,
static inline void hfi1_make_16b_hdr(struct hfi1_16b_header *hdr, static inline void hfi1_make_16b_hdr(struct hfi1_16b_header *hdr,
u32 slid, u32 dlid, u32 slid, u32 dlid,
u16 len, u16 pkey, u16 len, u16 pkey,
u8 becn, u8 fecn, u8 l4, bool becn, bool fecn, u8 l4,
u8 sc) u8 sc)
{ {
u32 lrh0 = 0; u32 lrh0 = 0;
......
...@@ -814,7 +814,7 @@ static inline void hfi1_make_rc_ack_16B(struct hfi1_packet *packet, ...@@ -814,7 +814,7 @@ static inline void hfi1_make_rc_ack_16B(struct hfi1_packet *packet,
struct ib_other_headers *ohdr; struct ib_other_headers *ohdr;
u32 bth0, bth1 = 0; u32 bth0, bth1 = 0;
u16 len, pkey; u16 len, pkey;
u8 becn = !!is_fecn; bool becn = is_fecn;
u8 l4 = OPA_16B_L4_IB_LOCAL; u8 l4 = OPA_16B_L4_IB_LOCAL;
u8 extra_bytes; u8 extra_bytes;
......
...@@ -751,7 +751,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, ...@@ -751,7 +751,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
ps->s_txreq->s_cur_size); ps->s_txreq->s_cur_size);
u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size + u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size +
extra_bytes + SIZE_OF_LT) >> 2); extra_bytes + SIZE_OF_LT) >> 2);
u8 becn = 0; bool becn = false;
if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH) && if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH) &&
hfi1_check_mcast(rdma_ah_get_dlid(&qp->remote_ah_attr))) { hfi1_check_mcast(rdma_ah_get_dlid(&qp->remote_ah_attr))) {
...@@ -789,7 +789,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, ...@@ -789,7 +789,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
if (qp->s_flags & RVT_S_ECN) { if (qp->s_flags & RVT_S_ECN) {
qp->s_flags &= ~RVT_S_ECN; qp->s_flags &= ~RVT_S_ECN;
/* we recently received a FECN, so return a BECN */ /* we recently received a FECN, so return a BECN */
becn = 1; becn = true;
} }
hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2); hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
......
...@@ -138,7 +138,7 @@ static const char *parse_syndrome(u8 syndrome) ...@@ -138,7 +138,7 @@ static const char *parse_syndrome(u8 syndrome)
} }
void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr, void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
u8 *ack, u8 *becn, u8 *fecn, u8 *mig, u8 *ack, bool *becn, bool *fecn, u8 *mig,
u8 *se, u8 *pad, u8 *opcode, u8 *tver, u8 *se, u8 *pad, u8 *opcode, u8 *tver,
u16 *pkey, u32 *psn, u32 *qpn) u16 *pkey, u32 *psn, u32 *qpn)
{ {
...@@ -184,7 +184,7 @@ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5, ...@@ -184,7 +184,7 @@ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
} }
void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr, void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
u8 *age, u8 *becn, u8 *fecn, u8 *age, bool *becn, bool *fecn,
u8 *l4, u8 *rc, u8 *sc, u8 *l4, u8 *rc, u8 *sc,
u16 *entropy, u16 *len, u16 *pkey, u16 *entropy, u16 *len, u16 *pkey,
u32 *dlid, u32 *slid) u32 *dlid, u32 *slid)
...@@ -207,7 +207,7 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr, ...@@ -207,7 +207,7 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
#define LRH_16B_PRN "age:%d becn:%d fecn:%d l4:%d " \ #define LRH_16B_PRN "age:%d becn:%d fecn:%d l4:%d " \
"rc:%d sc:%d pkey:0x%.4x entropy:0x%.4x" "rc:%d sc:%d pkey:0x%.4x entropy:0x%.4x"
const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass, const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
u8 age, u8 becn, u8 fecn, u8 l4, u8 age, bool becn, bool fecn, u8 l4,
u8 lnh, const char *lnh_name, u8 lver, u8 lnh, const char *lnh_name, u8 lver,
u8 rc, u8 sc, u8 sl, u16 entropy, u8 rc, u8 sc, u8 sl, u16 entropy,
u16 len, u16 pkey, u32 dlid, u32 slid) u16 len, u16 pkey, u32 dlid, u32 slid)
...@@ -235,7 +235,7 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass, ...@@ -235,7 +235,7 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
"op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \ "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \
"qpn:0x%.6x a:%d psn:0x%.8x" "qpn:0x%.6x a:%d psn:0x%.8x"
const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
u8 ack, u8 becn, u8 fecn, u8 mig, u8 ack, bool becn, bool fecn, u8 mig,
u8 se, u8 pad, u8 opcode, const char *opname, u8 se, u8 pad, u8 opcode, const char *opname,
u8 tver, u16 pkey, u32 psn, u32 qpn) u8 tver, u16 pkey, u32 psn, u32 qpn)
{ {
......
...@@ -101,7 +101,7 @@ u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opah); ...@@ -101,7 +101,7 @@ u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opah);
u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet); u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet);
const char *hfi1_trace_get_packet_l4_str(u8 l4); const char *hfi1_trace_get_packet_l4_str(u8 l4);
void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr, void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
u8 *ack, u8 *becn, u8 *fecn, u8 *mig, u8 *ack, bool *becn, bool *fecn, u8 *mig,
u8 *se, u8 *pad, u8 *opcode, u8 *tver, u8 *se, u8 *pad, u8 *opcode, u8 *tver,
u16 *pkey, u32 *psn, u32 *qpn); u16 *pkey, u32 *psn, u32 *qpn);
void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5, void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
...@@ -112,19 +112,19 @@ void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr, ...@@ -112,19 +112,19 @@ void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr,
u8 *pad, u8 *se, u8 *tver, u8 *pad, u8 *se, u8 *tver,
u32 *psn, u32 *qpn); u32 *psn, u32 *qpn);
void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr, void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
u8 *age, u8 *becn, u8 *fecn, u8 *age, bool *becn, bool *fecn,
u8 *l4, u8 *rc, u8 *sc, u8 *l4, u8 *rc, u8 *sc,
u16 *entropy, u16 *len, u16 *pkey, u16 *entropy, u16 *len, u16 *pkey,
u32 *dlid, u32 *slid); u32 *dlid, u32 *slid);
const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass, const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
u8 age, u8 becn, u8 fecn, u8 l4, u8 age, bool becn, bool fecn, u8 l4,
u8 lnh, const char *lnh_name, u8 lver, u8 lnh, const char *lnh_name, u8 lver,
u8 rc, u8 sc, u8 sl, u16 entropy, u8 rc, u8 sc, u8 sl, u16 entropy,
u16 len, u16 pkey, u32 dlid, u32 slid); u16 len, u16 pkey, u32 dlid, u32 slid);
const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
u8 ack, u8 becn, u8 fecn, u8 mig, u8 ack, bool becn, bool fecn, u8 mig,
u8 se, u8 pad, u8 opcode, const char *opname, u8 se, u8 pad, u8 opcode, const char *opname,
u8 tver, u16 pkey, u32 psn, u32 qpn); u8 tver, u16 pkey, u32 psn, u32 qpn);
...@@ -148,8 +148,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -148,8 +148,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
__field(u8, etype) __field(u8, etype)
__field(u8, ack) __field(u8, ack)
__field(u8, age) __field(u8, age)
__field(u8, becn) __field(bool, becn)
__field(u8, fecn) __field(bool, fecn)
__field(u8, l2) __field(u8, l2)
__field(u8, l4) __field(u8, l4)
__field(u8, lnh) __field(u8, lnh)
...@@ -290,8 +290,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -290,8 +290,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
__field(u8, hdr_type) __field(u8, hdr_type)
__field(u8, ack) __field(u8, ack)
__field(u8, age) __field(u8, age)
__field(u8, becn) __field(bool, becn)
__field(u8, fecn) __field(bool, fecn)
__field(u8, l4) __field(u8, l4)
__field(u8, lnh) __field(u8, lnh)
__field(u8, lver) __field(u8, lver)
......
...@@ -313,16 +313,14 @@ static inline u32 ib_bth_get_qpn(struct ib_other_headers *ohdr) ...@@ -313,16 +313,14 @@ static inline u32 ib_bth_get_qpn(struct ib_other_headers *ohdr)
return (u32)((be32_to_cpu(ohdr->bth[1])) & IB_QPN_MASK); return (u32)((be32_to_cpu(ohdr->bth[1])) & IB_QPN_MASK);
} }
static inline u8 ib_bth_get_becn(struct ib_other_headers *ohdr) static inline bool ib_bth_get_becn(struct ib_other_headers *ohdr)
{ {
return (u8)((be32_to_cpu(ohdr->bth[1]) >> IB_BECN_SHIFT) & return (ohdr->bth[1]) & cpu_to_be32(IB_BECN_SMASK);
IB_BECN_MASK);
} }
static inline u8 ib_bth_get_fecn(struct ib_other_headers *ohdr) static inline bool ib_bth_get_fecn(struct ib_other_headers *ohdr)
{ {
return (u8)((be32_to_cpu(ohdr->bth[1]) >> IB_FECN_SHIFT) & return (ohdr->bth[1]) & cpu_to_be32(IB_FECN_SMASK);
IB_FECN_MASK);
} }
static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr) static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册