Skip to content

Commit d5c7d9b

Browse files
Prasad Kannegantidavem330
authored andcommitted
liquidio: fix rare pci_driver.probe failure of VF driver
There's a rare pci_driver.probe failure of the VF driver that's caused by PF/VF handshake going out of sync. The culprit is octeon_mbox_write() who ignores an ack timeout condition; it just keeps unconditionally writing all elements of mbox_cmd->data[] even when the other side is not ready for them. Fix it by making each write of mbox_cmd->data[i] conditional to having previously received an ack. Also fix the octeon_mbox_state enum such that each state gets a unique value. Also add ULL suffix to numeric literals in macro definitions. Signed-off-by: Prasad Kanneganti <prasad.kanneganti@cavium.com> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ae782de commit d5c7d9b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ int octeon_mbox_write(struct octeon_device *oct,
178178
break;
179179
}
180180
}
181-
writeq(mbox_cmd->data[i], mbox->mbox_write_reg);
181+
if (ret == OCTEON_MBOX_STATUS_SUCCESS)
182+
writeq(mbox_cmd->data[i], mbox->mbox_write_reg);
183+
else
184+
break;
182185
}
183186
}
184187

drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020

2121
/* Macros for Mail Box Communication */
2222

23-
#define OCTEON_MBOX_DATA_MAX 32
23+
#define OCTEON_MBOX_DATA_MAX 32
2424

2525
#define OCTEON_VF_ACTIVE 0x1
2626
#define OCTEON_VF_FLR_REQUEST 0x2
2727
#define OCTEON_PF_CHANGED_VF_MACADDR 0x4
2828

2929
/*Macro for Read acknowldgement*/
30-
#define OCTEON_PFVFACK 0xffffffffffffffff
31-
#define OCTEON_PFVFSIG 0x1122334455667788
32-
#define OCTEON_PFVFERR 0xDEADDEADDEADDEAD
30+
#define OCTEON_PFVFACK 0xffffffffffffffffULL
31+
#define OCTEON_PFVFSIG 0x1122334455667788ULL
32+
#define OCTEON_PFVFERR 0xDEADDEADDEADDEADULL
3333

3434
#define LIO_MBOX_WRITE_WAIT_CNT 1000
3535
#define LIO_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
@@ -74,8 +74,8 @@ enum octeon_mbox_state {
7474
OCTEON_MBOX_STATE_REQUEST_RECEIVED = 4,
7575
OCTEON_MBOX_STATE_RESPONSE_PENDING = 8,
7676
OCTEON_MBOX_STATE_RESPONSE_RECEIVING = 16,
77-
OCTEON_MBOX_STATE_RESPONSE_RECEIVED = 16,
78-
OCTEON_MBOX_STATE_ERROR = 32
77+
OCTEON_MBOX_STATE_RESPONSE_RECEIVED = 32,
78+
OCTEON_MBOX_STATE_ERROR = 64
7979
};
8080

8181
struct octeon_mbox {

0 commit comments

Comments
 (0)