Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-11 Thread Andrew Donnellan
On 11/07/16 19:19, Ian Munsie wrote: I like this solution, but I'm not going to include it in v2 of this series and would rather it be submitted separately. The reason being is that this series will work as is, and I'd like to see this undergo some regression testing separate to the cx4 work,

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-11 Thread Ian Munsie
Excerpts from andrew.donnellan's message of 2016-07-07 18:15:06 +1000: > On 07/07/16 16:44, Andrew Donnellan wrote: > > We can match the vendor, device ID *and* class code - unfortunately > > there isn't a macro for this, which makes it a little bit less > > aesthetically pleasing, but I'm pretty

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-07 Thread Andrew Donnellan
On 07/07/16 16:44, Andrew Donnellan wrote: We can match the vendor, device ID *and* class code - unfortunately there isn't a macro for this, which makes it a little bit less aesthetically pleasing, but I'm pretty sure this works. Something like the below, which works fine: /* * Matches a

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-07 Thread Andrew Donnellan
On 07/07/16 16:26, Ian Munsie wrote: We could probably use a dedicated error label for all the error paths before the pci_dev_put in the main function so we don't need it in every error path. Yep, I've added that. If we explicitly match the Vendor + Device ID we will also match the

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-07 Thread Ian Munsie
Excerpts from andrew.donnellan's message of 2016-07-07 11:18:37 +1000: > > This is to balance the 'get' done in cxl_check_and_switch_mode(), right? > > A comment wouldn't hurt. I think we're missing the 'put' on the first > > error path above (!bridge). > > Yep, it's to balance the pci_dev_get()

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-06 Thread Andrew Donnellan
Thanks for the review Fred! On 07/07/16 04:51, Frederic Barrat wrote: +rc = CXL_READ_VSEC_MODE_CONTROL(dev, switch_work->vsec, ); +if (rc) { +dev_err(>dev, "cxl: Failed to read CAPI mode control: %i\n", rc); +pci_dev_put(dev); +goto err_free_work; +} +

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-06 Thread Frederic Barrat
Le 04/07/2016 15:22, Ian Munsie a écrit : From: Andrew Donnellan Add a new API, cxl_check_and_switch_mode() to allow for switching of bi-modal CAPI cards, such as the Mellanox CX-4 network card. When a driver requests to switch a card to CAPI mode, use PCI

Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-05 Thread Andrew Donnellan
On 04/07/16 23:22, Ian Munsie wrote: +static int setup_cxl_protocol_area(struct pci_dev *dev) +{ + u8 val; + int rc; + int vsec = find_cxl_vsec(dev); + + if (!vsec) { + dev_info(>dev, "CXL VSEC not found\n"); + return -ENODEV; + } + +

[PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards

2016-07-04 Thread Ian Munsie
From: Andrew Donnellan Add a new API, cxl_check_and_switch_mode() to allow for switching of bi-modal CAPI cards, such as the Mellanox CX-4 network card. When a driver requests to switch a card to CAPI mode, use PCI hotplug infrastructure to remove all PCI devices