[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201803020426.RXS5n3SH%fengguang.wu@intel.com>
Date: Fri, 2 Mar 2018 04:51:02 +0800
From: kbuild test robot <lkp@...el.com>
To: Edward Cree <ecree@...arflare.com>
Cc: kbuild-all@...org, linux-net-drivers@...arflare.com,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
"John W. Linville" <linville@...driver.com>
Subject: Re: [PATCH net-next 2/2] sfc: support RSS spreading of ethtool
ntuple filters
Hi Edward,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Edward-Cree/ntuple-filters-with-RSS/20180302-031011
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/net//ethernet/sfc/ef10.c: In function 'efx_ef10_filter_insert':
>> drivers/net//ethernet/sfc/ef10.c:4458:5: warning: 'ctx' may be used uninitialized in this function [-Wmaybe-uninitialized]
rc = efx_ef10_filter_push(efx, spec, &table->entry[ins_index].handle,
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ctx, replacing);
~~~~~~~~~~~~~~~
vim +/ctx +4458 drivers/net//ethernet/sfc/ef10.c
8127d661 Ben Hutchings 2013-08-29 4300
8127d661 Ben Hutchings 2013-08-29 4301 static s32 efx_ef10_filter_insert(struct efx_nic *efx,
8127d661 Ben Hutchings 2013-08-29 4302 struct efx_filter_spec *spec,
8127d661 Ben Hutchings 2013-08-29 4303 bool replace_equal)
8127d661 Ben Hutchings 2013-08-29 4304 {
8127d661 Ben Hutchings 2013-08-29 4305 struct efx_ef10_filter_table *table = efx->filter_state;
8127d661 Ben Hutchings 2013-08-29 4306 DECLARE_BITMAP(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT);
8127d661 Ben Hutchings 2013-08-29 4307 struct efx_filter_spec *saved_spec;
8127d661 Ben Hutchings 2013-08-29 4308 unsigned int match_pri, hash;
87dec16f Edward Cree 2018-02-27 4309 struct efx_rss_context *ctx;
8127d661 Ben Hutchings 2013-08-29 4310 unsigned int priv_flags;
8127d661 Ben Hutchings 2013-08-29 4311 bool replacing = false;
8127d661 Ben Hutchings 2013-08-29 4312 int ins_index = -1;
8127d661 Ben Hutchings 2013-08-29 4313 DEFINE_WAIT(wait);
8127d661 Ben Hutchings 2013-08-29 4314 bool is_mc_recip;
8127d661 Ben Hutchings 2013-08-29 4315 s32 rc;
8127d661 Ben Hutchings 2013-08-29 4316
8127d661 Ben Hutchings 2013-08-29 4317 /* For now, only support RX filters */
8127d661 Ben Hutchings 2013-08-29 4318 if ((spec->flags & (EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX)) !=
8127d661 Ben Hutchings 2013-08-29 4319 EFX_FILTER_FLAG_RX)
8127d661 Ben Hutchings 2013-08-29 4320 return -EINVAL;
8127d661 Ben Hutchings 2013-08-29 4321
7ac0dd9d Andrew Rybchenko 2016-06-15 4322 rc = efx_ef10_filter_pri(table, spec);
8127d661 Ben Hutchings 2013-08-29 4323 if (rc < 0)
8127d661 Ben Hutchings 2013-08-29 4324 return rc;
8127d661 Ben Hutchings 2013-08-29 4325 match_pri = rc;
8127d661 Ben Hutchings 2013-08-29 4326
8127d661 Ben Hutchings 2013-08-29 4327 hash = efx_ef10_filter_hash(spec);
8127d661 Ben Hutchings 2013-08-29 4328 is_mc_recip = efx_filter_is_mc_recipient(spec);
8127d661 Ben Hutchings 2013-08-29 4329 if (is_mc_recip)
8127d661 Ben Hutchings 2013-08-29 4330 bitmap_zero(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT);
8127d661 Ben Hutchings 2013-08-29 4331
87dec16f Edward Cree 2018-02-27 4332 if (spec->flags & EFX_FILTER_FLAG_RX_RSS) {
87dec16f Edward Cree 2018-02-27 4333 if (spec->rss_context)
87dec16f Edward Cree 2018-02-27 4334 ctx = efx_find_rss_context_entry(spec->rss_context,
87dec16f Edward Cree 2018-02-27 4335 &efx->rss_context.list);
87dec16f Edward Cree 2018-02-27 4336 else
87dec16f Edward Cree 2018-02-27 4337 ctx = &efx->rss_context;
87dec16f Edward Cree 2018-02-27 4338 if (!ctx)
87dec16f Edward Cree 2018-02-27 4339 return -ENOENT;
87dec16f Edward Cree 2018-02-27 4340 if (ctx->context_id == EFX_EF10_RSS_CONTEXT_INVALID)
87dec16f Edward Cree 2018-02-27 4341 return -EOPNOTSUPP;
87dec16f Edward Cree 2018-02-27 4342 }
87dec16f Edward Cree 2018-02-27 4343
8127d661 Ben Hutchings 2013-08-29 4344 /* Find any existing filters with the same match tuple or
8127d661 Ben Hutchings 2013-08-29 4345 * else a free slot to insert at. If any of them are busy,
8127d661 Ben Hutchings 2013-08-29 4346 * we have to wait and retry.
8127d661 Ben Hutchings 2013-08-29 4347 */
8127d661 Ben Hutchings 2013-08-29 4348 for (;;) {
8127d661 Ben Hutchings 2013-08-29 4349 unsigned int depth = 1;
8127d661 Ben Hutchings 2013-08-29 4350 unsigned int i;
8127d661 Ben Hutchings 2013-08-29 4351
8127d661 Ben Hutchings 2013-08-29 4352 spin_lock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4353
8127d661 Ben Hutchings 2013-08-29 4354 for (;;) {
8127d661 Ben Hutchings 2013-08-29 4355 i = (hash + depth) & (HUNT_FILTER_TBL_ROWS - 1);
8127d661 Ben Hutchings 2013-08-29 4356 saved_spec = efx_ef10_filter_entry_spec(table, i);
8127d661 Ben Hutchings 2013-08-29 4357
8127d661 Ben Hutchings 2013-08-29 4358 if (!saved_spec) {
8127d661 Ben Hutchings 2013-08-29 4359 if (ins_index < 0)
8127d661 Ben Hutchings 2013-08-29 4360 ins_index = i;
8127d661 Ben Hutchings 2013-08-29 4361 } else if (efx_ef10_filter_equal(spec, saved_spec)) {
8127d661 Ben Hutchings 2013-08-29 4362 if (table->entry[i].spec &
8127d661 Ben Hutchings 2013-08-29 4363 EFX_EF10_FILTER_FLAG_BUSY)
8127d661 Ben Hutchings 2013-08-29 4364 break;
8127d661 Ben Hutchings 2013-08-29 4365 if (spec->priority < saved_spec->priority &&
7665d1ab Ben Hutchings 2013-11-21 4366 spec->priority != EFX_FILTER_PRI_AUTO) {
8127d661 Ben Hutchings 2013-08-29 4367 rc = -EPERM;
8127d661 Ben Hutchings 2013-08-29 4368 goto out_unlock;
8127d661 Ben Hutchings 2013-08-29 4369 }
8127d661 Ben Hutchings 2013-08-29 4370 if (!is_mc_recip) {
8127d661 Ben Hutchings 2013-08-29 4371 /* This is the only one */
8127d661 Ben Hutchings 2013-08-29 4372 if (spec->priority ==
8127d661 Ben Hutchings 2013-08-29 4373 saved_spec->priority &&
8127d661 Ben Hutchings 2013-08-29 4374 !replace_equal) {
8127d661 Ben Hutchings 2013-08-29 4375 rc = -EEXIST;
8127d661 Ben Hutchings 2013-08-29 4376 goto out_unlock;
8127d661 Ben Hutchings 2013-08-29 4377 }
8127d661 Ben Hutchings 2013-08-29 4378 ins_index = i;
8127d661 Ben Hutchings 2013-08-29 4379 goto found;
8127d661 Ben Hutchings 2013-08-29 4380 } else if (spec->priority >
8127d661 Ben Hutchings 2013-08-29 4381 saved_spec->priority ||
8127d661 Ben Hutchings 2013-08-29 4382 (spec->priority ==
8127d661 Ben Hutchings 2013-08-29 4383 saved_spec->priority &&
8127d661 Ben Hutchings 2013-08-29 4384 replace_equal)) {
8127d661 Ben Hutchings 2013-08-29 4385 if (ins_index < 0)
8127d661 Ben Hutchings 2013-08-29 4386 ins_index = i;
8127d661 Ben Hutchings 2013-08-29 4387 else
8127d661 Ben Hutchings 2013-08-29 4388 __set_bit(depth, mc_rem_map);
8127d661 Ben Hutchings 2013-08-29 4389 }
8127d661 Ben Hutchings 2013-08-29 4390 }
8127d661 Ben Hutchings 2013-08-29 4391
8127d661 Ben Hutchings 2013-08-29 4392 /* Once we reach the maximum search depth, use
8127d661 Ben Hutchings 2013-08-29 4393 * the first suitable slot or return -EBUSY if
8127d661 Ben Hutchings 2013-08-29 4394 * there was none
8127d661 Ben Hutchings 2013-08-29 4395 */
8127d661 Ben Hutchings 2013-08-29 4396 if (depth == EFX_EF10_FILTER_SEARCH_LIMIT) {
8127d661 Ben Hutchings 2013-08-29 4397 if (ins_index < 0) {
8127d661 Ben Hutchings 2013-08-29 4398 rc = -EBUSY;
8127d661 Ben Hutchings 2013-08-29 4399 goto out_unlock;
8127d661 Ben Hutchings 2013-08-29 4400 }
8127d661 Ben Hutchings 2013-08-29 4401 goto found;
8127d661 Ben Hutchings 2013-08-29 4402 }
8127d661 Ben Hutchings 2013-08-29 4403
8127d661 Ben Hutchings 2013-08-29 4404 ++depth;
8127d661 Ben Hutchings 2013-08-29 4405 }
8127d661 Ben Hutchings 2013-08-29 4406
8127d661 Ben Hutchings 2013-08-29 4407 prepare_to_wait(&table->waitq, &wait, TASK_UNINTERRUPTIBLE);
8127d661 Ben Hutchings 2013-08-29 4408 spin_unlock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4409 schedule();
8127d661 Ben Hutchings 2013-08-29 4410 }
8127d661 Ben Hutchings 2013-08-29 4411
8127d661 Ben Hutchings 2013-08-29 4412 found:
8127d661 Ben Hutchings 2013-08-29 4413 /* Create a software table entry if necessary, and mark it
8127d661 Ben Hutchings 2013-08-29 4414 * busy. We might yet fail to insert, but any attempt to
8127d661 Ben Hutchings 2013-08-29 4415 * insert a conflicting filter while we're waiting for the
8127d661 Ben Hutchings 2013-08-29 4416 * firmware must find the busy entry.
8127d661 Ben Hutchings 2013-08-29 4417 */
8127d661 Ben Hutchings 2013-08-29 4418 saved_spec = efx_ef10_filter_entry_spec(table, ins_index);
8127d661 Ben Hutchings 2013-08-29 4419 if (saved_spec) {
7665d1ab Ben Hutchings 2013-11-21 4420 if (spec->priority == EFX_FILTER_PRI_AUTO &&
7665d1ab Ben Hutchings 2013-11-21 4421 saved_spec->priority >= EFX_FILTER_PRI_AUTO) {
8127d661 Ben Hutchings 2013-08-29 4422 /* Just make sure it won't be removed */
7665d1ab Ben Hutchings 2013-11-21 4423 if (saved_spec->priority > EFX_FILTER_PRI_AUTO)
7665d1ab Ben Hutchings 2013-11-21 4424 saved_spec->flags |= EFX_FILTER_FLAG_RX_OVER_AUTO;
8127d661 Ben Hutchings 2013-08-29 4425 table->entry[ins_index].spec &=
b59e6ef8 Ben Hutchings 2013-11-21 4426 ~EFX_EF10_FILTER_FLAG_AUTO_OLD;
8127d661 Ben Hutchings 2013-08-29 4427 rc = ins_index;
8127d661 Ben Hutchings 2013-08-29 4428 goto out_unlock;
8127d661 Ben Hutchings 2013-08-29 4429 }
8127d661 Ben Hutchings 2013-08-29 4430 replacing = true;
8127d661 Ben Hutchings 2013-08-29 4431 priv_flags = efx_ef10_filter_entry_flags(table, ins_index);
8127d661 Ben Hutchings 2013-08-29 4432 } else {
8127d661 Ben Hutchings 2013-08-29 4433 saved_spec = kmalloc(sizeof(*spec), GFP_ATOMIC);
8127d661 Ben Hutchings 2013-08-29 4434 if (!saved_spec) {
8127d661 Ben Hutchings 2013-08-29 4435 rc = -ENOMEM;
8127d661 Ben Hutchings 2013-08-29 4436 goto out_unlock;
8127d661 Ben Hutchings 2013-08-29 4437 }
8127d661 Ben Hutchings 2013-08-29 4438 *saved_spec = *spec;
8127d661 Ben Hutchings 2013-08-29 4439 priv_flags = 0;
8127d661 Ben Hutchings 2013-08-29 4440 }
8127d661 Ben Hutchings 2013-08-29 4441 efx_ef10_filter_set_entry(table, ins_index, saved_spec,
8127d661 Ben Hutchings 2013-08-29 4442 priv_flags | EFX_EF10_FILTER_FLAG_BUSY);
8127d661 Ben Hutchings 2013-08-29 4443
8127d661 Ben Hutchings 2013-08-29 4444 /* Mark lower-priority multicast recipients busy prior to removal */
8127d661 Ben Hutchings 2013-08-29 4445 if (is_mc_recip) {
8127d661 Ben Hutchings 2013-08-29 4446 unsigned int depth, i;
8127d661 Ben Hutchings 2013-08-29 4447
8127d661 Ben Hutchings 2013-08-29 4448 for (depth = 0; depth < EFX_EF10_FILTER_SEARCH_LIMIT; depth++) {
8127d661 Ben Hutchings 2013-08-29 4449 i = (hash + depth) & (HUNT_FILTER_TBL_ROWS - 1);
8127d661 Ben Hutchings 2013-08-29 4450 if (test_bit(depth, mc_rem_map))
8127d661 Ben Hutchings 2013-08-29 4451 table->entry[i].spec |=
8127d661 Ben Hutchings 2013-08-29 4452 EFX_EF10_FILTER_FLAG_BUSY;
8127d661 Ben Hutchings 2013-08-29 4453 }
8127d661 Ben Hutchings 2013-08-29 4454 }
8127d661 Ben Hutchings 2013-08-29 4455
8127d661 Ben Hutchings 2013-08-29 4456 spin_unlock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4457
8127d661 Ben Hutchings 2013-08-29 @4458 rc = efx_ef10_filter_push(efx, spec, &table->entry[ins_index].handle,
87dec16f Edward Cree 2018-02-27 4459 ctx, replacing);
8127d661 Ben Hutchings 2013-08-29 4460
8127d661 Ben Hutchings 2013-08-29 4461 /* Finalise the software table entry */
8127d661 Ben Hutchings 2013-08-29 4462 spin_lock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4463 if (rc == 0) {
8127d661 Ben Hutchings 2013-08-29 4464 if (replacing) {
8127d661 Ben Hutchings 2013-08-29 4465 /* Update the fields that may differ */
7665d1ab Ben Hutchings 2013-11-21 4466 if (saved_spec->priority == EFX_FILTER_PRI_AUTO)
7665d1ab Ben Hutchings 2013-11-21 4467 saved_spec->flags |=
7665d1ab Ben Hutchings 2013-11-21 4468 EFX_FILTER_FLAG_RX_OVER_AUTO;
8127d661 Ben Hutchings 2013-08-29 4469 saved_spec->priority = spec->priority;
7665d1ab Ben Hutchings 2013-11-21 4470 saved_spec->flags &= EFX_FILTER_FLAG_RX_OVER_AUTO;
8127d661 Ben Hutchings 2013-08-29 4471 saved_spec->flags |= spec->flags;
8127d661 Ben Hutchings 2013-08-29 4472 saved_spec->rss_context = spec->rss_context;
8127d661 Ben Hutchings 2013-08-29 4473 saved_spec->dmaq_id = spec->dmaq_id;
8127d661 Ben Hutchings 2013-08-29 4474 }
8127d661 Ben Hutchings 2013-08-29 4475 } else if (!replacing) {
8127d661 Ben Hutchings 2013-08-29 4476 kfree(saved_spec);
8127d661 Ben Hutchings 2013-08-29 4477 saved_spec = NULL;
8127d661 Ben Hutchings 2013-08-29 4478 }
8127d661 Ben Hutchings 2013-08-29 4479 efx_ef10_filter_set_entry(table, ins_index, saved_spec, priv_flags);
8127d661 Ben Hutchings 2013-08-29 4480
8127d661 Ben Hutchings 2013-08-29 4481 /* Remove and finalise entries for lower-priority multicast
8127d661 Ben Hutchings 2013-08-29 4482 * recipients
8127d661 Ben Hutchings 2013-08-29 4483 */
8127d661 Ben Hutchings 2013-08-29 4484 if (is_mc_recip) {
bb53f4d4 Martin Habets 2017-06-22 4485 MCDI_DECLARE_BUF(inbuf, MC_CMD_FILTER_OP_EXT_IN_LEN);
8127d661 Ben Hutchings 2013-08-29 4486 unsigned int depth, i;
8127d661 Ben Hutchings 2013-08-29 4487
8127d661 Ben Hutchings 2013-08-29 4488 memset(inbuf, 0, sizeof(inbuf));
8127d661 Ben Hutchings 2013-08-29 4489
8127d661 Ben Hutchings 2013-08-29 4490 for (depth = 0; depth < EFX_EF10_FILTER_SEARCH_LIMIT; depth++) {
8127d661 Ben Hutchings 2013-08-29 4491 if (!test_bit(depth, mc_rem_map))
8127d661 Ben Hutchings 2013-08-29 4492 continue;
8127d661 Ben Hutchings 2013-08-29 4493
8127d661 Ben Hutchings 2013-08-29 4494 i = (hash + depth) & (HUNT_FILTER_TBL_ROWS - 1);
8127d661 Ben Hutchings 2013-08-29 4495 saved_spec = efx_ef10_filter_entry_spec(table, i);
8127d661 Ben Hutchings 2013-08-29 4496 priv_flags = efx_ef10_filter_entry_flags(table, i);
8127d661 Ben Hutchings 2013-08-29 4497
8127d661 Ben Hutchings 2013-08-29 4498 if (rc == 0) {
8127d661 Ben Hutchings 2013-08-29 4499 spin_unlock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4500 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
8127d661 Ben Hutchings 2013-08-29 4501 MC_CMD_FILTER_OP_IN_OP_UNSUBSCRIBE);
8127d661 Ben Hutchings 2013-08-29 4502 MCDI_SET_QWORD(inbuf, FILTER_OP_IN_HANDLE,
8127d661 Ben Hutchings 2013-08-29 4503 table->entry[i].handle);
8127d661 Ben Hutchings 2013-08-29 4504 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP,
8127d661 Ben Hutchings 2013-08-29 4505 inbuf, sizeof(inbuf),
8127d661 Ben Hutchings 2013-08-29 4506 NULL, 0, NULL);
8127d661 Ben Hutchings 2013-08-29 4507 spin_lock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4508 }
8127d661 Ben Hutchings 2013-08-29 4509
8127d661 Ben Hutchings 2013-08-29 4510 if (rc == 0) {
8127d661 Ben Hutchings 2013-08-29 4511 kfree(saved_spec);
8127d661 Ben Hutchings 2013-08-29 4512 saved_spec = NULL;
8127d661 Ben Hutchings 2013-08-29 4513 priv_flags = 0;
8127d661 Ben Hutchings 2013-08-29 4514 } else {
8127d661 Ben Hutchings 2013-08-29 4515 priv_flags &= ~EFX_EF10_FILTER_FLAG_BUSY;
8127d661 Ben Hutchings 2013-08-29 4516 }
8127d661 Ben Hutchings 2013-08-29 4517 efx_ef10_filter_set_entry(table, i, saved_spec,
8127d661 Ben Hutchings 2013-08-29 4518 priv_flags);
8127d661 Ben Hutchings 2013-08-29 4519 }
8127d661 Ben Hutchings 2013-08-29 4520 }
8127d661 Ben Hutchings 2013-08-29 4521
8127d661 Ben Hutchings 2013-08-29 4522 /* If successful, return the inserted filter ID */
8127d661 Ben Hutchings 2013-08-29 4523 if (rc == 0)
0ccb998b Jon Cooper 2017-02-17 4524 rc = efx_ef10_make_filter_id(match_pri, ins_index);
8127d661 Ben Hutchings 2013-08-29 4525
8127d661 Ben Hutchings 2013-08-29 4526 wake_up_all(&table->waitq);
8127d661 Ben Hutchings 2013-08-29 4527 out_unlock:
8127d661 Ben Hutchings 2013-08-29 4528 spin_unlock_bh(&efx->filter_lock);
8127d661 Ben Hutchings 2013-08-29 4529 finish_wait(&table->waitq, &wait);
8127d661 Ben Hutchings 2013-08-29 4530 return rc;
8127d661 Ben Hutchings 2013-08-29 4531 }
8127d661 Ben Hutchings 2013-08-29 4532
:::::: The code at line 4458 was first introduced by commit
:::::: 8127d661e77f5ec410093bce411f540afa34593f sfc: Add support for Solarflare SFC9100 family
:::::: TO: Ben Hutchings <bhutchings@...arflare.com>
:::::: CC: Ben Hutchings <bhutchings@...arflare.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (40831 bytes)
Powered by blists - more mailing lists