On Fri, Apr 29, 2022 at 05:31:04PM +0800, Wenpeng Liang wrote: > From: Yangyang Li <liyangyang20@xxxxxxxxxx> > > CMDQ may fail during HNS ROCEE initialization. The following is the log > when the execution fails: > > [ 481.424373] hns3 0000:bd:00.2: In reset process RoCE client reinit. > [ 482.120830] hns3 0000:bd:00.2: CMDQ move tail from 840 to 839 > [ 482.129220] hns3 0000:bd:00.2 hns_2: failed to set gid, ret = -11! > [ 482.184702] hns3 0000:bd:00.2: CMDQ move tail from 840 to 839 > <...> > [ 485.540909] hns3 0000:bd:00.2: CMDQ move tail from 840 to 839 > [ 485.579958] hns3 0000:bd:00.2: CMDQ move tail from 840 to 0 > [ 495.694616] hns3 0000:bd:00.2: [cmd]token 14e mailbox 20 timeout. > [ 495.700689] hns3 0000:bd:00.2 hns_2: set HEM step 0 failed! > [ 495.706242] hns3 0000:bd:00.2 hns_2: set HEM address to HW failed! > [ 495.712412] hns3 0000:bd:00.2 hns_2: failed to alloc mtpt, ret = -16. > [ 495.718836] infiniband hns_2: Couldn't create ib_mad PD > [ 495.724046] infiniband hns_2: Couldn't open port 1 > [ 495.729375] hns3 0000:bd:00.2: Reset done, RoCE client reinit finished. > > However, even if ib_mad client registration failed, ib_register_device() > still returns success to the driver. > > In the device initialization process, CMDQ execution fails because HW/FW > is abnormal. Therefore, if CMDQ fails, the initialization function should > set CMDQ to a fatal error state and return a failure to the caller. > > Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") > Signed-off-by: Yangyang Li <liyangyang20@xxxxxxxxxx> > Signed-off-by: Wenpeng Liang <liangwenpeng@xxxxxxxxxx> > --- > drivers/infiniband/hw/hns/hns_roce_device.h | 6 ++++++ > drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++ > 2 files changed, 27 insertions(+) Applied to for-next, thanks Jason