* [PATCH net-next 0/6] use pci_zalloc_consistent
@ 2018-06-05 12:28 YueHaibing
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
YueHaibing (6):
net: hippi: use pci_zalloc_consistent
net: atheros: use pci_zalloc_consistent
net: neterion: use pci_zalloc_consistent
netxen_nic: use pci_zalloc_consistent
net: tlan: use pci_zalloc_consistent
enic: use pci_zalloc_consistent
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++----
drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++--
drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
drivers/net/ethernet/neterion/s2io.c | 10 ++++----
.../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 ++++++++------------
drivers/net/ethernet/ti/tlan.c | 7 +++---
drivers/net/hippi/rrunner.c | 28 +++++++++-------------
8 files changed, 35 insertions(+), 54 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next 1/6] net: hippi: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-06 9:53 ` Sergei Shtylyov
2018-06-06 15:04 ` kbuild test robot
2018-06-05 12:28 ` [PATCH net-next 2/6] net: atheros: " YueHaibing
` (5 subsequent siblings)
6 siblings, 2 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
use pci_zalloc_consistent to remove unnecessary memset.
Also remove a local intermediate pointer 'tmpptr'.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/hippi/rrunner.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index f411164..9de7d2a 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -93,7 +93,6 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
static int version_disp;
u8 pci_latency;
struct rr_private *rrpriv;
- void *tmpptr;
dma_addr_t ring_dma;
int ret = -ENOMEM;
@@ -155,29 +154,26 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
- rrpriv->tx_ring = tmpptr;
+ rrpriv->tx_ring = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
rrpriv->tx_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!rrpriv->tx_ring) {
ret = -ENOMEM;
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
- rrpriv->rx_ring = tmpptr;
+ rrpriv->rx_ring = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
rrpriv->rx_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!rrpriv->rx_ring) {
ret = -ENOMEM;
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, EVT_RING_SIZE, &ring_dma);
- rrpriv->evt_ring = tmpptr;
+ rrpriv->evt_ring = pci_alloc_consistent(pdev, EVT_RING_SIZE, &ring_dma);
rrpriv->evt_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!trrpriv->evt_ring) {
ret = -ENOMEM;
goto out;
}
@@ -1192,24 +1188,22 @@ static int rr_open(struct net_device *dev)
goto error;
}
- rrpriv->rx_ctrl = pci_alloc_consistent(pdev,
- 256 * sizeof(struct ring_ctrl),
- &dma_addr);
+ rrpriv->rx_ctrl = pci_zalloc_consistent(pdev,
+ 256 * sizeof(struct ring_ctrl),
+ &dma_addr);
if (!rrpriv->rx_ctrl) {
ecode = -ENOMEM;
goto error;
}
rrpriv->rx_ctrl_dma = dma_addr;
- memset(rrpriv->rx_ctrl, 0, 256*sizeof(struct ring_ctrl));
- rrpriv->info = pci_alloc_consistent(pdev, sizeof(struct rr_info),
- &dma_addr);
+ rrpriv->info = pci_zalloc_consistent(pdev, sizeof(struct rr_info),
+ &dma_addr);
if (!rrpriv->info) {
ecode = -ENOMEM;
goto error;
}
rrpriv->info_dma = dma_addr;
- memset(rrpriv->info, 0, sizeof(struct rr_info));
wmb();
spin_lock_irqsave(&rrpriv->lock, flags);
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 2/6] net: atheros: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-05 12:28 ` [PATCH net-next 3/6] net: neterion: " YueHaibing
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
use pci_zalloc_consistent to remove unnecessary memset
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++-----
drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++---
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 9dc6da0..41da42f 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -829,7 +829,7 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
&adapter->ring_dma);
if (adapter->ring_vir_addr == NULL) {
netdev_err(adapter->netdev,
- "pci_alloc_consistent failed, size = D%d\n", size);
+ "pci_zalloc_consistent failed, size = D%d\n", size);
return -ENOMEM;
}
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index b81fbf11..c72ef33 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -1069,16 +1069,14 @@ static s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
+ sizeof(struct stats_msg_block)
+ 40;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = pci_zalloc_consistent(pdev, ring_header->size,
+ &ring_header->dma);
if (unlikely(!ring_header->desc)) {
if (netif_msg_drv(adapter))
- dev_err(&pdev->dev, "pci_alloc_consistent failed\n");
+ dev_err(&pdev->dev, "pci_zalloc_consistent failed\n");
goto err_nomem;
}
- memset(ring_header->desc, 0, ring_header->size);
-
/* init TPD ring */
tpd_ring->dma = ring_header->dma;
offset = (tpd_ring->dma & 0x7) ? (8 - (ring_header->dma & 0x7)) : 0;
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index db4bcc5..d430dc9 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -300,11 +300,10 @@ static s32 atl2_setup_ring_resources(struct atl2_adapter *adapter)
adapter->txs_ring_size * 4 + 7 + /* dword align */
adapter->rxd_ring_size * 1536 + 127; /* 128bytes align */
- adapter->ring_vir_addr = pci_alloc_consistent(pdev, size,
- &adapter->ring_dma);
+ adapter->ring_vir_addr = pci_zalloc_consistent(pdev, size,
+ &adapter->ring_dma);
if (!adapter->ring_vir_addr)
return -ENOMEM;
- memset(adapter->ring_vir_addr, 0, adapter->ring_size);
/* Init TXD Ring */
adapter->txd_dma = adapter->ring_dma ;
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 3/6] net: neterion: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 2/6] net: atheros: " YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-05 12:28 ` [PATCH net-next 4/6] netxen_nic: " YueHaibing
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
use pci_zalloc_consistent to remove unnecessary memset.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/neterion/s2io.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index b8983e7..4e8a2fd 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -733,8 +733,8 @@ static int init_shared_mem(struct s2io_nic *nic)
rx_blocks = &ring->rx_blocks[j];
size = SIZE_OF_BLOCK; /* size is always page size */
- tmp_v_addr = pci_alloc_consistent(nic->pdev, size,
- &tmp_p_addr);
+ tmp_v_addr = pci_zalloc_consistent(nic->pdev, size,
+ &tmp_p_addr);
if (tmp_v_addr == NULL) {
/*
* In case of failure, free_shared_mem()
@@ -746,7 +746,6 @@ static int init_shared_mem(struct s2io_nic *nic)
return -ENOMEM;
}
mem_allocated += size;
- memset(tmp_v_addr, 0, size);
size = sizeof(struct rxd_info) *
rxd_count[nic->rxd_mode];
@@ -835,8 +834,8 @@ static int init_shared_mem(struct s2io_nic *nic)
/* Allocation and initialization of Statistics block */
size = sizeof(struct stat_block);
mac_control->stats_mem =
- pci_alloc_consistent(nic->pdev, size,
- &mac_control->stats_mem_phy);
+ pci_zalloc_consistent(nic->pdev, size,
+ &mac_control->stats_mem_phy);
if (!mac_control->stats_mem) {
/*
@@ -851,7 +850,6 @@ static int init_shared_mem(struct s2io_nic *nic)
tmp_v_addr = mac_control->stats_mem;
mac_control->stats_info = tmp_v_addr;
- memset(tmp_v_addr, 0, size);
DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 4/6] netxen_nic: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
` (2 preceding siblings ...)
2018-06-05 12:28 ` [PATCH net-next 3/6] net: neterion: " YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-06 9:56 ` Sergei Shtylyov
2018-06-05 12:28 ` [PATCH net-next 5/6] net: tlan: " YueHaibing
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
use pci_zalloc_consistent to remove unnecessary memset.
Also remove a local intermediate pointer 'void *addr'.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
.../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 +++++++++-------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
index 7503aa2..096047e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
@@ -267,7 +267,6 @@ nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter,
static int
nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
{
- void *addr;
nx_hostrq_rx_ctx_t *prq;
nx_cardrsp_rx_ctx_t *prsp;
nx_hostrq_rds_ring_t *prq_rds;
@@ -297,19 +296,17 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
rsp_size =
SIZEOF_CARDRSP_RX(nx_cardrsp_rx_ctx_t, nrds_rings, nsds_rings);
- addr = pci_alloc_consistent(adapter->pdev,
- rq_size, &hostrq_phys_addr);
- if (addr == NULL)
+ prq = pci_alloc_consistent(adapter->pdev,
+ rq_size, &hostrq_phys_addr);
+ if (!prq)
return -ENOMEM;
- prq = addr;
- addr = pci_alloc_consistent(adapter->pdev,
- rsp_size, &cardrsp_phys_addr);
- if (addr == NULL) {
+ prsp = pci_alloc_consistent(adapter->pdev,
+ rsp_size, &cardrsp_phys_addr);
+ if (!prsp) {
err = -ENOMEM;
goto out_free_rq;
}
- prsp = addr;
prq->host_rsp_dma_addr = cpu_to_le64(cardrsp_phys_addr);
@@ -445,23 +442,20 @@ nx_fw_cmd_create_tx_ctx(struct netxen_adapter *adapter)
struct netxen_cmd_args cmd;
rq_size = SIZEOF_HOSTRQ_TX(nx_hostrq_tx_ctx_t);
- rq_addr = pci_alloc_consistent(adapter->pdev,
- rq_size, &rq_phys_addr);
+ rq_addr = pci_zalloc_consistent(adapter->pdev,
+ rq_size, &rq_phys_addr);
if (!rq_addr)
return -ENOMEM;
rsp_size = SIZEOF_CARDRSP_TX(nx_cardrsp_tx_ctx_t);
- rsp_addr = pci_alloc_consistent(adapter->pdev,
- rsp_size, &rsp_phys_addr);
+ rsp_addr = pci_zalloc_consistent(adapter->pdev,
+ rsp_size, &rsp_phys_addr);
if (!rsp_addr) {
err = -ENOMEM;
goto out_free_rq;
}
- memset(rq_addr, 0, rq_size);
prq = rq_addr;
-
- memset(rsp_addr, 0, rsp_size);
prsp = rsp_addr;
prq->host_rsp_dma_addr = cpu_to_le64(rsp_phys_addr);
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 5/6] net: tlan: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
` (3 preceding siblings ...)
2018-06-05 12:28 ` [PATCH net-next 4/6] netxen_nic: " YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-05 12:28 ` [PATCH net-next 6/6] enic: " YueHaibing
2018-06-05 12:39 ` [PATCH net-next 0/6] " Andy Shevchenko
6 siblings, 0 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/ti/tlan.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index c769cd9..66f2e5d 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -843,9 +843,9 @@ static int tlan_init(struct net_device *dev)
dma_size = (TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS)
* (sizeof(struct tlan_list));
- priv->dma_storage = pci_alloc_consistent(priv->pci_dev,
- dma_size,
- &priv->dma_storage_dma);
+ priv->dma_storage = pci_zalloc_consistent(priv->pci_dev,
+ dma_size,
+ &priv->dma_storage_dma);
priv->dma_size = dma_size;
if (priv->dma_storage == NULL) {
@@ -853,7 +853,6 @@ static int tlan_init(struct net_device *dev)
dev->name);
return -ENOMEM;
}
- memset(priv->dma_storage, 0, dma_size);
priv->rx_list = (struct tlan_list *)
ALIGN((unsigned long)priv->dma_storage, 8);
priv->rx_list_dma = ALIGN(priv->dma_storage_dma, 8);
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 6/6] enic: use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
` (4 preceding siblings ...)
2018-06-05 12:28 ` [PATCH net-next 5/6] net: tlan: " YueHaibing
@ 2018-06-05 12:28 ` YueHaibing
2018-06-05 12:39 ` [PATCH net-next 0/6] " Andy Shevchenko
6 siblings, 0 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c
index 76cdd4c..7693af9 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c
@@ -1217,13 +1217,12 @@ int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
tlv_size = sizeof(struct filter) +
sizeof(struct filter_action) +
2 * sizeof(struct filter_tlv);
- tlv_va = pci_alloc_consistent(vdev->pdev, tlv_size, &tlv_pa);
+ tlv_va = pci_zalloc_consistent(vdev->pdev, tlv_size, &tlv_pa);
if (!tlv_va)
return -ENOMEM;
tlv = tlv_va;
a0 = tlv_pa;
a1 = tlv_size;
- memset(tlv, 0, tlv_size);
tlv->type = CLSF_TLV_FILTER;
tlv->length = sizeof(struct filter);
*(struct filter *)&tlv->val = *data;
--
2.7.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
` (5 preceding siblings ...)
2018-06-05 12:28 ` [PATCH net-next 6/6] enic: " YueHaibing
@ 2018-06-05 12:39 ` Andy Shevchenko
2018-06-05 12:49 ` Christoph Hellwig
6 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2018-06-05 12:39 UTC (permalink / raw)
To: YueHaibing, Christoph Hellwig
Cc: David S. Miller, netdev, Linux Kernel Mailing List, jcliburn,
chris.snook, benve, Jon Mason, chessman, jes, rahul.verma
On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>
Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
dma.*alloc() ?
> YueHaibing (6):
> net: hippi: use pci_zalloc_consistent
> net: atheros: use pci_zalloc_consistent
> net: neterion: use pci_zalloc_consistent
> netxen_nic: use pci_zalloc_consistent
> net: tlan: use pci_zalloc_consistent
> enic: use pci_zalloc_consistent
>
> drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
> drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++----
> drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++--
> drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
> drivers/net/ethernet/neterion/s2io.c | 10 ++++----
> .../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 ++++++++------------
> drivers/net/ethernet/ti/tlan.c | 7 +++---
> drivers/net/hippi/rrunner.c | 28 +++++++++-------------
> 8 files changed, 35 insertions(+), 54 deletions(-)
>
> --
> 2.7.0
>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
2018-06-05 12:49 ` Christoph Hellwig
@ 2018-06-05 12:46 ` Andy Shevchenko
2018-06-05 13:04 ` YueHaibing
2018-06-05 13:00 ` David Miller
1 sibling, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2018-06-05 12:46 UTC (permalink / raw)
To: Christoph Hellwig
Cc: YueHaibing, David S. Miller, netdev, Linux Kernel Mailing List,
jcliburn, chris.snook, benve, Jon Mason, chessman, jes,
rahul.verma
On Tue, Jun 5, 2018 at 3:49 PM, Christoph Hellwig <hch@lst.de> wrote:
> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>> >
>>
>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>> dma.*alloc() ?
>
> All drivers should move from pci_dma* to dma_* eventually. Converting
> from one flavor of deprecated to another is completely pointless.
Exactly my impression. Thanks, Christoph for clarification.
YueHaibing, care to follow what Christoph said and change your series
accordingly?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
2018-06-05 12:39 ` [PATCH net-next 0/6] " Andy Shevchenko
@ 2018-06-05 12:49 ` Christoph Hellwig
2018-06-05 12:46 ` Andy Shevchenko
2018-06-05 13:00 ` David Miller
0 siblings, 2 replies; 15+ messages in thread
From: Christoph Hellwig @ 2018-06-05 12:49 UTC (permalink / raw)
To: Andy Shevchenko
Cc: YueHaibing, Christoph Hellwig, David S. Miller, netdev,
Linux Kernel Mailing List, jcliburn, chris.snook, benve,
Jon Mason, chessman, jes, rahul.verma
On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
> >
>
> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
> dma.*alloc() ?
All drivers should move from pci_dma* to dma_* eventually. Converting
from one flavor of deprecated to another is completely pointless.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
2018-06-05 12:49 ` Christoph Hellwig
2018-06-05 12:46 ` Andy Shevchenko
@ 2018-06-05 13:00 ` David Miller
1 sibling, 0 replies; 15+ messages in thread
From: David Miller @ 2018-06-05 13:00 UTC (permalink / raw)
To: hch
Cc: andy.shevchenko, yuehaibing, netdev, linux-kernel, jcliburn,
chris.snook, benve, jdmason, chessman, jes, rahul.verma
From: Christoph Hellwig <hch@lst.de>
Date: Tue, 5 Jun 2018 14:49:29 +0200
> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>> >
>>
>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>> dma.*alloc() ?
>
> All drivers should move from pci_dma* to dma_* eventually. Converting
> from one flavor of deprecated to another is completely pointless.
Agreed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
2018-06-05 12:46 ` Andy Shevchenko
@ 2018-06-05 13:04 ` YueHaibing
0 siblings, 0 replies; 15+ messages in thread
From: YueHaibing @ 2018-06-05 13:04 UTC (permalink / raw)
To: Andy Shevchenko, Christoph Hellwig
Cc: David S. Miller, netdev, Linux Kernel Mailing List, jcliburn,
chris.snook, benve, Jon Mason, chessman, jes, rahul.verma
On 2018/6/5 20:46, Andy Shevchenko wrote:
> On Tue, Jun 5, 2018 at 3:49 PM, Christoph Hellwig <hch@lst.de> wrote:
>> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>>>>
>>>
>>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>>> dma.*alloc() ?
>>
>> All drivers should move from pci_dma* to dma_* eventually. Converting
>> from one flavor of deprecated to another is completely pointless.
>
> Exactly my impression. Thanks, Christoph for clarification.
>
> YueHaibing, care to follow what Christoph said and change your series
> accordingly?
ok, will send v2
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/6] net: hippi: use pci_zalloc_consistent
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
@ 2018-06-06 9:53 ` Sergei Shtylyov
2018-06-06 15:04 ` kbuild test robot
1 sibling, 0 replies; 15+ messages in thread
From: Sergei Shtylyov @ 2018-06-06 9:53 UTC (permalink / raw)
To: YueHaibing, davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma
Hello!
On 6/5/2018 3:28 PM, YueHaibing wrote:
> use pci_zalloc_consistent to remove unnecessary memset.
> Also remove a local intermediate pointer 'tmpptr'.
Don't do 2 things with 1 patch.
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 4/6] netxen_nic: use pci_zalloc_consistent
2018-06-05 12:28 ` [PATCH net-next 4/6] netxen_nic: " YueHaibing
@ 2018-06-06 9:56 ` Sergei Shtylyov
0 siblings, 0 replies; 15+ messages in thread
From: Sergei Shtylyov @ 2018-06-06 9:56 UTC (permalink / raw)
To: YueHaibing, davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma
On 6/5/2018 3:28 PM, YueHaibing wrote:
> use pci_zalloc_consistent to remove unnecessary memset.
> Also remove a local intermediate pointer 'void *addr'.
AAgain, don't do 2 things with 1 patch.
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/6] net: hippi: use pci_zalloc_consistent
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
2018-06-06 9:53 ` Sergei Shtylyov
@ 2018-06-06 15:04 ` kbuild test robot
1 sibling, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2018-06-06 15:04 UTC (permalink / raw)
To: YueHaibing
Cc: kbuild-all, davem, netdev, linux-kernel, jcliburn, chris.snook,
benve, jdmason, chessman, jes, rahul.verma, YueHaibing
[-- Attachment #1: Type: text/plain, Size: 5410 bytes --]
Hi YueHaibing,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/YueHaibing/use-pci_zalloc_consistent/20180606-205531
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/net/hippi/rrunner.c: In function 'rr_init_one':
>> drivers/net/hippi/rrunner.c:176:7: error: 'trrpriv' undeclared (first use in this function); did you mean 'rrpriv'?
if (!trrpriv->evt_ring) {
^~~~~~~
rrpriv
drivers/net/hippi/rrunner.c:176:7: note: each undeclared identifier is reported only once for each function it appears in
vim +176 drivers/net/hippi/rrunner.c
74
75 /*
76 * Implementation notes:
77 *
78 * The DMA engine only allows for DMA within physical 64KB chunks of
79 * memory. The current approach of the driver (and stack) is to use
80 * linear blocks of memory for the skbuffs. However, as the data block
81 * is always the first part of the skb and skbs are 2^n aligned so we
82 * are guarantted to get the whole block within one 64KB align 64KB
83 * chunk.
84 *
85 * On the long term, relying on being able to allocate 64KB linear
86 * chunks of memory is not feasible and the skb handling code and the
87 * stack will need to know about I/O vectors or something similar.
88 */
89
90 static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
91 {
92 struct net_device *dev;
93 static int version_disp;
94 u8 pci_latency;
95 struct rr_private *rrpriv;
96 dma_addr_t ring_dma;
97 int ret = -ENOMEM;
98
99 dev = alloc_hippi_dev(sizeof(struct rr_private));
100 if (!dev)
101 goto out3;
102
103 ret = pci_enable_device(pdev);
104 if (ret) {
105 ret = -ENODEV;
106 goto out2;
107 }
108
109 rrpriv = netdev_priv(dev);
110
111 SET_NETDEV_DEV(dev, &pdev->dev);
112
113 ret = pci_request_regions(pdev, "rrunner");
114 if (ret < 0)
115 goto out;
116
117 pci_set_drvdata(pdev, dev);
118
119 rrpriv->pci_dev = pdev;
120
121 spin_lock_init(&rrpriv->lock);
122
123 dev->netdev_ops = &rr_netdev_ops;
124
125 /* display version info if adapter is found */
126 if (!version_disp) {
127 /* set display flag to TRUE so that */
128 /* we only display this string ONCE */
129 version_disp = 1;
130 printk(version);
131 }
132
133 pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency);
134 if (pci_latency <= 0x58){
135 pci_latency = 0x58;
136 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, pci_latency);
137 }
138
139 pci_set_master(pdev);
140
141 printk(KERN_INFO "%s: Essential RoadRunner serial HIPPI "
142 "at 0x%llx, irq %i, PCI latency %i\n", dev->name,
143 (unsigned long long)pci_resource_start(pdev, 0),
144 pdev->irq, pci_latency);
145
146 /*
147 * Remap the MMIO regs into kernel space.
148 */
149 rrpriv->regs = pci_iomap(pdev, 0, 0x1000);
150 if (!rrpriv->regs) {
151 printk(KERN_ERR "%s: Unable to map I/O register, "
152 "RoadRunner will be disabled.\n", dev->name);
153 ret = -EIO;
154 goto out;
155 }
156
157 rrpriv->tx_ring = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
158 rrpriv->tx_ring_dma = ring_dma;
159
160 if (!rrpriv->tx_ring) {
161 ret = -ENOMEM;
162 goto out;
163 }
164
165 rrpriv->rx_ring = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
166 rrpriv->rx_ring_dma = ring_dma;
167
168 if (!rrpriv->rx_ring) {
169 ret = -ENOMEM;
170 goto out;
171 }
172
173 rrpriv->evt_ring = pci_alloc_consistent(pdev, EVT_RING_SIZE, &ring_dma);
174 rrpriv->evt_ring_dma = ring_dma;
175
> 176 if (!trrpriv->evt_ring) {
177 ret = -ENOMEM;
178 goto out;
179 }
180
181 /*
182 * Don't access any register before this point!
183 */
184 #ifdef __BIG_ENDIAN
185 writel(readl(&rrpriv->regs->HostCtrl) | NO_SWAP,
186 &rrpriv->regs->HostCtrl);
187 #endif
188 /*
189 * Need to add a case for little-endian 64-bit hosts here.
190 */
191
192 rr_init(dev);
193
194 ret = register_netdev(dev);
195 if (ret)
196 goto out;
197 return 0;
198
199 out:
200 if (rrpriv->evt_ring)
201 pci_free_consistent(pdev, EVT_RING_SIZE, rrpriv->evt_ring,
202 rrpriv->evt_ring_dma);
203 if (rrpriv->rx_ring)
204 pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring,
205 rrpriv->rx_ring_dma);
206 if (rrpriv->tx_ring)
207 pci_free_consistent(pdev, TX_TOTAL_SIZE, rrpriv->tx_ring,
208 rrpriv->tx_ring_dma);
209 if (rrpriv->regs)
210 pci_iounmap(pdev, rrpriv->regs);
211 if (pdev)
212 pci_release_regions(pdev);
213 out2:
214 free_netdev(dev);
215 out3:
216 return ret;
217 }
218
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39429 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-06-06 15:05 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 12:28 [PATCH net-next 0/6] use pci_zalloc_consistent YueHaibing
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
2018-06-06 9:53 ` Sergei Shtylyov
2018-06-06 15:04 ` kbuild test robot
2018-06-05 12:28 ` [PATCH net-next 2/6] net: atheros: " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 3/6] net: neterion: " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 4/6] netxen_nic: " YueHaibing
2018-06-06 9:56 ` Sergei Shtylyov
2018-06-05 12:28 ` [PATCH net-next 5/6] net: tlan: " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 6/6] enic: " YueHaibing
2018-06-05 12:39 ` [PATCH net-next 0/6] " Andy Shevchenko
2018-06-05 12:49 ` Christoph Hellwig
2018-06-05 12:46 ` Andy Shevchenko
2018-06-05 13:04 ` YueHaibing
2018-06-05 13:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).