Message ID | 1425573992-30955-12-git-send-email-jeffrey.t.kirsher@intel.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 2015-03-05 at 08:46 -0800, Jeff Kirsher wrote: [...] > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > @@ -9459,6 +9459,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > struct i40e_pf *pf; > struct i40e_hw *hw; > static u16 pfs_found; > + u32 ioremap_len; > u16 link_status; > int err = 0; > u32 len; > @@ -9507,8 +9508,11 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > hw = &pf->hw; > hw->back = pf; > - hw->hw_addr = ioremap(pci_resource_start(pdev, 0), > - pci_resource_len(pdev, 0)); > + > + ioremap_len = min_t(int, pci_resource_len(pdev, 0), > + I40E_MAX_CSR_SPACE); What type do you really want ioremap_len to be, u32 or int? (I think the correct answer is unsigned long as that's the ioremap() parameter type.) Ben. > + hw->hw_addr = ioremap(pci_resource_start(pdev, 0), ioremap_len); > if (!hw->hw_addr) { > err = -EIO; > dev_info(&pdev->dev, "ioremap(0x%04x, 0x%04x) failed: 0x%x\n",
On Fri, 2015-03-06 at 00:16 +0000, Ben Hutchings wrote: > On Thu, 2015-03-05 at 08:46 -0800, Jeff Kirsher wrote: > [...] > > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > > @@ -9459,6 +9459,7 @@ static int i40e_probe(struct pci_dev *pdev, > const struct pci_device_id *ent) > > struct i40e_pf *pf; > > struct i40e_hw *hw; > > static u16 pfs_found; > > + u32 ioremap_len; > > u16 link_status; > > int err = 0; > > u32 len; > > @@ -9507,8 +9508,11 @@ static int i40e_probe(struct pci_dev *pdev, > const struct pci_device_id *ent) > > > > hw = &pf->hw; > > hw->back = pf; > > - hw->hw_addr = ioremap(pci_resource_start(pdev, 0), > > - pci_resource_len(pdev, 0)); > > + > > + ioremap_len = min_t(int, pci_resource_len(pdev, 0), > > + I40E_MAX_CSR_SPACE); > > What type do you really want ioremap_len to be, u32 or int? (I think > the correct answer is unsigned long as that's the ioremap() parameter > type.) Yeah, I agree. Once Dave updates his net-next tree with the patches he has accepted, I will send out a fix.
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Date: Thu, 05 Mar 2015 17:55:43 -0800 > Yeah, I agree. Once Dave updates his net-next tree with the patches he > has accepted, I will send out a fix. Just push it out now, sorry about that. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2015-03-05 at 21:15 -0500, David Miller wrote: > From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> > Date: Thu, 05 Mar 2015 17:55:43 -0800 > > > Yeah, I agree. Once Dave updates his net-next tree with the patches he > > has accepted, I will send out a fix. > > Just push it out now, sorry about that. Ok, working on it now and will have it sent here soon.
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index c513731..ce3fbb8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -72,6 +72,7 @@ #define I40E_MAX_NUM_DESCRIPTORS 4096 #define I40E_MAX_REGISTER 0x800000 +#define I40E_MAX_CSR_SPACE (4 * 1024 * 1024 - 64 * 1024) #define I40E_DEFAULT_NUM_DESCRIPTORS 512 #define I40E_REQ_DESCRIPTOR_MULTIPLE 32 #define I40E_MIN_NUM_DESCRIPTORS 64 diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 02b57c3..f769005 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -9459,6 +9459,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct i40e_pf *pf; struct i40e_hw *hw; static u16 pfs_found; + u32 ioremap_len; u16 link_status; int err = 0; u32 len; @@ -9507,8 +9508,11 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) hw = &pf->hw; hw->back = pf; - hw->hw_addr = ioremap(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); + + ioremap_len = min_t(int, pci_resource_len(pdev, 0), + I40E_MAX_CSR_SPACE); + + hw->hw_addr = ioremap(pci_resource_start(pdev, 0), ioremap_len); if (!hw->hw_addr) { err = -EIO; dev_info(&pdev->dev, "ioremap(0x%04x, 0x%04x) failed: 0x%x\n",