netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>
Cc: Netdev <netdev@vger.kernel.org>,
	"simon.horman@netronome.com" <simon.horman@netronome.com>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	"Arad, Ronen" <ronen.arad@intel.com>,
	"Fastabend, John R" <john.r.fastabend@intel.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	davidch <davidch@broadcom.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: Re: [RFC PATCH net-next 2/4] switchdev: add fwd_mark generator helper
Date: Mon, 15 Jun 2015 17:09:13 +0300	[thread overview]
Message-ID: <557EDC89.1040705@cogentembedded.com> (raw)
In-Reply-To: <CAE4R7bCABXELpMjqL1x1qyRy11JGmtMGZ6-Yo_5hXbWuFFF8_Q@mail.gmail.com>

Hello.

On 6/15/2015 4:52 PM, Scott Feldman wrote:

>>>>> From: Scott Feldman <sfeldma@gmail.com>

>>>>> skb->fwd_mark and dev->fwd_mark are 32-bit and should be unique for device
>>>>> and maybe even unique for a sub-set of ports within device, so add
>>>>> switchdev helper function to generate unique marks based on driver-supplied
>>>>> key.  Typically, the driver would use device switch ID for key, and maybe
>>>>> additional fields in key for grouped ports such as bridge ifindex.  The key
>>>>> can be of arbitrary length.

>>>>> The generator uses a global hash table to store fwd_marks hashed by key.

>>>>> Signed-off-by: Scott Feldman <sfeldma@gmail.com>

>>> <snip>

>>>>> +u32 switchdev_mark_get(void *key, size_t key_len)
>>>>> +{
>>>>> +      struct switchdev_mark_ht_entry {
>>>>> +              struct hlist_node entry;
>>>>> +              void *key;
>>>>> +              size_t key_len;
>>>>> +              u32 key_crc32;
>>>>> +              u32 mark;
>>>>> +      } *entry;
>>>>> +      u32 key_crc32 = crc32(~0, key, key_len);
>>>>> +      u32 mark = 0;
>>>>> +      unsigned long flags;
>>>>> +
>>>>> +      spin_lock_irqsave(&switchdev_mark_lock, flags);

>>>> I fail to see why _irqsave variant is needed here.

>>> I don't know what context caller is in, so using most conservative
>>> spinlock.  Is there a better way?

>> I don't see why would someone call this from irq.

> Ok, good point, I'll adjust to spin_lock.

     I guess spi_lock_irq() is what you meant. Disabling IRQs when called from 
the hardirq context made no sense since hardirq handlrs are executed with IRQs 
disabled anyway.

WBR, Sergei

  reply	other threads:[~2015-06-15 14:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-13 18:04 [RFC PATCH net-next 0/4] switchdev: avoid duplicate packet forwarding sfeldma
2015-06-13 18:04 ` [RFC PATCH net-next 1/4] net: don't reforward packets already forwarded by offload device sfeldma
2015-06-14  6:51   ` Jiri Pirko
2015-06-15 14:21   ` roopa
2015-06-13 18:04 ` [RFC PATCH net-next 2/4] switchdev: add fwd_mark generator helper sfeldma
2015-06-14  6:56   ` Jiri Pirko
2015-06-14 17:50     ` Scott Feldman
2015-06-15  5:46       ` Jiri Pirko
2015-06-15 13:52         ` Scott Feldman
2015-06-15 14:09           ` Sergei Shtylyov [this message]
2015-06-15 15:17   ` roopa
2015-06-13 18:04 ` [RFC PATCH net-next 3/4] rocker: add fwd_mark support sfeldma
2015-06-14  7:02   ` Jiri Pirko
2015-06-14 18:00     ` Scott Feldman
2015-06-15  5:49       ` Jiri Pirko
2015-06-13 18:04 ` [RFC PATCH net-next 4/4] switchdev: update documentation for fwd_mark sfeldma
2015-06-15 13:54 ` [RFC PATCH net-next 0/4] switchdev: avoid duplicate packet forwarding roopa
2015-06-15 14:23 ` roopa
2015-06-15 23:25 ` David Miller
2015-06-16  6:04   ` Jiri Pirko
2015-06-16 16:47     ` Scott Feldman
2015-06-16 21:11       ` Jiri Pirko
2015-06-16 23:53         ` Scott Feldman
2015-06-17  6:30           ` Jiri Pirko
2015-06-17  7:02             ` Scott Feldman
2015-06-17 10:23         ` Jamal Hadi Salim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557EDC89.1040705@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=andrew@lunn.ch \
    --cc=davidch@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=john.r.fastabend@intel.com \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=ronen.arad@intel.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=sfeldma@gmail.com \
    --cc=simon.horman@netronome.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).