Re: [PATCH net-next 1/6] net: hippi: use pci_zalloc_consistent
From: kbuild test robot
Date: Wed Jun 06 2018 - 11:05:04 EST
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:
.config.gz
Description: application/gzip