* [PATCH] bluetooth: LLVMLinux: Remove VLAIS from bluetooth/amp.c
From: behanw @ 2014-09-05 23:03 UTC (permalink / raw)
To: davem, gustavo, johan.hedberg, marcel
Cc: linux-bluetooth, linux-kernel, netdev, torvalds, Behan Webster,
Mark Charlebois, Jan-Simon Möller
From: Behan Webster <behanw@converseincode.com>
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This patch allocates the appropriate amount of memory
using an char array.
The new code can be compiled with both gcc and clang.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
---
net/bluetooth/amp.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 016cdb6..2640d78 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -149,15 +149,14 @@ static int hmac_sha256(u8 *key, u8 ksize, char *plaintext, u8 psize, u8 *output)
if (ret) {
BT_DBG("crypto_ahash_setkey failed: err %d", ret);
} else {
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(tfm)];
- } desc;
+ char desc[sizeof(struct shash_desc) +
+ crypto_shash_descsize(tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)desc;
- desc.shash.tfm = tfm;
- desc.shash.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+ shash->tfm = tfm;
+ shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
- ret = crypto_shash_digest(&desc.shash, plaintext, psize,
+ ret = crypto_shash_digest(shash, plaintext, psize,
output);
}
--
1.9.1
^ permalink raw reply related
* Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM
From: Arjan van de Ven @ 2014-09-05 23:05 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tejun Heo, Luis R. Rodriguez, Greg Kroah-Hartman, Wu Zhangjin,
Takashi Iwai, linux-kernel@vger.kernel.org, Oleg Nesterov, hare,
Andrew Morton, Tetsuo Handa, Joseph Salisbury, Benjamin Poirier,
Santosh Rastapur, Kay Sievers, One Thousand Gnomes, Tim Gardner,
Pierre Fersing, Nagalakshmi Nandigama, Praveen Krishnamoorthy,
Sreekanth Reddy, Abhijit Mahajan <abhiji
In-Reply-To: <20140905225248.GC35667@core.coreip.homeip.net>
On 9/5/2014 3:52 PM, Dmitry Torokhov wrote:
> On Fri, Sep 05, 2014 at 03:45:08PM -0700, Arjan van de Ven wrote:
>> On 9/5/2014 3:29 PM, Tejun Heo wrote:
>>> Hello, Dmitry.
>>>
>>> On Fri, Sep 05, 2014 at 11:10:03AM -0700, Dmitry Torokhov wrote:
>>>> I do not agree that it is actually user-visible change: generally speaking you
>>>> do not really know if device is there or not. They come and go. Like I said,
>>>> consider all permutations, with hot-pluggable buses, deferred probing, etc,
>>>
>>> It is for storage devices which always have guaranteed synchronous
>>> probing on module load and well-defined probing order. Sure, modern
>>> setups are a lot more dynamic but I'm quite certain that there are
>>> setups in the wild which depend on storage driver loading being
>>> synchronous. We can't simply declare one day that such behavior is
>>> broken and break, most likely, their boots.
>>
>> we even depend on this in the mount-by-label cases
>>
>> many setups assume that the internal storage prevails over the USB stick in the case of conflicts.
>> it's a security issue; you don't want the built in secure bootloader that has a kernel root argument
>> by label/uuid.
>> the security there tends to assume that built-in wins over USB
>
> Ahem... and they sure it works reliably with large storage arrays? With
> SCSI doing probing asynchronously already?
you tend to trust your large storage array
you tend to not trust the walk up USB stick.
^ permalink raw reply
* Re: [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
From: Hannes Frederic Sowa @ 2014-09-05 23:07 UTC (permalink / raw)
To: Cong Wang; +Cc: Cong Wang, netdev, Sabrina Dubroca, David S. Miller
In-Reply-To: <CAHA+R7N+WGNV5yTQ_hVbn-ez4Ar9395HzOGUU4tG9uLHqFPndA@mail.gmail.com>
On Sat, Sep 6, 2014, at 00:41, Cong Wang wrote:
> On Fri, Sep 5, 2014 at 3:26 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > Hi Cong,
> >
> > Just doing normal review, really no bad intentions, just technical
> > follow-up. ;)
>
> I believe you are not supposed to do it since definitely you
> said you don't want to work with me. You said it, not me,
> I respect any of your choice. :)
Oh no, you misunderstood me (maybe my bad). My only critique was that
you could have stated that you also saw a problem with the ENODEV return
before the patch was looked at by David.
Sure, let's forget that and work together.
> > On Fri, Sep 5, 2014, at 23:33, Cong Wang wrote:
> >> It is possible that the interface is already gone after joining
> >> the list of anycast on this interface as we don't hold a refcount
> >> for the device, in this case we are safe to ignore the error.
> >
> > anycast code actually inserts routes into the routing table and holds a
> > reference on the interface while that route is active.
>
> But route could be deleted.
The routes are managed by the inet6_dev and it will drop the routes on
interface shutdown, correct. There is no strong reference from socket to
the routing entry. Only deleting a route should not work as it will
still be referenced by the anycast list in inet6_dev (though it won't
get used anymore).
> >> What's more important, for API compatibility we should not
> >> change this behavior for applications even if it were correct.
> >
> > IMHO adding new error codes never breaks existing applications because
> > there is no way they can explore all possible errno variables. Also we
> > already report ENODEV from multicast setsockopts. So I think it would be
> > ok to leave it as is, but I have no strong opinion on that and it would
> > be ok by me if the patch got accepted (maybe update the changelog).
> >
>
> Again, too late to change, the code has been there since the beginning
> of git history. You should have a strong argument if you want to change
> it,
> otherwise restore old behavior, that is all. Obviously you don't even
> mention
> this when you accept that patch.
Let's settle this:
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Bye,
Hannes
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: Add function for parsing the header length out of linear ethernet frames
From: Alexander Duyck @ 2014-09-05 23:15 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: netdev@vger.kernel.org, David S. Miller, Eric Dumazet,
jeffrey.t.kirsher
In-Reply-To: <CAADnVQKNoOdSuuQ-voKVNpke-4BjvC_pU=g65=m70Y4TsTpTag@mail.gmail.com>
On 09/05/2014 01:02 PM, Alexei Starovoitov wrote:
> On Fri, Sep 5, 2014 at 11:10 AM, Alexander Duyck
> <alexander.h.duyck@intel.com> wrote:
>> This patch updates some of the flow_dissector api so that it can be used to
>> parse the length of ethernet buffers stored in fragments. Most of the
>> changes needed were to __skb_get_poff as it needed to be updated to support
>> sending a linear buffer instead of a skb.
>>
>>
>> u32 __skb_get_poff(const struct sk_buff *skb);
>> +u32 ___skb_get_poff(const struct sk_buff *skb, void *data,
>> + const struct flow_keys *keys, int hlen);
>
> three underscores and not a static function?
> May be we need to come with a proper name for it.
> Two easy to confuse with two underscore version...
Actually what I could do is probably rename the 2 underscore version to
drop the underscores and then rename the 3 underscore version to just 2
underscores. Then it would match up closer with how the other functions
are dealing with the data/hlen values.
Thanks,
Alex
^ permalink raw reply
* [PATCH net v1 1/2] amd-xgbe: Treat certain counter registers as 64 bit
From: Tom Lendacky @ 2014-09-05 23:02 UTC (permalink / raw)
To: netdev; +Cc: davem
In-Reply-To: <20140905230224.27896.64932.stgit@tlendack-t1.amdoffice.net>
Even if the management counters are configured to be 32 bit register
values, the [rt]xoctetcount_gb and [rt]xoctetcount_g counters are
always 64 bit counter registers. Since they are not being treated as
64 bit values, these statistics are being reported incorrectly (ifconfig,
ethtool, etc.).
Update the routines used to read the registers to access the "hi"
register (an offset of 4 from the "lo" register) to create a 64 bit
value for these 64 bit counters.
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 190 +++++++++++++++++-------------
1 file changed, 108 insertions(+), 82 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 6d0207e..f3d04f1 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1954,6 +1954,32 @@ static void xgbe_config_vlan_support(struct xgbe_prv_data *pdata)
xgbe_disable_rx_vlan_stripping(pdata);
}
+static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo)
+{
+ bool read_hi;
+ u64 val;
+
+ switch (reg_lo) {
+ /* These registers are always 64 bit */
+ case MMC_TXOCTETCOUNT_GB_LO:
+ case MMC_TXOCTETCOUNT_G_LO:
+ case MMC_RXOCTETCOUNT_GB_LO:
+ case MMC_RXOCTETCOUNT_G_LO:
+ read_hi = true;
+ break;
+
+ default:
+ read_hi = false;
+ };
+
+ val = XGMAC_IOREAD(pdata, reg_lo);
+
+ if (read_hi)
+ val |= ((u64)XGMAC_IOREAD(pdata, reg_lo + 4) << 32);
+
+ return val;
+}
+
static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata)
{
struct xgbe_mmc_stats *stats = &pdata->mmc_stats;
@@ -1961,75 +1987,75 @@ static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata)
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB))
stats->txoctetcount_gb +=
- XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB))
stats->txframecount_gb +=
- XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G))
stats->txbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G))
stats->txmulticastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB))
stats->tx64octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB))
stats->tx65to127octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB))
stats->tx128to255octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB))
stats->tx256to511octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB))
stats->tx512to1023octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB))
stats->tx1024tomaxoctets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB))
stats->txunicastframes_gb +=
- XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB))
stats->txmulticastframes_gb +=
- XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB))
stats->txbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR))
stats->txunderflowerror +=
- XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO);
+ xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G))
stats->txoctetcount_g +=
- XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G))
stats->txframecount_g +=
- XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES))
stats->txpauseframes +=
- XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO);
+ xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G))
stats->txvlanframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO);
}
static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata)
@@ -2039,95 +2065,95 @@ static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata)
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB))
stats->rxframecount_gb +=
- XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB))
stats->rxoctetcount_gb +=
- XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G))
stats->rxoctetcount_g +=
- XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G))
stats->rxbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G))
stats->rxmulticastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR))
stats->rxcrcerror +=
- XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO);
+ xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR))
stats->rxrunterror +=
- XGMAC_IOREAD(pdata, MMC_RXRUNTERROR);
+ xgbe_mmc_read(pdata, MMC_RXRUNTERROR);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR))
stats->rxjabbererror +=
- XGMAC_IOREAD(pdata, MMC_RXJABBERERROR);
+ xgbe_mmc_read(pdata, MMC_RXJABBERERROR);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G))
stats->rxundersize_g +=
- XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G);
+ xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G))
stats->rxoversize_g +=
- XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G);
+ xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB))
stats->rx64octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB))
stats->rx65to127octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB))
stats->rx128to255octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB))
stats->rx256to511octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB))
stats->rx512to1023octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB))
stats->rx1024tomaxoctets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G))
stats->rxunicastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR))
stats->rxlengtherror +=
- XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO);
+ xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE))
stats->rxoutofrangetype +=
- XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO);
+ xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES))
stats->rxpauseframes +=
- XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO);
+ xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW))
stats->rxfifooverflow +=
- XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO);
+ xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB))
stats->rxvlanframes_gb +=
- XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO);
if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR))
stats->rxwatchdogerror +=
- XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR);
+ xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR);
}
static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata)
@@ -2138,127 +2164,127 @@ static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata)
XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1);
stats->txoctetcount_gb +=
- XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO);
stats->txframecount_gb +=
- XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO);
stats->txbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO);
stats->txmulticastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO);
stats->tx64octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO);
stats->tx65to127octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO);
stats->tx128to255octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO);
stats->tx256to511octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO);
stats->tx512to1023octets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO);
stats->tx1024tomaxoctets_gb +=
- XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO);
stats->txunicastframes_gb +=
- XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO);
stats->txmulticastframes_gb +=
- XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO);
stats->txbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO);
stats->txunderflowerror +=
- XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO);
+ xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO);
stats->txoctetcount_g +=
- XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO);
stats->txframecount_g +=
- XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO);
stats->txpauseframes +=
- XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO);
+ xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO);
stats->txvlanframes_g +=
- XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO);
stats->rxframecount_gb +=
- XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO);
stats->rxoctetcount_gb +=
- XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO);
stats->rxoctetcount_g +=
- XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO);
stats->rxbroadcastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO);
stats->rxmulticastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO);
stats->rxcrcerror +=
- XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO);
+ xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO);
stats->rxrunterror +=
- XGMAC_IOREAD(pdata, MMC_RXRUNTERROR);
+ xgbe_mmc_read(pdata, MMC_RXRUNTERROR);
stats->rxjabbererror +=
- XGMAC_IOREAD(pdata, MMC_RXJABBERERROR);
+ xgbe_mmc_read(pdata, MMC_RXJABBERERROR);
stats->rxundersize_g +=
- XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G);
+ xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G);
stats->rxoversize_g +=
- XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G);
+ xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G);
stats->rx64octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO);
stats->rx65to127octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO);
stats->rx128to255octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO);
stats->rx256to511octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO);
stats->rx512to1023octets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO);
stats->rx1024tomaxoctets_gb +=
- XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO);
stats->rxunicastframes_g +=
- XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO);
+ xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO);
stats->rxlengtherror +=
- XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO);
+ xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO);
stats->rxoutofrangetype +=
- XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO);
+ xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO);
stats->rxpauseframes +=
- XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO);
+ xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO);
stats->rxfifooverflow +=
- XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO);
+ xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO);
stats->rxvlanframes_gb +=
- XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO);
+ xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO);
stats->rxwatchdogerror +=
- XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR);
+ xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR);
/* Un-freeze counters */
XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0);
^ permalink raw reply related
* Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM
From: Dmitry Torokhov @ 2014-09-05 23:18 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Tejun Heo, Luis R. Rodriguez, Greg Kroah-Hartman, Wu Zhangjin,
Takashi Iwai, linux-kernel@vger.kernel.org, Oleg Nesterov, hare,
Andrew Morton, Tetsuo Handa, Joseph Salisbury, Benjamin Poirier,
Santosh Rastapur, Kay Sievers, One Thousand Gnomes, Tim Gardner,
Pierre Fersing, Nagalakshmi Nandigama, Praveen Krishnamoorthy,
Sreekanth Reddy, Abhijit Mahajan <abhiji
In-Reply-To: <540A41BA.4010105@linux.intel.com>
On Fri, Sep 05, 2014 at 04:05:30PM -0700, Arjan van de Ven wrote:
> On 9/5/2014 3:52 PM, Dmitry Torokhov wrote:
> >On Fri, Sep 05, 2014 at 03:45:08PM -0700, Arjan van de Ven wrote:
> >>On 9/5/2014 3:29 PM, Tejun Heo wrote:
> >>>Hello, Dmitry.
> >>>
> >>>On Fri, Sep 05, 2014 at 11:10:03AM -0700, Dmitry Torokhov wrote:
> >>>>I do not agree that it is actually user-visible change: generally speaking you
> >>>>do not really know if device is there or not. They come and go. Like I said,
> >>>>consider all permutations, with hot-pluggable buses, deferred probing, etc,
> >>>
> >>>It is for storage devices which always have guaranteed synchronous
> >>>probing on module load and well-defined probing order. Sure, modern
> >>>setups are a lot more dynamic but I'm quite certain that there are
> >>>setups in the wild which depend on storage driver loading being
> >>>synchronous. We can't simply declare one day that such behavior is
> >>>broken and break, most likely, their boots.
> >>
> >>we even depend on this in the mount-by-label cases
> >>
> >>many setups assume that the internal storage prevails over the USB stick in the case of conflicts.
> >>it's a security issue; you don't want the built in secure bootloader that has a kernel root argument
> >>by label/uuid.
> >>the security there tends to assume that built-in wins over USB
> >
> >Ahem... and they sure it works reliably with large storage arrays? With
> >SCSI doing probing asynchronously already?
>
> you tend to trust your large storage array
> you tend to not trust the walk up USB stick.
If you allow physical access it does not matter really.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] bluetooth: LLVMLinux: Remove VLAIS from bluetooth/amp.c
From: Marcel Holtmann @ 2014-09-05 23:22 UTC (permalink / raw)
To: behanw-k/hB3zQhLwledRVtV/plodBPR1lH4CV8
Cc: David S. Miller, Gustavo F. Padovan, Johan Hedberg,
BlueZ development, kernel list, netdev-u79uwXL29TY76Z2rM5mHXA,
Linus Torvalds, Mark Charlebois, Jan-Simon Möller
In-Reply-To: <1409958214-5651-1-git-send-email-behanw-k/hB3zQhLwledRVtV/plodBPR1lH4CV8@public.gmane.org>
Hi Behan,
> Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
> compliant equivalent. This patch allocates the appropriate amount of memory
> using an char array.
>
> The new code can be compiled with both gcc and clang.
>
> struct shash_desc contains a flexible array member member ctx declared with
> CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
> of the array declared after struct shash_desc with long long.
>
> No trailing padding is required because it is not a struct type that can
> be used in an array.
>
> The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
> as would be the case for a struct containing a member with
> CRYPTO_MINALIGN_ATTR.
>
> Signed-off-by: Behan Webster <behanw-k/hB3zQhLwledRVtV/plodBPR1lH4CV8@public.gmane.org>
> Signed-off-by: Mark Charlebois <charlebm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Jan-Simon Möller <dl9pf-Mmb7MZpHnFY@public.gmane.org>
> ---
> net/bluetooth/amp.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM
From: Dmitry Torokhov @ 2014-09-05 23:22 UTC (permalink / raw)
To: Tejun Heo
Cc: Luis R. Rodriguez, Greg Kroah-Hartman, Wu Zhangjin, Takashi Iwai,
Arjan van de Ven, linux-kernel@vger.kernel.org, Oleg Nesterov,
hare, Andrew Morton, Tetsuo Handa, Joseph Salisbury,
Benjamin Poirier, Santosh Rastapur, Kay Sievers,
One Thousand Gnomes, Tim Gardner, Pierre Fersing,
Nagalakshmi Nandigama, Praveen Krishnamoorthy, Sreekanth Reddy,
Abhijit
In-Reply-To: <20140905225533.GE15723@mtj.dyndns.org>
Hi Tejun,
On Sat, Sep 06, 2014 at 07:55:33AM +0900, Tejun Heo wrote:
> Hello, Dmitry.
>
> On Fri, Sep 05, 2014 at 03:49:17PM -0700, Dmitry Torokhov wrote:
> > On Sat, Sep 06, 2014 at 07:31:39AM +0900, Tejun Heo wrote:
> > > On Sat, Sep 06, 2014 at 07:29:56AM +0900, Tejun Heo wrote:
> > > > It is for storage devices which always have guaranteed synchronous
> > > > probing on module load and well-defined probing order.
> >
> > Agree about probing order (IIRC that is why we had to revert the
> > wholesale asynchronous probing a few years back) but totally disagree
> > about synchronous module loading.
>
> I don't get it. This is a behavior userland already depends on for
> boots. What's there to agree or disagree? This is just a fact that
> we can't do this w/o disturbing some userlands in a major way.
I am just expressing my disbelief that somebody relies on module loading
being synchronous with probing. Out of curiosity, do you have any
pointers?
>
> > Anyway, I just posted a patch that I think preserves module loading
> > behavior and solves my issue with built-in modules. It does not help
> > Luis' issue though (but then I think the main problem is with systemd
> > being stupid there).
>
> This sure can be worked around from userland side too by not imposing
> any timeout on module loading but that said for the same reasons that
> you've been arguing until now, I actually do think that it's kinda
> silly to make device probing synchronous to module loading at this
> time and age. What we disagree on is not that we want to separate
> those waits. It is about how to achieve it.
Well, there are separate things we want to solve. My main issue is not
with modules, but rather compiled-in drivers that stall kernel boot,
and these particular drivers are just fine if they are probed out of
bound.
>
> > > To add a bit, if the argument here is that dependency on such behavior
> > > shouldn't exist and module loading and device probing should always be
> > > asynchronous, the right approach is implementing "synchronous_probing"
> > > flag not the other way around. I actually wouldn't hate to see that
> > > change happening but whoever submits and routes such a change should
> > > be ready for a major shitstorm, I'm afraid.
> >
> > I think we already had this storm and that is why here we have opt-in
> > behavior for the drivers.
>
> It's a different shitstorm where we actively break bootings on some
> userlands. Trust me. That's gonna be a lot worse.
That did break bootings and that's why we reverted the wholesale async
probing.
Thanks.
--
Dmitry
^ permalink raw reply
* [PATCH net-next v2 0/3] Drop get_headlen functions in favor of generic function
From: Alexander Duyck @ 2014-09-05 23:20 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, jeffrey.t.kirsher
This series replaces the igb_get_headlen and ixgbe_get_headlen functions
with a generic function named eth_get_headlen.
I have done some performance testing on ixgbe with 258 byte frames since
the calls are only used on frames larger than 256 bytes and have seen no
significant difference in CPU utilization.
v2: renamed __skb_get_poff to skb_get_poff
renamed ___skb_get_poff to __skb_get_poff
---
Alexander Duyck (3):
net: Add function for parsing the header length out of linear ethernet frames
igb: use new eth_get_headlen interface
ixgbe: use new eth_get_headlen interface
drivers/net/ethernet/intel/igb/igb_main.c | 109 -----------------------
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 116 -------------------------
include/linux/etherdevice.h | 1
include/linux/skbuff.h | 4 +
include/net/flow_keys.h | 2
net/core/filter.c | 2
net/core/flow_dissector.c | 46 +++++++---
net/ethernet/eth.c | 27 ++++++
8 files changed, 68 insertions(+), 239 deletions(-)
--
^ permalink raw reply
* [PATCH net-next v2 2/3] igb: use new eth_get_headlen interface
From: Alexander Duyck @ 2014-09-05 23:20 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, jeffrey.t.kirsher
In-Reply-To: <20140905231807.2035.33588.stgit@ahduyck-bv4.jf.intel.com>
Update igb to drop the igb_get_headlen function in favor of eth_get_headlen.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 109 -----------------------------
1 file changed, 1 insertion(+), 108 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 89de7fe..4c023f0 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6769,113 +6769,6 @@ static bool igb_is_non_eop(struct igb_ring *rx_ring,
}
/**
- * igb_get_headlen - determine size of header for LRO/GRO
- * @data: pointer to the start of the headers
- * @max_len: total length of section to find headers in
- *
- * This function is meant to determine the length of headers that will
- * be recognized by hardware for LRO, and GRO offloads. The main
- * motivation of doing this is to only perform one pull for IPv4 TCP
- * packets so that we can do basic things like calculating the gso_size
- * based on the average data per packet.
- **/
-static unsigned int igb_get_headlen(unsigned char *data,
- unsigned int max_len)
-{
- union {
- unsigned char *network;
- /* l2 headers */
- struct ethhdr *eth;
- struct vlan_hdr *vlan;
- /* l3 headers */
- struct iphdr *ipv4;
- struct ipv6hdr *ipv6;
- } hdr;
- __be16 protocol;
- u8 nexthdr = 0; /* default to not TCP */
- u8 hlen;
-
- /* this should never happen, but better safe than sorry */
- if (max_len < ETH_HLEN)
- return max_len;
-
- /* initialize network frame pointer */
- hdr.network = data;
-
- /* set first protocol and move network header forward */
- protocol = hdr.eth->h_proto;
- hdr.network += ETH_HLEN;
-
- /* handle any vlan tag if present */
- if (protocol == htons(ETH_P_8021Q)) {
- if ((hdr.network - data) > (max_len - VLAN_HLEN))
- return max_len;
-
- protocol = hdr.vlan->h_vlan_encapsulated_proto;
- hdr.network += VLAN_HLEN;
- }
-
- /* handle L3 protocols */
- if (protocol == htons(ETH_P_IP)) {
- if ((hdr.network - data) > (max_len - sizeof(struct iphdr)))
- return max_len;
-
- /* access ihl as a u8 to avoid unaligned access on ia64 */
- hlen = (hdr.network[0] & 0x0F) << 2;
-
- /* verify hlen meets minimum size requirements */
- if (hlen < sizeof(struct iphdr))
- return hdr.network - data;
-
- /* record next protocol if header is present */
- if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
- nexthdr = hdr.ipv4->protocol;
- } else if (protocol == htons(ETH_P_IPV6)) {
- if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
- return max_len;
-
- /* record next protocol */
- nexthdr = hdr.ipv6->nexthdr;
- hlen = sizeof(struct ipv6hdr);
- } else {
- return hdr.network - data;
- }
-
- /* relocate pointer to start of L4 header */
- hdr.network += hlen;
-
- /* finally sort out TCP */
- if (nexthdr == IPPROTO_TCP) {
- if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
- return max_len;
-
- /* access doff as a u8 to avoid unaligned access on ia64 */
- hlen = (hdr.network[12] & 0xF0) >> 2;
-
- /* verify hlen meets minimum size requirements */
- if (hlen < sizeof(struct tcphdr))
- return hdr.network - data;
-
- hdr.network += hlen;
- } else if (nexthdr == IPPROTO_UDP) {
- if ((hdr.network - data) > (max_len - sizeof(struct udphdr)))
- return max_len;
-
- hdr.network += sizeof(struct udphdr);
- }
-
- /* If everything has gone correctly hdr.network should be the
- * data section of the packet and will be the end of the header.
- * If not then it probably represents the end of the last recognized
- * header.
- */
- if ((hdr.network - data) < max_len)
- return hdr.network - data;
- else
- return max_len;
-}
-
-/**
* igb_pull_tail - igb specific version of skb_pull_tail
* @rx_ring: rx descriptor ring packet is being transacted on
* @rx_desc: pointer to the EOP Rx descriptor
@@ -6919,7 +6812,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
/* we need the header to contain the greater of either ETH_HLEN or
* 60 bytes if the skb->len is less than 60 for skb_pad.
*/
- pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN);
+ pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);
/* align pull length to size of long to optimize memcpy performance */
skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
^ permalink raw reply related
* [PATCH net-next v2 1/3] net: Add function for parsing the header length out of linear ethernet frames
From: Alexander Duyck @ 2014-09-05 23:20 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, jeffrey.t.kirsher
In-Reply-To: <20140905231807.2035.33588.stgit@ahduyck-bv4.jf.intel.com>
This patch updates some of the flow_dissector api so that it can be used to
parse the length of ethernet buffers stored in fragments. Most of the
changes needed were to __skb_get_poff as it needed to be updated to support
sending a linear buffer instead of a skb.
I have split __skb_get_poff into two functions, the first is skb_get_poff
and it retains the functionality of the original __skb_get_poff. The other
function is __skb_get_poff which now works much like __skb_flow_dissect in
relation to skb_flow_dissect in that it provides the same functionality but
works with just a data buffer and hlen instead of needing an skb.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
include/linux/etherdevice.h | 1 +
include/linux/skbuff.h | 4 +++-
include/net/flow_keys.h | 2 ++
net/core/filter.c | 2 +-
net/core/flow_dissector.c | 46 ++++++++++++++++++++++++++++++-------------
net/ethernet/eth.c | 27 +++++++++++++++++++++++++
6 files changed, 66 insertions(+), 16 deletions(-)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9c5529d..733980f 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,7 @@
#include <asm/bitsperlong.h>
#ifdef __KERNEL__
+u32 eth_get_headlen(void *data, unsigned int max_len);
__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
extern const struct header_ops eth_header_ops;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 02529fc..72fcc90 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3216,7 +3216,9 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
-u32 __skb_get_poff(const struct sk_buff *skb);
+u32 skb_get_poff(const struct sk_buff *skb);
+u32 __skb_get_poff(const struct sk_buff *skb, void *data,
+ const struct flow_keys *keys, int hlen);
/**
* skb_head_is_locked - Determine if the skb->head is locked down
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index 9a03f73..7ee2df0 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -40,4 +40,6 @@ static inline __be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8
return __skb_flow_get_ports(skb, thoff, ip_proto, NULL, 0);
}
u32 flow_hash_from_keys(struct flow_keys *keys);
+unsigned int flow_get_hlen(const unsigned char *data, unsigned int max_len,
+ __be16 protocol);
#endif
diff --git a/net/core/filter.c b/net/core/filter.c
index d814b8a..613409e 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -113,7 +113,7 @@ static unsigned int pkt_type_offset(void)
static u64 __skb_get_pay_offset(u64 ctx, u64 a, u64 x, u64 r4, u64 r5)
{
- return __skb_get_poff((struct sk_buff *)(unsigned long) ctx);
+ return skb_get_poff((struct sk_buff *)(unsigned long) ctx);
}
static u64 __skb_get_nlattr(u64 ctx, u64 a, u64 x, u64 r4, u64 r5)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 12f48ca..8e5decb 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -13,6 +13,7 @@
#include <linux/if_pppox.h>
#include <linux/ppp_defs.h>
#include <net/flow_keys.h>
+#include <scsi/fc/fc_fcoe.h>
/* copy saddr & daddr, possibly using 64bit load/store
* Equivalent to : flow->src = iph->saddr;
@@ -117,6 +118,13 @@ ipv6:
flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
nhoff += sizeof(struct ipv6hdr);
+ /* skip the flow label processing if skb is NULL. The
+ * assumption here is that if there is no skb we are not
+ * looking for flow info as much as we are length.
+ */
+ if (!skb)
+ break;
+
flow_label = ip6_flowlabel(iph);
if (flow_label) {
/* Awesome, IPv6 packet has a flow label so we can
@@ -165,6 +173,9 @@ ipv6:
return false;
}
}
+ case htons(ETH_P_FCOE):
+ flow->thoff = (u16)(nhoff + FCOE_HEADER_LEN);
+ /* fall through */
default:
return false;
}
@@ -316,26 +327,18 @@ u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
}
EXPORT_SYMBOL(__skb_tx_hash);
-/* __skb_get_poff() returns the offset to the payload as far as it could
- * be dissected. The main user is currently BPF, so that we can dynamically
- * truncate packets without needing to push actual payload to the user
- * space and can analyze headers only, instead.
- */
-u32 __skb_get_poff(const struct sk_buff *skb)
+u32 __skb_get_poff(const struct sk_buff *skb, void *data,
+ const struct flow_keys *keys, int hlen)
{
- struct flow_keys keys;
- u32 poff = 0;
+ u32 poff = keys->thoff;
- if (!skb_flow_dissect(skb, &keys))
- return 0;
-
- poff += keys.thoff;
- switch (keys.ip_proto) {
+ switch (keys->ip_proto) {
case IPPROTO_TCP: {
const struct tcphdr *tcph;
struct tcphdr _tcph;
- tcph = skb_header_pointer(skb, poff, sizeof(_tcph), &_tcph);
+ tcph = __skb_header_pointer(skb, poff, sizeof(_tcph),
+ data, hlen, &_tcph);
if (!tcph)
return poff;
@@ -369,6 +372,21 @@ u32 __skb_get_poff(const struct sk_buff *skb)
return poff;
}
+/* skb_get_poff() returns the offset to the payload as far as it could
+ * be dissected. The main user is currently BPF, so that we can dynamically
+ * truncate packets without needing to push actual payload to the user
+ * space and can analyze headers only, instead.
+ */
+u32 skb_get_poff(const struct sk_buff *skb)
+{
+ struct flow_keys keys;
+
+ if (!skb_flow_dissect(skb, &keys))
+ return 0;
+
+ return __skb_get_poff(skb, skb->data, &keys, skb_headlen(skb));
+}
+
static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
{
#ifdef CONFIG_XPS
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 5cebca1..33a140e 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -146,6 +146,33 @@ int eth_rebuild_header(struct sk_buff *skb)
EXPORT_SYMBOL(eth_rebuild_header);
/**
+ * eth_get_headlen - determine the the length of header for an ethernet frame
+ * @data: pointer to start of frame
+ * @len: total length of frame
+ *
+ * Make a best effort attempt to pull the length for all of the headers for
+ * a given frame in a linear buffer.
+ */
+u32 eth_get_headlen(void *data, unsigned int len)
+{
+ const struct ethhdr *eth = (const struct ethhdr *)data;
+ struct flow_keys keys;
+
+ /* this should never happen, but better safe than sorry */
+ if (len < sizeof(*eth))
+ return len;
+
+ /* parse any remaining L2/L3 headers, check for L4 */
+ if (!__skb_flow_dissect(NULL, &keys, data,
+ eth->h_proto, sizeof(*eth), len))
+ return max_t(u32, keys.thoff, sizeof(*eth));
+
+ /* parse for any L4 headers */
+ return min_t(u32, __skb_get_poff(NULL, data, &keys, len), len);
+}
+EXPORT_SYMBOL(eth_get_headlen);
+
+/**
* eth_type_trans - determine the packet's protocol ID.
* @skb: received socket data
* @dev: receiving network device
^ permalink raw reply related
* [PATCH net-next v2 3/3] ixgbe: use new eth_get_headlen interface
From: Alexander Duyck @ 2014-09-05 23:22 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, jeffrey.t.kirsher
In-Reply-To: <20140905231807.2035.33588.stgit@ahduyck-bv4.jf.intel.com>
Update ixgbe to drop the ixgbe_get_headlen function in favor of eth_get_headlen.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 116 -------------------------
1 file changed, 1 insertion(+), 115 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 53fbf06..09c3746 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1521,120 +1521,6 @@ void ixgbe_alloc_rx_buffers(struct ixgbe_ring *rx_ring, u16 cleaned_count)
ixgbe_release_rx_desc(rx_ring, i);
}
-/**
- * ixgbe_get_headlen - determine size of header for RSC/LRO/GRO/FCOE
- * @data: pointer to the start of the headers
- * @max_len: total length of section to find headers in
- *
- * This function is meant to determine the length of headers that will
- * be recognized by hardware for LRO, GRO, and RSC offloads. The main
- * motivation of doing this is to only perform one pull for IPv4 TCP
- * packets so that we can do basic things like calculating the gso_size
- * based on the average data per packet.
- **/
-static unsigned int ixgbe_get_headlen(unsigned char *data,
- unsigned int max_len)
-{
- union {
- unsigned char *network;
- /* l2 headers */
- struct ethhdr *eth;
- struct vlan_hdr *vlan;
- /* l3 headers */
- struct iphdr *ipv4;
- struct ipv6hdr *ipv6;
- } hdr;
- __be16 protocol;
- u8 nexthdr = 0; /* default to not TCP */
- u8 hlen;
-
- /* this should never happen, but better safe than sorry */
- if (max_len < ETH_HLEN)
- return max_len;
-
- /* initialize network frame pointer */
- hdr.network = data;
-
- /* set first protocol and move network header forward */
- protocol = hdr.eth->h_proto;
- hdr.network += ETH_HLEN;
-
- /* handle any vlan tag if present */
- if (protocol == htons(ETH_P_8021Q)) {
- if ((hdr.network - data) > (max_len - VLAN_HLEN))
- return max_len;
-
- protocol = hdr.vlan->h_vlan_encapsulated_proto;
- hdr.network += VLAN_HLEN;
- }
-
- /* handle L3 protocols */
- if (protocol == htons(ETH_P_IP)) {
- if ((hdr.network - data) > (max_len - sizeof(struct iphdr)))
- return max_len;
-
- /* access ihl as a u8 to avoid unaligned access on ia64 */
- hlen = (hdr.network[0] & 0x0F) << 2;
-
- /* verify hlen meets minimum size requirements */
- if (hlen < sizeof(struct iphdr))
- return hdr.network - data;
-
- /* record next protocol if header is present */
- if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
- nexthdr = hdr.ipv4->protocol;
- } else if (protocol == htons(ETH_P_IPV6)) {
- if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
- return max_len;
-
- /* record next protocol */
- nexthdr = hdr.ipv6->nexthdr;
- hlen = sizeof(struct ipv6hdr);
-#ifdef IXGBE_FCOE
- } else if (protocol == htons(ETH_P_FCOE)) {
- if ((hdr.network - data) > (max_len - FCOE_HEADER_LEN))
- return max_len;
- hlen = FCOE_HEADER_LEN;
-#endif
- } else {
- return hdr.network - data;
- }
-
- /* relocate pointer to start of L4 header */
- hdr.network += hlen;
-
- /* finally sort out TCP/UDP */
- if (nexthdr == IPPROTO_TCP) {
- if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
- return max_len;
-
- /* access doff as a u8 to avoid unaligned access on ia64 */
- hlen = (hdr.network[12] & 0xF0) >> 2;
-
- /* verify hlen meets minimum size requirements */
- if (hlen < sizeof(struct tcphdr))
- return hdr.network - data;
-
- hdr.network += hlen;
- } else if (nexthdr == IPPROTO_UDP) {
- if ((hdr.network - data) > (max_len - sizeof(struct udphdr)))
- return max_len;
-
- hdr.network += sizeof(struct udphdr);
- }
-
- /*
- * If everything has gone correctly hdr.network should be the
- * data section of the packet and will be the end of the header.
- * If not then it probably represents the end of the last recognized
- * header.
- */
- if ((hdr.network - data) < max_len)
- return hdr.network - data;
- else
- return max_len;
-}
-
static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
struct sk_buff *skb)
{
@@ -1793,7 +1679,7 @@ static void ixgbe_pull_tail(struct ixgbe_ring *rx_ring,
* we need the header to contain the greater of either ETH_HLEN or
* 60 bytes if the skb->len is less than 60 for skb_pad.
*/
- pull_len = ixgbe_get_headlen(va, IXGBE_RX_HDR_SIZE);
+ pull_len = eth_get_headlen(va, IXGBE_RX_HDR_SIZE);
/* align pull length to size of long to optimize memcpy performance */
skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
^ permalink raw reply related
* Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM
From: Tejun Heo @ 2014-09-05 23:32 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Luis R. Rodriguez, Greg Kroah-Hartman, Wu Zhangjin, Takashi Iwai,
Arjan van de Ven, linux-kernel@vger.kernel.org, Oleg Nesterov,
hare, Andrew Morton, Tetsuo Handa, Joseph Salisbury,
Benjamin Poirier, Santosh Rastapur, Kay Sievers,
One Thousand Gnomes, Tim Gardner, Pierre Fersing,
Nagalakshmi Nandigama, Praveen Krishnamoorthy, Sreekanth Reddy,
Abhijit
In-Reply-To: <20140905232242.GE35667@core.coreip.homeip.net>
Hey,
On Fri, Sep 05, 2014 at 04:22:42PM -0700, Dmitry Torokhov wrote:
> > I don't get it. This is a behavior userland already depends on for
> > boots. What's there to agree or disagree? This is just a fact that
> > we can't do this w/o disturbing some userlands in a major way.
>
> I am just expressing my disbelief that somebody relies on module loading
> being synchronous with probing. Out of curiosity, do you have any
> pointers?
I've seen initrd scripts which depended on the behavior to wait for
storage devices over the years. AFAIK, none of the modern distros
does it but this has been such a basic feature all along and it seems
highly unlikely to me that there's no userland remaining out there
depending on such behavior. We do have a lot of different userlands,
many of them quite ad-hoc.
Thanks.
--
tejun
^ permalink raw reply
* Re: [PATCH net-next v2 2/3] igb: use new eth_get_headlen interface
From: Jeff Kirsher @ 2014-09-05 23:34 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, davem, eric.dumazet
In-Reply-To: <20140905232031.2035.70831.stgit@ahduyck-bv4.jf.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4881 bytes --]
On Fri, 2014-09-05 at 19:20 -0400, Alexander Duyck wrote:
> Update igb to drop the igb_get_headlen function in favor of eth_get_headlen.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 109 -----------------------------
> 1 file changed, 1 insertion(+), 108 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 89de7fe..4c023f0 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -6769,113 +6769,6 @@ static bool igb_is_non_eop(struct igb_ring *rx_ring,
> }
>
> /**
> - * igb_get_headlen - determine size of header for LRO/GRO
> - * @data: pointer to the start of the headers
> - * @max_len: total length of section to find headers in
> - *
> - * This function is meant to determine the length of headers that will
> - * be recognized by hardware for LRO, and GRO offloads. The main
> - * motivation of doing this is to only perform one pull for IPv4 TCP
> - * packets so that we can do basic things like calculating the gso_size
> - * based on the average data per packet.
> - **/
> -static unsigned int igb_get_headlen(unsigned char *data,
> - unsigned int max_len)
> -{
> - union {
> - unsigned char *network;
> - /* l2 headers */
> - struct ethhdr *eth;
> - struct vlan_hdr *vlan;
> - /* l3 headers */
> - struct iphdr *ipv4;
> - struct ipv6hdr *ipv6;
> - } hdr;
> - __be16 protocol;
> - u8 nexthdr = 0; /* default to not TCP */
> - u8 hlen;
> -
> - /* this should never happen, but better safe than sorry */
> - if (max_len < ETH_HLEN)
> - return max_len;
> -
> - /* initialize network frame pointer */
> - hdr.network = data;
> -
> - /* set first protocol and move network header forward */
> - protocol = hdr.eth->h_proto;
> - hdr.network += ETH_HLEN;
> -
> - /* handle any vlan tag if present */
> - if (protocol == htons(ETH_P_8021Q)) {
> - if ((hdr.network - data) > (max_len - VLAN_HLEN))
> - return max_len;
> -
> - protocol = hdr.vlan->h_vlan_encapsulated_proto;
> - hdr.network += VLAN_HLEN;
> - }
> -
> - /* handle L3 protocols */
> - if (protocol == htons(ETH_P_IP)) {
> - if ((hdr.network - data) > (max_len - sizeof(struct iphdr)))
> - return max_len;
> -
> - /* access ihl as a u8 to avoid unaligned access on ia64 */
> - hlen = (hdr.network[0] & 0x0F) << 2;
> -
> - /* verify hlen meets minimum size requirements */
> - if (hlen < sizeof(struct iphdr))
> - return hdr.network - data;
> -
> - /* record next protocol if header is present */
> - if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
> - nexthdr = hdr.ipv4->protocol;
> - } else if (protocol == htons(ETH_P_IPV6)) {
> - if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
> - return max_len;
> -
> - /* record next protocol */
> - nexthdr = hdr.ipv6->nexthdr;
> - hlen = sizeof(struct ipv6hdr);
> - } else {
> - return hdr.network - data;
> - }
> -
> - /* relocate pointer to start of L4 header */
> - hdr.network += hlen;
> -
> - /* finally sort out TCP */
> - if (nexthdr == IPPROTO_TCP) {
> - if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
> - return max_len;
> -
> - /* access doff as a u8 to avoid unaligned access on ia64 */
> - hlen = (hdr.network[12] & 0xF0) >> 2;
> -
> - /* verify hlen meets minimum size requirements */
> - if (hlen < sizeof(struct tcphdr))
> - return hdr.network - data;
> -
> - hdr.network += hlen;
> - } else if (nexthdr == IPPROTO_UDP) {
> - if ((hdr.network - data) > (max_len - sizeof(struct udphdr)))
> - return max_len;
> -
> - hdr.network += sizeof(struct udphdr);
> - }
> -
> - /* If everything has gone correctly hdr.network should be the
> - * data section of the packet and will be the end of the header.
> - * If not then it probably represents the end of the last recognized
> - * header.
> - */
> - if ((hdr.network - data) < max_len)
> - return hdr.network - data;
> - else
> - return max_len;
> -}
> -
> -/**
> * igb_pull_tail - igb specific version of skb_pull_tail
> * @rx_ring: rx descriptor ring packet is being transacted on
> * @rx_desc: pointer to the EOP Rx descriptor
> @@ -6919,7 +6812,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
> /* we need the header to contain the greater of either ETH_HLEN or
> * 60 bytes if the skb->len is less than 60 for skb_pad.
> */
> - pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN);
> + pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);
>
> /* align pull length to size of long to optimize memcpy performance */
> skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH net-next v2 3/3] ixgbe: use new eth_get_headlen interface
From: Jeff Kirsher @ 2014-09-05 23:35 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, davem, eric.dumazet
In-Reply-To: <20140905232053.2035.65715.stgit@ahduyck-bv4.jf.intel.com>
[-- Attachment #1: Type: text/plain, Size: 5110 bytes --]
On Fri, 2014-09-05 at 19:22 -0400, Alexander Duyck wrote:
> Update ixgbe to drop the ixgbe_get_headlen function in favor of eth_get_headlen.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 116 -------------------------
> 1 file changed, 1 insertion(+), 115 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 53fbf06..09c3746 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -1521,120 +1521,6 @@ void ixgbe_alloc_rx_buffers(struct ixgbe_ring *rx_ring, u16 cleaned_count)
> ixgbe_release_rx_desc(rx_ring, i);
> }
>
> -/**
> - * ixgbe_get_headlen - determine size of header for RSC/LRO/GRO/FCOE
> - * @data: pointer to the start of the headers
> - * @max_len: total length of section to find headers in
> - *
> - * This function is meant to determine the length of headers that will
> - * be recognized by hardware for LRO, GRO, and RSC offloads. The main
> - * motivation of doing this is to only perform one pull for IPv4 TCP
> - * packets so that we can do basic things like calculating the gso_size
> - * based on the average data per packet.
> - **/
> -static unsigned int ixgbe_get_headlen(unsigned char *data,
> - unsigned int max_len)
> -{
> - union {
> - unsigned char *network;
> - /* l2 headers */
> - struct ethhdr *eth;
> - struct vlan_hdr *vlan;
> - /* l3 headers */
> - struct iphdr *ipv4;
> - struct ipv6hdr *ipv6;
> - } hdr;
> - __be16 protocol;
> - u8 nexthdr = 0; /* default to not TCP */
> - u8 hlen;
> -
> - /* this should never happen, but better safe than sorry */
> - if (max_len < ETH_HLEN)
> - return max_len;
> -
> - /* initialize network frame pointer */
> - hdr.network = data;
> -
> - /* set first protocol and move network header forward */
> - protocol = hdr.eth->h_proto;
> - hdr.network += ETH_HLEN;
> -
> - /* handle any vlan tag if present */
> - if (protocol == htons(ETH_P_8021Q)) {
> - if ((hdr.network - data) > (max_len - VLAN_HLEN))
> - return max_len;
> -
> - protocol = hdr.vlan->h_vlan_encapsulated_proto;
> - hdr.network += VLAN_HLEN;
> - }
> -
> - /* handle L3 protocols */
> - if (protocol == htons(ETH_P_IP)) {
> - if ((hdr.network - data) > (max_len - sizeof(struct iphdr)))
> - return max_len;
> -
> - /* access ihl as a u8 to avoid unaligned access on ia64 */
> - hlen = (hdr.network[0] & 0x0F) << 2;
> -
> - /* verify hlen meets minimum size requirements */
> - if (hlen < sizeof(struct iphdr))
> - return hdr.network - data;
> -
> - /* record next protocol if header is present */
> - if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
> - nexthdr = hdr.ipv4->protocol;
> - } else if (protocol == htons(ETH_P_IPV6)) {
> - if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
> - return max_len;
> -
> - /* record next protocol */
> - nexthdr = hdr.ipv6->nexthdr;
> - hlen = sizeof(struct ipv6hdr);
> -#ifdef IXGBE_FCOE
> - } else if (protocol == htons(ETH_P_FCOE)) {
> - if ((hdr.network - data) > (max_len - FCOE_HEADER_LEN))
> - return max_len;
> - hlen = FCOE_HEADER_LEN;
> -#endif
> - } else {
> - return hdr.network - data;
> - }
> -
> - /* relocate pointer to start of L4 header */
> - hdr.network += hlen;
> -
> - /* finally sort out TCP/UDP */
> - if (nexthdr == IPPROTO_TCP) {
> - if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
> - return max_len;
> -
> - /* access doff as a u8 to avoid unaligned access on ia64 */
> - hlen = (hdr.network[12] & 0xF0) >> 2;
> -
> - /* verify hlen meets minimum size requirements */
> - if (hlen < sizeof(struct tcphdr))
> - return hdr.network - data;
> -
> - hdr.network += hlen;
> - } else if (nexthdr == IPPROTO_UDP) {
> - if ((hdr.network - data) > (max_len - sizeof(struct udphdr)))
> - return max_len;
> -
> - hdr.network += sizeof(struct udphdr);
> - }
> -
> - /*
> - * If everything has gone correctly hdr.network should be the
> - * data section of the packet and will be the end of the header.
> - * If not then it probably represents the end of the last recognized
> - * header.
> - */
> - if ((hdr.network - data) < max_len)
> - return hdr.network - data;
> - else
> - return max_len;
> -}
> -
> static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
> struct sk_buff *skb)
> {
> @@ -1793,7 +1679,7 @@ static void ixgbe_pull_tail(struct ixgbe_ring *rx_ring,
> * we need the header to contain the greater of either ETH_HLEN or
> * 60 bytes if the skb->len is less than 60 for skb_pad.
> */
> - pull_len = ixgbe_get_headlen(va, IXGBE_RX_HDR_SIZE);
> + pull_len = eth_get_headlen(va, IXGBE_RX_HDR_SIZE);
>
> /* align pull length to size of long to optimize memcpy performance */
> skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH net v6 4/4] tg3: Fix tx_pending checks for tg3_tso_bug
From: Prashant Sreedharan @ 2014-09-05 23:35 UTC (permalink / raw)
To: Benjamin Poirier; +Cc: Michael Chan, netdev, linux-kernel
In-Reply-To: <1409880647-14887-5-git-send-email-bpoirier@suse.de>
> static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,
> struct netdev_queue *txq, struct sk_buff *skb)
> {
> - struct sk_buff *segs, *nskb;
> - u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3;
> + unsigned int segs_remaining = skb_shinfo(skb)->gso_segs;
>
> - /* Estimate the number of fragments in the worst case */
> - tg3_maybe_stop_txq(tnapi, txq, frag_cnt_est, frag_cnt_est);
> - if (netif_tx_queue_stopped(txq))
> - return NETDEV_TX_BUSY;
> + if (unlikely(tg3_tx_avail(tnapi) <= segs_remaining)) {
> + if (!skb_is_nonlinear(skb) || skb_linearize(skb))
> + goto tg3_tso_bug_drop;
> + tg3_start_xmit(skb, tp->dev);
fyi.. Initially the driver was doing a skb_copy()
(tigon3_dma_hwbug_workaround()) for LSO skb that met HW bug conditions
but users started reporting page allocation failures due to copying of
large LSO skbs. To avoid this Commit 4caab52eb102f1 (tg3: Prevent page
allocation failure during TSO workaround) changed the driver logic to do
skb_gso_segment() for LSO skbs that met the HW bug conditions. With
skb_linearize() we might end up again with memory allocation failures
for large LSO skbs though at a much less frequent level (ie when TX
queue is almost full).
Also some of the tg3 supported chips like 5719, 57766 have dma_limits of
4k, 2k respectively so if the LSO skb that gets linearized has size more
than dma_limit then tg3_tx_frag_set() will consume more descriptors and
if budget becomes 0 in tg3_tx_frag_set() we end up calling tg3_tso_bug()
again and eventually dropping the skb, if descriptors do not get freed
still. Instead the skb can be dropped when we know we do not have enough
descriptors to handle skb for these chip versions.
> + } else {
> + struct sk_buff *segs, *nskb;
>
> - segs = skb_gso_segment(skb, tp->dev->features &
> - ~(NETIF_F_TSO | NETIF_F_TSO6));
> - if (IS_ERR(segs) || !segs)
> - goto tg3_tso_bug_end;
> + segs = skb_gso_segment(skb, tp->dev->features &
> + ~(NETIF_F_TSO | NETIF_F_TSO6 |
> + NETIF_F_SG));
> + if (IS_ERR(segs) || !segs)
> + goto tg3_tso_bug_drop;
>
> - do {
> - nskb = segs;
> - segs = segs->next;
> - nskb->next = NULL;
> - tg3_start_xmit(nskb, tp->dev);
> - } while (segs);
> + do {
> + nskb = segs;
> + segs = segs->next;
> + nskb->next = NULL;
> + if (--segs_remaining)
> + __tg3_start_xmit(nskb, tp->dev, segs_remaining);
> + else
> + tg3_start_xmit(nskb, tp->dev);
> + } while (segs);
>
> -tg3_tso_bug_end:
> + dev_kfree_skb_any(skb);
> + }
> +
> + return NETDEV_TX_OK;
> +
> +tg3_tso_bug_drop:
> + tp->tx_dropped++;
> dev_kfree_skb_any(skb);
>
> return NETDEV_TX_OK;
> @@ -7895,6 +7908,12 @@ tg3_tso_bug_end:
> /* hard_start_xmit for all devices */
> static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> + return __tg3_start_xmit(skb, dev, MAX_SKB_FRAGS + 1);
> +}
> +
> +static netdev_tx_t __tg3_start_xmit(struct sk_buff *skb,
> + struct net_device *dev, u32 stop_thresh)
> +{
> struct tg3 *tp = netdev_priv(dev);
> u32 len, entry, base_flags, mss, vlan = 0;
> u32 budget;
> @@ -8102,7 +8121,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
> tw32_tx_mbox(tnapi->prodmbox, entry);
>
> tnapi->tx_prod = entry;
> - tg3_maybe_stop_txq(tnapi, txq, MAX_SKB_FRAGS + 1,
> + tg3_maybe_stop_txq(tnapi, txq, stop_thresh,
> TG3_TX_WAKEUP_THRESH(tnapi));
>
> mmiowb();
> @@ -12336,9 +12355,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
> if ((ering->rx_pending > tp->rx_std_ring_mask) ||
> (ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) ||
> (ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
> - (ering->tx_pending <= MAX_SKB_FRAGS + 1) ||
> - (tg3_flag(tp, TSO_BUG) &&
> - (ering->tx_pending <= (MAX_SKB_FRAGS * 3))))
> + (ering->tx_pending <= MAX_SKB_FRAGS + 1))
> return -EINVAL;
>
> if (netif_running(dev)) {
^ permalink raw reply
* [Patch iproute2] iplink: forbid negative ifindex and modifying ifindex
From: Cong Wang @ 2014-09-05 23:36 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, Stephen Hemminger
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
ip/iplink.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index ea06871..a8a19dd 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -400,6 +400,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
} else if (strcmp(*argv, "index") == 0) {
NEXT_ARG();
*index = atoi(*argv);
+ if (*index < 0)
+ invarg("Invalid \"index\" value", *argv);
} else if (matches(*argv, "link") == 0) {
NEXT_ARG();
*link = *argv;
@@ -607,7 +609,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
char *name = NULL;
char *link = NULL;
char *type = NULL;
- int index = 0;
+ int index = -1;
int group;
struct link_util *lu = NULL;
struct iplink_req req;
@@ -658,6 +660,11 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
"argument is required.\n");
exit(-1);
}
+ if (cmd == RTM_NEWLINK && index != -1) {
+ fprintf(stderr, "index can be used only when "
+ "creating devices.\n");
+ exit(-1);
+ }
req.i.ifi_index = ll_name_to_index(dev);
if (req.i.ifi_index == 0) {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH net-next v2 1/3] net: Add function for parsing the header length out of linear ethernet frames
From: Alexei Starovoitov @ 2014-09-05 23:39 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, davem, eric.dumazet, jeffrey.t.kirsher
In-Reply-To: <20140905232017.2035.58501.stgit@ahduyck-bv4.jf.intel.com>
On Fri, Sep 05, 2014 at 07:20:26PM -0400, Alexander Duyck wrote:
> This patch updates some of the flow_dissector api so that it can be used to
> parse the length of ethernet buffers stored in fragments. Most of the
> changes needed were to __skb_get_poff as it needed to be updated to support
> sending a linear buffer instead of a skb.
>
> I have split __skb_get_poff into two functions, the first is skb_get_poff
> and it retains the functionality of the original __skb_get_poff. The other
> function is __skb_get_poff which now works much like __skb_flow_dissect in
> relation to skb_flow_dissect in that it provides the same functionality but
> works with just a data buffer and hlen instead of needing an skb.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
> include/linux/etherdevice.h | 1 +
> include/linux/skbuff.h | 4 +++-
> include/net/flow_keys.h | 2 ++
> net/core/filter.c | 2 +-
> net/core/flow_dissector.c | 46 ++++++++++++++++++++++++++++++-------------
> net/ethernet/eth.c | 27 +++++++++++++++++++++++++
> 6 files changed, 66 insertions(+), 16 deletions(-)
names and bpf related bits look good to me
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
^ permalink raw reply
* [PATCH iproute2] ip: support of usec rtt in tcp_metrics
From: Eric Dumazet @ 2014-09-05 23:54 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
Starting from linux-3.15, kernel supports new tcp metric attributes :
TCP_METRIC_RTT_US & TCP_METRIC_RTTVAR_US
Update ip command to detect their use.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
ip/tcp_metrics.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c
index e0f0344..bbbb4cc 100644
--- a/ip/tcp_metrics.c
+++ b/ip/tcp_metrics.c
@@ -216,6 +216,7 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
a = attrs[TCP_METRICS_ATTR_VALS];
if (a) {
struct rtattr *m[TCP_METRIC_MAX + 1 + 1];
+ unsigned long rtt = 0, rttvar = 0;
parse_rtattr_nested(m, TCP_METRIC_MAX + 1, a);
@@ -225,18 +226,30 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
a = m[i + 1];
if (!a)
continue;
- if (metric_name[i])
- fprintf(fp, " %s ", metric_name[i]);
- else
- fprintf(fp, " metric_%d ", i);
-
+ if (i != TCP_METRIC_RTT &&
+ i != TCP_METRIC_RTT_US &&
+ i != TCP_METRIC_RTTVAR &&
+ i != TCP_METRIC_RTTVAR_US) {
+ if (metric_name[i])
+ fprintf(fp, " %s ", metric_name[i]);
+ else
+ fprintf(fp, " metric_%d ", i);
+ }
val = rta_getattr_u32(a);
switch (i) {
case TCP_METRIC_RTT:
- fprintf(fp, "%luus", (val * 1000UL) >> 3);
+ if (!rtt)
+ rtt = (val * 1000UL) >> 3;
break;
case TCP_METRIC_RTTVAR:
- fprintf(fp, "%luus", (val * 1000UL) >> 2);
+ if (!rttvar)
+ rttvar = (val * 1000UL) >> 2;
+ break;
+ case TCP_METRIC_RTT_US:
+ rtt = val >> 3;
+ break;
+ case TCP_METRIC_RTTVAR_US:
+ rttvar = val >> 2;
break;
case TCP_METRIC_SSTHRESH:
case TCP_METRIC_CWND:
@@ -246,6 +259,10 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
break;
}
}
+ if (rtt)
+ fprintf(fp, " rtt %luus", rtt);
+ if (rttvar)
+ fprintf(fp, " rttvar %luus", rttvar);
}
a = attrs[TCP_METRICS_ATTR_FOPEN_MSS];
^ permalink raw reply related
* Re: [PATCH iproute2] ip: support of usec rtt in tcp_metrics
From: Stephen Hemminger @ 2014-09-06 0:02 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1409961244.26422.142.camel@edumazet-glaptop2.roam.corp.google.com>
On Fri, 05 Sep 2014 16:54:04 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> + if (i != TCP_METRIC_RTT &&
> + i != TCP_METRIC_RTT_US &&
> + i != TCP_METRIC_RTTVAR &&
> + i != TCP_METRIC_RTTVAR_US) {
> + if (metric_name[i])
> + fprintf(fp, " %s ", metric_name[i]);
> + else
> + fprintf(fp, " metric_%d ", i);
Why not put new metrics in metric_name array? and make the check something like:
if (i < ARRAY_SIZE(metric_name) && metric_name[i])
fprintf(fp, " %s ", metric_name[i]);
else
fprintf(fp, " metric_%d ", i)
This makes it future proof, and gets rid of the silly test.
^ permalink raw reply
* Re: [PATCH net v6 4/4] tg3: Fix tx_pending checks for tg3_tso_bug
From: Eric Dumazet @ 2014-09-06 0:03 UTC (permalink / raw)
To: Prashant Sreedharan; +Cc: Benjamin Poirier, Michael Chan, netdev, linux-kernel
In-Reply-To: <1409960135.18724.33.camel@prashant>
On Fri, 2014-09-05 at 16:35 -0700, Prashant Sreedharan wrote:
> fyi.. Initially the driver was doing a skb_copy()
> (tigon3_dma_hwbug_workaround()) for LSO skb that met HW bug conditions
> but users started reporting page allocation failures due to copying of
> large LSO skbs. To avoid this Commit 4caab52eb102f1 (tg3: Prevent page
> allocation failure during TSO workaround) changed the driver logic to do
> skb_gso_segment() for LSO skbs that met the HW bug conditions. With
> skb_linearize() we might end up again with memory allocation failures
> for large LSO skbs though at a much less frequent level (ie when TX
> queue is almost full).
Note that TCP stack has one skb collapse feature, currently limited in
allocation of linear skbs fitting a whole page.
Instead of this private helper (and pretty limited one btw), we could
add a core function, that would build skbs with order-0 fragments.
Instead of skb_linearize(), I guess many call sites could instead use
this new helper.
Because as you said, skb_linearize() of one 64KB GSO packet can ask
order-5 allocations, and this generally does not work reliably.
^ permalink raw reply
* Re: [PATCH net v6 4/4] tg3: Fix tx_pending checks for tg3_tso_bug
From: David Miller @ 2014-09-06 0:13 UTC (permalink / raw)
To: eric.dumazet; +Cc: prashant, bpoirier, mchan, netdev, linux-kernel
In-Reply-To: <1409961810.26422.149.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 05 Sep 2014 17:03:30 -0700
> Instead of this private helper (and pretty limited one btw), we could
> add a core function, that would build skbs with order-0 fragments.
>
> Instead of skb_linearize(), I guess many call sites could instead use
> this new helper.
>
> Because as you said, skb_linearize() of one 64KB GSO packet can ask
> order-5 allocations, and this generally does not work reliably.
xen-netback could make use of this helper too.
^ permalink raw reply
* Re: [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr
From: David Miller @ 2014-09-06 0:13 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: yoshfuji, netdev
In-Reply-To: <1409781562-4191-1-git-send-email-nicolas.dichtel@6wind.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed, 3 Sep 2014 23:59:21 +0200
> There is no reason to take a refcnt before deleting the peer address route.
> It's done some lines below for the local prefix route because
> inet6_ifa_finish_destroy() will release it at the end.
> For the peer address route, we want to free it right now.
>
> This bug has been introduced by commit
> caeaba79009c ("ipv6: add support of peer address").
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied.
^ permalink raw reply
* Re: [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove peer addr
From: David Miller @ 2014-09-06 0:13 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: yoshfuji, netdev
In-Reply-To: <1409781562-4191-2-git-send-email-nicolas.dichtel@6wind.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed, 3 Sep 2014 23:59:22 +0200
> addrconf_get_prefix_route() ensures to get the right route in the right table.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] ipv4: fix a race in update_or_create_fnhe()
From: David Miller @ 2014-09-06 0:16 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1409808116.26422.83.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 03 Sep 2014 22:21:56 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> nh_exceptions is effectively used under rcu, but lacks proper
> barriers. Between kzalloc() and setting of nh->nh_exceptions(),
> we need a proper memory barrier.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: 4895c771c7f00 ("ipv4: Add FIB nexthop exceptions.")
Applied, thanks Eric.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox