* [RFC v2 5/7] mm/huge_memory: use new hashtable implementation
From: Sasha Levin @ 2012-08-03 14:23 UTC (permalink / raw)
To: torvalds
Cc: tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem, rostedt,
mingo, ebiederm, aarcange, ericvh, netdev, Sasha Levin
In-Reply-To: <1344003788-1417-1-git-send-email-levinsasha928@gmail.com>
Switch hugemem to use the new hashtable implementation. This reduces the amount of
generic unrelated code in the hugemem.
This also removes the dymanic allocation of the hash table. The size of the table is
constant so there's no point in paying the price of an extra dereference when accessing
it.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
mm/huge_memory.c | 56 ++++++++++-------------------------------------------
1 files changed, 11 insertions(+), 45 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 57c4b93..7b2cad5 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -17,6 +17,7 @@
#include <linux/khugepaged.h>
#include <linux/freezer.h>
#include <linux/mman.h>
+#include <linux/hashtable.h>
#include <asm/tlb.h>
#include <asm/pgalloc.h>
#include "internal.h"
@@ -57,12 +58,13 @@ static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
static unsigned int khugepaged_max_ptes_none __read_mostly = HPAGE_PMD_NR-1;
static int khugepaged(void *none);
-static int mm_slots_hash_init(void);
static int khugepaged_slab_init(void);
static void khugepaged_slab_free(void);
-#define MM_SLOTS_HASH_HEADS 1024
-static struct hlist_head *mm_slots_hash __read_mostly;
+#define MM_SLOTS_HASH_BITS 10
+#define MM_SLOTS_HASH_CMP(mm_slot, obj) ((mm_slot)->mm == (obj))
+DEFINE_STATIC_HASHTABLE(mm_slots_hash, MM_SLOTS_HASH_BITS);
+
static struct kmem_cache *mm_slot_cache __read_mostly;
/**
@@ -140,7 +142,7 @@ static int start_khugepaged(void)
int err = 0;
if (khugepaged_enabled()) {
int wakeup;
- if (unlikely(!mm_slot_cache || !mm_slots_hash)) {
+ if (unlikely(!mm_slot_cache)) {
err = -ENOMEM;
goto out;
}
@@ -554,12 +556,6 @@ static int __init hugepage_init(void)
if (err)
goto out;
- err = mm_slots_hash_init();
- if (err) {
- khugepaged_slab_free();
- goto out;
- }
-
/*
* By default disable transparent hugepages on smaller systems,
* where the extra memory used could hurt more than TLB overhead
@@ -1562,47 +1558,17 @@ static inline void free_mm_slot(struct mm_slot *mm_slot)
kmem_cache_free(mm_slot_cache, mm_slot);
}
-static int __init mm_slots_hash_init(void)
-{
- mm_slots_hash = kzalloc(MM_SLOTS_HASH_HEADS * sizeof(struct hlist_head),
- GFP_KERNEL);
- if (!mm_slots_hash)
- return -ENOMEM;
- return 0;
-}
-
-#if 0
-static void __init mm_slots_hash_free(void)
-{
- kfree(mm_slots_hash);
- mm_slots_hash = NULL;
-}
-#endif
-
static struct mm_slot *get_mm_slot(struct mm_struct *mm)
{
- struct mm_slot *mm_slot;
- struct hlist_head *bucket;
- struct hlist_node *node;
-
- bucket = &mm_slots_hash[((unsigned long)mm / sizeof(struct mm_struct))
- % MM_SLOTS_HASH_HEADS];
- hlist_for_each_entry(mm_slot, node, bucket, hash) {
- if (mm == mm_slot->mm)
- return mm_slot;
- }
- return NULL;
+ return hash_get(&mm_slots_hash, mm, struct mm_slot,
+ hash, MM_SLOTS_HASH_CMP);
}
static void insert_to_mm_slots_hash(struct mm_struct *mm,
struct mm_slot *mm_slot)
{
- struct hlist_head *bucket;
-
- bucket = &mm_slots_hash[((unsigned long)mm / sizeof(struct mm_struct))
- % MM_SLOTS_HASH_HEADS];
mm_slot->mm = mm;
- hlist_add_head(&mm_slot->hash, bucket);
+ hash_add(&mm_slots_hash, &mm_slot->hash, (long)mm);
}
static inline int khugepaged_test_exit(struct mm_struct *mm)
@@ -1675,7 +1641,7 @@ void __khugepaged_exit(struct mm_struct *mm)
spin_lock(&khugepaged_mm_lock);
mm_slot = get_mm_slot(mm);
if (mm_slot && khugepaged_scan.mm_slot != mm_slot) {
- hlist_del(&mm_slot->hash);
+ hash_del(&mm_slot->hash);
list_del(&mm_slot->mm_node);
free = 1;
}
@@ -2089,7 +2055,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
if (khugepaged_test_exit(mm)) {
/* free mm_slot */
- hlist_del(&mm_slot->hash);
+ hash_del(&mm_slot->hash);
list_del(&mm_slot->mm_node);
/*
--
1.7.8.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related
* [RFC v2 6/7] tracepoint: use new hashtable implementation
From: Sasha Levin @ 2012-08-03 14:23 UTC (permalink / raw)
To: torvalds
Cc: tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem, rostedt,
mingo, ebiederm, aarcange, ericvh, netdev, Sasha Levin
In-Reply-To: <1344003788-1417-1-git-send-email-levinsasha928@gmail.com>
Switch tracepoints to use the new hashtable implementation. This reduces the amount of
generic unrelated code in the tracepoints.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
kernel/tracepoint.c | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index d96ba22..b5a2650 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/static_key.h>
+#include <linux/hashtable.h>
extern struct tracepoint * const __start___tracepoints_ptrs[];
extern struct tracepoint * const __stop___tracepoints_ptrs[];
@@ -49,8 +50,7 @@ static LIST_HEAD(tracepoint_module_list);
* Protected by tracepoints_mutex.
*/
#define TRACEPOINT_HASH_BITS 6
-#define TRACEPOINT_TABLE_SIZE (1 << TRACEPOINT_HASH_BITS)
-static struct hlist_head tracepoint_table[TRACEPOINT_TABLE_SIZE];
+DEFINE_STATIC_HASHTABLE(tracepoint_table, TRACEPOINT_HASH_BITS);
/*
* Note about RCU :
@@ -191,16 +191,14 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry,
*/
static struct tracepoint_entry *get_tracepoint(const char *name)
{
- struct hlist_head *head;
struct hlist_node *node;
struct tracepoint_entry *e;
u32 hash = jhash(name, strlen(name), 0);
- head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
- hlist_for_each_entry(e, node, head, hlist) {
+ hash_for_each_possible(&tracepoint_table, node, e, hlist, hash)
if (!strcmp(name, e->name))
return e;
- }
+
return NULL;
}
@@ -210,19 +208,13 @@ static struct tracepoint_entry *get_tracepoint(const char *name)
*/
static struct tracepoint_entry *add_tracepoint(const char *name)
{
- struct hlist_head *head;
- struct hlist_node *node;
struct tracepoint_entry *e;
size_t name_len = strlen(name) + 1;
u32 hash = jhash(name, name_len-1, 0);
- head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
- hlist_for_each_entry(e, node, head, hlist) {
- if (!strcmp(name, e->name)) {
- printk(KERN_NOTICE
- "tracepoint %s busy\n", name);
- return ERR_PTR(-EEXIST); /* Already there */
- }
+ if (get_tracepoint(name)) {
+ printk(KERN_NOTICE "tracepoint %s busy\n", name);
+ return ERR_PTR(-EEXIST); /* Already there */
}
/*
* Using kmalloc here to allocate a variable length element. Could
@@ -234,7 +226,7 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
memcpy(&e->name[0], name, name_len);
e->funcs = NULL;
e->refcount = 0;
- hlist_add_head(&e->hlist, head);
+ hash_add(&tracepoint_table, &e->hlist, hash);
return e;
}
@@ -244,7 +236,7 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
*/
static inline void remove_tracepoint(struct tracepoint_entry *e)
{
- hlist_del(&e->hlist);
+ hash_del(&e->hlist);
kfree(e);
}
--
1.7.8.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related
* [RFC v2 7/7] net,9p: use new hashtable implementation
From: Sasha Levin @ 2012-08-03 14:23 UTC (permalink / raw)
To: torvalds
Cc: tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem, rostedt,
mingo, ebiederm, aarcange, ericvh, netdev, Sasha Levin
In-Reply-To: <1344003788-1417-1-git-send-email-levinsasha928@gmail.com>
Switch 9p error table to use the new hashtable implementation. This reduces the amount of
generic unrelated code in 9p.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
net/9p/error.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/net/9p/error.c b/net/9p/error.c
index 2ab2de7..f1037db 100644
--- a/net/9p/error.c
+++ b/net/9p/error.c
@@ -34,7 +34,7 @@
#include <linux/jhash.h>
#include <linux/errno.h>
#include <net/9p/9p.h>
-
+#include <linux/hashtable.h>
/**
* struct errormap - map string errors from Plan 9 to Linux numeric ids
* @name: string sent over 9P
@@ -50,8 +50,8 @@ struct errormap {
struct hlist_node list;
};
-#define ERRHASHSZ 32
-static struct hlist_head hash_errmap[ERRHASHSZ];
+#define ERRHASHSZ 5
+DEFINE_STATIC_HASHTABLE(hash_errmap, ERRHASHSZ);
/* FixMe - reduce to a reasonable size */
static struct errormap errmap[] = {
@@ -196,15 +196,14 @@ int p9_error_init(void)
int bucket;
/* initialize hash table */
- for (bucket = 0; bucket < ERRHASHSZ; bucket++)
- INIT_HLIST_HEAD(&hash_errmap[bucket]);
+ hash_init(&hash_errmap, ERRHASHSZ);
/* load initial error map into hash table */
for (c = errmap; c->name != NULL; c++) {
c->namelen = strlen(c->name);
- bucket = jhash(c->name, c->namelen, 0) % ERRHASHSZ;
+ bucket = jhash(c->name, c->namelen, 0);
INIT_HLIST_NODE(&c->list);
- hlist_add_head(&c->list, &hash_errmap[bucket]);
+ hash_add(&hash_errmap, &c->list, bucket);
}
return 1;
@@ -228,8 +227,8 @@ int p9_errstr2errno(char *errstr, int len)
errno = 0;
p = NULL;
c = NULL;
- bucket = jhash(errstr, len, 0) % ERRHASHSZ;
- hlist_for_each_entry(c, p, &hash_errmap[bucket], list) {
+ bucket = jhash(errstr, len, 0);
+ hash_for_each_possible(&hash_errmap, p, c, list, bucket) {
if (c->namelen == len && !memcmp(c->name, errstr, len)) {
errno = c->val;
break;
--
1.7.8.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related
* Re: CPU: 0 Not tainted (3.1.9+ #1) when ifconfig rose0 down
From: folkert @ 2012-08-03 14:32 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: Bernard Pidoux, linux-hams, Linux Netdev List
In-Reply-To: <87ipd0ykdg.fsf@xmission.com>
> You might want to simply try moving unregister_netdevice_notifier a bit
> earlier in rose_exit and see if that helps. Otherwise I would recommend
> instrumenting the code up with some printk so you can understand what
> part of unregistration is failing.
Or bisect! Give e.g. the oldest 2.6 kernel a try to find a last known
good and then do a bisect upto a known bad kernel.
Folkert van Heusden
--
To MultiTail einai ena polymorfiko ergaleio gia ta logfiles kai tin
eksodo twn entolwn. Prosferei: filtrarisma, xrwmatismo, sygxwneysi,
diaforetikes provoles. http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
^ permalink raw reply
* pull request: wireless 2012-08-03
From: John W. Linville @ 2012-08-03 14:56 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 22472 bytes --]
commit d4e5979c0da95791aa717c18e162540c7a596360
Dave,
This request covers a batch of fixes intended for the 3.6 stream.
Daniel Drake provides a pair of libertas fixes: one to avoid
unnecessary resets in order to keep the MMC layer happy; and another
to correct a couple of memory leaks.
Eliad Peller gives us a mac80211 fix for an issue that could fail to
notify userland of a completed scan.
Johannes Berg provides "a few fixes for various things [Johannes]
found doing code inspection for [his] multi-channel work".
Mohammed Shafi Shajakhan provides a simple hardware-enablement
(i.e. device ID) patch for ath9k.
Paul Stewart provides a cfg80211 fix to ensure that the presence of
beacons on a channel is recorded correctly.
Rafał Miłecki gives us a bcma device ID patch to support BCM43228
devices, and a b43 GPIO fix.
Seth Forshee provide a pair of patches to properly expose some
regulatory information needed by brcmsmac. This corrects a lockdep
issue created by a patch that is already in the tree.
Stanislaw Gruszka provides a regulatory code fix to correct an earlier
regression with the rt2x00 drivers.
Woody Hung offers an rt2x00 fix to correct a regression when resuming
an rt3290 device from S3/S4. This one seems big, but most of its
size comes from moving a function between two source files.
Please let me know if there are problems!
Thanks,
John
---
The following changes since commit e33cdac014d50dd9753e1399ae8b0b5cd98d7aa0:
ipv4: route.c cleanup (2012-08-02 02:54:43 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git tags/master-2012-08-03
for you to fetch changes up to d4e5979c0da95791aa717c18e162540c7a596360:
ath9k: Add PID/VID support for AR1111 (2012-08-03 10:11:14 -0400)
----------------------------------------------------------------
Daniel Drake (2):
libertas: don't reset card on error when it is being removed
libertas: fix two memory leaks
Eliad Peller (1):
mac80211: don't clear sched_scan_sdata on sched scan stop request
Johannes Berg (4):
mac80211: fix scan_sdata assignment
Merge remote-tracking branch 'wireless/master' into mac80211
mac80211: clear timer bits when disconnecting
mac80211: cancel mesh path timer
John W. Linville (1):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Mohammed Shafi Shajakhan (1):
ath9k: Add PID/VID support for AR1111
Paul Stewart (1):
cfg80211: Clear "beacon_found" on regulatory restore
Rafał Miłecki (2):
bcma: BCM43228 support
b43: fix logic in GPIO init
Seth Forshee (2):
cfg80211: add channel flag to prohibit OFDM operation
brcmsmac: use channel flags to restrict OFDM
Stanislaw Gruszka (1):
wireless: reg: restore previous behaviour of chan->max_power calculations
Woody Hung (1):
rt2x00 : fix rt3290 resuming failed.
drivers/bcma/host_pci.c | 1 +
drivers/bcma/sprom.c | 4 +-
drivers/net/wireless/ath/ath9k/hw.c | 1 +
drivers/net/wireless/ath/ath9k/hw.h | 1 +
drivers/net/wireless/ath/ath9k/pci.c | 1 +
drivers/net/wireless/b43/main.c | 21 +++---
drivers/net/wireless/brcm80211/brcmsmac/channel.c | 5 +-
.../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 3 +-
drivers/net/wireless/libertas/cfg.c | 1 +
drivers/net/wireless/libertas/if_sdio.c | 1 +
drivers/net/wireless/libertas/main.c | 5 +-
drivers/net/wireless/rt2x00/rt2800lib.c | 68 +++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800pci.c | 71 --------------------
include/linux/bcma/bcma_driver_chipcommon.h | 6 ++
include/net/cfg80211.h | 2 +
net/mac80211/mesh.c | 3 +
net/mac80211/mlme.c | 2 +
net/mac80211/scan.c | 3 +-
net/wireless/reg.c | 19 +++++-
19 files changed, 129 insertions(+), 89 deletions(-)
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 11b32d2..a6e5672 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -272,6 +272,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
{ 0, },
};
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 26823d9..9ea4627 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
@@ -507,7 +507,9 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus)
/* for these chips OTP is always available */
present = true;
break;
-
+ case BCMA_CHIP_ID_BCM43228:
+ present = chip_status & BCMA_CC_CHIPST_43228_OTP_PRESENT;
+ break;
default:
present = false;
break;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index cfa91ab..60b6a9d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -730,6 +730,7 @@ int ath9k_hw_init(struct ath_hw *ah)
case AR9300_DEVID_QCA955X:
case AR9300_DEVID_AR9580:
case AR9300_DEVID_AR9462:
+ case AR9485_DEVID_AR1111:
break;
default:
if (common->bus_ops->ath_bus_type == ATH_USB)
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index dd0c146..ce7332c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -49,6 +49,7 @@
#define AR9300_DEVID_AR9462 0x0034
#define AR9300_DEVID_AR9330 0x0035
#define AR9300_DEVID_QCA955X 0x0038
+#define AR9485_DEVID_AR1111 0x0037
#define AR5416_AR9100_DEVID 0x000b
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 87b89d5..d455de9 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -37,6 +37,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
{ PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
{ PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
{ PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9462 */
+ { PCI_VDEVICE(ATHEROS, 0x0037) }, /* PCI-E AR1111/AR9485 */
{ 0 }
};
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index b80352b..a140165 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2719,32 +2719,37 @@ static int b43_gpio_init(struct b43_wldev *dev)
if (dev->dev->chip_id == 0x4301) {
mask |= 0x0060;
set |= 0x0060;
+ } else if (dev->dev->chip_id == 0x5354) {
+ /* Don't allow overtaking buttons GPIOs */
+ set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */
}
- if (dev->dev->chip_id == 0x5354)
- set &= 0xff02;
+
if (0 /* FIXME: conditional unknown */ ) {
b43_write16(dev, B43_MMIO_GPIO_MASK,
b43_read16(dev, B43_MMIO_GPIO_MASK)
| 0x0100);
- mask |= 0x0180;
- set |= 0x0180;
+ /* BT Coexistance Input */
+ mask |= 0x0080;
+ set |= 0x0080;
+ /* BT Coexistance Out */
+ mask |= 0x0100;
+ set |= 0x0100;
}
if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) {
+ /* PA is controlled by gpio 9, let ucode handle it */
b43_write16(dev, B43_MMIO_GPIO_MASK,
b43_read16(dev, B43_MMIO_GPIO_MASK)
| 0x0200);
mask |= 0x0200;
set |= 0x0200;
}
- if (dev->dev->core_rev >= 2)
- mask |= 0x0010; /* FIXME: This is redundant. */
switch (dev->dev->bus_type) {
#ifdef CONFIG_B43_BCMA
case B43_BUS_BCMA:
bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
(bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
- BCMA_CC_GPIOCTL) & mask) | set);
+ BCMA_CC_GPIOCTL) & ~mask) | set);
break;
#endif
#ifdef CONFIG_B43_SSB
@@ -2753,7 +2758,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
if (gpiodev)
ssb_write32(gpiodev, B43_GPIO_CONTROL,
(ssb_read32(gpiodev, B43_GPIO_CONTROL)
- & mask) | set);
+ & ~mask) | set);
break;
#endif
}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
index 9a4c63f..7ed7d75 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -382,9 +382,7 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec,
{
struct brcms_c_info *wlc = wlc_cm->wlc;
struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel;
- const struct ieee80211_reg_rule *reg_rule;
struct txpwr_limits txpwr;
- int ret;
brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr);
@@ -393,8 +391,7 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec,
);
/* set or restore gmode as required by regulatory */
- ret = freq_reg_info(wlc->wiphy, ch->center_freq, 0, ®_rule);
- if (!ret && (reg_rule->flags & NL80211_RRF_NO_OFDM))
+ if (ch->flags & IEEE80211_CHAN_NO_OFDM)
brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false);
else
brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 9e79d47..192ad5c 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -121,7 +121,8 @@ static struct ieee80211_channel brcms_2ghz_chantable[] = {
IEEE80211_CHAN_NO_HT40PLUS),
CHAN2GHZ(14, 2484,
IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS |
- IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
+ IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS |
+ IEEE80211_CHAN_NO_OFDM)
};
static struct ieee80211_channel brcms_5ghz_nphy_chantable[] = {
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index eb5de80..1c10b54 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1254,6 +1254,7 @@ static int lbs_associate(struct lbs_private *priv,
netif_tx_wake_all_queues(priv->dev);
}
+ kfree(cmd);
done:
lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret);
return ret;
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 76caeba..e970897 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1314,6 +1314,7 @@ static void if_sdio_remove(struct sdio_func *func)
kfree(packet);
}
+ kfree(card);
lbs_deb_leave(LBS_DEB_SDIO);
}
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 5804818..fe1ea43 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -571,7 +571,10 @@ static int lbs_thread(void *data)
netdev_info(dev, "Timeout submitting command 0x%04x\n",
le16_to_cpu(cmdnode->cmdbuf->command));
lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
- if (priv->reset_card)
+
+ /* Reset card, but only when it isn't in the process
+ * of being shutdown anyway. */
+ if (!dev->dismantle && priv->reset_card)
priv->reset_card(priv);
}
priv->cmd_timed_out = 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 88455b1..cb8c2ac 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -221,6 +221,67 @@ static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex);
}
+static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+ int i, count;
+
+ rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®);
+ if (rt2x00_get_field32(reg, WLAN_EN))
+ return 0;
+
+ rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
+ rt2x00_set_field32(®, FRC_WL_ANT_SET, 1);
+ rt2x00_set_field32(®, WLAN_CLK_EN, 0);
+ rt2x00_set_field32(®, WLAN_EN, 1);
+ rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+
+ udelay(REGISTER_BUSY_DELAY);
+
+ count = 0;
+ do {
+ /*
+ * Check PLL_LD & XTAL_RDY.
+ */
+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
+ rt2800_register_read(rt2x00dev, CMB_CTRL, ®);
+ if (rt2x00_get_field32(reg, PLL_LD) &&
+ rt2x00_get_field32(reg, XTAL_RDY))
+ break;
+ udelay(REGISTER_BUSY_DELAY);
+ }
+
+ if (i >= REGISTER_BUSY_COUNT) {
+
+ if (count >= 10)
+ return -EIO;
+
+ rt2800_register_write(rt2x00dev, 0x58, 0x018);
+ udelay(REGISTER_BUSY_DELAY);
+ rt2800_register_write(rt2x00dev, 0x58, 0x418);
+ udelay(REGISTER_BUSY_DELAY);
+ rt2800_register_write(rt2x00dev, 0x58, 0x618);
+ udelay(REGISTER_BUSY_DELAY);
+ count++;
+ } else {
+ count = 0;
+ }
+
+ rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®);
+ rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0);
+ rt2x00_set_field32(®, WLAN_CLK_EN, 1);
+ rt2x00_set_field32(®, WLAN_RESET, 1);
+ rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+ udelay(10);
+ rt2x00_set_field32(®, WLAN_RESET, 0);
+ rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+ udelay(10);
+ rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff);
+ } while (count != 0);
+
+ return 0;
+}
+
void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
const u8 command, const u8 token,
const u8 arg0, const u8 arg1)
@@ -400,6 +461,13 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
{
unsigned int i;
u32 reg;
+ int retval;
+
+ if (rt2x00_rt(rt2x00dev, RT3290)) {
+ retval = rt2800_enable_wlan_rt3290(rt2x00dev);
+ if (retval)
+ return -EBUSY;
+ }
/*
* If driver doesn't wake up firmware here,
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 235376e..98aa426 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -980,66 +980,6 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
return rt2800_validate_eeprom(rt2x00dev);
}
-static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
-{
- u32 reg;
- int i, count;
-
- rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®);
- if (rt2x00_get_field32(reg, WLAN_EN))
- return 0;
-
- rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
- rt2x00_set_field32(®, FRC_WL_ANT_SET, 1);
- rt2x00_set_field32(®, WLAN_CLK_EN, 0);
- rt2x00_set_field32(®, WLAN_EN, 1);
- rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
-
- udelay(REGISTER_BUSY_DELAY);
-
- count = 0;
- do {
- /*
- * Check PLL_LD & XTAL_RDY.
- */
- for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
- rt2800_register_read(rt2x00dev, CMB_CTRL, ®);
- if (rt2x00_get_field32(reg, PLL_LD) &&
- rt2x00_get_field32(reg, XTAL_RDY))
- break;
- udelay(REGISTER_BUSY_DELAY);
- }
-
- if (i >= REGISTER_BUSY_COUNT) {
-
- if (count >= 10)
- return -EIO;
-
- rt2800_register_write(rt2x00dev, 0x58, 0x018);
- udelay(REGISTER_BUSY_DELAY);
- rt2800_register_write(rt2x00dev, 0x58, 0x418);
- udelay(REGISTER_BUSY_DELAY);
- rt2800_register_write(rt2x00dev, 0x58, 0x618);
- udelay(REGISTER_BUSY_DELAY);
- count++;
- } else {
- count = 0;
- }
-
- rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®);
- rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0);
- rt2x00_set_field32(®, WLAN_CLK_EN, 1);
- rt2x00_set_field32(®, WLAN_RESET, 1);
- rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
- udelay(10);
- rt2x00_set_field32(®, WLAN_RESET, 0);
- rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
- udelay(10);
- rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff);
- } while (count != 0);
-
- return 0;
-}
static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
{
int retval;
@@ -1063,17 +1003,6 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
return retval;
/*
- * In probe phase call rt2800_enable_wlan_rt3290 to enable wlan
- * clk for rt3290. That avoid the MCU fail in start phase.
- */
- if (rt2x00_rt(rt2x00dev, RT3290)) {
- retval = rt2800_enable_wlan_rt3290(rt2x00dev);
-
- if (retval)
- return retval;
- }
-
- /*
* This device has multiple filters for control frames
* and has a separate filter for PS Poll frames.
*/
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 3c80885..d323a4b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -89,6 +89,12 @@
#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2
#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2
#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4
+#define BCMA_CC_CHIPST_43228_ILP_DIV_EN 0x00000001
+#define BCMA_CC_CHIPST_43228_OTP_PRESENT 0x00000002
+#define BCMA_CC_CHIPST_43228_SERDES_REFCLK_PADSEL 0x00000004
+#define BCMA_CC_CHIPST_43228_SDIO_MODE 0x00000008
+#define BCMA_CC_CHIPST_43228_SDIO_OTP_PRESENT 0x00000010
+#define BCMA_CC_CHIPST_43228_SDIO_RESET 0x00000020
#define BCMA_CC_CHIPST_4706_PKG_OPTION BIT(0) /* 0: full-featured package 1: low-cost package */
#define BCMA_CC_CHIPST_4706_SFLASH_PRESENT BIT(1) /* 0: parallel, 1: serial flash is present */
#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 493fa0c..3d254e1 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -96,6 +96,7 @@ enum ieee80211_band {
* is not permitted.
* @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
* is not permitted.
+ * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
*/
enum ieee80211_channel_flags {
IEEE80211_CHAN_DISABLED = 1<<0,
@@ -104,6 +105,7 @@ enum ieee80211_channel_flags {
IEEE80211_CHAN_RADAR = 1<<3,
IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
+ IEEE80211_CHAN_NO_OFDM = 1<<6,
};
#define IEEE80211_CHAN_NO_HT40 \
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 6fac18c..8557235 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -622,6 +622,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
del_timer_sync(&sdata->u.mesh.housekeeping_timer);
del_timer_sync(&sdata->u.mesh.mesh_path_root_timer);
+ del_timer_sync(&sdata->u.mesh.mesh_path_timer);
/*
* If the timer fired while we waited for it, it will have
* requeued the work. Now the work will be running again
@@ -634,6 +635,8 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
local->fif_other_bss--;
atomic_dec(&local->iff_allmultis);
ieee80211_configure_filter(local);
+
+ sdata->u.mesh.timers_running = 0;
}
static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index cef0c9e..a4a5acd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1430,6 +1430,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
del_timer_sync(&sdata->u.mgd.timer);
del_timer_sync(&sdata->u.mgd.chswitch_timer);
+
+ sdata->u.mgd.timers_running = 0;
}
void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index bcaee5d..839dd97 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -299,7 +299,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
if (local->scan_req != local->int_scan_req)
cfg80211_scan_done(local->scan_req, aborted);
local->scan_req = NULL;
- local->scan_sdata = NULL;
+ rcu_assign_pointer(local->scan_sdata, NULL);
local->scanning = 0;
local->scan_channel = NULL;
@@ -984,7 +984,6 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata)
kfree(local->sched_scan_ies.ie[i]);
drv_sched_scan_stop(local, sdata);
- rcu_assign_pointer(local->sched_scan_sdata, NULL);
}
out:
mutex_unlock(&local->mtx);
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2303ee7..2ded3c7 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -680,6 +680,8 @@ static u32 map_regdom_flags(u32 rd_flags)
channel_flags |= IEEE80211_CHAN_NO_IBSS;
if (rd_flags & NL80211_RRF_DFS)
channel_flags |= IEEE80211_CHAN_RADAR;
+ if (rd_flags & NL80211_RRF_NO_OFDM)
+ channel_flags |= IEEE80211_CHAN_NO_OFDM;
return channel_flags;
}
@@ -901,7 +903,21 @@ static void handle_channel(struct wiphy *wiphy,
chan->max_antenna_gain = min(chan->orig_mag,
(int) MBI_TO_DBI(power_rule->max_antenna_gain));
chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
- chan->max_power = min(chan->max_power, chan->max_reg_power);
+ if (chan->orig_mpwr) {
+ /*
+ * Devices that have their own custom regulatory domain
+ * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
+ * passed country IE power settings.
+ */
+ if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+ wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
+ wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
+ chan->max_power = chan->max_reg_power;
+ else
+ chan->max_power = min(chan->orig_mpwr,
+ chan->max_reg_power);
+ } else
+ chan->max_power = chan->max_reg_power;
}
static void handle_band(struct wiphy *wiphy,
@@ -1885,6 +1901,7 @@ static void restore_custom_reg_settings(struct wiphy *wiphy)
chan->flags = chan->orig_flags;
chan->max_antenna_gain = chan->orig_mag;
chan->max_power = chan->orig_mpwr;
+ chan->beacon_found = false;
}
}
}
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related
* Re: skb_warn_bad_offload with kernel 3.5 (maybe gso/bridge related ?)
From: Ben Hutchings @ 2012-08-03 15:40 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Yann Dupont, netdev@vger.kernel.org, Herbert Xu
In-Reply-To: <1343983887.9299.817.camel@edumazet-glaptop>
On Fri, 2012-08-03 at 10:51 +0200, Eric Dumazet wrote:
> On Fri, 2012-08-03 at 10:10 +0200, Yann Dupont wrote:
> > Hello everybody,
> >
> > I have a machine using ceph rbd volume, as a client (rbd module) to
> > backup data.
> >
> > I was running kernel 3.2.22 ok. Tried 3.5.0 because some rbd fixes went in.
> >
> > Now, shortly after the start, my logs are filled by that :
> >
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.780860]
> > WARNING: at net/core/dev.c:1888 skb_warn_bad_offload+0xb6/0xc1()
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.780920]
> > Hardware name: PowerEdge M605
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.780990] :
> > caps=(0x0000000000005000, 0x0000000000000000) len=7292 data_len=5792
> > gso_size=1448 gso_type=1 ip_summed=1
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.781071]
> > Modules linked in: rbd libceph ipt_MASQUERADE iptable_nat nf_nat
> > ipt_REJECT veth fuse xt_physdev xt_iprange xt_multiport ip6table_filter
> > ip6_tables xt_LOG xt_limit xt_tcpudp xt_state iptable_filter ip_tables
> > x_tables nf_conntrack_tftp nf_conntrack_ftp nf_conntrack_ipv4
> > nf_defrag_ipv4 8021q bridge stp llc ext2 mbcache dm_round_robin
> > dm_multipath scsi_dh nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 ipv6
> > powernow_k8 freq_table mperf kvm_amd snd_pcm kvm snd_timer snd soundcore
> > snd_page_alloc tpm_tis tpm tpm_bios pcspkr evdev psmouse microcode
> > joydev dcdbas shpchp i2c_nforce2 pci_hotplug serio_raw processor
> > i2c_core hid_generic thermal_sys hed button xfs exportfs dm_mod ses
> > enclosure usbhid hid sg sr_mod sd_mod cdrom usb_storage lpfc
> > scsi_transport_fc scsi_tgt ohci_hcd bnx2x mptsas mptscsih bnx2 mptbase
> > scsi_transport_sas crc32c scsi_mod libcrc32c mdio ehci_hcd [last
> > unloaded: scsi_wait_scan]
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.785995]
> > Pid: 0, comm: swapper/0 Not tainted 3.5.0-dsiun-120521 #5
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786055]
> > Call Trace:
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786108]
> > <IRQ> [<ffffffff813bde00>] ? skb_warn_bad_offload+0x6f/0xc1
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786209]
> > [<ffffffff8103a109>] ? warn_slowpath_common+0x79/0xc0
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786269]
> > [<ffffffff8103a205>] ? warn_slowpath_fmt+0x45/0x50
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786330]
> > [<ffffffff81068647>] ? get_nohz_timer_target+0x57/0xd0
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786390]
> > [<ffffffff813bde47>] ? skb_warn_bad_offload+0xb6/0xc1
> > Jul 31 18:15:01 singleton.u06.univ-nantes.prive kernel: [ 1175.786452]
> > [<ffffffff813110e7>] ? skb_gso_segment+0x207/0x280
[...]
> I dont know, maybe its more a GRO issue ?
>
> When a NIC delivers skbs with ip_summed set to CHECKSUM_UNNECESSARY,
> should resulting GRO packet have ip_summed set to CHECKSUM_PARTIAL ?
I think GRO is doing the right thing, and I can't think why we should
see ip_summed = CHECKSUM_PARTIAL if the skb is forwarded by a bridge. I
think skb_gso_segment() now needs to handle CHECKSUM_UNNECESSARY
without warning, and it can be done somewhat more efficiently (as there
is no need to copy payload and generate checksums).
By the way, the warning in skb_gso_segment() is not new, even though I
changed it recently. I don't know why it might have started being
triggered between 3.2 and 3.5.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [REGRESSION][v3.5] iwlwifi: include rssi as part of decision making for reduce txpower
From: Joseph Salisbury @ 2012-08-03 16:24 UTC (permalink / raw)
To: wey-yi.w.guy-ral2JQCrhuEAvxtiuMwx3w,
johannes.berg-ral2JQCrhuEAvxtiuMwx3w, ilw-VuQAYsv1563Yd54FQh9/CA,
linville-2XuSBdqkA4R54TAoqtyWWQ,
emmanuel.grumbach-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hello,
A bug[0] was reported against Ubuntu that reports a kernel panic when
using the hotkey to disable then re-enable wifi on a Dell XPS 14z. A
kernel bisect was performed, which indicated the following commit as the
source of the regression:
commit dd551ab7b47ace14753b0d73f79437cc35adcf6b
Author: Wey-Yi Guy <wey-yi.w.guy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Thu May 3 14:22:01 2012 -0700
iwlwifi: include rssi as part of decision making for reduce txpower
In bt coex, consider the average rssi as part of decision making
process
Change-Id: I8d11d7f177a6875e2a9d08f7539d42253226fd7a
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/1945
Tested-by: Jenkins
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
A test kernel was created with this commit reverted, which stopped the
kernel panic from occurring.
A bugzilla bug[1] has been opened.
Thanks,
Joe
[0] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1029547
[1] https://bugzilla.kernel.org/show_bug.cgi?id=45491
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [REGRESSION][v3.5] iwlwifi: include rssi as part of decision making for reduce txpower
From: Johannes Berg @ 2012-08-03 16:30 UTC (permalink / raw)
To: Joseph Salisbury
Cc: wey-yi.w.guy, ilw, linville, emmanuel.grumbach, linux-wireless,
netdev, linux-kernel
In-Reply-To: <501BFB29.7010801@canonical.com>
On Fri, 2012-08-03 at 12:24 -0400, Joseph Salisbury wrote:
> A test kernel was created with this commit reverted, which stopped the
> kernel panic from occurring.
>
> A bugzilla bug[1] has been opened.
> [0] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1029547
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=45491
This is a duplicate of https://bugzilla.kernel.org/show_bug.cgi?id=45481
which I've already commented on with the correct fix. I've also sent the
fix to stable:
http://www.mail-archive.com/stable@vger.kernel.org/msg12286.html
Thanks,
johannes
^ permalink raw reply
* Re: [REGRESSION][v3.5] iwlwifi: include rssi as part of decision making for reduce txpower
From: Joseph Salisbury @ 2012-08-03 16:43 UTC (permalink / raw)
To: Johannes Berg
Cc: wey-yi.w.guy, ilw, linville, emmanuel.grumbach, linux-wireless,
netdev, linux-kernel
In-Reply-To: <1344011416.4482.11.camel@jlt3.sipsolutions.net>
On 08/03/2012 12:30 PM, Johannes Berg wrote:
> On Fri, 2012-08-03 at 12:24 -0400, Joseph Salisbury wrote:
>
>> A test kernel was created with this commit reverted, which stopped the
>> kernel panic from occurring.
>>
>> A bugzilla bug[1] has been opened.
>> [0] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1029547
>> [1] https://bugzilla.kernel.org/show_bug.cgi?id=45491
> This is a duplicate of https://bugzilla.kernel.org/show_bug.cgi?id=45481
> which I've already commented on with the correct fix. I've also sent the
> fix to stable:
>
> http://www.mail-archive.com/stable@vger.kernel.org/msg12286.html
>
> Thanks,
> johannes
>
Great! Thanks for the feedback, Johannes.
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Tejun Heo @ 2012-08-03 17:15 UTC (permalink / raw)
To: Sasha Levin
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <1344003788-1417-2-git-send-email-levinsasha928@gmail.com>
Hello, Sasha.
On Fri, Aug 03, 2012 at 04:23:02PM +0200, Sasha Levin wrote:
> +#define DEFINE_STATIC_HASHTABLE(n, b) \
> + static struct hash_table n = { .bits = (b), \
> + .buckets = { [0 ... ((1 << (b)) - 1)] = HLIST_HEAD_INIT } }
What does this "static" mean?
> +#define DEFINE_HASHTABLE(n, b) \
> + union { \
> + struct hash_table n; \
> + struct { \
> + size_t bits; \
> + struct hlist_head buckets[1 << (b)]; \
> + } __##n ; \
> + };
Is this supposed to be embedded in struct definition? If so, the name
is rather misleading as DEFINE_* is supposed to define and initialize
stand-alone constructs. Also, for struct members, simply putting hash
entries after struct hash_table should work.
Wouldn't using DEFINE_HASHTABLE() for the first macro and
DEFINE_HASHTABLE_MEMBER() for the latter be better?
> +#define HASH_BITS(name) ((name)->bits)
> +#define HASH_SIZE(name) (1 << (HASH_BITS(name)))
> +
> +__attribute__ ((unused))
Are we using __attribute__((unused)) for functions defined in headers
instead of static inline now? If so, why?
> +static void hash_init(struct hash_table *ht, size_t bits)
> +{
> + size_t i;
I would prefer int here but no biggie.
> + ht->bits = bits;
> + for (i = 0; i < (1 << bits); i++)
> + INIT_HLIST_HEAD(&ht->buckets[i]);
> +}
> +
> +static void hash_add(struct hash_table *ht, struct hlist_node *node, long key)
> +{
> + hlist_add_head(node,
> + &ht->buckets[hash_long((unsigned long)key, HASH_BITS(ht))]);
> +}
> +
> +
> +#define hash_get(name, key, type, member, cmp_fn) \
> +({ \
> + struct hlist_node *__node; \
> + typeof(key) __key = key; \
> + type *__obj = NULL; \
> + hlist_for_each_entry(__obj, __node, &(name)->buckets[ \
> + hash_long((unsigned long) __key, \
> + HASH_BITS(name))], member) \
> + if (cmp_fn(__obj, __key)) \
> + break; \
> + __obj; \
> +})
As opposed to using hash_for_each_possible(), how much difference does
this make? Is it really worthwhile?
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Tejun Heo @ 2012-08-03 17:16 UTC (permalink / raw)
To: Sasha Levin
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <20120803171515.GH15477@google.com>
Ooh, one more thing. Comments please.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Eric Dumazet @ 2012-08-03 17:39 UTC (permalink / raw)
To: Sasha Levin
Cc: torvalds, tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <1344003788-1417-2-git-send-email-levinsasha928@gmail.com>
On Fri, 2012-08-03 at 16:23 +0200, Sasha Levin wrote:
> This hashtable implementation is using hlist buckets to provide a simple
> hashtable to prevent it from getting reimplemented all over the kernel.
>
> +static void hash_add(struct hash_table *ht, struct hlist_node *node, long key)
> +{
> + hlist_add_head(node,
> + &ht->buckets[hash_long((unsigned long)key, HASH_BITS(ht))]);
> +}
> +
Why key is a long, casted later to "unsigned long" ?
hash_long() is expensive on 64bit arches, and not really needed
if key is an u32 from the beginning ( I am referring to your patches 6 &
7 using jhash() )
Maybe you could use a macro, so that we can automatically select
hash_32() if key is an u32, and hash_long() for other types.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [E1000-devel] discussion questions: SR-IOV, virtualization, and bonding
From: Ben Hutchings @ 2012-08-03 17:49 UTC (permalink / raw)
To: John Fastabend
Cc: Jay Vosburgh, Chris Friesen, e1000-devel@lists.sourceforge.net,
netdev
In-Reply-To: <501B587E.6040703@intel.com>
On Thu, 2012-08-02 at 21:50 -0700, John Fastabend wrote:
> On 8/2/2012 4:01 PM, Jay Vosburgh wrote:
[...]
> > Still, though, isn't "influence the guest's choice" pretty much
> > satisified by having the VF interface go carrier down in the guest when
> > the host wants it to? Or are you thinking about more fine grained than
> > that?
> >
>
> Perhaps one argument against this is if the hardware supports loopback
> modes or the edge relay in the hardware is acting like a VEB it may
> still be possible to support VF to VF traffic even if the external link
> is down. Not sure how useful this is though or if any existing hardware
> even supports it.
[...]
It seems to me that VF to VF traffic ought to still work. If it doesn't
then that's an unfortunate regression when moving from software bridging
and virtio to hardware-supported network virtualisation. (But hybrid
network virtualisation may help to solve that.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [RFC v2 7/7] net,9p: use new hashtable implementation
From: Eric Dumazet @ 2012-08-03 18:00 UTC (permalink / raw)
To: Sasha Levin
Cc: torvalds, tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <1344003788-1417-8-git-send-email-levinsasha928@gmail.com>
On Fri, 2012-08-03 at 16:23 +0200, Sasha Levin wrote:
> Switch 9p error table to use the new hashtable implementation. This reduces the amount of
> generic unrelated code in 9p.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> net/9p/error.c | 17 ++++++++---------
> 1 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/net/9p/error.c b/net/9p/error.c
> index 2ab2de7..f1037db 100644
> --- a/net/9p/error.c
> +++ b/net/9p/error.c
> @@ -34,7 +34,7 @@
> #include <linux/jhash.h>
> #include <linux/errno.h>
> #include <net/9p/9p.h>
> -
> +#include <linux/hashtable.h>
> /**
> * struct errormap - map string errors from Plan 9 to Linux numeric ids
> * @name: string sent over 9P
> @@ -50,8 +50,8 @@ struct errormap {
> struct hlist_node list;
> };
>
> -#define ERRHASHSZ 32
> -static struct hlist_head hash_errmap[ERRHASHSZ];
> +#define ERRHASHSZ 5
This name is confusing, it should mention SHIFT or BITS maybe...
> +DEFINE_STATIC_HASHTABLE(hash_errmap, ERRHASHSZ);
>
> /* FixMe - reduce to a reasonable size */
> static struct errormap errmap[] = {
> @@ -196,15 +196,14 @@ int p9_error_init(void)
> int bucket;
remove "int bucket" and use :
u32 hash;
>
> /* initialize hash table */
> - for (bucket = 0; bucket < ERRHASHSZ; bucket++)
> - INIT_HLIST_HEAD(&hash_errmap[bucket]);
> + hash_init(&hash_errmap, ERRHASHSZ);
Why is hash_init() even needed ?
If hash is "DEFINE_STATIC_HASHTABLE(...)", its already ready for use !
>
> /* load initial error map into hash table */
> for (c = errmap; c->name != NULL; c++) {
> c->namelen = strlen(c->name);
> - bucket = jhash(c->name, c->namelen, 0) % ERRHASHSZ;
> + bucket = jhash(c->name, c->namelen, 0);
bucket is a wrong name here, its more like "key" or "hash"
> INIT_HLIST_NODE(&c->list);
> - hlist_add_head(&c->list, &hash_errmap[bucket]);
> + hash_add(&hash_errmap, &c->list, bucket);
> }
>
> return 1;
> @@ -228,8 +227,8 @@ int p9_errstr2errno(char *errstr, int len)
> errno = 0;
> p = NULL;
> c = NULL;
> - bucket = jhash(errstr, len, 0) % ERRHASHSZ;
> - hlist_for_each_entry(c, p, &hash_errmap[bucket], list) {
> + bucket = jhash(errstr, len, 0);
hash = jhash(errstr, len, 0);
> + hash_for_each_possible(&hash_errmap, p, c, list, bucket) {
> if (c->namelen == len && !memcmp(c->name, errstr, len)) {
> errno = c->val;
> break;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH net-next,1/1] hyperv: Move wait completion msg code into rndis_filter_halt_device()
From: Haiyang Zhang @ 2012-08-03 19:32 UTC (permalink / raw)
To: davem, netdev; +Cc: haiyangz, kys, olaf, jasowang, linux-kernel, devel
We need to wait for send_completion msg before put_rndis_request() at
the end of rndis_filter_halt_device(). Otherwise, netvsc_send_completion()
may reference freed memory which is overwritten, and cause panic.
Reported-by: Long Li <longli@microsoft.com>
Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
drivers/net/hyperv/netvsc.c | 7 -------
drivers/net/hyperv/rndis_filter.c | 11 +++++++++++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 6cee291..4a1a5f5 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -383,13 +383,6 @@ int netvsc_device_remove(struct hv_device *device)
unsigned long flags;
net_device = hv_get_drvdata(device);
- spin_lock_irqsave(&device->channel->inbound_lock, flags);
- net_device->destroy = true;
- spin_unlock_irqrestore(&device->channel->inbound_lock, flags);
-
- /* Wait for all send completions */
- wait_event(net_device->wait_drain,
- atomic_read(&net_device->num_outstanding_sends) == 0);
netvsc_disconnect_vsp(net_device);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index e5d6146..1e88a10 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -718,6 +718,9 @@ static void rndis_filter_halt_device(struct rndis_device *dev)
{
struct rndis_request *request;
struct rndis_halt_request *halt;
+ struct netvsc_device *nvdev = dev->net_dev;
+ struct hv_device *hdev = nvdev->dev;
+ ulong flags;
/* Attempt to do a rndis device halt */
request = get_rndis_request(dev, RNDIS_MSG_HALT,
@@ -735,6 +738,14 @@ static void rndis_filter_halt_device(struct rndis_device *dev)
dev->state = RNDIS_DEV_UNINITIALIZED;
cleanup:
+ spin_lock_irqsave(&hdev->channel->inbound_lock, flags);
+ nvdev->destroy = true;
+ spin_unlock_irqrestore(&hdev->channel->inbound_lock, flags);
+
+ /* Wait for all send completions */
+ wait_event(nvdev->wait_drain,
+ atomic_read(&nvdev->num_outstanding_sends) == 0);
+
if (request)
put_rndis_request(dev, request);
return;
--
1.7.4.1
^ permalink raw reply related
* ethtool 3.5 released
From: Ben Hutchings @ 2012-08-03 19:48 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
ethtool version 3.5 has been released.
Home page: https://ftp.kernel.org/pub/software/network/ethtool/
Download link:
https://ftp.kernel.org/pub/software/network/ethtool/ethtool-3.1.tar.gz
Release notes:
* Feature: Display support for 1000BASE-KX and 10GBASE-KX4 link modes
* Feature: Energy-Efficient Ethernet (EEE) configuration
(--show-eee and --set-eee options)
* Fix: Don't trust drivers to null-terminate strings
* Feature: Display support for 40G link modes
* Package: Update RPM summary, description and URL
* Package: Exclude redundant documentation from RPM
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH] ipv4: remove parentheses in return statement
From: Jean Sacren @ 2012-08-03 20:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.dumazet
In-Reply-To: <20120803.015243.1041602621154758483.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Fri, 03 Aug 2012 01:52:43 -0700
>
> From: Jean Sacren <sakiwit@gmail.com>
> Date: Fri, 3 Aug 2012 01:43:10 -0600
>
> > Signed-off-by: Jean Sacren <sakiwit@gmail.com>
>
> > - return ((val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
> > - (IN4_ADDR_HSIZE - 1));
> > + return (val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
> > + (IN4_ADDR_HSIZE - 1);
>
> Those parenthesis are there to make the evaluation order and
> grouping explicit.
>
> The other ones you changed are wrong for similar reasons.
Barring the speed issue raised by Eric Dumazet, this patch is correct.
To illustrate, the patch merely changes
return (A);
to
return A;
where A is nothing but an expression, regardless if it is a simple one
or a compound one.
Whatever A is, it evaluates to a value. The parentheses do _not_
contribute to the evaluation. They do not alter precedence. They do not
make the evaluation order explicit. They are there to serve no purpose,
yet they do make return statement look like a function call.
Moreover, A is one single entity. It does not group with anything else.
I really don't see the significance of making A a group by itself.
Thank you for reviewing the patch. With all due respect, your assessment
is hard to agree with this moment.
--
Jean Sacren
^ permalink raw reply
* Re: [PATCH V2 09/12] net/eipoib: Add main driver functionality
From: Ali Ayoub @ 2012-08-03 20:31 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Or Gerlitz, davem, roland, netdev, sean.hefty, Erez Shitrit
In-Reply-To: <87boitz044.fsf@xmission.com>
On 8/2/2012 10:15 AM, Eric W. Biederman wrote:
> Or Gerlitz <ogerlitz@mellanox.com> writes:
>
>> From: Erez Shitrit <erezsh@mellanox.co.il>
>>
>> The eipoib driver provides a standard Ethernet netdevice over
>> the InfiniBand IPoIB interface .
>>
>> Some services can run only on top of Ethernet L2 interfaces, and cannot be
>> bound to an IPoIB interface. With this new driver, these services can run
>> seamlessly.
>
> Do I read this code correctly that what you are doing is not tunneling
> ethernet over IB but instead you are removing an ethernet header and
> replacing it with an IB header?
Correct.
eIPoIB runs standard IPoIB on the wire, thus it doesn't encapsulate the
Ethernet frame on top of IPoIB, but rather translates it to an IPoIB
packet, this allows us to expose an Ethernet L2 network device, and
still keep interoperability with existing IPoIB endpoints. Running full
encapsulation (i.e. EoIPoIB) will break interoperability.
> Do I also read this code correctly if you can't find your destination
> mac address in your ""neighbor table"" you do a normal IPoIB arp
> for the infiniband GUID?
Correct.
Wire protocol remains IPoIB.
> Do I read this right that if presented with a non-IPv4 or ARP packet
> this code will do something undefined and unpredictable?
The current code drops IPv6 packets (see IS_E_IPOIB_PROTO), IPv6 support
will be added later on.
> Maybe this makes some sense but just skimming it looks like you
> are trying to force a square peg into a round hole resulting in
> some weird code and some very weird maintainability issues.
>
> I am honestly surprised at this approach. I would think it would be
> faster and simpler to run an IB queue pair directly to the hypervisor or
> possibly even the guest operating system bypassing the kernel and doing
> all of this translation in userspace.
With eIPoIB architecture, the VM sees standard Ethernet emulator,
allowing the administrator to enslave eIPoIB PIF to the vSwitch/vBridge
as if it was standard Ethernet. Other approaches that exposes IB QP to
the VM (with w/o bypassing the kernel) won't be possible with the
current emulators and management tools.
--
Ali;
^ permalink raw reply
* Re: [RFC v2 7/7] net,9p: use new hashtable implementation
From: Sasha Levin @ 2012-08-03 21:14 UTC (permalink / raw)
To: Eric Dumazet
Cc: torvalds, tj, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <1344016851.9299.1415.camel@edumazet-glaptop>
On 08/03/2012 08:00 PM, Eric Dumazet wrote:
> On Fri, 2012-08-03 at 16:23 +0200, Sasha Levin wrote:
>> /* initialize hash table */
>> - for (bucket = 0; bucket < ERRHASHSZ; bucket++)
>> - INIT_HLIST_HEAD(&hash_errmap[bucket]);
>> + hash_init(&hash_errmap, ERRHASHSZ);
>
> Why is hash_init() even needed ?
>
> If hash is "DEFINE_STATIC_HASHTABLE(...)", its already ready for use !
Indeed it is.
I've removed it, and then decided to put it back since the definition of the hashtable isn't fully cooked yet, and I didn't want to miss this initialization point if it turn out we need to initialize that hashtable afterall.
I will remove it once the hashtable definitions are clear.
The rest of the review comments will be addressed.
Thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Sasha Levin @ 2012-08-03 21:19 UTC (permalink / raw)
To: Tejun Heo
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <20120803171515.GH15477@google.com>
On 08/03/2012 07:15 PM, Tejun Heo wrote:
> Hello, Sasha.
>
> On Fri, Aug 03, 2012 at 04:23:02PM +0200, Sasha Levin wrote:
>> +#define DEFINE_STATIC_HASHTABLE(n, b) \
>> + static struct hash_table n = { .bits = (b), \
>> + .buckets = { [0 ... ((1 << (b)) - 1)] = HLIST_HEAD_INIT } }
>
> What does this "static" mean?
>
>> +#define DEFINE_HASHTABLE(n, b) \
>> + union { \
>> + struct hash_table n; \
>> + struct { \
>> + size_t bits; \
>> + struct hlist_head buckets[1 << (b)]; \
>> + } __##n ; \
>> + };
>
> Is this supposed to be embedded in struct definition? If so, the name
> is rather misleading as DEFINE_* is supposed to define and initialize
> stand-alone constructs. Also, for struct members, simply putting hash
> entries after struct hash_table should work.
It would work, but I didn't want to just put them in the union since I feel it's safer to keep them in a separate struct so they won't be used by mistake,
> Wouldn't using DEFINE_HASHTABLE() for the first macro and
> DEFINE_HASHTABLE_MEMBER() for the latter be better?
Indeed that sounds better, will fix.
>> +#define HASH_BITS(name) ((name)->bits)
>> +#define HASH_SIZE(name) (1 << (HASH_BITS(name)))
>> +
>> +__attribute__ ((unused))
>
> Are we using __attribute__((unused)) for functions defined in headers
> instead of static inline now? If so, why?
>
>> +static void hash_init(struct hash_table *ht, size_t bits)
>> +{
>> + size_t i;
>
> I would prefer int here but no biggie.
Just wondering, is there a particular reason behind it?
>> + ht->bits = bits;
>> + for (i = 0; i < (1 << bits); i++)
>> + INIT_HLIST_HEAD(&ht->buckets[i]);
>> +}
>> +
>> +static void hash_add(struct hash_table *ht, struct hlist_node *node, long key)
>> +{
>> + hlist_add_head(node,
>> + &ht->buckets[hash_long((unsigned long)key, HASH_BITS(ht))]);
>> +}
>> +
>> +
>> +#define hash_get(name, key, type, member, cmp_fn) \
>> +({ \
>> + struct hlist_node *__node; \
>> + typeof(key) __key = key; \
>> + type *__obj = NULL; \
>> + hlist_for_each_entry(__obj, __node, &(name)->buckets[ \
>> + hash_long((unsigned long) __key, \
>> + HASH_BITS(name))], member) \
>> + if (cmp_fn(__obj, __key)) \
>> + break; \
>> + __obj; \
>> +})
>
> As opposed to using hash_for_each_possible(), how much difference does
> this make? Is it really worthwhile?
Most of the places I've switched to using this hashtable so far (4 out of 6) are using hash_get(). I think that the code looks cleaner when you an just provide a comparison function instead of implementing the iteration itself.
I think hash_for_for_each_possible() is useful if the comparison condition is more complex than a simple comparison of one of the object members with the key - there's no need to force it on all the users.
>
> Thanks.
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Tejun Heo @ 2012-08-03 21:30 UTC (permalink / raw)
To: Sasha Levin
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <501C407D.9080900@gmail.com>
Hello,
On Fri, Aug 03, 2012 at 11:19:57PM +0200, Sasha Levin wrote:
> > Is this supposed to be embedded in struct definition? If so, the name
> > is rather misleading as DEFINE_* is supposed to define and initialize
> > stand-alone constructs. Also, for struct members, simply putting hash
> > entries after struct hash_table should work.
>
> It would work, but I didn't want to just put them in the union since
> I feel it's safer to keep them in a separate struct so they won't be
> used by mistake,
Just use ugly enough pre/postfixes. If the user still accesses that,
it's the user's fault.
> >> +static void hash_init(struct hash_table *ht, size_t bits)
> >> +{
> >> + size_t i;
> >
> > I would prefer int here but no biggie.
>
> Just wondering, is there a particular reason behind it?
It isn't a size and using unsigned when signed suffices seems to cause
more headache than helps anything usually due to lack of values to use
for exceptional conditions (usually -errno or -1).
> > As opposed to using hash_for_each_possible(), how much difference does
> > this make? Is it really worthwhile?
>
> Most of the places I've switched to using this hashtable so far (4
> out of 6) are using hash_get(). I think that the code looks cleaner
> when you an just provide a comparison function instead of
> implementing the iteration itself.
>
> I think hash_for_for_each_possible() is useful if the comparison
> condition is more complex than a simple comparison of one of the
> object members with the key - there's no need to force it on all the
> users.
I don't know. What's the difference? In terms of LOC, it might even
not save any thanks to the extra function definition, right? I don't
think it's saving enough complexity to justify a separate rather
unusual interface.
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH] ipv4: remove parentheses in return statement
From: David Miller @ 2012-08-03 21:31 UTC (permalink / raw)
To: sakiwit; +Cc: netdev, eric.dumazet
In-Reply-To: <20120803202350.GA7520@mail.gmail.com>
From: Jean Sacren <sakiwit@gmail.com>
Date: Fri, 3 Aug 2012 14:23:50 -0600
> To illustrate, the patch merely changes
>
> return (A);
>
> to
>
> return A;
Life is not black and white my friend, there are shades
of gray. I feel bad for you if you read coding style rules
in a %100 literal sense with no room for interpretation.
People add extra parenthesis to add clarity, so you are
entirely misrepresenting these cases.
This was not a simple case of:
return (A);
but more like something that looks as:
return ((A & B) | (C ^ D));
and that is perfectly fine.
^ permalink raw reply
* Re: [PATCH V2 09/12] net/eipoib: Add main driver functionality
From: David Miller @ 2012-08-03 21:33 UTC (permalink / raw)
To: ali; +Cc: ebiederm, ogerlitz, roland, netdev, sean.hefty, erezsh
In-Reply-To: <501C3527.6060809@mellanox.com>
From: Ali Ayoub <ali@mellanox.com>
Date: Fri, 03 Aug 2012 13:31:35 -0700
> With eIPoIB architecture, the VM sees standard Ethernet emulator,
> allowing the administrator to enslave eIPoIB PIF to the vSwitch/vBridge
> as if it was standard Ethernet. Other approaches that exposes IB QP to
> the VM (with w/o bypassing the kernel) won't be possible with the
> current emulators and management tools.
So then fix the emulators and management tools to handle IB instead
of adding this bogus new protocol?
This new protocol seems to exist only because you don't want to have
to enhance the emulators and tools, and I'm sorry that isn't a valid
reason to do something like this.
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Sasha Levin @ 2012-08-03 21:36 UTC (permalink / raw)
To: Tejun Heo
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <20120803213017.GK15477@google.com>
On 08/03/2012 11:30 PM, Tejun Heo wrote:
>> I think hash_for_for_each_possible() is useful if the comparison
>> > condition is more complex than a simple comparison of one of the
>> > object members with the key - there's no need to force it on all the
>> > users.
> I don't know. What's the difference? In terms of LOC, it might even
> not save any thanks to the extra function definition, right? I don't
> think it's saving enough complexity to justify a separate rather
> unusual interface.
The function definition itself is just a macro, for example:
#define MM_SLOTS_HASH_CMP(mm_slot, obj) ((mm_slot)->mm == (obj))
As an alternative, what do you think about simplifying that to be just a 'cond' instead of a function? Something like:
hash_get(&mm_slots_hash, mm, struct mm_slot, hash, mm);
In that case, the last param ("mm") will get unrolled to a condition like this:
if ((obj)->mm == key)
Which will be simple and easy for the user.
The only reason I want to keep this interface is that most cases I've stumbled so far were easy short comparisons of a struct member with the key, and I don't want to make them more complex than they need to be. I probably will switch hash_get() to use hash_for_each_possible() as well, which will cut down on how hash_get() is a separate case.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [RFC v2 1/7] hashtable: introduce a small and naive hashtable
From: Sasha Levin @ 2012-08-03 21:41 UTC (permalink / raw)
To: Tejun Heo
Cc: torvalds, akpm, linux-kernel, linux-mm, paul.gortmaker, davem,
rostedt, mingo, ebiederm, aarcange, ericvh, netdev
In-Reply-To: <20120803213017.GK15477@google.com>
On 08/03/2012 11:30 PM, Tejun Heo wrote:
> Hello,
>
> On Fri, Aug 03, 2012 at 11:19:57PM +0200, Sasha Levin wrote:
>>> Is this supposed to be embedded in struct definition? If so, the name
>>> is rather misleading as DEFINE_* is supposed to define and initialize
>>> stand-alone constructs. Also, for struct members, simply putting hash
>>> entries after struct hash_table should work.
>>
>> It would work, but I didn't want to just put them in the union since
>> I feel it's safer to keep them in a separate struct so they won't be
>> used by mistake,
>
> Just use ugly enough pre/postfixes. If the user still accesses that,
> it's the user's fault.
I forgot to comment on that one, sorry.
If we put hash entries after struct hash_table we don't take the bits field size into account, or did I miss something?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ 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