On Mon, Apr 13, 2020 at 02:40:40PM +0800, Weihang Li wrote: > From: Lang Cheng <chenglang@xxxxxxxxxx> > > Encapsulate codes to get status of cqe into a function and use map table > instead of switch-case to reduce cyclomatic complexity of > hns_roce_v2_poll_one(). > > Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx> > Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx> > drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 130 +++++++++++++---------------- > 1 file changed, 57 insertions(+), 73 deletions(-) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > index e938bd8..c2d2c9e 100644 > +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > @@ -2954,6 +2954,61 @@ static int hns_roce_v2_sw_poll_cq(struct hns_roce_cq *hr_cq, int num_entries, > return npolled; > } > > +static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp, > + struct hns_roce_v2_cqe *cqe, struct ib_wc *wc) > +{ > + static struct { > + u32 cqe_status; > + enum ib_wc_status wc_status; > + } map[] = { Also should be const Jason