drivers/misc/habanalabs/common/device.c:289:3: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: 70b2f993ea4a79c298aac4ec1c58089020536ba5 habanalabs: create common folder
date: 2 weeks ago
compiler: riscv64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/misc/habanalabs/common/device.c:289:3: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
snprintf(workq_name, 32, "hl-free-jobs-%u", i);
^
>> drivers/misc/habanalabs/common/device.c:1304:24: warning: Variable 'add_cdev_sysfs_on_err' is reassigned a value before the old one has been used. [redundantAssignment]
add_cdev_sysfs_on_err = false;
^
drivers/misc/habanalabs/common/device.c:1262:24: note: Variable 'add_cdev_sysfs_on_err' is reassigned a value before the old one has been used.
add_cdev_sysfs_on_err = true;
^
drivers/misc/habanalabs/common/device.c:1304:24: note: Variable 'add_cdev_sysfs_on_err' is reassigned a value before the old one has been used.
add_cdev_sysfs_on_err = false;
^
>> drivers/misc/habanalabs/common/command_submission.c:720:6: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
rc = cs_parser(hpriv, job);
^
drivers/misc/habanalabs/common/command_submission.c:691:7: note: Variable 'rc' is reassigned a value before the old one has been used.
rc = -ENOMEM;
^
drivers/misc/habanalabs/common/command_submission.c:720:6: note: Variable 'rc' is reassigned a value before the old one has been used.
rc = cs_parser(hpriv, job);
^
vim +289 drivers/misc/habanalabs/common/device.c
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 241
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 242 /*
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 243 * device_early_init - do some early initialization for the habanalabs device
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 244 *
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 245 * @hdev: pointer to habanalabs device structure
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 246 *
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 247 * Install the relevant function pointers and call the early_init function,
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 248 * if such a function exists
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 249 */
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 250 static int device_early_init(struct hl_device *hdev)
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 251 {
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 252 int i, rc;
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 253 char workq_name[32];
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 254
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 255 switch (hdev->asic_type) {
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 256 case ASIC_GOYA:
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 257 goya_set_asic_funcs(hdev);
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 258 strlcpy(hdev->asic_name, "GOYA", sizeof(hdev->asic_name));
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 259 break;
af57cb81a6df58 drivers/misc/habanalabs/device.c Oded Gabbay 2020-05-11 260 case ASIC_GAUDI:
af57cb81a6df58 drivers/misc/habanalabs/device.c Oded Gabbay 2020-05-11 261 gaudi_set_asic_funcs(hdev);
af57cb81a6df58 drivers/misc/habanalabs/device.c Oded Gabbay 2020-05-11 262 sprintf(hdev->asic_name, "GAUDI");
af57cb81a6df58 drivers/misc/habanalabs/device.c Oded Gabbay 2020-05-11 263 break;
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 264 default:
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 265 dev_err(hdev->dev, "Unrecognized ASIC type %d\n",
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 266 hdev->asic_type);
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 267 return -EINVAL;
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 268 }
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 269
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 270 rc = hdev->asic_funcs->early_init(hdev);
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 271 if (rc)
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 272 return rc;
99b9d7b4970cf1 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 273
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 274 rc = hl_asid_init(hdev);
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 275 if (rc)
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 276 goto early_fini;
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 277
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 278 if (hdev->asic_prop.completion_queues_count) {
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 279 hdev->cq_wq = kcalloc(hdev->asic_prop.completion_queues_count,
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 280 sizeof(*hdev->cq_wq),
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 281 GFP_ATOMIC);
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 282 if (!hdev->cq_wq) {
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 283 rc = -ENOMEM;
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 284 goto asid_fini;
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 285 }
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 286 }
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 287
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 288 for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 @289 snprintf(workq_name, 32, "hl-free-jobs-%u", i);
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 290 hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 291 if (hdev->cq_wq == NULL) {
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 292 dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 293 rc = -ENOMEM;
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 294 goto free_cq_wq;
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 295 }
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 296 }
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 297
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 298 hdev->eq_wq = alloc_workqueue("hl-events", WQ_UNBOUND, 0);
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 299 if (hdev->eq_wq == NULL) {
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 300 dev_err(hdev->dev, "Failed to allocate EQ workqueue\n");
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 301 rc = -ENOMEM;
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 302 goto free_cq_wq;
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 303 }
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 304
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 305 hdev->hl_chip_info = kzalloc(sizeof(struct hwmon_chip_info),
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 306 GFP_KERNEL);
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 307 if (!hdev->hl_chip_info) {
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 308 rc = -ENOMEM;
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 309 goto free_eq_wq;
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 310 }
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 311
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 312 hdev->idle_busy_ts_arr = kmalloc_array(HL_IDLE_BUSY_TS_ARR_SIZE,
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 313 sizeof(struct hl_device_idle_busy_ts),
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 314 (GFP_KERNEL | __GFP_ZERO));
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 315 if (!hdev->idle_busy_ts_arr) {
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 316 rc = -ENOMEM;
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 317 goto free_chip_info;
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 318 }
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 319
be5d926b5c1043 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 320 hl_cb_mgr_init(&hdev->kernel_cb_mgr);
be5d926b5c1043 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 321
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 322 mutex_init(&hdev->send_cpu_message_lock);
19734970c98b07 drivers/misc/habanalabs/device.c Oded Gabbay 2019-05-04 323 mutex_init(&hdev->debug_lock);
8d45f1de3994c5 drivers/misc/habanalabs/device.c Tomer Tayar 2019-05-13 324 mutex_init(&hdev->mmu_cache_lock);
eff6f4a0e70b7b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 325 INIT_LIST_HEAD(&hdev->hw_queues_mirror_list);
eff6f4a0e70b7b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 326 spin_lock_init(&hdev->hw_queues_mirror_lock);
eb7caf84b02938 drivers/misc/habanalabs/device.c Oded Gabbay 2019-07-30 327 INIT_LIST_HEAD(&hdev->fpriv_list);
eb7caf84b02938 drivers/misc/habanalabs/device.c Oded Gabbay 2019-07-30 328 mutex_init(&hdev->fpriv_list_lock);
f8c8c7d5f1b0ea drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 329 atomic_set(&hdev->in_reset, 0);
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 330
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 331 return 0;
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 332
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 333 free_chip_info:
75b3cb2bb08037 drivers/misc/habanalabs/device.c Oded Gabbay 2019-08-28 334 kfree(hdev->hl_chip_info);
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 335 free_eq_wq:
d91389bc839d72 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 336 destroy_workqueue(hdev->eq_wq);
1251f23ae8583b drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 337 free_cq_wq:
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 338 for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++)
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 339 if (hdev->cq_wq[i])
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 340 destroy_workqueue(hdev->cq_wq[i]);
5574cb2194b13d drivers/misc/habanalabs/device.c Ofir Bitton 2020-07-05 341 kfree(hdev->cq_wq);
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 342 asid_fini:
9494a8dd8d22cb drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 343 hl_asid_fini(hdev);
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 344 early_fini:
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 345 if (hdev->asic_funcs->early_fini)
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 346 hdev->asic_funcs->early_fini(hdev);
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 347
0861e41de53044 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 348 return rc;
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 349 }
c4d66343a46a49 drivers/misc/habanalabs/device.c Oded Gabbay 2019-02-16 350
:::::: The code at line 289 was first introduced by commit
:::::: 5574cb2194b13de78df68cd32655ddbe619b1251 habanalabs: Assign each CQ with its own work queue
:::::: TO: Ofir Bitton <obitton(a)habana.ai>
:::::: CC: Oded Gabbay <oded.gabbay(a)gmail.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [f2fs:dev-test 37/38] fs/f2fs/super.c:3058:48: error: 'struct blk_zone' has no member named 'capacity'
by Jaegeuk Kim
On 08/10, Niklas Cassel wrote:
> On Tue, Jul 21, 2020 at 12:57:36PM -0700, Jaegeuk Kim wrote:
> > On 07/21, Aravind Ramesh wrote:
> > > Hello Jaegeuk,
> > > The patch that adds the capacity struct member has been merged to linux-block tree's for-next branch.
> > > So either:
> > > 1. f2fs-dev branch has to carry the same patch, from here:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/log...
> > > I had mentioned this is the cover letter of this patch.
> > > 2. linux-block pull request has to be merged before f2fs pull request to Linus
> > > 3. Or this f2fs patch has to wait until next merge window (the one after kernel 5.9 merge window)
> >
> > Yeah, indeed. Let me queue this patch and try upstream later till block has it.
>
> Hello Jaegeuk,
>
> Just curious, where is this queued?
>
> I can't find it on any of your branches on this git:
> https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
>
> FWIW, commit 82394db7383d ("block: add capacity field to zone descriptors")
> is now in Torvald's tree.
>
> Which merge window did you intend for this patch? 5.9 or 5.10?
It was in https://github.com/jaegeuk/f2fs/commit/550451dc977aeb0000104eb9777fd1dca0...,
and will be moved into kernel.org once pull request for 4.9 was applied.
I think we can merge it in 5.10.
Thanks,
>
>
> Kind regards,
> Niklas
>
> >
> > Thanks,
> >
> > >
> > > Thanks
> > > Aravind
> > >
> > > > -----Original Message-----
> > > > From: kernel test robot <lkp(a)intel.com>
> > > > Sent: Tuesday, July 21, 2020 12:43 PM
> > > > To: Aravind Ramesh <Aravind.Ramesh(a)wdc.com>
> > > > Cc: kbuild-all(a)lists.01.org; linux-f2fs-devel(a)lists.sourceforge.net; Jaegeuk Kim
> > > > <jaegeuk(a)kernel.org>; Damien Le Moal <Damien.LeMoal(a)wdc.com>; Niklas Cassel
> > > > <Niklas.Cassel(a)wdc.com>; Chao Yu <yuchao0(a)huawei.com>; Chao Yu
> > > > <chao(a)kernel.org>
> > > > Subject: [f2fs:dev-test 37/38] fs/f2fs/super.c:3058:48: error: 'struct blk_zone' has
> > > > no member named 'capacity'
> > > >
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
> > > > head: 439633ba3673a5d8983529426df144c64a23d181
> > > > commit: d787c5eec8b58bb47d4bf750758e0e87d667bf56 [37/38] f2fs: support
> > > > zone capacity less than zone size
> > > > config: nds32-allyesconfig (attached as .config)
> > > > compiler: nds32le-linux-gcc (GCC) 9.3.0
> > > > reproduce (this is a W=1 build):
> > > > wget https://raw.githubusercontent.com/intel/lkp-
> > > > tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > chmod +x ~/bin/make.cross
> > > > git checkout d787c5eec8b58bb47d4bf750758e0e87d667bf56
> > > > # save the attached .config to linux build tree
> > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross
> > > > ARCH=nds32
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <lkp(a)intel.com>
> > > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > > fs/f2fs/super.c: In function 'f2fs_report_zone_cb':
> > > > >> fs/f2fs/super.c:3058:48: error: 'struct blk_zone' has no member named 'capacity'
> > > > 3058 | rz_args->dev->zone_capacity_blocks[idx] = zone->capacity >>
> > > > | ^~
> > > > fs/f2fs/super.c:3060:23: error: 'struct blk_zone' has no member named 'capacity'
> > > > 3060 | if (zone->len != zone->capacity && !rz_args->zone_cap_mismatch)
> > > > | ^~
> > > >
> > > > vim +3058 fs/f2fs/super.c
> > > >
> > > > 3048
> > > > 3049 static int f2fs_report_zone_cb(struct blk_zone *zone, unsigned int idx,
> > > > 3050 void *data)
> > > > 3051 {
> > > > 3052 struct f2fs_report_zones_args *rz_args = data;
> > > > 3053
> > > > 3054 if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
> > > > 3055 return 0;
> > > > 3056
> > > > 3057 set_bit(idx, rz_args->dev->blkz_seq);
> > > > > 3058 rz_args->dev->zone_capacity_blocks[idx] = zone->capacity >>
> > > > 3059
> > > > F2FS_LOG_SECTORS_PER_BLOCK;
> > > > 3060 if (zone->len != zone->capacity && !rz_args->zone_cap_mismatch)
> > > > 3061 rz_args->zone_cap_mismatch = true;
> > > > 3062
> > > > 3063 return 0;
> > > > 3064 }
> > > > 3065
> > > >
> > > > ---
> > > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[jkirsher-next-queue:dev-queue 4/33] drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2269:15: error: redefinition of 'truesize'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
head: 5cf0cbb14925b7131baa959b35a2267d6bbb6651
commit: b9b2990dfe8754cb52443a4cfe8c8f7faf6f1cb6 [4/33] ixgbe: fix XDP redirect on archs with PAGE_SIZE above 4K
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout b9b2990dfe8754cb52443a4cfe8c8f7faf6f1cb6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c: In function 'ixgbe_rx_buffer_flip':
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2269:15: error: redefinition of 'truesize'
2269 | unsigned int truesize = ring_uses_build_skb(rx_ring) ?
| ^~~~~~~~
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2265:15: note: previous definition of 'truesize' was here
2265 | unsigned int truesize = ixgbe_rx_frame_truesize(rx_ring, size);
| ^~~~~~~~
vim +/truesize +2269 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
2260
2261 static void ixgbe_rx_buffer_flip(struct ixgbe_ring *rx_ring,
2262 struct ixgbe_rx_buffer *rx_buffer,
2263 unsigned int size)
2264 {
2265 unsigned int truesize = ixgbe_rx_frame_truesize(rx_ring, size);
2266 #if (PAGE_SIZE < 8192)
2267 rx_buffer->page_offset ^= truesize;
2268 #else
> 2269 unsigned int truesize = ring_uses_build_skb(rx_ring) ?
2270 SKB_DATA_ALIGN(IXGBE_SKB_PAD + size) +
2271 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) :
2272 SKB_DATA_ALIGN(size);
2273
2274 rx_buffer->page_offset += truesize;
2275 #endif
2276 }
2277
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[ti:ti-rt-linux-5.4.y 2283/9274] drivers/remoteproc/remoteproc_core.c:1879:29: warning: Uninitialized variable: firmware_p
by kernel test robot
tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.4.y
head: e6f6398802d41ad655b6a4108be588d533e3c1c4
commit: c1a632fc83e364aa8fd82e949b47b36db64523c5 [2283/9274] remoteproc: add infrastructure support to allow pre-loaded remoteprocs
compiler: sh4-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/remoteproc/remoteproc_core.c:1879:29: warning: Uninitialized variable: firmware_p [uninitvar]
ret = rproc_fw_boot(rproc, firmware_p);
^
drivers/remoteproc/remoteproc_core.c:553:38: warning: Uninitialized variable: rvdev [uninitvar]
if (rsc->num_of_vrings > ARRAY_SIZE(rvdev->vring)) {
^
>> drivers/remoteproc/remoteproc_core.c:1378:52: warning: Uninitialized variable: fw [uninitvar]
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
^
drivers/remoteproc/remoteproc_core.c:1431:37: warning: Uninitialized variable: fw [uninitvar]
ret = rproc_fw_sanity_check(rproc, fw);
^
drivers/remoteproc/remoteproc_core.c:1461:47: warning: Uninitialized variable: fw [uninitvar]
rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
^
drivers/remoteproc/remoteproc_core.c:1464:30: warning: Uninitialized variable: fw [uninitvar]
ret = rproc_parse_fw(rproc, fw);
^
drivers/remoteproc/remoteproc_core.c:1489:27: warning: Uninitialized variable: fw [uninitvar]
ret = rproc_start(rproc, fw);
^
vim +1879 drivers/remoteproc/remoteproc_core.c
87775487f5e847 Suman Anna 2018-01-15 1825
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1826 /**
1b0ef9068f053d Suman Anna 2017-07-20 1827 * rproc_boot() - boot a remote processor
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1828 * @rproc: handle of a remote processor
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1829 *
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1830 * Boot a remote processor (i.e. load its firmware, power it on, ...).
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1831 *
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1832 * If the remote processor is already powered on, this function immediately
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1833 * returns (successfully).
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1834 *
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1835 * Returns 0 on success, and an appropriate error value otherwise.
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1836 */
1b0ef9068f053d Suman Anna 2017-07-20 1837 int rproc_boot(struct rproc *rproc)
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1838 {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1839 const struct firmware *firmware_p;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1840 struct device *dev;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1841 int ret;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1842
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1843 if (!rproc) {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1844 pr_err("invalid rproc handle\n");
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1845 return -EINVAL;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1846 }
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1847
b5ab5e24e960b9 Ohad Ben-Cohen 2012-05-30 1848 dev = &rproc->dev;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1849
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1850 ret = mutex_lock_interruptible(&rproc->lock);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1851 if (ret) {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1852 dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1853 return ret;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1854 }
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1855
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1856 if (rproc->state == RPROC_DELETED) {
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1857 ret = -ENODEV;
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1858 dev_err(dev, "can't boot deleted rproc %s\n", rproc->name);
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1859 goto unlock_mutex;
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1860 }
2099c77d4af7d1 Sarangdhar Joshi 2017-01-23 1861
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1862 /* skip the boot process if rproc is already powered up */
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1863 if (atomic_inc_return(&rproc->power) > 1) {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1864 ret = 0;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1865 goto unlock_mutex;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1866 }
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1867
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1868 dev_info(dev, "powering up %s\n", rproc->name);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1869
c1a632fc83e364 Suman Anna 2018-10-08 1870 if (!rproc->skip_firmware_request) {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1871 /* load firmware */
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1872 ret = request_firmware(&firmware_p, rproc->firmware, dev);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1873 if (ret < 0) {
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1874 dev_err(dev, "request_firmware failed: %d\n", ret);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1875 goto downref_rproc;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1876 }
c1a632fc83e364 Suman Anna 2018-10-08 1877 }
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1878
400e64df6b237e Ohad Ben-Cohen 2011-10-20 @1879 ret = rproc_fw_boot(rproc, firmware_p);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1880
c1a632fc83e364 Suman Anna 2018-10-08 1881 if (!rproc->skip_firmware_request)
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1882 release_firmware(firmware_p);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1883
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1884 downref_rproc:
fbb6aacb078285 Bjorn Andersson 2016-10-02 1885 if (ret)
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1886 atomic_dec(&rproc->power);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1887 unlock_mutex:
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1888 mutex_unlock(&rproc->lock);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1889 return ret;
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1890 }
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1891 EXPORT_SYMBOL(rproc_boot);
400e64df6b237e Ohad Ben-Cohen 2011-10-20 1892
:::::: The code at line 1879 was first introduced by commit
:::::: 400e64df6b237eb36b127efd72000a2794f9eec1 remoteproc: add framework for controlling remote processors
:::::: TO: Ohad Ben-Cohen <ohad(a)wizery.com>
:::::: CC: Ohad Ben-Cohen <ohad(a)wizery.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[alaahl:for-upstream 167/236] drivers/vdpa/mlx5/core/mr.c:264:21: error: implicit declaration of function '__phys_to_pfn'; did you mean
by kernel test robot
Hi Eli,
FYI, the error/warning still remains.
tree: https://github.com/alaahl/linux.git for-upstream
head: 7e2972f9d6d90949315c1f55f5b2c825d7401420
commit: d0b0eb15a6014a21c60e860a42550df5be7b5b29 [167/236] vdpa/mlx5: Add shared memory registration code
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout d0b0eb15a6014a21c60e860a42550df5be7b5b29
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/ia64/include/asm/ptrace.h:46,
from arch/ia64/include/asm/processor.h:20,
from arch/ia64/include/asm/thread_info.h:12,
from include/linux/thread_info.h:38,
from include/asm-generic/preempt.h:5,
from ./arch/ia64/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/vdpa.h:6,
from drivers/vdpa/mlx5/core/mr.c:4:
drivers/vdpa/mlx5/core/mr.c: In function 'map_direct_mr':
>> drivers/vdpa/mlx5/core/mr.c:264:21: error: implicit declaration of function '__phys_to_pfn'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
264 | pg = pfn_to_page(__phys_to_pfn(pa));
| ^~~~~~~~~~~~~
arch/ia64/include/asm/page.h:108:40: note: in definition of macro 'pfn_to_page'
108 | # define pfn_to_page(pfn) (vmem_map + (pfn))
| ^~~
cc1: some warnings being treated as errors
vim +264 drivers/vdpa/mlx5/core/mr.c
225
226 static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr,
227 struct vhost_iotlb *iotlb)
228 {
229 struct vhost_iotlb_map *map;
230 unsigned long lgcd = 0;
231 int log_entity_size;
232 unsigned long size;
233 u64 start = 0;
234 int err;
235 struct page *pg;
236 unsigned int nsg;
237 int sglen;
238 u64 pa;
239 u64 paend;
240 struct scatterlist *sg;
241 struct device *dma = mvdev->mdev->device;
242 int ret;
243
244 for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
245 map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
246 size = maplen(map, mr);
247 lgcd = gcd(lgcd, size);
248 start += size;
249 }
250 log_entity_size = ilog2(lgcd);
251
252 sglen = 1 << log_entity_size;
253 nsg = MLX5_DIV_ROUND_UP_POW2(mr->end - mr->start, log_entity_size);
254
255 err = sg_alloc_table(&mr->sg_head, nsg, GFP_KERNEL);
256 if (err)
257 return err;
258
259 sg = mr->sg_head.sgl;
260 for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
261 map; map = vhost_iotlb_itree_next(map, mr->start, mr->end - 1)) {
262 paend = map->addr + maplen(map, mr);
263 for (pa = map->addr; pa < paend; pa += sglen) {
> 264 pg = pfn_to_page(__phys_to_pfn(pa));
265 if (!sg) {
266 mlx5_vdpa_warn(mvdev, "sg null. start 0x%llx, end 0x%llx\n",
267 map->start, map->last + 1);
268 err = -ENOMEM;
269 goto err_map;
270 }
271 sg_set_page(sg, pg, sglen, 0);
272 sg = sg_next(sg);
273 if (!sg)
274 goto done;
275 }
276 }
277 done:
278 mr->log_size = log_entity_size;
279 mr->nsg = nsg;
280 ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
281 if (!ret)
282 goto err_map;
283
284 err = create_direct_mr(mvdev, mr);
285 if (err)
286 goto err_direct;
287
288 return 0;
289
290 err_direct:
291 dma_unmap_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
292 err_map:
293 sg_free_table(&mr->sg_head);
294 return err;
295 }
296
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
drivers/pci/pci.c:3911 pci_pio_to_address() warn: always true condition '(pio >= (0 - 0)) => (0-u64max >= 0)'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: b8104fda1fff0882e43b7e98832a76d7e98eb3e9 logic_pio: Define PIO_INDIRECT_SIZE for !CONFIG_INDIRECT_PIO
date: 9 months ago
config: s390-randconfig-m031-20200810 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
New smatch warnings:
drivers/pci/pci.c:3911 pci_pio_to_address() warn: always true condition '(pio >= (0 - 0)) => (0-u64max >= 0)'
Old smatch warnings:
drivers/pci/pci.c:5982 pci_specified_resource_alignment() warn: should '1 << align_order' be a 64 bit type?
vim +3911 drivers/pci/pci.c
c5076cfe768998 Tomasz Nowicki 2016-05-11 3905
c5076cfe768998 Tomasz Nowicki 2016-05-11 3906 phys_addr_t pci_pio_to_address(unsigned long pio)
c5076cfe768998 Tomasz Nowicki 2016-05-11 3907 {
c5076cfe768998 Tomasz Nowicki 2016-05-11 3908 phys_addr_t address = (phys_addr_t)OF_BAD_ADDR;
c5076cfe768998 Tomasz Nowicki 2016-05-11 3909
c5076cfe768998 Tomasz Nowicki 2016-05-11 3910 #ifdef PCI_IOBASE
5745392e0c2b78 Zhichang Yuan 2018-03-15 @3911 if (pio >= MMIO_UPPER_LIMIT)
c5076cfe768998 Tomasz Nowicki 2016-05-11 3912 return address;
c5076cfe768998 Tomasz Nowicki 2016-05-11 3913
5745392e0c2b78 Zhichang Yuan 2018-03-15 3914 address = logic_pio_to_hwaddr(pio);
c5076cfe768998 Tomasz Nowicki 2016-05-11 3915 #endif
c5076cfe768998 Tomasz Nowicki 2016-05-11 3916
c5076cfe768998 Tomasz Nowicki 2016-05-11 3917 return address;
c5076cfe768998 Tomasz Nowicki 2016-05-11 3918 }
c5076cfe768998 Tomasz Nowicki 2016-05-11 3919
:::::: The code at line 3911 was first introduced by commit
:::::: 5745392e0c2b78e0d73203281d5c42cbd6993194 PCI: Apply the new generic I/O management on PCI IO hosts
:::::: TO: Zhichang Yuan <yuanzhichang(a)hisilicon.com>
:::::: CC: Bjorn Helgaas <helgaas(a)kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[josef-btrfs:locking-rework 16/18] include/trace/events/btrfs.h:2066:1: sparse: sparse: context imbalance in '__btrfs_tree_lock' - wrong count at exit
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git locking-rework
head: ecc26315fec63c1ce9a1420cb6d9b6e0d0c4d7f5
commit: 061e82bf86d54d981acb307eff1fa114e71c3854 [16/18] btrfs: change our extent buffer lock to a rw_semaphore
config: i386-randconfig-s002-20200810 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-141-g19506bc2-dirty
git checkout 061e82bf86d54d981acb307eff1fa114e71c3854
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
fs/btrfs/locking.c: note: in included file (through fs/btrfs/ctree.h):
>> include/trace/events/btrfs.h:2066:1: sparse: sparse: context imbalance in '__btrfs_tree_lock' - wrong count at exit
fs/btrfs/locking.c:217:6: sparse: sparse: context imbalance in 'btrfs_tree_lock' - wrong count at exit
vim +/__btrfs_tree_lock +2066 include/trace/events/btrfs.h
34e73cc930a867 Qu Wenruo 2019-04-15 2065
34e73cc930a867 Qu Wenruo 2019-04-15 @2066 DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock,
34e73cc930a867 Qu Wenruo 2019-04-15 2067 TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
34e73cc930a867 Qu Wenruo 2019-04-15 2068
34e73cc930a867 Qu Wenruo 2019-04-15 2069 TP_ARGS(eb, start_ns)
34e73cc930a867 Qu Wenruo 2019-04-15 2070 );
34e73cc930a867 Qu Wenruo 2019-04-15 2071
:::::: The code at line 2066 was first introduced by commit
:::::: 34e73cc930a8677426c9cbffdd3421e18f32e79f btrfs: trace: Introduce trace events for sleepable tree lock
:::::: TO: Qu Wenruo <wqu(a)suse.com>
:::::: CC: David Sterba <dsterba(a)suse.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [PATCH v3 2/5] btrfs: extent-tree: Kill BUG_ON() in __btrfs_free_extent() and do better comment
by kernel test robot
Hi Qu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.8 next-20200810]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Qu-Wenruo/btrfs-Enhanced-runtime...
base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: arm-randconfig-r025-20200810 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 3a34228bff6fdf45b50cb57cf5fb85d659eeb672)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from fs/btrfs/extent-tree.c:20:
In file included from fs/btrfs/tree-log.h:9:
fs/btrfs/ctree.h:2265:8: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
size_t __const btrfs_get_num_csums(void);
^~~~~~~~
In file included from fs/btrfs/extent-tree.c:28:
fs/btrfs/sysfs.h:16:14: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
const char * const btrfs_feature_set_name(enum btrfs_feature_set set);
^~~~~~
>> fs/btrfs/extent-tree.c:3157:8: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
sizeof(*ei) + sizeof(*bi));
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ctree.h:3101:41: note: expanded from macro 'btrfs_crit'
btrfs_printk(fs_info, KERN_CRIT fmt, ##args)
~~~ ^~~~
3 warnings generated.
vim +3157 fs/btrfs/extent-tree.c
2932
2933 /*
2934 * Real work happens here to drop one or more refs of @node.
2935 *
2936 * The work is mostly done in two parts:
2937 * 1. Locate the extent refs.
2938 * It's either inlined in EXTENT/METADATA_ITEM or in keyed SHARED_* item.
2939 * Locate it then reduces the refs number or remove the ref line completely.
2940 *
2941 * 2. Update the refs count in EXTENT/METADATA_ITEM
2942 *
2943 * Due to the above two operations and possible optimizations, the function
2944 * is a little hard to read, but with the following examples, the result
2945 * of this function should be pretty easy to get.
2946 *
2947 * Example:
2948 * *** Inlined backref case ***
2949 * In extent tree we have:
2950 * item 0 key (13631488 EXTENT_ITEM 1048576) itemoff 16201 itemsize 82
2951 * refs 2 gen 6 flags DATA
2952 * extent data backref root FS_TREE objectid 258 offset 0 count 1
2953 * extent data backref root FS_TREE objectid 257 offset 0 count 1
2954 *
2955 * This function get called with
2956 * node->bytenr = 13631488, node->num_bytes = 1048576
2957 * root_objectid = FS_TREE, owner_objectid = 257, owner_offset = 0,
2958 * refs_to_drop = 1
2959 * Then we should get some like:
2960 * item 0 key (13631488 EXTENT_ITEM 1048576) itemoff 16201 itemsize 82
2961 * refs 1 gen 6 flags DATA
2962 * extent data backref root FS_TREE objectid 258 offset 0 count 1
2963 *
2964 * *** Keyed backref case ***
2965 * In extent tree we have:
2966 * item 0 key (13631488 EXTENT_ITEM 1048576) itemoff 3971 itemsize 24
2967 * refs 754 gen 6 flags DATA
2968 * [...]
2969 * item 2 key (13631488 EXTENT_DATA_REF <HASH>) itemoff 3915 itemsize 28
2970 * extent data backref root FS_TREE objectid 866 offset 0 count 1
2971 * This function get called with
2972 * node->bytenr = 13631488, node->num_bytes = 1048576
2973 * root_objectid = FS_TREE, owner_objectid = 866, owner_offset = 0,
2974 * refs_to_drop = 1
2975 * Then we should get some like:
2976 * item 0 key (13631488 EXTENT_ITEM 1048576) itemoff 3971 itemsize 24
2977 * refs 753 gen 6 flags DATA
2978 * And that (13631488 EXTENT_DATA_REF <HASH>) get removed.
2979 */
2980 static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
2981 struct btrfs_delayed_ref_node *node, u64 parent,
2982 u64 root_objectid, u64 owner_objectid,
2983 u64 owner_offset, int refs_to_drop,
2984 struct btrfs_delayed_extent_op *extent_op)
2985 {
2986 struct btrfs_fs_info *info = trans->fs_info;
2987 struct btrfs_key key;
2988 struct btrfs_path *path;
2989 struct btrfs_root *extent_root = info->extent_root;
2990 struct extent_buffer *leaf;
2991 struct btrfs_extent_item *ei;
2992 struct btrfs_extent_inline_ref *iref;
2993 int ret;
2994 int is_data;
2995 int extent_slot = 0;
2996 int found_extent = 0;
2997 int num_to_del = 1;
2998 u32 item_size;
2999 u64 refs;
3000 u64 bytenr = node->bytenr;
3001 u64 num_bytes = node->num_bytes;
3002 int last_ref = 0;
3003 bool skinny_metadata = btrfs_fs_incompat(info, SKINNY_METADATA);
3004
3005 path = btrfs_alloc_path();
3006 if (!path)
3007 return -ENOMEM;
3008
3009 path->leave_spinning = 1;
3010
3011 is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID;
3012
3013 if (unlikely(!is_data && refs_to_drop != 1)) {
3014 btrfs_crit(info,
3015 "invalid refs_to_drop, dropping more than 1 refs for tree block %llu refs_to_drop %u",
3016 node->bytenr, refs_to_drop);
3017 ret = -EINVAL;
3018 btrfs_abort_transaction(trans, ret);
3019 goto out;
3020 }
3021
3022 if (is_data)
3023 skinny_metadata = false;
3024
3025 ret = lookup_extent_backref(trans, path, &iref, bytenr, num_bytes,
3026 parent, root_objectid, owner_objectid,
3027 owner_offset);
3028 if (ret == 0) {
3029 /*
3030 * Either the inline backref or the SHARED_DATA_REF/
3031 * SHARED_BLOCK_REF is found
3032 *
3033 * Here is a quick path to locate EXTENT/METADATA_ITEM.
3034 * It's possible the EXTENT/METADATA_ITEM is near current slot.
3035 */
3036 extent_slot = path->slots[0];
3037 while (extent_slot >= 0) {
3038 btrfs_item_key_to_cpu(path->nodes[0], &key,
3039 extent_slot);
3040 if (key.objectid != bytenr)
3041 break;
3042 if (key.type == BTRFS_EXTENT_ITEM_KEY &&
3043 key.offset == num_bytes) {
3044 found_extent = 1;
3045 break;
3046 }
3047 if (key.type == BTRFS_METADATA_ITEM_KEY &&
3048 key.offset == owner_objectid) {
3049 found_extent = 1;
3050 break;
3051 }
3052
3053 /* Quick path didn't find the EXTEMT/METADATA_ITEM */
3054 if (path->slots[0] - extent_slot > 5)
3055 break;
3056 extent_slot--;
3057 }
3058
3059 if (!found_extent) {
3060 if (unlikely(iref)) {
3061 btrfs_crit(info,
3062 "invalid iref, no EXTENT/METADATA_ITEM found but has inline extent ref");
3063 goto err_dump_abort;
3064 }
3065 /* Must be SHARED_* item, remove the backref first */
3066 ret = remove_extent_backref(trans, path, NULL,
3067 refs_to_drop,
3068 is_data, &last_ref);
3069 if (ret) {
3070 btrfs_abort_transaction(trans, ret);
3071 goto out;
3072 }
3073 btrfs_release_path(path);
3074 path->leave_spinning = 1;
3075
3076
3077 /* Slow path to locate EXTENT/METADATA_ITEM */
3078 key.objectid = bytenr;
3079 key.type = BTRFS_EXTENT_ITEM_KEY;
3080 key.offset = num_bytes;
3081
3082 if (!is_data && skinny_metadata) {
3083 key.type = BTRFS_METADATA_ITEM_KEY;
3084 key.offset = owner_objectid;
3085 }
3086
3087 ret = btrfs_search_slot(trans, extent_root,
3088 &key, path, -1, 1);
3089 if (ret > 0 && skinny_metadata && path->slots[0]) {
3090 /*
3091 * Couldn't find our skinny metadata item,
3092 * see if we have ye olde extent item.
3093 */
3094 path->slots[0]--;
3095 btrfs_item_key_to_cpu(path->nodes[0], &key,
3096 path->slots[0]);
3097 if (key.objectid == bytenr &&
3098 key.type == BTRFS_EXTENT_ITEM_KEY &&
3099 key.offset == num_bytes)
3100 ret = 0;
3101 }
3102
3103 if (ret > 0 && skinny_metadata) {
3104 skinny_metadata = false;
3105 key.objectid = bytenr;
3106 key.type = BTRFS_EXTENT_ITEM_KEY;
3107 key.offset = num_bytes;
3108 btrfs_release_path(path);
3109 ret = btrfs_search_slot(trans, extent_root,
3110 &key, path, -1, 1);
3111 }
3112
3113 if (ret) {
3114 btrfs_err(info,
3115 "umm, got %d back from search, was looking for %llu",
3116 ret, bytenr);
3117 if (ret > 0)
3118 btrfs_print_leaf(path->nodes[0]);
3119 }
3120 if (ret < 0) {
3121 btrfs_abort_transaction(trans, ret);
3122 goto out;
3123 }
3124 extent_slot = path->slots[0];
3125 }
3126 } else if (WARN_ON(ret == -ENOENT)) {
3127 btrfs_print_leaf(path->nodes[0]);
3128 btrfs_err(info,
3129 "unable to find ref byte nr %llu parent %llu root %llu owner %llu offset %llu",
3130 bytenr, parent, root_objectid, owner_objectid,
3131 owner_offset);
3132 btrfs_abort_transaction(trans, ret);
3133 goto out;
3134 } else {
3135 btrfs_abort_transaction(trans, ret);
3136 goto out;
3137 }
3138
3139 leaf = path->nodes[0];
3140 item_size = btrfs_item_size_nr(leaf, extent_slot);
3141 if (unlikely(item_size < sizeof(*ei))) {
3142 ret = -EINVAL;
3143 btrfs_print_v0_err(info);
3144 btrfs_abort_transaction(trans, ret);
3145 goto out;
3146 }
3147 ei = btrfs_item_ptr(leaf, extent_slot,
3148 struct btrfs_extent_item);
3149 if (owner_objectid < BTRFS_FIRST_FREE_OBJECTID &&
3150 key.type == BTRFS_EXTENT_ITEM_KEY) {
3151 struct btrfs_tree_block_info *bi;
3152 if (unlikely(item_size < sizeof(*ei) + sizeof(*bi))) {
3153 btrfs_crit(info,
3154 "invalid extent item size for key (%llu, %u, %llu) owner %llu, has %u expect >= %lu",
3155 key.objectid, key.type, key.offset,
3156 owner_objectid, item_size,
> 3157 sizeof(*ei) + sizeof(*bi));
3158 goto err_dump_abort;
3159 }
3160 bi = (struct btrfs_tree_block_info *)(ei + 1);
3161 WARN_ON(owner_objectid != btrfs_tree_block_level(leaf, bi));
3162 }
3163
3164 refs = btrfs_extent_refs(leaf, ei);
3165 if (refs < refs_to_drop) {
3166 btrfs_crit(info,
3167 "trying to drop %d refs but we only have %Lu for bytenr %Lu",
3168 refs_to_drop, refs, bytenr);
3169 goto err_dump_abort;
3170 }
3171 refs -= refs_to_drop;
3172
3173 if (refs > 0) {
3174 if (extent_op)
3175 __run_delayed_extent_op(extent_op, leaf, ei);
3176 /*
3177 * In the case of inline back ref, reference count will
3178 * be updated by remove_extent_backref
3179 */
3180 if (iref) {
3181 if (unlikely(!found_extent)) {
3182 btrfs_crit(info,
3183 "invalid iref, got inlined extent ref but no EXTENT/METADATA_ITEM found");
3184 goto err_dump_abort;
3185 }
3186 } else {
3187 btrfs_set_extent_refs(leaf, ei, refs);
3188 btrfs_mark_buffer_dirty(leaf);
3189 }
3190 if (found_extent) {
3191 ret = remove_extent_backref(trans, path, iref,
3192 refs_to_drop, is_data,
3193 &last_ref);
3194 if (ret) {
3195 btrfs_abort_transaction(trans, ret);
3196 goto out;
3197 }
3198 }
3199 } else {
3200 /* In this branch refs == 1 */
3201 if (found_extent) {
3202 if (is_data && refs_to_drop !=
3203 extent_data_ref_count(path, iref)) {
3204 btrfs_crit(info,
3205 "invalid refs_to_drop, current refs %u refs_to_drop %u",
3206 extent_data_ref_count(path, iref),
3207 refs_to_drop);
3208 goto err_dump_abort;
3209 }
3210 if (iref) {
3211 if (path->slots[0] != extent_slot) {
3212 btrfs_crit(info,
3213 "invalid iref, extent item key (%llu %u %llu) doesn't has wanted iref",
3214 key.objectid, key.type,
3215 key.offset);
3216 goto err_dump_abort;
3217 }
3218 } else {
3219 /*
3220 * No inline ref, we must at SHARED_* item,
3221 * And it's single ref, it must be:
3222 * | extent_slot ||extent_slot + 1|
3223 * [ EXTENT/METADATA_ITEM ][ SHARED_* ITEM ]
3224 */
3225 if (path->slots[0] != extent_slot + 1) {
3226 btrfs_crit(info,
3227 "invalid SHARED_* item, previous item is not EXTENT/METADATA_ITEM");
3228 goto err_dump_abort;
3229 }
3230 path->slots[0] = extent_slot;
3231 num_to_del = 2;
3232 }
3233 }
3234
3235 last_ref = 1;
3236 ret = btrfs_del_items(trans, extent_root, path, path->slots[0],
3237 num_to_del);
3238 if (ret) {
3239 btrfs_abort_transaction(trans, ret);
3240 goto out;
3241 }
3242 btrfs_release_path(path);
3243
3244 if (is_data) {
3245 ret = btrfs_del_csums(trans, info->csum_root, bytenr,
3246 num_bytes);
3247 if (ret) {
3248 btrfs_abort_transaction(trans, ret);
3249 goto out;
3250 }
3251 }
3252
3253 ret = add_to_free_space_tree(trans, bytenr, num_bytes);
3254 if (ret) {
3255 btrfs_abort_transaction(trans, ret);
3256 goto out;
3257 }
3258
3259 ret = btrfs_update_block_group(trans, bytenr, num_bytes, 0);
3260 if (ret) {
3261 btrfs_abort_transaction(trans, ret);
3262 goto out;
3263 }
3264 }
3265 btrfs_release_path(path);
3266
3267 out:
3268 btrfs_free_path(path);
3269 return ret;
3270 err_dump_abort:
3271 /*
3272 * Leaf dump can take up a lot of dmesg buffer since default nodesize
3273 * is already 16K.
3274 * So we only do full leaf dump for debug build.
3275 */
3276 if (IS_ENABLED(CONFIG_BTRFS_DEBUG)) {
3277 btrfs_crit(info, "path->slots[0]=%d extent_slot=%d",
3278 path->slots[0], extent_slot);
3279 btrfs_print_leaf(path->nodes[0]);
3280 }
3281
3282 btrfs_abort_transaction(trans, -EUCLEAN);
3283 btrfs_free_path(path);
3284 return -EUCLEAN;
3285 }
3286
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[jkirsher-next-queue:dev-queue 32/33] drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:50: sparse: sparse: incorrect type in initializer (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
head: 5cf0cbb14925b7131baa959b35a2267d6bbb6651
commit: f9f6d7ca51320f99e7d1c1b8facc5c129e9c413f [32/33] i40e: Add flow director support for IPv6
config: x86_64-randconfig-s022-20200810 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-141-g19506bc2-dirty
git checkout f9f6d7ca51320f99e7d1c1b8facc5c129e9c413f
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:50: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be32 @@ got unsigned int @@
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:50: sparse: expected restricted __be32
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:50: sparse: got unsigned int
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:62: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be32 @@ got unsigned int @@
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:62: sparse: expected restricted __be32
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4117:62: sparse: got unsigned int
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:17: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be32 @@ got unsigned int @@
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:17: sparse: expected restricted __be32
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:17: sparse: got unsigned int
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:29: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be32 @@ got unsigned int @@
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:29: sparse: expected restricted __be32
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4118:29: sparse: got unsigned int
vim +4117 drivers/net/ethernet/intel/i40e/i40e_ethtool.c
4087
4088 /**
4089 * i40e_check_fdir_input_set - Check that a given rx_flow_spec mask is valid
4090 * @vsi: pointer to the targeted VSI
4091 * @fsp: pointer to Rx flow specification
4092 * @userdef: userdefined data from flow specification
4093 *
4094 * Ensures that a given ethtool_rx_flow_spec has a valid mask. Some support
4095 * for partial matches exists with a few limitations. First, hardware only
4096 * supports masking by word boundary (2 bytes) and not per individual bit.
4097 * Second, hardware is limited to using one mask for a flow type and cannot
4098 * use a separate mask for each filter.
4099 *
4100 * To support these limitations, if we already have a configured filter for
4101 * the specified type, this function enforces that new filters of the type
4102 * match the configured input set. Otherwise, if we do not have a filter of
4103 * the specified type, we allow the input set to be updated to match the
4104 * desired filter.
4105 *
4106 * To help ensure that administrators understand why filters weren't displayed
4107 * as supported, we print a diagnostic message displaying how the input set
4108 * would change and warning to delete the preexisting filters if required.
4109 *
4110 * Returns 0 on successful input set match, and a negative return code on
4111 * failure.
4112 **/
4113 static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
4114 struct ethtool_rx_flow_spec *fsp,
4115 struct i40e_rx_flow_userdef *userdef)
4116 {
> 4117 static const __be32 ipv6_full_mask[4] = {0xffffffff, 0xffffffff,
4118 0xffffffff, 0xffffffff};
4119 struct ethtool_tcpip6_spec *tcp_ip6_spec;
4120 struct ethtool_usrip6_spec *usr_ip6_spec;
4121 struct ethtool_tcpip4_spec *tcp_ip4_spec;
4122 struct ethtool_usrip4_spec *usr_ip4_spec;
4123 struct i40e_pf *pf = vsi->back;
4124 u64 current_mask, new_mask;
4125 bool new_flex_offset = false;
4126 bool flex_l3 = false;
4127 u16 *fdir_filter_count;
4128 u16 index, src_offset = 0;
4129 u8 pit_index = 0;
4130 int err;
4131
4132 switch (fsp->flow_type & ~FLOW_EXT) {
4133 case SCTP_V4_FLOW:
4134 index = I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
4135 fdir_filter_count = &pf->fd_sctp4_filter_cnt;
4136 break;
4137 case TCP_V4_FLOW:
4138 index = I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
4139 fdir_filter_count = &pf->fd_tcp4_filter_cnt;
4140 break;
4141 case UDP_V4_FLOW:
4142 index = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
4143 fdir_filter_count = &pf->fd_udp4_filter_cnt;
4144 break;
4145 case SCTP_V6_FLOW:
4146 index = I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
4147 fdir_filter_count = &pf->fd_sctp6_filter_cnt;
4148 break;
4149 case TCP_V6_FLOW:
4150 index = I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
4151 fdir_filter_count = &pf->fd_tcp6_filter_cnt;
4152 break;
4153 case UDP_V6_FLOW:
4154 index = I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
4155 fdir_filter_count = &pf->fd_udp6_filter_cnt;
4156 break;
4157 case IP_USER_FLOW:
4158 index = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
4159 fdir_filter_count = &pf->fd_ip4_filter_cnt;
4160 flex_l3 = true;
4161 break;
4162 case IPV6_USER_FLOW:
4163 index = I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
4164 fdir_filter_count = &pf->fd_ip6_filter_cnt;
4165 flex_l3 = true;
4166 break;
4167 default:
4168 return -EOPNOTSUPP;
4169 }
4170
4171 /* Read the current input set from register memory. */
4172 current_mask = i40e_read_fd_input_set(pf, index);
4173 new_mask = current_mask;
4174
4175 /* Determine, if any, the required changes to the input set in order
4176 * to support the provided mask.
4177 *
4178 * Hardware only supports masking at word (2 byte) granularity and does
4179 * not support full bitwise masking. This implementation simplifies
4180 * even further and only supports fully enabled or fully disabled
4181 * masks for each field, even though we could split the ip4src and
4182 * ip4dst fields.
4183 */
4184 switch (fsp->flow_type & ~FLOW_EXT) {
4185 case SCTP_V4_FLOW:
4186 new_mask &= ~I40E_VERIFY_TAG_MASK;
4187 fallthrough;
4188 case TCP_V4_FLOW:
4189 case UDP_V4_FLOW:
4190 tcp_ip4_spec = &fsp->m_u.tcp_ip4_spec;
4191
4192 /* IPv4 source address */
4193 if (tcp_ip4_spec->ip4src == htonl(0xFFFFFFFF))
4194 new_mask |= I40E_L3_SRC_MASK;
4195 else if (!tcp_ip4_spec->ip4src)
4196 new_mask &= ~I40E_L3_SRC_MASK;
4197 else
4198 return -EOPNOTSUPP;
4199
4200 /* IPv4 destination address */
4201 if (tcp_ip4_spec->ip4dst == htonl(0xFFFFFFFF))
4202 new_mask |= I40E_L3_DST_MASK;
4203 else if (!tcp_ip4_spec->ip4dst)
4204 new_mask &= ~I40E_L3_DST_MASK;
4205 else
4206 return -EOPNOTSUPP;
4207
4208 /* L4 source port */
4209 if (tcp_ip4_spec->psrc == htons(0xFFFF))
4210 new_mask |= I40E_L4_SRC_MASK;
4211 else if (!tcp_ip4_spec->psrc)
4212 new_mask &= ~I40E_L4_SRC_MASK;
4213 else
4214 return -EOPNOTSUPP;
4215
4216 /* L4 destination port */
4217 if (tcp_ip4_spec->pdst == htons(0xFFFF))
4218 new_mask |= I40E_L4_DST_MASK;
4219 else if (!tcp_ip4_spec->pdst)
4220 new_mask &= ~I40E_L4_DST_MASK;
4221 else
4222 return -EOPNOTSUPP;
4223
4224 /* Filtering on Type of Service is not supported. */
4225 if (tcp_ip4_spec->tos)
4226 return -EOPNOTSUPP;
4227
4228 break;
4229 case SCTP_V6_FLOW:
4230 new_mask &= ~I40E_VERIFY_TAG_MASK;
4231 fallthrough;
4232 case TCP_V6_FLOW:
4233 case UDP_V6_FLOW:
4234 tcp_ip6_spec = &fsp->m_u.tcp_ip6_spec;
4235
4236 /* Check if user provided IPv6 source address. */
4237 if (ipv6_addr_equal((struct in6_addr *)&tcp_ip6_spec->ip6src,
4238 (struct in6_addr *)&ipv6_full_mask))
4239 new_mask |= I40E_L3_V6_SRC_MASK;
4240 else if (ipv6_addr_any((struct in6_addr *)
4241 &tcp_ip6_spec->ip6src))
4242 new_mask &= ~I40E_L3_V6_SRC_MASK;
4243 else
4244 return -EOPNOTSUPP;
4245
4246 /* Check if user provided destination address. */
4247 if (ipv6_addr_equal((struct in6_addr *)&tcp_ip6_spec->ip6dst,
4248 (struct in6_addr *)&ipv6_full_mask))
4249 new_mask |= I40E_L3_V6_DST_MASK;
4250 else if (ipv6_addr_any((struct in6_addr *)
4251 &tcp_ip6_spec->ip6src))
4252 new_mask &= ~I40E_L3_V6_DST_MASK;
4253 else
4254 return -EOPNOTSUPP;
4255
4256 /* L4 source port */
4257 if (tcp_ip6_spec->psrc == htons(0xFFFF))
4258 new_mask |= I40E_L4_SRC_MASK;
4259 else if (!tcp_ip6_spec->psrc)
4260 new_mask &= ~I40E_L4_SRC_MASK;
4261 else
4262 return -EOPNOTSUPP;
4263
4264 /* L4 destination port */
4265 if (tcp_ip6_spec->pdst == htons(0xFFFF))
4266 new_mask |= I40E_L4_DST_MASK;
4267 else if (!tcp_ip6_spec->pdst)
4268 new_mask &= ~I40E_L4_DST_MASK;
4269 else
4270 return -EOPNOTSUPP;
4271
4272 /* Filtering on Traffic Classes is not supported. */
4273 if (tcp_ip6_spec->tclass)
4274 return -EOPNOTSUPP;
4275 break;
4276 case IP_USER_FLOW:
4277 usr_ip4_spec = &fsp->m_u.usr_ip4_spec;
4278
4279 /* IPv4 source address */
4280 if (usr_ip4_spec->ip4src == htonl(0xFFFFFFFF))
4281 new_mask |= I40E_L3_SRC_MASK;
4282 else if (!usr_ip4_spec->ip4src)
4283 new_mask &= ~I40E_L3_SRC_MASK;
4284 else
4285 return -EOPNOTSUPP;
4286
4287 /* IPv4 destination address */
4288 if (usr_ip4_spec->ip4dst == htonl(0xFFFFFFFF))
4289 new_mask |= I40E_L3_DST_MASK;
4290 else if (!usr_ip4_spec->ip4dst)
4291 new_mask &= ~I40E_L3_DST_MASK;
4292 else
4293 return -EOPNOTSUPP;
4294
4295 /* First 4 bytes of L4 header */
4296 if (usr_ip4_spec->l4_4_bytes == htonl(0xFFFFFFFF))
4297 new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
4298 else if (!usr_ip4_spec->l4_4_bytes)
4299 new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
4300 else
4301 return -EOPNOTSUPP;
4302
4303 /* Filtering on Type of Service is not supported. */
4304 if (usr_ip4_spec->tos)
4305 return -EOPNOTSUPP;
4306
4307 /* Filtering on IP version is not supported */
4308 if (usr_ip4_spec->ip_ver)
4309 return -EINVAL;
4310
4311 /* Filtering on L4 protocol is not supported */
4312 if (usr_ip4_spec->proto)
4313 return -EINVAL;
4314
4315 break;
4316 case IPV6_USER_FLOW:
4317 usr_ip6_spec = &fsp->m_u.usr_ip6_spec;
4318
4319 /* Check if user provided IPv6 source address. */
4320 if (ipv6_addr_equal((struct in6_addr *)&usr_ip6_spec->ip6src,
4321 (struct in6_addr *)&ipv6_full_mask))
4322 new_mask |= I40E_L3_V6_SRC_MASK;
4323 else if (ipv6_addr_any((struct in6_addr *)
4324 &usr_ip6_spec->ip6src))
4325 new_mask &= ~I40E_L3_V6_SRC_MASK;
4326 else
4327 return -EOPNOTSUPP;
4328
4329 /* Check if user provided destination address. */
4330 if (ipv6_addr_equal((struct in6_addr *)&usr_ip6_spec->ip6dst,
4331 (struct in6_addr *)&ipv6_full_mask))
4332 new_mask |= I40E_L3_V6_DST_MASK;
4333 else if (ipv6_addr_any((struct in6_addr *)
4334 &usr_ip6_spec->ip6src))
4335 new_mask &= ~I40E_L3_V6_DST_MASK;
4336 else
4337 return -EOPNOTSUPP;
4338
4339 if (usr_ip6_spec->l4_4_bytes == htonl(0xFFFFFFFF))
4340 new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
4341 else if (!usr_ip6_spec->l4_4_bytes)
4342 new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
4343 else
4344 return -EOPNOTSUPP;
4345
4346 /* Filtering on Traffic class is not supported. */
4347 if (usr_ip6_spec->tclass)
4348 return -EOPNOTSUPP;
4349
4350 /* Filtering on L4 protocol is not supported */
4351 if (usr_ip6_spec->l4_proto)
4352 return -EINVAL;
4353
4354 break;
4355 default:
4356 return -EOPNOTSUPP;
4357 }
4358
4359 /* First, clear all flexible filter entries */
4360 new_mask &= ~I40E_FLEX_INPUT_MASK;
4361
4362 /* If we have a flexible filter, try to add this offset to the correct
4363 * flexible filter PIT list. Once finished, we can update the mask.
4364 * If the src_offset changed, we will get a new mask value which will
4365 * trigger an input set change.
4366 */
4367 if (userdef->flex_filter) {
4368 struct i40e_flex_pit *l3_flex_pit = NULL, *flex_pit = NULL;
4369
4370 /* Flexible offset must be even, since the flexible payload
4371 * must be aligned on 2-byte boundary.
4372 */
4373 if (userdef->flex_offset & 0x1) {
4374 dev_warn(&pf->pdev->dev,
4375 "Flexible data offset must be 2-byte aligned\n");
4376 return -EINVAL;
4377 }
4378
4379 src_offset = userdef->flex_offset >> 1;
4380
4381 /* FLX_PIT source offset value is only so large */
4382 if (src_offset > I40E_MAX_FLEX_SRC_OFFSET) {
4383 dev_warn(&pf->pdev->dev,
4384 "Flexible data must reside within first 64 bytes of the packet payload\n");
4385 return -EINVAL;
4386 }
4387
4388 /* See if this offset has already been programmed. If we get
4389 * an ERR_PTR, then the filter is not safe to add. Otherwise,
4390 * if we get a NULL pointer, this means we will need to add
4391 * the offset.
4392 */
4393 flex_pit = i40e_find_flex_offset(&pf->l4_flex_pit_list,
4394 src_offset);
4395 if (IS_ERR(flex_pit))
4396 return PTR_ERR(flex_pit);
4397
4398 /* IP_USER_FLOW filters match both L4 (ICMP) and L3 (unknown)
4399 * packet types, and thus we need to program both L3 and L4
4400 * flexible values. These must have identical flexible index,
4401 * as otherwise we can't correctly program the input set. So
4402 * we'll find both an L3 and L4 index and make sure they are
4403 * the same.
4404 */
4405 if (flex_l3) {
4406 l3_flex_pit =
4407 i40e_find_flex_offset(&pf->l3_flex_pit_list,
4408 src_offset);
4409 if (IS_ERR(l3_flex_pit))
4410 return PTR_ERR(l3_flex_pit);
4411
4412 if (flex_pit) {
4413 /* If we already had a matching L4 entry, we
4414 * need to make sure that the L3 entry we
4415 * obtained uses the same index.
4416 */
4417 if (l3_flex_pit) {
4418 if (l3_flex_pit->pit_index !=
4419 flex_pit->pit_index) {
4420 return -EINVAL;
4421 }
4422 } else {
4423 new_flex_offset = true;
4424 }
4425 } else {
4426 flex_pit = l3_flex_pit;
4427 }
4428 }
4429
4430 /* If we didn't find an existing flex offset, we need to
4431 * program a new one. However, we don't immediately program it
4432 * here because we will wait to program until after we check
4433 * that it is safe to change the input set.
4434 */
4435 if (!flex_pit) {
4436 new_flex_offset = true;
4437 pit_index = i40e_unused_pit_index(pf);
4438 } else {
4439 pit_index = flex_pit->pit_index;
4440 }
4441
4442 /* Update the mask with the new offset */
4443 new_mask |= i40e_pit_index_to_mask(pit_index);
4444 }
4445
4446 /* If the mask and flexible filter offsets for this filter match the
4447 * currently programmed values we don't need any input set change, so
4448 * this filter is safe to install.
4449 */
4450 if (new_mask == current_mask && !new_flex_offset)
4451 return 0;
4452
4453 netif_info(pf, drv, vsi->netdev, "Input set change requested for %s flows:\n",
4454 i40e_flow_str(fsp));
4455 i40e_print_input_set(vsi, current_mask, new_mask);
4456 if (new_flex_offset) {
4457 netif_info(pf, drv, vsi->netdev, "FLEX index %d: Offset -> %d",
4458 pit_index, src_offset);
4459 }
4460
4461 /* Hardware input sets are global across multiple ports, so even the
4462 * main port cannot change them when in MFP mode as this would impact
4463 * any filters on the other ports.
4464 */
4465 if (pf->flags & I40E_FLAG_MFP_ENABLED) {
4466 netif_err(pf, drv, vsi->netdev, "Cannot change Flow Director input sets while MFP is enabled\n");
4467 return -EOPNOTSUPP;
4468 }
4469
4470 /* This filter requires us to update the input set. However, hardware
4471 * only supports one input set per flow type, and does not support
4472 * separate masks for each filter. This means that we can only support
4473 * a single mask for all filters of a specific type.
4474 *
4475 * If we have preexisting filters, they obviously depend on the
4476 * current programmed input set. Display a diagnostic message in this
4477 * case explaining why the filter could not be accepted.
4478 */
4479 if (*fdir_filter_count) {
4480 netif_err(pf, drv, vsi->netdev, "Cannot change input set for %s flows until %d preexisting filters are removed\n",
4481 i40e_flow_str(fsp),
4482 *fdir_filter_count);
4483 return -EOPNOTSUPP;
4484 }
4485
4486 i40e_write_fd_input_set(pf, index, new_mask);
4487
4488 /* IP_USER_FLOW filters match both IPv4/Other and IPv4/Fragmented
4489 * frames. If we're programming the input set for IPv4/Other, we also
4490 * need to program the IPv4/Fragmented input set. Since we don't have
4491 * separate support, we'll always assume and enforce that the two flow
4492 * types must have matching input sets.
4493 */
4494 if (index == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER)
4495 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4,
4496 new_mask);
4497
4498 /* Add the new offset and update table, if necessary */
4499 if (new_flex_offset) {
4500 err = i40e_add_flex_offset(&pf->l4_flex_pit_list, src_offset,
4501 pit_index);
4502 if (err)
4503 return err;
4504
4505 if (flex_l3) {
4506 err = i40e_add_flex_offset(&pf->l3_flex_pit_list,
4507 src_offset,
4508 pit_index);
4509 if (err)
4510 return err;
4511 }
4512
4513 i40e_reprogram_flex_pit(pf);
4514 }
4515
4516 return 0;
4517 }
4518
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month