Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 084c9535 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'qdisc-hashtable'



Jiri Kosina says:

====================
Convert qdisc linked list into a hashtable

This is a respin of the v6 of the original patch [1], split into two-patch
series as requested by davem; first patch fixes all symbol conflicts
that'd happen once netdevice.h starts to include hashtable.h, the second
one performs the actual switch to hashtable.

I've preserved Cong's Reviewed-by:, as code-wise this series is identical
to the original v6 of the patch.

[1] lkml.kernel.org/r/alpine.LNX.2.00.1608011220580.22028@cbobk.fhfr.pm
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents b89b815c 59cc1f61
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -597,14 +597,14 @@ static u32 hash_get(u8 *addr)
}

/**
 * hash_add - Hash function to add mac addr from hash table
 * emac_hash_add - Hash function to add mac addr from hash table
 * @priv: The DaVinci EMAC private adapter structure
 * @mac_addr: mac address to delete from hash table
 *
 * Adds mac address to the internal hash table
 *
 */
static int hash_add(struct emac_priv *priv, u8 *mac_addr)
static int emac_hash_add(struct emac_priv *priv, u8 *mac_addr)
{
	struct device *emac_dev = &priv->ndev->dev;
	u32 rc = 0;
@@ -613,7 +613,7 @@ static int hash_add(struct emac_priv *priv, u8 *mac_addr)

	if (hash_value >= EMAC_NUM_MULTICAST_BITS) {
		if (netif_msg_drv(priv)) {
			dev_err(emac_dev, "DaVinci EMAC: hash_add(): Invalid "\
			dev_err(emac_dev, "DaVinci EMAC: emac_hash_add(): Invalid "\
				"Hash %08x, should not be greater than %08x",
				hash_value, (EMAC_NUM_MULTICAST_BITS - 1));
		}
@@ -639,14 +639,14 @@ static int hash_add(struct emac_priv *priv, u8 *mac_addr)
}

/**
 * hash_del - Hash function to delete mac addr from hash table
 * emac_hash_del - Hash function to delete mac addr from hash table
 * @priv: The DaVinci EMAC private adapter structure
 * @mac_addr: mac address to delete from hash table
 *
 * Removes mac address from the internal hash table
 *
 */
static int hash_del(struct emac_priv *priv, u8 *mac_addr)
static int emac_hash_del(struct emac_priv *priv, u8 *mac_addr)
{
	u32 hash_value;
	u32 hash_bit;
@@ -696,10 +696,10 @@ static void emac_add_mcast(struct emac_priv *priv, u32 action, u8 *mac_addr)

	switch (action) {
	case EMAC_MULTICAST_ADD:
		update = hash_add(priv, mac_addr);
		update = emac_hash_add(priv, mac_addr);
		break;
	case EMAC_MULTICAST_DEL:
		update = hash_del(priv, mac_addr);
		update = emac_hash_del(priv, mac_addr);
		break;
	case EMAC_ALL_MULTI_SET:
		update = 1;
+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include <uapi/linux/netdevice.h>
#include <uapi/linux/if_bonding.h>
#include <uapi/linux/pkt_cls.h>
#include <linux/hashtable.h>

struct netpoll_info;
struct device;
@@ -1800,6 +1801,9 @@ struct net_device {
	unsigned int		num_tx_queues;
	unsigned int		real_num_tx_queues;
	struct Qdisc		*qdisc;
#ifdef CONFIG_NET_SCHED
	DECLARE_HASHTABLE	(qdisc_hash, 4);
#endif
	unsigned long		tx_queue_len;
	spinlock_t		tx_global_lock;
	int			watchdog_timeo;
+2 −2
Original line number Diff line number Diff line
@@ -90,8 +90,8 @@ int unregister_qdisc(struct Qdisc_ops *qops);
void qdisc_get_default(char *id, size_t len);
int qdisc_set_default(const char *id);

void qdisc_list_add(struct Qdisc *q);
void qdisc_list_del(struct Qdisc *q);
void qdisc_hash_add(struct Qdisc *q);
void qdisc_hash_del(struct Qdisc *q);
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ struct Qdisc {
	u32			limit;
	const struct Qdisc_ops	*ops;
	struct qdisc_size_table	__rcu *stab;
	struct list_head	list;
	struct hlist_node       hash;
	u32			handle;
	u32			parent;
	void			*u32_node;
+3 −0
Original line number Diff line number Diff line
@@ -7629,6 +7629,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
	INIT_LIST_HEAD(&dev->all_adj_list.lower);
	INIT_LIST_HEAD(&dev->ptype_all);
	INIT_LIST_HEAD(&dev->ptype_specific);
#ifdef CONFIG_NET_SCHED
	hash_init(dev->qdisc_hash);
#endif
	dev->priv_flags = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM;
	setup(dev);

Loading