* [PATCH net-next v3 4/7] ibmvnic: Update TX pool initialization routine
From: Thomas Falcon @ 2018-03-15 16:02 UTC (permalink / raw)
To: netdev; +Cc: jallen, nfont, davem, Thomas Falcon
In-Reply-To: <1521129763-21030-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
Introduce function that initializes one TX pool. Use that to
create each pool entry in both the standard TX pool and TSO
pool arrays.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 90 ++++++++++++++++++++------------------
1 file changed, 48 insertions(+), 42 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 258d54e..2bb5d56 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -635,13 +635,43 @@ static void release_tx_pools(struct ibmvnic_adapter *adapter)
adapter->num_active_tx_pools = 0;
}
+static int init_one_tx_pool(struct net_device *netdev,
+ struct ibmvnic_tx_pool *tx_pool,
+ int num_entries, int buf_size)
+{
+ struct ibmvnic_adapter *adapter = netdev_priv(netdev);
+ int i;
+
+ tx_pool->tx_buff = kcalloc(num_entries,
+ sizeof(struct ibmvnic_tx_buff),
+ GFP_KERNEL);
+ if (!tx_pool->tx_buff)
+ return -1;
+
+ if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff,
+ num_entries * buf_size))
+ return -1;
+
+ tx_pool->free_map = kcalloc(num_entries, sizeof(int), GFP_KERNEL);
+ if (!tx_pool->free_map)
+ return -1;
+
+ for (i = 0; i < num_entries; i++)
+ tx_pool->free_map[i] = i;
+
+ tx_pool->consumer_index = 0;
+ tx_pool->producer_index = 0;
+ tx_pool->num_buffers = num_entries;
+ tx_pool->buf_size = buf_size;
+
+ return 0;
+}
+
static int init_tx_pools(struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
- struct device *dev = &adapter->vdev->dev;
- struct ibmvnic_tx_pool *tx_pool;
int tx_subcrqs;
- int i, j;
+ int i, rc;
tx_subcrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
adapter->tx_pool = kcalloc(tx_subcrqs,
@@ -649,53 +679,29 @@ static int init_tx_pools(struct net_device *netdev)
if (!adapter->tx_pool)
return -1;
+ adapter->tso_pool = kcalloc(tx_subcrqs,
+ sizeof(struct ibmvnic_tx_pool), GFP_KERNEL);
+ if (!adapter->tso_pool)
+ return -1;
+
adapter->num_active_tx_pools = tx_subcrqs;
for (i = 0; i < tx_subcrqs; i++) {
- tx_pool = &adapter->tx_pool[i];
-
- netdev_dbg(adapter->netdev,
- "Initializing tx_pool[%d], %lld buffs\n",
- i, adapter->req_tx_entries_per_subcrq);
-
- tx_pool->tx_buff = kcalloc(adapter->req_tx_entries_per_subcrq,
- sizeof(struct ibmvnic_tx_buff),
- GFP_KERNEL);
- if (!tx_pool->tx_buff) {
- dev_err(dev, "tx pool buffer allocation failed\n");
- release_tx_pools(adapter);
- return -1;
- }
-
- if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff,
- adapter->req_tx_entries_per_subcrq *
- (adapter->req_mtu + VLAN_HLEN))) {
- release_tx_pools(adapter);
- return -1;
- }
-
- /* alloc TSO ltb */
- if (alloc_long_term_buff(adapter, &tx_pool->tso_ltb,
- IBMVNIC_TSO_BUFS *
- IBMVNIC_TSO_BUF_SZ)) {
+ rc = init_one_tx_pool(netdev, &adapter->tx_pool[i],
+ adapter->req_tx_entries_per_subcrq,
+ adapter->req_mtu + VLAN_HLEN);
+ if (rc) {
release_tx_pools(adapter);
- return -1;
+ return rc;
}
- tx_pool->tso_index = 0;
-
- tx_pool->free_map = kcalloc(adapter->req_tx_entries_per_subcrq,
- sizeof(int), GFP_KERNEL);
- if (!tx_pool->free_map) {
+ init_one_tx_pool(netdev, &adapter->tso_pool[i],
+ IBMVNIC_TSO_BUFS,
+ IBMVNIC_TSO_BUF_SZ);
+ if (rc) {
release_tx_pools(adapter);
- return -1;
+ return rc;
}
-
- for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++)
- tx_pool->free_map[j] = j;
-
- tx_pool->consumer_index = 0;
- tx_pool->producer_index = 0;
}
return 0;
--
2.7.5
^ permalink raw reply related
* [PATCH net-next v3 2/7] ibmvnic: Update and clean up reset TX pool routine
From: Thomas Falcon @ 2018-03-15 16:02 UTC (permalink / raw)
To: netdev; +Cc: jallen, nfont, davem, Thomas Falcon
In-Reply-To: <1521129763-21030-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
Update TX pool reset routine to accommodate new TSO pool array. Introduce
a function that resets one TX pool, and use that function to initialize
each pool in both pool arrays.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 45 +++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 9c7d19c..4dc3044 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -557,36 +557,41 @@ static int init_rx_pools(struct net_device *netdev)
return 0;
}
+static int reset_one_tx_pool(struct ibmvnic_adapter *adapter,
+ struct ibmvnic_tx_pool *tx_pool)
+{
+ int rc, i;
+
+ rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff);
+ if (rc)
+ return rc;
+
+ memset(tx_pool->tx_buff, 0,
+ tx_pool->num_buffers *
+ sizeof(struct ibmvnic_tx_buff));
+
+ for (i = 0; i < tx_pool->num_buffers; i++)
+ tx_pool->free_map[i] = i;
+
+ tx_pool->consumer_index = 0;
+ tx_pool->producer_index = 0;
+
+ return 0;
+}
+
static int reset_tx_pools(struct ibmvnic_adapter *adapter)
{
- struct ibmvnic_tx_pool *tx_pool;
int tx_scrqs;
- int i, j, rc;
+ int i, rc;
tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
for (i = 0; i < tx_scrqs; i++) {
- netdev_dbg(adapter->netdev, "Re-setting tx_pool[%d]\n", i);
-
- tx_pool = &adapter->tx_pool[i];
-
- rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff);
+ rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]);
if (rc)
return rc;
-
- rc = reset_long_term_buff(adapter, &tx_pool->tso_ltb);
+ rc = reset_one_tx_pool(adapter, &adapter->tx_pool[i]);
if (rc)
return rc;
-
- memset(tx_pool->tx_buff, 0,
- adapter->req_tx_entries_per_subcrq *
- sizeof(struct ibmvnic_tx_buff));
-
- for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++)
- tx_pool->free_map[j] = j;
-
- tx_pool->consumer_index = 0;
- tx_pool->producer_index = 0;
- tx_pool->tso_index = 0;
}
return 0;
--
2.7.5
^ permalink raw reply related
* [PATCH net-next v3 1/7] ibmvnic: Generalize TX pool structure
From: Thomas Falcon @ 2018-03-15 16:02 UTC (permalink / raw)
To: netdev; +Cc: jallen, nfont, davem, Thomas Falcon
In-Reply-To: <1521129763-21030-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
Remove some unused fields in the structure and include values
describing the individual buffer size and number of buffers in
a TX pool. This allows us to use these fields for TX pool buffer
accounting as opposed to using hard coded values. Finally, split
TSO buffers out and provide an additional TX pool array for TSO.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 099c89d..a2e21b3 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -917,11 +917,9 @@ struct ibmvnic_tx_pool {
int *free_map;
int consumer_index;
int producer_index;
- wait_queue_head_t ibmvnic_tx_comp_q;
- struct task_struct *work_thread;
struct ibmvnic_long_term_buff long_term_buff;
- struct ibmvnic_long_term_buff tso_ltb;
- int tso_index;
+ int num_buffers;
+ int buf_size;
};
struct ibmvnic_rx_buff {
@@ -1044,6 +1042,7 @@ struct ibmvnic_adapter {
u64 promisc;
struct ibmvnic_tx_pool *tx_pool;
+ struct ibmvnic_tx_pool *tso_pool;
struct completion init_done;
int init_done_rc;
--
2.7.5
^ permalink raw reply related
* [PATCH net-next v3 0/7] ibmvnic: Update TX pool and TX routines
From: Thomas Falcon @ 2018-03-15 16:02 UTC (permalink / raw)
To: netdev; +Cc: jallen, nfont, davem, Thomas Falcon
This patch restructures the TX pool data structure and provides a
separate TX pool array for TSO transmissions. This is already used
in some way due to our unique DMA situation, namely that we cannot
use single DMA mappings for packet data. Previously, both buffer
arrays used the same pool entry. This restructuring allows for
some additional cleanup in the driver code, especially in some
places in the device transmit routine.
In addition, it allows us to more easily track the consumer
and producer indexes of a particular pool. This has been
further improved by better tracking of in-use buffers to
prevent possible data corruption in case an invalid buffer
entry is used.
v3: Forgot to update TX pool cleaning function to handle new data
structures. Included 7th patch for that.
v2: Fix typo in 3/6 commit subject line
Thomas Falcon (7):
ibmvnic: Generalize TX pool structure
ibmvnic: Update and clean up reset TX pool routine
ibmvnic: Update release TX pool routine
ibmvnic: Update TX pool initialization routine
ibmvnic: Update TX and TX completion routines
ibmvnic: Improve TX buffer accounting
ibmvnic: Update TX pool cleaning routine
drivers/net/ethernet/ibm/ibmvnic.c | 275 +++++++++++++++++++++----------------
drivers/net/ethernet/ibm/ibmvnic.h | 8 +-
2 files changed, 160 insertions(+), 123 deletions(-)
--
2.7.5
^ permalink raw reply
* Re: [RFC PATCH 0/2] net:setup XPS mapping for each online CPU
From: Eric Dumazet @ 2018-03-15 15:59 UTC (permalink / raw)
To: Paolo Abeni
Cc: netdev, David Miller, Jeff Kirsher, intel-wired-lan,
Alexander Duyck
In-Reply-To: <1521129082.2681.13.camel@redhat.com>
On Thu, Mar 15, 2018 at 8:51 AM Paolo Abeni <pabeni@redhat.com> wrote:
> Hi,
> On Thu, 2018-03-15 at 15:31 +0000, Eric Dumazet wrote:
> > On Thu, Mar 15, 2018 at 8:08 AM Paolo Abeni <pabeni@redhat.com> wrote:
> >
> > > Currently, most MQ netdevice setup the default XPS configuration
mapping
> >
> > 1-1
> > > the first real_num_tx_queues queues and CPUs and no mapping is
created for
> > > the CPUs with id greater then real_num_tx_queues, if any.
> > > As a result, the xmit path for unconnected sockets on such cores
> >
> > experiences a
> > > relevant overhead in netdev_pick_tx(), which needs to dissect each
packet
> >
> > and
> > > compute its hash.
> > > Such scenario is easily triggered. e.g. from DNS server under relevant
> >
> > load, as
> > > the user-space process is moved away from the CPUs serving the
softirqs
> >
> > (note:
> > > this is beneficial for the overall DNS server performances).
> > > This series introduces an helper to easily setup up XPS mapping for
all
> >
> > the
> > > online CPUs, and use it in the ixgbe driver, demonstrating a relevant
> > > performance improvement in the above scenario.
> > > Paolo Abeni (2):
> > > net: introduce netif_set_xps()
> > > ixgbe: setup XPS via netif_set_xps()
> >
> >
> > Resent, not HTML this time, sorry for duplication.
> >
> > I truly believe XPS should not be setup by devices.
> >
> > XPS is policy, and policy does belong to user space.
> Thank you for your comments!
> As general principle, I agree policies should be in user-space, but I
> also think that the kernel should provide a reasonable default. Many MQ
> devices already configure XPS and their default is AFAICS sub-optimal.
> > Note that if XPS is not setup, MQ queue selection is just fine by
default ;
> I'm sorry, I do not follow. AFAICS with unconnected sockets without XPS
> we always hit the netdev_pick_tx()/skb_tx_hash()/skb_flow_dissect()
> overhead in xmit path.
Then fix this if you want, instead of fixing one NIC only, or by enforcing
XPS by all NIC.
For unconnected sockets, picking the TX queue based on current cpu is good,
we do not have to enforce ordering as much as possible.
(pfifo_fast no longer can enforce it anyway)
^ permalink raw reply
* Re: [PATCH] Bluetooth: btrsi: rework dependencies
From: Arnd Bergmann @ 2018-03-15 15:57 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Johan Hedberg, Kalle Valo, Linux Bluetooth mailing list, LKML,
linux-wireless, Networking
In-Reply-To: <EE0D5CBE-0867-4FE0-B157-CA4086C84233@holtmann.org>
On Thu, Mar 15, 2018 at 4:50 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
>> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
>> index 03cfc1b20c4a..9e8d22712ff3 100644
>> --- a/drivers/bluetooth/Makefile
>> +++ b/drivers/bluetooth/Makefile
>> @@ -28,7 +28,7 @@ obj-$(CONFIG_BT_QCA) += btqca.o
>>
>> obj-$(CONFIG_BT_HCIUART_NOKIA) += hci_nokia.o
>>
>> -obj-$(CONFIG_BT_HCIRSI) += btrsi.o
>> +obj-$(CONFIG_BT_HCIRSI_MODULE) += btrsi.o
>
> do we need this new option? I have avoided these kind of complex things multi config entries. Can we not just select the RSI_91X?
>
I couldn't come up with a simpler way to do this.
Selecting RSI_91X is not possible unless we make the BT
driver 'depend on WLAN_VENDOR_RSI && MAC80211',
which is even more backwards.
The problem here is that it's actually a reverse dependency:
the wlan driver calls into the bt driver.
What we could do is to make BT_HCIRSI a silent symbol
and have that selected by RSI_COEX, which can then
be user-visible. With that, the Kconfig structure would follow
what the code does.
Arnd
^ permalink raw reply
* Re: [PATCH] net: dev_forward_skb(): Scrub packet's per-netns info only when crossing netns
From: Shmulik Ladkani @ 2018-03-15 15:54 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Liran Alon, davem, netdev, linux-kernel, idan.brown, Yuval Shaia
In-Reply-To: <cd0b73e3-2cde-1442-4312-566c69571e8a@iogearbox.net>
On Thu, 15 Mar 2018 16:13:39 +0100 Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 03/15/2018 01:50 PM, Shmulik Ladkani wrote:
> >
> > It would be beneficial to have the mark preserved when skb is injected
> > to the slave device's rx path (especially when it's on the same netns).
>
> Right, I think also here the easiest would be to have a BPF_F_PRESERVE_MARK
> flag to opt-in in general case (xnet/non-xnet)
Sounds okay to me.
> But lets presume for a sec you would _not_ scrub it, then how are users
> supposed to make use of this? The feature/bug may not be critical enough
> (well, otherwise it wouldn't have been like this for long time) for stable,
> so to write an app relying on it the behavior will change from kernel A to
> kernel B, where you need to end up having a full blown veth run-time test
> in order to figure it out before you can use it, not really useful either.
Let's assume BPF_F_PRESERVE_MARK is a feature then, which is available only
in new kernels.
As said, this flag will not be honored by older kernels.
But your "run-time test" argument is true for every new flag-bit
introduced to bpf functions, for example:
BPF_F_SEQ_NUMBER was added after other skb_set_tunnel_key flags,
Same for BPF_F_INVALIDATE_HASH (skb_store_bytes), BPF_F_MARK_ENFORCE
(l4_csum_replace) and others.
With every flag addition, the flag mask validation in the corresponding
bpf function has been relaxed to support it.
Why is BPF_F_PRESERVE_MARK any different from any previous flag addition?
Thanks,
Shmulik
^ permalink raw reply
* Re: [PATCH net-next 1/6] net: Convert l2tp_net_ops
From: Guillaume Nault @ 2018-03-15 15:52 UTC (permalink / raw)
To: Kirill Tkhai
Cc: dev-yBygre7rU0TnMu66kgdUjQ, wensong-ud5FBsm0p/xg9hUCZPvPmw,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
netdev-u79uwXL29TY76Z2rM5mHXA,
roopa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR,
dsahern-Re5JQEeQqe8AvxtiuMwx3w, fw-HFFVJYpyMKqzQB+pC5nmwQ,
jchapman-Bm0nJX+W7e9BDgjK7y7TUQ, lvs-devel-u79uwXL29TY76Z2rM5mHXA,
ja-FgGsKACvmQM, netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
elena.reshetova-ral2JQCrhuEAvxtiuMwx3w,
amine.kherbouche-pdR9zngts4EAvxtiuMwx3w,
kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
rshearma-43mecJUBy8ZBDgjK7y7TUQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
pablo-Cap9r6Oaw4JrovVCs/uTlw, dwindsor-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <152110505785.28582.3727938208418496683.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On Thu, Mar 15, 2018 at 12:10:57PM +0300, Kirill Tkhai wrote:
> Init method is rather simple. Exit method queues del_work
> for every tunnel from per-net list. This seems to be safe
> to be marked async.
>
Acked-by: Guillaume Nault <g.nault-pHk1y4uTXVDytLWWfqlThQ@public.gmane.org>
^ permalink raw reply
* Re: [RFC PATCH 0/2] net:setup XPS mapping for each online CPU
From: Paolo Abeni @ 2018-03-15 15:51 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, David Miller, Jeff Kirsher, intel-wired-lan,
Alexander Duyck
In-Reply-To: <CANn89iKcHzs2enS-CjNx3xJWwXwjX9Uu_7JYihOR4=HPsQLj6Q@mail.gmail.com>
Hi,
On Thu, 2018-03-15 at 15:31 +0000, Eric Dumazet wrote:
> On Thu, Mar 15, 2018 at 8:08 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> > Currently, most MQ netdevice setup the default XPS configuration mapping
>
> 1-1
> > the first real_num_tx_queues queues and CPUs and no mapping is created for
> > the CPUs with id greater then real_num_tx_queues, if any.
> > As a result, the xmit path for unconnected sockets on such cores
>
> experiences a
> > relevant overhead in netdev_pick_tx(), which needs to dissect each packet
>
> and
> > compute its hash.
> > Such scenario is easily triggered. e.g. from DNS server under relevant
>
> load, as
> > the user-space process is moved away from the CPUs serving the softirqs
>
> (note:
> > this is beneficial for the overall DNS server performances).
> > This series introduces an helper to easily setup up XPS mapping for all
>
> the
> > online CPUs, and use it in the ixgbe driver, demonstrating a relevant
> > performance improvement in the above scenario.
> > Paolo Abeni (2):
> > net: introduce netif_set_xps()
> > ixgbe: setup XPS via netif_set_xps()
>
>
> Resent, not HTML this time, sorry for duplication.
>
> I truly believe XPS should not be setup by devices.
>
> XPS is policy, and policy does belong to user space.
Thank you for your comments!
As general principle, I agree policies should be in user-space, but I
also think that the kernel should provide a reasonable default. Many MQ
devices already configure XPS and their default is AFAICS sub-optimal.
> Note that if XPS is not setup, MQ queue selection is just fine by default ;
I'm sorry, I do not follow. AFAICS with unconnected sockets without XPS
we always hit the netdev_pick_tx()/skb_tx_hash()/skb_flow_dissect()
overhead in xmit path.
Cheers,
Paolo
^ permalink raw reply
* Re: [PATCH] Bluetooth: btrsi: rework dependencies
From: Marcel Holtmann @ 2018-03-15 15:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Johan Hedberg, Kalle Valo, Linux Bluetooth mailing list, LKML,
linux-wireless, netdev
In-Reply-To: <20180315154312.3941446-1-arnd@arndb.de>
Hi Arnd,
> The linkage between the bluetooth driver and the wireless
> driver is not defined properly, leading to build problems
> such as:
>
> warning: (BT_HCIRSI) selects RSI_COEX which has unmet direct dependencies (NETDEVICES && WLAN && WLAN_VENDOR_RSI && BT_HCIRSI && RSI_91X)
> drivers/net/wireless/rsi/rsi_91x_main.o: In function `rsi_read_pkt':
> (.text+0x205): undefined reference to `rsi_bt_ops'
>
> To actually make it work, we need the following steps:
>
> - remove the bogus 'select RSI_COEX', this is already covered
> by the default
> - change RSI_COEX to a 'bool' symbol so that the #ifdefs work
> all the time
> - ensure that BT_HCIRSI is built-in whenever RSI_91X is built-in
> - prevent BT_HCIRSI from being enabled when CONFIG_BT=m and
> RSI_91X=y, as this cannot work
>
> Fixes: 38aa4da50483 ("Bluetooth: btrsi: add new rsi bluetooth driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/bluetooth/Kconfig | 9 ++++++++-
> drivers/bluetooth/Makefile | 2 +-
> drivers/net/wireless/rsi/Kconfig | 6 +-----
> 3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index d8bbd661dbdb..6b3e8bf69d07 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -394,8 +394,9 @@ config BT_QCOMSMD
>
> config BT_HCIRSI
> tristate "Redpine HCI support"
> + depends on RSI_91X
> + depends on !(BT=m && RSI_91X=y)
> default n
> - select RSI_COEX
> help
> Redpine BT driver.
> This driver handles BT traffic from upper layers and pass
> @@ -404,4 +405,10 @@ config BT_HCIRSI
> Say Y here to compile support for HCI over Redpine into the
> kernel or say M to compile as a module.
>
> +config BT_HCIRSI_MODULE
> + tristate
> + # ensure that the BT_HCIRSI driver is visible to the core
> + default y if BT_HCIRSI=m && RSI_91X=y
> + default BT_HCIRSI
> +
> endmenu
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index 03cfc1b20c4a..9e8d22712ff3 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -28,7 +28,7 @@ obj-$(CONFIG_BT_QCA) += btqca.o
>
> obj-$(CONFIG_BT_HCIUART_NOKIA) += hci_nokia.o
>
> -obj-$(CONFIG_BT_HCIRSI) += btrsi.o
> +obj-$(CONFIG_BT_HCIRSI_MODULE) += btrsi.o
do we need this new option? I have avoided these kind of complex things multi config entries. Can we not just select the RSI_91X?
Regards
Marcel
^ permalink raw reply
* [net-next 5/5] tipc: some name changes
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
We rename some lists and fields in struct publication both to make
the naming more consistent and to better reflect their roles. We
also update the descriptions of those lists.
node_list -> local_publ
cluster_list -> all_publ
pport_list -> binding_sock
ref -> port
There are no functional changes in this commit.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/name_distr.c | 12 ++---
net/tipc/name_distr.h | 2 +-
net/tipc/name_table.c | 143 ++++++++++++++++++++++++--------------------------
net/tipc/name_table.h | 38 ++++++++------
net/tipc/socket.c | 14 ++---
5 files changed, 106 insertions(+), 103 deletions(-)
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 4c54fb3..28d095a 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -56,7 +56,7 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
i->type = htonl(p->type);
i->lower = htonl(p->lower);
i->upper = htonl(p->upper);
- i->ref = htonl(p->ref);
+ i->port = htonl(p->port);
i->key = htonl(p->key);
}
@@ -209,15 +209,15 @@ static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr)
spin_lock_bh(&tn->nametbl_lock);
p = tipc_nametbl_remove_publ(net, publ->type, publ->lower,
- publ->node, publ->ref, publ->key);
+ publ->node, publ->port, publ->key);
if (p)
tipc_node_unsubscribe(net, &p->binding_node, addr);
spin_unlock_bh(&tn->nametbl_lock);
if (p != publ) {
pr_err("Unable to remove publication from failed node\n"
- " (type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
- publ->type, publ->lower, publ->node, publ->ref,
+ " (type=%u, lower=%u, node=0x%x, port=%u, key=%u)\n",
+ publ->type, publ->lower, publ->node, publ->port,
publ->key);
}
@@ -268,7 +268,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
ntohl(i->lower),
ntohl(i->upper),
TIPC_CLUSTER_SCOPE, node,
- ntohl(i->ref), ntohl(i->key));
+ ntohl(i->port), ntohl(i->key));
if (publ) {
tipc_node_subscribe(net, &publ->binding_node, node);
return true;
@@ -276,7 +276,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
} else if (dtype == WITHDRAWAL) {
publ = tipc_nametbl_remove_publ(net, ntohl(i->type),
ntohl(i->lower),
- node, ntohl(i->ref),
+ node, ntohl(i->port),
ntohl(i->key));
if (publ) {
tipc_node_unsubscribe(net, &publ->binding_node, node);
diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h
index 1264ba0..4753e62 100644
--- a/net/tipc/name_distr.h
+++ b/net/tipc/name_distr.h
@@ -63,7 +63,7 @@ struct distr_item {
__be32 type;
__be32 lower;
__be32 upper;
- __be32 ref;
+ __be32 port;
__be32 key;
};
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 6d7b4c7..bbbfc07 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -1,7 +1,7 @@
/*
* net/tipc/name_table.c: TIPC name table code
*
- * Copyright (c) 2000-2006, 2014-2015, Ericsson AB
+ * Copyright (c) 2000-2006, 2014-2018, Ericsson AB
* Copyright (c) 2004-2008, 2010-2014, Wind River Systems
* All rights reserved.
*
@@ -51,11 +51,11 @@
/**
* struct name_info - name sequence publication info
* @node_list: list of publications on own node of this <type,lower,upper>
- * @cluster_list: list of all publications of this <type,lower,upper>
+ * @all_publ: list of all publications of this <type,lower,upper>
*/
struct name_info {
- struct list_head node_list;
- struct list_head cluster_list;
+ struct list_head local_publ;
+ struct list_head all_publ;
};
/**
@@ -102,7 +102,7 @@ static int hash(int x)
* publ_create - create a publication structure
*/
static struct publication *publ_create(u32 type, u32 lower, u32 upper,
- u32 scope, u32 node, u32 port_ref,
+ u32 scope, u32 node, u32 port,
u32 key)
{
struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
@@ -116,9 +116,9 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
publ->upper = upper;
publ->scope = scope;
publ->node = node;
- publ->ref = port_ref;
+ publ->port = port;
publ->key = key;
- INIT_LIST_HEAD(&publ->pport_list);
+ INIT_LIST_HEAD(&publ->binding_sock);
return publ;
}
@@ -237,9 +237,9 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
info = sseq->info;
/* Check if an identical publication already exists */
- list_for_each_entry(publ, &info->cluster_list, cluster_list) {
- if ((publ->ref == port) && (publ->key == key) &&
- (!publ->node || (publ->node == node)))
+ list_for_each_entry(publ, &info->all_publ, all_publ) {
+ if (publ->port == port && publ->key == key &&
+ (!publ->node || publ->node == node))
return NULL;
}
} else {
@@ -278,8 +278,8 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
return NULL;
}
- INIT_LIST_HEAD(&info->node_list);
- INIT_LIST_HEAD(&info->cluster_list);
+ INIT_LIST_HEAD(&info->local_publ);
+ INIT_LIST_HEAD(&info->all_publ);
/* Insert new sub-sequence */
sseq = &nseq->sseqs[inspos];
@@ -298,15 +298,15 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
if (!publ)
return NULL;
- list_add(&publ->cluster_list, &info->cluster_list);
+ list_add(&publ->all_publ, &info->all_publ);
if (in_own_node(net, node))
- list_add(&publ->node_list, &info->node_list);
+ list_add(&publ->local_publ, &info->local_publ);
/* Any subscriptions waiting for notification? */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_sub_report_overlap(s, publ->lower, publ->upper,
- TIPC_PUBLISHED, publ->ref,
+ TIPC_PUBLISHED, publ->port,
publ->node, publ->scope,
created_subseq);
}
@@ -327,7 +327,7 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
static struct publication *tipc_nameseq_remove_publ(struct net *net,
struct name_seq *nseq,
u32 inst, u32 node,
- u32 ref, u32 key)
+ u32 port, u32 key)
{
struct publication *publ;
struct sub_seq *sseq = nameseq_find_subseq(nseq, inst);
@@ -342,20 +342,20 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
info = sseq->info;
/* Locate publication, if it exists */
- list_for_each_entry(publ, &info->cluster_list, cluster_list) {
- if ((publ->key == key) && (publ->ref == ref) &&
- (!publ->node || (publ->node == node)))
+ list_for_each_entry(publ, &info->all_publ, all_publ) {
+ if (publ->key == key && publ->port == port &&
+ (!publ->node || publ->node == node))
goto found;
}
return NULL;
found:
- list_del(&publ->cluster_list);
+ list_del(&publ->all_publ);
if (in_own_node(net, node))
- list_del(&publ->node_list);
+ list_del(&publ->local_publ);
/* Contract subseq list if no more publications for that subseq */
- if (list_empty(&info->cluster_list)) {
+ if (list_empty(&info->all_publ)) {
kfree(info);
free = &nseq->sseqs[nseq->first_free--];
memmove(sseq, sseq + 1, (free - (sseq + 1)) * sizeof(*sseq));
@@ -365,8 +365,9 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
/* Notify any waiting subscriptions */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_sub_report_overlap(s, publ->lower, publ->upper,
- TIPC_WITHDRAWN, publ->ref, publ->node,
- publ->scope, removed_subseq);
+ TIPC_WITHDRAWN, publ->port,
+ publ->node, publ->scope,
+ removed_subseq);
}
return publ;
@@ -402,12 +403,12 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq,
struct name_info *info = sseq->info;
int must_report = 1;
- list_for_each_entry(crs, &info->cluster_list,
- cluster_list) {
+ list_for_each_entry(crs, &info->all_publ, all_publ) {
tipc_sub_report_overlap(sub, sseq->lower,
sseq->upper,
TIPC_PUBLISHED,
- crs->ref, crs->node,
+ crs->port,
+ crs->node,
crs->scope,
must_report);
must_report = 0;
@@ -460,7 +461,7 @@ struct publication *tipc_nametbl_insert_publ(struct net *net, u32 type,
}
struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type,
- u32 lower, u32 node, u32 ref,
+ u32 lower, u32 node, u32 port,
u32 key)
{
struct publication *publ;
@@ -470,7 +471,7 @@ struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type,
return NULL;
spin_lock_bh(&seq->lock);
- publ = tipc_nameseq_remove_publ(net, seq, lower, node, ref, key);
+ publ = tipc_nameseq_remove_publ(net, seq, lower, node, port, key);
if (!seq->first_free && list_empty(&seq->subscriptions)) {
hlist_del_init_rcu(&seq->ns_list);
kfree(seq->sseqs);
@@ -503,7 +504,7 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance,
struct name_info *info;
struct publication *publ;
struct name_seq *seq;
- u32 ref = 0;
+ u32 port = 0;
u32 node = 0;
if (!tipc_in_scope(*destnode, tn->own_addr))
@@ -521,42 +522,42 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance,
/* Closest-First Algorithm */
if (likely(!*destnode)) {
- if (!list_empty(&info->node_list)) {
- publ = list_first_entry(&info->node_list,
+ if (!list_empty(&info->local_publ)) {
+ publ = list_first_entry(&info->local_publ,
struct publication,
- node_list);
- list_move_tail(&publ->node_list,
- &info->node_list);
+ local_publ);
+ list_move_tail(&publ->local_publ,
+ &info->local_publ);
} else {
- publ = list_first_entry(&info->cluster_list,
+ publ = list_first_entry(&info->all_publ,
struct publication,
- cluster_list);
- list_move_tail(&publ->cluster_list,
- &info->cluster_list);
+ all_publ);
+ list_move_tail(&publ->all_publ,
+ &info->all_publ);
}
}
/* Round-Robin Algorithm */
else if (*destnode == tn->own_addr) {
- if (list_empty(&info->node_list))
+ if (list_empty(&info->local_publ))
goto no_match;
- publ = list_first_entry(&info->node_list, struct publication,
- node_list);
- list_move_tail(&publ->node_list, &info->node_list);
+ publ = list_first_entry(&info->local_publ, struct publication,
+ local_publ);
+ list_move_tail(&publ->local_publ, &info->local_publ);
} else {
- publ = list_first_entry(&info->cluster_list, struct publication,
- cluster_list);
- list_move_tail(&publ->cluster_list, &info->cluster_list);
+ publ = list_first_entry(&info->all_publ, struct publication,
+ all_publ);
+ list_move_tail(&publ->all_publ, &info->all_publ);
}
- ref = publ->ref;
+ port = publ->port;
node = publ->node;
no_match:
spin_unlock_bh(&seq->lock);
not_found:
rcu_read_unlock();
*destnode = node;
- return ref;
+ return port;
}
bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
@@ -578,17 +579,16 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
sseq = nameseq_find_subseq(seq, instance);
if (likely(sseq)) {
info = sseq->info;
- list_for_each_entry(publ, &info->cluster_list, cluster_list) {
+ list_for_each_entry(publ, &info->all_publ, all_publ) {
if (publ->scope != scope)
continue;
- if (publ->ref == exclude && publ->node == self)
+ if (publ->port == exclude && publ->node == self)
continue;
- tipc_dest_push(dsts, publ->node, publ->ref);
+ tipc_dest_push(dsts, publ->node, publ->port);
(*dstcnt)++;
if (all)
continue;
- list_move_tail(&publ->cluster_list,
- &info->cluster_list);
+ list_move_tail(&publ->all_publ, &info->all_publ);
break;
}
}
@@ -619,9 +619,9 @@ void tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
if (sseq->lower > upper)
break;
info = sseq->info;
- list_for_each_entry(p, &info->node_list, node_list) {
+ list_for_each_entry(p, &info->local_publ, local_publ) {
if (p->scope == scope || (!exact && p->scope < scope))
- tipc_dest_push(dports, 0, p->ref);
+ tipc_dest_push(dports, 0, p->port);
}
}
spin_unlock_bh(&seq->lock);
@@ -651,7 +651,7 @@ void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower,
stop = seq->sseqs + seq->first_free;
for (; sseq != stop && sseq->lower <= upper; sseq++) {
info = sseq->info;
- list_for_each_entry(publ, &info->cluster_list, cluster_list) {
+ list_for_each_entry(publ, &info->all_publ, all_publ) {
tipc_nlist_add(nodes, publ->node);
}
}
@@ -680,10 +680,10 @@ void tipc_nametbl_build_group(struct net *net, struct tipc_group *grp,
stop = seq->sseqs + seq->first_free;
for (; sseq != stop; sseq++) {
info = sseq->info;
- list_for_each_entry(p, &info->cluster_list, cluster_list) {
+ list_for_each_entry(p, &info->all_publ, all_publ) {
if (p->scope != scope)
continue;
- tipc_group_add_member(grp, p->node, p->ref, p->lower);
+ tipc_group_add_member(grp, p->node, p->port, p->lower);
}
}
spin_unlock_bh(&seq->lock);
@@ -728,7 +728,7 @@ struct publication *tipc_nametbl_publish(struct net *net, u32 type, u32 lower,
/**
* tipc_nametbl_withdraw - withdraw name publication from network name tables
*/
-int tipc_nametbl_withdraw(struct net *net, u32 type, u32 lower, u32 ref,
+int tipc_nametbl_withdraw(struct net *net, u32 type, u32 lower, u32 port,
u32 key)
{
struct publication *publ;
@@ -737,18 +737,18 @@ int tipc_nametbl_withdraw(struct net *net, u32 type, u32 lower, u32 ref,
spin_lock_bh(&tn->nametbl_lock);
publ = tipc_nametbl_remove_publ(net, type, lower, tn->own_addr,
- ref, key);
+ port, key);
if (likely(publ)) {
tn->nametbl->local_publ_count--;
skb = tipc_named_withdraw(net, publ);
/* Any pending external events? */
tipc_named_process_backlog(net);
- list_del_init(&publ->pport_list);
+ list_del_init(&publ->binding_sock);
kfree_rcu(publ, rcu);
} else {
pr_err("Unable to remove local publication\n"
- "(type=%u, lower=%u, ref=%u, key=%u)\n",
- type, lower, ref, key);
+ "(type=%u, lower=%u, port=%u, key=%u)\n",
+ type, lower, port, key);
}
spin_unlock_bh(&tn->nametbl_lock);
@@ -851,10 +851,9 @@ static void tipc_purge_publications(struct net *net, struct name_seq *seq)
spin_lock_bh(&seq->lock);
sseq = seq->sseqs;
info = sseq->info;
- list_for_each_entry_safe(publ, safe, &info->cluster_list,
- cluster_list) {
+ list_for_each_entry_safe(publ, safe, &info->all_publ, all_publ) {
tipc_nameseq_remove_publ(net, seq, publ->lower, publ->node,
- publ->ref, publ->key);
+ publ->port, publ->key);
kfree_rcu(publ, rcu);
}
hlist_del_init_rcu(&seq->ns_list);
@@ -901,19 +900,17 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,
struct publication *p;
if (*last_publ) {
- list_for_each_entry(p, &sseq->info->cluster_list,
- cluster_list)
+ list_for_each_entry(p, &sseq->info->all_publ, all_publ)
if (p->key == *last_publ)
break;
if (p->key != *last_publ)
return -EPIPE;
} else {
- p = list_first_entry(&sseq->info->cluster_list,
- struct publication,
- cluster_list);
+ p = list_first_entry(&sseq->info->all_publ, struct publication,
+ all_publ);
}
- list_for_each_entry_from(p, &sseq->info->cluster_list, cluster_list) {
+ list_for_each_entry_from(p, &sseq->info->all_publ, all_publ) {
*last_publ = p->key;
hdr = genlmsg_put(msg->skb, msg->portid, msg->seq,
@@ -940,7 +937,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,
goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_NODE, p->node))
goto publ_msg_full;
- if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_REF, p->ref))
+ if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_REF, p->port))
goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_KEY, p->key))
goto publ_msg_full;
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index cb16bd8..34a4ccb 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -54,19 +54,22 @@ struct tipc_group;
* @type: name sequence type
* @lower: name sequence lower bound
* @upper: name sequence upper bound
- * @scope: scope of publication
- * @node: network address of publishing port's node
- * @ref: publishing port
- * @key: publication key
- * @nodesub_list: subscription to "node down" event (off-node publication only)
- * @local_list: adjacent entries in list of publications made by this node
- * @pport_list: adjacent entries in list of publications made by this port
- * @node_list: adjacent matching name seq publications with >= node scope
- * @cluster_list: adjacent matching name seq publications with >= cluster scope
- * @zone_list: adjacent matching name seq publications with >= zone scope
+ * @scope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE
+ * @node: network address of publishing socket's node
+ * @port: publishing port
+ * @key: publication key, unique across the cluster
+ * @binding_node: all publications from the same node which bound this one
+ * - Remote publications: in node->publ_list
+ * Used by node/name distr to withdraw publications when node is lost
+ * - Local/node scope publications: in name_table->node_scope list
+ * - Local/cluster scope publications: in name_table->cluster_scope list
+ * @binding_sock: all publications from the same socket which bound this one
+ * Used by socket to withdraw publications when socket is unbound/released
+ * @local_publ: list of identical publications made from this node
+ * Used by closest_first and multicast receive lookup algorithms
+ * @all_publ: all publications identical to this one, whatever node and scope
+ * Used by round-robin lookup algorithm
* @rcu: RCU callback head used for deferred freeing
- *
- * Note that the node list, cluster list, and zone list are circular lists.
*/
struct publication {
u32 type;
@@ -74,12 +77,12 @@ struct publication {
u32 upper;
u32 scope;
u32 node;
- u32 ref;
+ u32 port;
u32 key;
struct list_head binding_node;
- struct list_head pport_list;
- struct list_head node_list;
- struct list_head cluster_list;
+ struct list_head binding_sock;
+ struct list_head local_publ;
+ struct list_head all_publ;
struct rcu_head rcu;
};
@@ -87,7 +90,10 @@ struct publication {
* struct name_table - table containing all existing port name publications
* @seq_hlist: name sequence hash lists
* @node_scope: all local publications with node scope
+ * - used by name_distr during re-init of name table
* @cluster_scope: all local publications with cluster scope
+ * - used by name_distr to send bulk updates to new nodes
+ * - used by name_distr during re-init of name table
* @local_publ_count: number of publications issued by this node
*/
struct name_table {
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 910d382..a4a9148 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2605,7 +2605,7 @@ static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
if (unlikely(!publ))
return -EINVAL;
- list_add(&publ->pport_list, &tsk->publications);
+ list_add(&publ->binding_sock, &tsk->publications);
tsk->pub_count++;
tsk->published = 1;
return 0;
@@ -2622,7 +2622,7 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
if (scope != TIPC_NODE_SCOPE)
scope = TIPC_CLUSTER_SCOPE;
- list_for_each_entry_safe(publ, safe, &tsk->publications, pport_list) {
+ list_for_each_entry_safe(publ, safe, &tsk->publications, binding_sock) {
if (seq) {
if (publ->scope != scope)
continue;
@@ -2633,12 +2633,12 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
if (publ->upper != seq->upper)
break;
tipc_nametbl_withdraw(net, publ->type, publ->lower,
- publ->ref, publ->key);
+ publ->port, publ->key);
rc = 0;
break;
}
tipc_nametbl_withdraw(net, publ->type, publ->lower,
- publ->ref, publ->key);
+ publ->port, publ->key);
rc = 0;
}
if (list_empty(&tsk->publications))
@@ -3292,7 +3292,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb,
struct publication *p;
if (*last_publ) {
- list_for_each_entry(p, &tsk->publications, pport_list) {
+ list_for_each_entry(p, &tsk->publications, binding_sock) {
if (p->key == *last_publ)
break;
}
@@ -3309,10 +3309,10 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb,
}
} else {
p = list_first_entry(&tsk->publications, struct publication,
- pport_list);
+ binding_sock);
}
- list_for_each_entry_from(p, &tsk->publications, pport_list) {
+ list_for_each_entry_from(p, &tsk->publications, binding_sock) {
err = __tipc_nl_add_sk_publ(skb, cb, p);
if (err) {
*last_publ = p->key;
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* [net-next 4/5] tipc: merge two lists in struct publication
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
The size of struct publication can be reduced further. Membership in
lists 'nodesub_list' and 'local_list' is mutually exlusive, in that
remote publications use the former and local publications the latter.
We replace the two lists with one single, named 'binding_node' which
reflects what it really is.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/name_distr.c | 20 ++++++++++----------
net/tipc/name_table.h | 5 ++---
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 11ce205..4c54fb3 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -91,10 +91,10 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
struct sk_buff *skb;
if (publ->scope == TIPC_NODE_SCOPE) {
- list_add_tail_rcu(&publ->local_list, &nt->node_scope);
+ list_add_tail_rcu(&publ->binding_node, &nt->node_scope);
return NULL;
}
- list_add_tail_rcu(&publ->local_list, &nt->cluster_scope);
+ list_add_tail_rcu(&publ->binding_node, &nt->cluster_scope);
skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
if (!skb) {
@@ -115,7 +115,7 @@ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ)
struct sk_buff *buf;
struct distr_item *item;
- list_del(&publ->local_list);
+ list_del(&publ->binding_node);
if (publ->scope == TIPC_NODE_SCOPE)
return NULL;
@@ -147,7 +147,7 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
ITEM_SIZE) * ITEM_SIZE;
u32 msg_rem = msg_dsz;
- list_for_each_entry(publ, pls, local_list) {
+ list_for_each_entry(publ, pls, binding_node) {
/* Prepare next buffer: */
if (!skb) {
skb = named_prepare_buf(net, PUBLICATION, msg_rem,
@@ -211,7 +211,7 @@ static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr)
p = tipc_nametbl_remove_publ(net, publ->type, publ->lower,
publ->node, publ->ref, publ->key);
if (p)
- tipc_node_unsubscribe(net, &p->nodesub_list, addr);
+ tipc_node_unsubscribe(net, &p->binding_node, addr);
spin_unlock_bh(&tn->nametbl_lock);
if (p != publ) {
@@ -246,7 +246,7 @@ void tipc_publ_notify(struct net *net, struct list_head *nsub_list, u32 addr)
{
struct publication *publ, *tmp;
- list_for_each_entry_safe(publ, tmp, nsub_list, nodesub_list)
+ list_for_each_entry_safe(publ, tmp, nsub_list, binding_node)
tipc_publ_purge(net, publ, addr);
tipc_dist_queue_purge(net, addr);
}
@@ -270,7 +270,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
TIPC_CLUSTER_SCOPE, node,
ntohl(i->ref), ntohl(i->key));
if (publ) {
- tipc_node_subscribe(net, &publ->nodesub_list, node);
+ tipc_node_subscribe(net, &publ->binding_node, node);
return true;
}
} else if (dtype == WITHDRAWAL) {
@@ -279,7 +279,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
node, ntohl(i->ref),
ntohl(i->key));
if (publ) {
- tipc_node_unsubscribe(net, &publ->nodesub_list, node);
+ tipc_node_unsubscribe(net, &publ->binding_node, node);
kfree_rcu(publ, rcu);
return true;
}
@@ -385,9 +385,9 @@ void tipc_named_reinit(struct net *net)
spin_lock_bh(&tn->nametbl_lock);
- list_for_each_entry_rcu(publ, &nt->node_scope, local_list)
+ list_for_each_entry_rcu(publ, &nt->node_scope, binding_node)
publ->node = tn->own_addr;
- list_for_each_entry_rcu(publ, &nt->cluster_scope, local_list)
+ list_for_each_entry_rcu(publ, &nt->cluster_scope, binding_node)
publ->node = tn->own_addr;
spin_unlock_bh(&tn->nametbl_lock);
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index a9063e2..cb16bd8 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -1,7 +1,7 @@
/*
* net/tipc/name_table.h: Include file for TIPC name table code
*
- * Copyright (c) 2000-2006, 2014-2015, Ericsson AB
+ * Copyright (c) 2000-2006, 2014-2018, Ericsson AB
* Copyright (c) 2004-2005, 2010-2011, Wind River Systems
* All rights reserved.
*
@@ -76,8 +76,7 @@ struct publication {
u32 node;
u32 ref;
u32 key;
- struct list_head nodesub_list;
- struct list_head local_list;
+ struct list_head binding_node;
struct list_head pport_list;
struct list_head node_list;
struct list_head cluster_list;
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* [net-next 3/5] tipc: remove zone_list member in struct publication
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
As a further consequence of the previous commits, we can also remove
the member 'zone_list 'in struct name_info and struct publication.
Instead, we now let the member cluster_list take over the role a
container of all publications of a given <type,lower, upper>.
We also remove the counters for the size of those lists, since
they don't serve any purpose.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/name_table.c | 101 ++++++++++++++------------------------------------
net/tipc/name_table.h | 5 +--
2 files changed, 30 insertions(+), 76 deletions(-)
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 1a3a327..6d7b4c7 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -50,24 +50,12 @@
/**
* struct name_info - name sequence publication info
- * @node_list: circular list of publications made by own node
- * @cluster_list: circular list of publications made by own cluster
- * @zone_list: circular list of publications made by own zone
- * @node_list_size: number of entries in "node_list"
- * @cluster_list_size: number of entries in "cluster_list"
- * @zone_list_size: number of entries in "zone_list"
- *
- * Note: The zone list always contains at least one entry, since all
- * publications of the associated name sequence belong to it.
- * (The cluster and node lists may be empty.)
+ * @node_list: list of publications on own node of this <type,lower,upper>
+ * @cluster_list: list of all publications of this <type,lower,upper>
*/
struct name_info {
struct list_head node_list;
struct list_head cluster_list;
- struct list_head zone_list;
- u32 node_list_size;
- u32 cluster_list_size;
- u32 zone_list_size;
};
/**
@@ -249,7 +237,7 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
info = sseq->info;
/* Check if an identical publication already exists */
- list_for_each_entry(publ, &info->zone_list, zone_list) {
+ list_for_each_entry(publ, &info->cluster_list, cluster_list) {
if ((publ->ref == port) && (publ->key == key) &&
(!publ->node || (publ->node == node)))
return NULL;
@@ -292,7 +280,6 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
INIT_LIST_HEAD(&info->node_list);
INIT_LIST_HEAD(&info->cluster_list);
- INIT_LIST_HEAD(&info->zone_list);
/* Insert new sub-sequence */
sseq = &nseq->sseqs[inspos];
@@ -311,18 +298,10 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
if (!publ)
return NULL;
- list_add(&publ->zone_list, &info->zone_list);
- info->zone_list_size++;
-
- if (in_own_cluster(net, node)) {
- list_add(&publ->cluster_list, &info->cluster_list);
- info->cluster_list_size++;
- }
+ list_add(&publ->cluster_list, &info->cluster_list);
- if (in_own_node(net, node)) {
+ if (in_own_node(net, node))
list_add(&publ->node_list, &info->node_list);
- info->node_list_size++;
- }
/* Any subscriptions waiting for notification? */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
@@ -363,7 +342,7 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
info = sseq->info;
/* Locate publication, if it exists */
- list_for_each_entry(publ, &info->zone_list, zone_list) {
+ list_for_each_entry(publ, &info->cluster_list, cluster_list) {
if ((publ->key == key) && (publ->ref == ref) &&
(!publ->node || (publ->node == node)))
goto found;
@@ -371,24 +350,12 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
return NULL;
found:
- /* Remove publication from zone scope list */
- list_del(&publ->zone_list);
- info->zone_list_size--;
-
- /* Remove publication from cluster scope list, if present */
- if (in_own_cluster(net, node)) {
- list_del(&publ->cluster_list);
- info->cluster_list_size--;
- }
-
- /* Remove publication from node scope list, if present */
- if (in_own_node(net, node)) {
+ list_del(&publ->cluster_list);
+ if (in_own_node(net, node))
list_del(&publ->node_list);
- info->node_list_size--;
- }
/* Contract subseq list if no more publications for that subseq */
- if (list_empty(&info->zone_list)) {
+ if (list_empty(&info->cluster_list)) {
kfree(info);
free = &nseq->sseqs[nseq->first_free--];
memmove(sseq, sseq + 1, (free - (sseq + 1)) * sizeof(*sseq));
@@ -435,7 +402,8 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq,
struct name_info *info = sseq->info;
int must_report = 1;
- list_for_each_entry(crs, &info->zone_list, zone_list) {
+ list_for_each_entry(crs, &info->cluster_list,
+ cluster_list) {
tipc_sub_report_overlap(sub, sseq->lower,
sseq->upper,
TIPC_PUBLISHED,
@@ -559,18 +527,12 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance,
node_list);
list_move_tail(&publ->node_list,
&info->node_list);
- } else if (!list_empty(&info->cluster_list)) {
+ } else {
publ = list_first_entry(&info->cluster_list,
struct publication,
cluster_list);
list_move_tail(&publ->cluster_list,
&info->cluster_list);
- } else {
- publ = list_first_entry(&info->zone_list,
- struct publication,
- zone_list);
- list_move_tail(&publ->zone_list,
- &info->zone_list);
}
}
@@ -581,16 +543,10 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance,
publ = list_first_entry(&info->node_list, struct publication,
node_list);
list_move_tail(&publ->node_list, &info->node_list);
- } else if (in_own_cluster_exact(net, *destnode)) {
- if (list_empty(&info->cluster_list))
- goto no_match;
+ } else {
publ = list_first_entry(&info->cluster_list, struct publication,
cluster_list);
list_move_tail(&publ->cluster_list, &info->cluster_list);
- } else {
- publ = list_first_entry(&info->zone_list, struct publication,
- zone_list);
- list_move_tail(&publ->zone_list, &info->zone_list);
}
ref = publ->ref;
@@ -622,7 +578,7 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
sseq = nameseq_find_subseq(seq, instance);
if (likely(sseq)) {
info = sseq->info;
- list_for_each_entry(publ, &info->zone_list, zone_list) {
+ list_for_each_entry(publ, &info->cluster_list, cluster_list) {
if (publ->scope != scope)
continue;
if (publ->ref == exclude && publ->node == self)
@@ -631,7 +587,8 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
(*dstcnt)++;
if (all)
continue;
- list_move_tail(&publ->zone_list, &info->zone_list);
+ list_move_tail(&publ->cluster_list,
+ &info->cluster_list);
break;
}
}
@@ -641,15 +598,14 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
return !list_empty(dsts);
}
-int tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
- u32 scope, bool exact, struct list_head *dports)
+void tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
+ u32 scope, bool exact, struct list_head *dports)
{
struct sub_seq *sseq_stop;
struct name_info *info;
struct publication *p;
struct name_seq *seq;
struct sub_seq *sseq;
- int res = 0;
rcu_read_lock();
seq = nametbl_find_seq(net, type);
@@ -667,14 +623,10 @@ int tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
if (p->scope == scope || (!exact && p->scope < scope))
tipc_dest_push(dports, 0, p->ref);
}
-
- if (info->cluster_list_size != info->node_list_size)
- res = 1;
}
spin_unlock_bh(&seq->lock);
exit:
rcu_read_unlock();
- return res;
}
/* tipc_nametbl_lookup_dst_nodes - find broadcast destination nodes
@@ -699,7 +651,7 @@ void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower,
stop = seq->sseqs + seq->first_free;
for (; sseq != stop && sseq->lower <= upper; sseq++) {
info = sseq->info;
- list_for_each_entry(publ, &info->zone_list, zone_list) {
+ list_for_each_entry(publ, &info->cluster_list, cluster_list) {
tipc_nlist_add(nodes, publ->node);
}
}
@@ -728,7 +680,7 @@ void tipc_nametbl_build_group(struct net *net, struct tipc_group *grp,
stop = seq->sseqs + seq->first_free;
for (; sseq != stop; sseq++) {
info = sseq->info;
- list_for_each_entry(p, &info->zone_list, zone_list) {
+ list_for_each_entry(p, &info->cluster_list, cluster_list) {
if (p->scope != scope)
continue;
tipc_group_add_member(grp, p->node, p->ref, p->lower);
@@ -899,7 +851,8 @@ static void tipc_purge_publications(struct net *net, struct name_seq *seq)
spin_lock_bh(&seq->lock);
sseq = seq->sseqs;
info = sseq->info;
- list_for_each_entry_safe(publ, safe, &info->zone_list, zone_list) {
+ list_for_each_entry_safe(publ, safe, &info->cluster_list,
+ cluster_list) {
tipc_nameseq_remove_publ(net, seq, publ->lower, publ->node,
publ->ref, publ->key);
kfree_rcu(publ, rcu);
@@ -948,17 +901,19 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,
struct publication *p;
if (*last_publ) {
- list_for_each_entry(p, &sseq->info->zone_list, zone_list)
+ list_for_each_entry(p, &sseq->info->cluster_list,
+ cluster_list)
if (p->key == *last_publ)
break;
if (p->key != *last_publ)
return -EPIPE;
} else {
- p = list_first_entry(&sseq->info->zone_list, struct publication,
- zone_list);
+ p = list_first_entry(&sseq->info->cluster_list,
+ struct publication,
+ cluster_list);
}
- list_for_each_entry_from(p, &sseq->info->zone_list, zone_list) {
+ list_for_each_entry_from(p, &sseq->info->cluster_list, cluster_list) {
*last_publ = p->key;
hdr = genlmsg_put(msg->skb, msg->portid, msg->seq,
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 47f72cd..a9063e2 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -81,7 +81,6 @@ struct publication {
struct list_head pport_list;
struct list_head node_list;
struct list_head cluster_list;
- struct list_head zone_list;
struct rcu_head rcu;
};
@@ -102,8 +101,8 @@ struct name_table {
int tipc_nl_name_table_dump(struct sk_buff *skb, struct netlink_callback *cb);
u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance, u32 *node);
-int tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
- u32 scope, bool exact, struct list_head *dports);
+void tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
+ u32 scope, bool exact, struct list_head *dports);
void tipc_nametbl_build_group(struct net *net, struct tipc_group *grp,
u32 type, u32 domain);
void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower,
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* [net-next 2/5] tipc: remove zone publication list in name table
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
As a consequence of the previous commit we nan now eliminate zone scope
related lists in the name table. We start with name_table::publ_list[3],
which can now be replaced with two lists, one for node scope publications
and one for cluster scope publications.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/core.h | 5 +++++
net/tipc/name_distr.c | 39 ++++++++++++++++++---------------------
net/tipc/name_table.c | 5 ++---
net/tipc/name_table.h | 6 ++++--
4 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/net/tipc/core.h b/net/tipc/core.h
index ff8b071..347f850 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -131,6 +131,11 @@ static inline struct list_head *tipc_nodes(struct net *net)
return &tipc_net(net)->node_list;
}
+static inline struct name_table *tipc_name_table(struct net *net)
+{
+ return tipc_net(net)->nametbl;
+}
+
static inline struct tipc_topsrv *tipc_topsrv(struct net *net)
{
return tipc_net(net)->topsrv;
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 23f8899..11ce205 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -86,25 +86,25 @@ static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size,
*/
struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
{
- struct tipc_net *tn = net_generic(net, tipc_net_id);
- struct sk_buff *buf;
+ struct name_table *nt = tipc_name_table(net);
struct distr_item *item;
+ struct sk_buff *skb;
- list_add_tail_rcu(&publ->local_list,
- &tn->nametbl->publ_list[publ->scope]);
-
- if (publ->scope == TIPC_NODE_SCOPE)
+ if (publ->scope == TIPC_NODE_SCOPE) {
+ list_add_tail_rcu(&publ->local_list, &nt->node_scope);
return NULL;
+ }
+ list_add_tail_rcu(&publ->local_list, &nt->cluster_scope);
- buf = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
- if (!buf) {
+ skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
+ if (!skb) {
pr_warn("Publication distribution failure\n");
return NULL;
}
- item = (struct distr_item *)msg_data(buf_msg(buf));
+ item = (struct distr_item *)msg_data(buf_msg(skb));
publ_to_item(item, publ);
- return buf;
+ return skb;
}
/**
@@ -184,16 +184,13 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
*/
void tipc_named_node_up(struct net *net, u32 dnode)
{
- struct tipc_net *tn = net_generic(net, tipc_net_id);
+ struct name_table *nt = tipc_name_table(net);
struct sk_buff_head head;
__skb_queue_head_init(&head);
rcu_read_lock();
- named_distribute(net, &head, dnode,
- &tn->nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
- named_distribute(net, &head, dnode,
- &tn->nametbl->publ_list[TIPC_ZONE_SCOPE]);
+ named_distribute(net, &head, dnode, &nt->cluster_scope);
rcu_read_unlock();
tipc_node_xmit(net, &head, dnode, 0);
@@ -382,16 +379,16 @@ void tipc_named_rcv(struct net *net, struct sk_buff_head *inputq)
*/
void tipc_named_reinit(struct net *net)
{
- struct tipc_net *tn = net_generic(net, tipc_net_id);
+ struct name_table *nt = tipc_name_table(net);
+ struct tipc_net *tn = tipc_net(net);
struct publication *publ;
- int scope;
spin_lock_bh(&tn->nametbl_lock);
- for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_NODE_SCOPE; scope++)
- list_for_each_entry_rcu(publ, &tn->nametbl->publ_list[scope],
- local_list)
- publ->node = tn->own_addr;
+ list_for_each_entry_rcu(publ, &nt->node_scope, local_list)
+ publ->node = tn->own_addr;
+ list_for_each_entry_rcu(publ, &nt->cluster_scope, local_list)
+ publ->node = tn->own_addr;
spin_unlock_bh(&tn->nametbl_lock);
}
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 6772390..1a3a327 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -878,9 +878,8 @@ int tipc_nametbl_init(struct net *net)
for (i = 0; i < TIPC_NAMETBL_SIZE; i++)
INIT_HLIST_HEAD(&tipc_nametbl->seq_hlist[i]);
- INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_ZONE_SCOPE]);
- INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
- INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_NODE_SCOPE]);
+ INIT_LIST_HEAD(&tipc_nametbl->node_scope);
+ INIT_LIST_HEAD(&tipc_nametbl->cluster_scope);
tn->nametbl = tipc_nametbl;
spin_lock_init(&tn->nametbl_lock);
return 0;
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 1765260..47f72cd 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -88,12 +88,14 @@ struct publication {
/**
* struct name_table - table containing all existing port name publications
* @seq_hlist: name sequence hash lists
- * @publ_list: pulication lists
+ * @node_scope: all local publications with node scope
+ * @cluster_scope: all local publications with cluster scope
* @local_publ_count: number of publications issued by this node
*/
struct name_table {
struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
- struct list_head publ_list[TIPC_PUBL_SCOPE_NUM];
+ struct list_head node_scope;
+ struct list_head cluster_scope;
u32 local_publ_count;
};
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* [net-next 1/5] tipc: obsolete TIPC_ZONE_SCOPE
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
Publications for TIPC_CLUSTER_SCOPE and TIPC_ZONE_SCOPE are in all
aspects handled the same way, both on the publishing node and on the
receiving nodes.
Despite previous ambitions to the contrary, this is never going to change,
so we take the conseqeunce of this and obsolete TIPC_ZONE_SCOPE and related
macros/functions. Whenever a user is doing a bind() or a sendmsg() attempt
using ZONE_SCOPE we translate this internally to CLUSTER_SCOPE, while we
remain compatible with users and remote nodes still using ZONE_SCOPE.
Furthermore, the non-formalized scope value 0 has always been permitted
for use during lookup, with the same meaning as ZONE_SCOPE/CLUSTER_SCOPE.
We now permit it even as binding scope, but for compatibility reasons we
choose to not change the value of TIPC_CLUSTER_SCOPE.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
include/uapi/linux/tipc.h | 102 ++++++++++++++++++++++++----------------------
net/tipc/addr.c | 31 --------------
net/tipc/addr.h | 10 +++++
net/tipc/msg.c | 2 +-
net/tipc/name_table.c | 3 +-
net/tipc/net.c | 2 +-
net/tipc/socket.c | 15 ++++---
7 files changed, 77 insertions(+), 88 deletions(-)
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index 14bacc7..4ac9f1f 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -61,50 +61,6 @@ struct tipc_name_seq {
__u32 upper;
};
-/* TIPC Address Size, Offset, Mask specification for Z.C.N
- */
-#define TIPC_NODE_BITS 12
-#define TIPC_CLUSTER_BITS 12
-#define TIPC_ZONE_BITS 8
-
-#define TIPC_NODE_OFFSET 0
-#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
-#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
-
-#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
-#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
-#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
-
-#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
-#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
-#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
-
-#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
-
-static inline __u32 tipc_addr(unsigned int zone,
- unsigned int cluster,
- unsigned int node)
-{
- return (zone << TIPC_ZONE_OFFSET) |
- (cluster << TIPC_CLUSTER_OFFSET) |
- node;
-}
-
-static inline unsigned int tipc_zone(__u32 addr)
-{
- return addr >> TIPC_ZONE_OFFSET;
-}
-
-static inline unsigned int tipc_cluster(__u32 addr)
-{
- return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
-}
-
-static inline unsigned int tipc_node(__u32 addr)
-{
- return addr & TIPC_NODE_MASK;
-}
-
/*
* Application-accessible port name types
*/
@@ -117,9 +73,10 @@ static inline unsigned int tipc_node(__u32 addr)
/*
* Publication scopes when binding port names and port name sequences
*/
-#define TIPC_ZONE_SCOPE 1
-#define TIPC_CLUSTER_SCOPE 2
-#define TIPC_NODE_SCOPE 3
+enum tipc_scope {
+ TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */
+ TIPC_NODE_SCOPE = 3
+};
/*
* Limiting values for messages
@@ -243,7 +200,7 @@ struct sockaddr_tipc {
struct tipc_group_req {
__u32 type; /* group id */
__u32 instance; /* member id */
- __u32 scope; /* zone/cluster/node */
+ __u32 scope; /* cluster/node */
__u32 flags;
};
@@ -268,4 +225,53 @@ struct tipc_sioc_ln_req {
__u32 bearer_id;
char linkname[TIPC_MAX_LINK_NAME];
};
+
+
+/* The macros and functions below are deprecated:
+ */
+
+#define TIPC_ZONE_SCOPE 1
+
+#define TIPC_NODE_BITS 12
+#define TIPC_CLUSTER_BITS 12
+#define TIPC_ZONE_BITS 8
+
+#define TIPC_NODE_OFFSET 0
+#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
+#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
+
+#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
+#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
+#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
+
+#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
+#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
+#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
+
+#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
+
+static inline __u32 tipc_addr(unsigned int zone,
+ unsigned int cluster,
+ unsigned int node)
+{
+ return (zone << TIPC_ZONE_OFFSET) |
+ (cluster << TIPC_CLUSTER_OFFSET) |
+ node;
+}
+
+static inline unsigned int tipc_zone(__u32 addr)
+{
+ return addr >> TIPC_ZONE_OFFSET;
+}
+
+static inline unsigned int tipc_cluster(__u32 addr)
+{
+ return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
+}
+
+static inline unsigned int tipc_node(__u32 addr)
+{
+ return addr & TIPC_NODE_MASK;
+}
+
#endif
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index 48fd3b5..97cd857 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -64,23 +64,6 @@ int in_own_node(struct net *net, u32 addr)
}
/**
- * addr_domain - convert 2-bit scope value to equivalent message lookup domain
- *
- * Needed when address of a named message must be looked up a second time
- * after a network hop.
- */
-u32 addr_domain(struct net *net, u32 sc)
-{
- struct tipc_net *tn = net_generic(net, tipc_net_id);
-
- if (likely(sc == TIPC_NODE_SCOPE))
- return tn->own_addr;
- if (sc == TIPC_CLUSTER_SCOPE)
- return tipc_cluster_mask(tn->own_addr);
- return tipc_zone_mask(tn->own_addr);
-}
-
-/**
* tipc_addr_domain_valid - validates a network domain address
*
* Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
@@ -124,20 +107,6 @@ int tipc_in_scope(u32 domain, u32 addr)
return 0;
}
-/**
- * tipc_addr_scope - convert message lookup domain to a 2-bit scope value
- */
-int tipc_addr_scope(u32 domain)
-{
- if (likely(!domain))
- return TIPC_ZONE_SCOPE;
- if (tipc_node(domain))
- return TIPC_NODE_SCOPE;
- if (tipc_cluster(domain))
- return TIPC_CLUSTER_SCOPE;
- return TIPC_ZONE_SCOPE;
-}
-
char *tipc_addr_string_fill(char *string, u32 addr)
{
snprintf(string, 16, "<%u.%u.%u>",
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index bebb347..2ecf5a5 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -60,6 +60,16 @@ static inline u32 tipc_cluster_mask(u32 addr)
return addr & TIPC_ZONE_CLUSTER_MASK;
}
+static inline int tipc_node2scope(u32 node)
+{
+ return node ? TIPC_NODE_SCOPE : TIPC_CLUSTER_SCOPE;
+}
+
+static inline int tipc_scope2node(struct net *net, int sc)
+{
+ return sc != TIPC_NODE_SCOPE ? 0 : tipc_own_addr(net);
+}
+
u32 tipc_own_addr(struct net *net);
int in_own_cluster(struct net *net, u32 addr);
int in_own_cluster_exact(struct net *net, u32 addr);
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 4e1c6f6..b6c45dc 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -580,7 +580,7 @@ bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err)
msg = buf_msg(skb);
if (msg_reroute_cnt(msg))
return false;
- dnode = addr_domain(net, msg_lookup_scope(msg));
+ dnode = tipc_scope2node(net, msg_lookup_scope(msg));
dport = tipc_nametbl_translate(net, msg_nametype(msg),
msg_nameinst(msg), &dnode);
if (!dport)
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index e01c9c6..6772390 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -473,8 +473,7 @@ struct publication *tipc_nametbl_insert_publ(struct net *net, u32 type,
struct name_seq *seq = nametbl_find_seq(net, type);
int index = hash(type);
- if ((scope < TIPC_ZONE_SCOPE) || (scope > TIPC_NODE_SCOPE) ||
- (lower > upper)) {
+ if (scope > TIPC_NODE_SCOPE || lower > upper) {
pr_debug("Failed to publish illegal {%u,%u,%u} with scope %u\n",
type, lower, upper, scope);
return NULL;
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 1a2fde0..5c4c440 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -118,7 +118,7 @@ int tipc_net_start(struct net *net, u32 addr)
tipc_sk_reinit(net);
tipc_nametbl_publish(net, TIPC_CFG_SRV, tn->own_addr, tn->own_addr,
- TIPC_ZONE_SCOPE, 0, tn->own_addr);
+ TIPC_CLUSTER_SCOPE, 0, tn->own_addr);
pr_info("Started in network mode\n");
pr_info("Own node address %s, network identity %u\n",
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 8b04e60..910d382 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -644,7 +644,7 @@ static int tipc_bind(struct socket *sock, struct sockaddr *uaddr,
goto exit;
}
- res = (addr->scope > 0) ?
+ res = (addr->scope >= 0) ?
tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq) :
tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq);
exit:
@@ -1280,8 +1280,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
struct tipc_msg *hdr = &tsk->phdr;
struct tipc_name_seq *seq;
struct sk_buff_head pkts;
- u32 type, inst, domain;
u32 dnode, dport;
+ u32 type, inst;
int mtu, rc;
if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE))
@@ -1332,13 +1332,12 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
if (dest->addrtype == TIPC_ADDR_NAME) {
type = dest->addr.name.name.type;
inst = dest->addr.name.name.instance;
- domain = dest->addr.name.domain;
- dnode = domain;
+ dnode = dest->addr.name.domain;
msg_set_type(hdr, TIPC_NAMED_MSG);
msg_set_hdr_sz(hdr, NAMED_H_SIZE);
msg_set_nametype(hdr, type);
msg_set_nameinst(hdr, inst);
- msg_set_lookup_scope(hdr, tipc_addr_scope(domain));
+ msg_set_lookup_scope(hdr, tipc_node2scope(dnode));
dport = tipc_nametbl_translate(net, type, inst, &dnode);
msg_set_destnode(hdr, dnode);
msg_set_destport(hdr, dport);
@@ -2592,6 +2591,9 @@ static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
struct publication *publ;
u32 key;
+ if (scope != TIPC_NODE_SCOPE)
+ scope = TIPC_CLUSTER_SCOPE;
+
if (tipc_sk_connected(sk))
return -EINVAL;
key = tsk->portid + tsk->pub_count + 1;
@@ -2617,6 +2619,9 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
struct publication *safe;
int rc = -EINVAL;
+ if (scope != TIPC_NODE_SCOPE)
+ scope = TIPC_CLUSTER_SCOPE;
+
list_for_each_entry_safe(publ, safe, &tsk->publications, pport_list) {
if (seq) {
if (publ->scope != scope)
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* [net-next 0/5] tipc: obsolete zone concept
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
In-Reply-To: <1521128935-6141-1-git-send-email-jon.maloy@ericsson.com>
Functionality related to the zone concept was never implemented in TIPC.
In this series we eliminate the remaining traces of it in the code, and
can hence take a first step in reducing the footprint and complexity of
the binding table.
Jon Maloy (5):
tipc: obsolete TIPC_ZONE_SCOPE
tipc: remove zone publication list in name table
tipc: remove zone_list member in struct publication
tipc: merge two lists in struct publication
tipc: some name changes
include/uapi/linux/tipc.h | 102 ++++++++++++-----------
net/tipc/addr.c | 31 -------
net/tipc/addr.h | 10 +++
net/tipc/core.h | 5 ++
net/tipc/msg.c | 2 +-
net/tipc/name_distr.c | 63 +++++++-------
net/tipc/name_distr.h | 2 +-
net/tipc/name_table.c | 206 ++++++++++++++++++----------------------------
net/tipc/name_table.h | 54 ++++++------
net/tipc/net.c | 2 +-
net/tipc/socket.c | 29 ++++---
11 files changed, 227 insertions(+), 279 deletions(-)
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply
* [net-next 0/5] tipc: obsolete zone concept
From: Jon Maloy @ 2018-03-15 15:48 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion, mohan.krishna.ghanta.krishnamurthy
Functionality related to the 'zone' concept was never implemented in
TIPC. In this series we eliminate the remaining traces of it in the
code, and can hence take a first step in reducing the footprint and
complexity of the binding table.
Jon Maloy (5):
tipc: obsolete TIPC_ZONE_SCOPE
tipc: remove zone publication list in name table
tipc: remove zone_list member in struct publication
tipc: merge two lists in struct publication
tipc: some name changes
include/uapi/linux/tipc.h | 102 ++++++++++++-----------
net/tipc/addr.c | 31 -------
net/tipc/addr.h | 10 +++
net/tipc/core.h | 5 ++
net/tipc/msg.c | 2 +-
net/tipc/name_distr.c | 63 +++++++-------
net/tipc/name_distr.h | 2 +-
net/tipc/name_table.c | 206 ++++++++++++++++++----------------------------
net/tipc/name_table.h | 54 ++++++------
net/tipc/net.c | 2 +-
net/tipc/socket.c | 29 ++++---
11 files changed, 227 insertions(+), 279 deletions(-)
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply
* Re: [PATCH 2/2] net: phy: relax error checking when creating sysfs link netdev->phydev
From: Grygorii Strashko @ 2018-03-15 15:47 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: David S. Miller, netdev, Andrew Lunn, Florian Fainelli,
Sekhar Nori, linux-kernel, linux-omap
In-Reply-To: <20180315022637.GA20975@kroah.com>
On 03/14/2018 09:26 PM, Greg Kroah-Hartman wrote:
> On Wed, Mar 14, 2018 at 05:26:24PM -0500, Grygorii Strashko wrote:
>> Some ethernet drivers (like TI CPSW) may connect and manage >1 Net PHYs per
>> one netdevice, as result such drivers will produce warning during system
>> boot and fail to connect second phy to netdevice when PHYLIB framework
>> will try to create sysfs link netdev->phydev for second PHY
>> in phy_attach_direct(), because sysfs link with the same name has been
>> created already for the first PHY. As result, second CPSW external
>> port will became unusable.
>>
>> Fix it by relaxing error checking when PHYLIB framework is creating sysfs
>> link netdev->phydev in phy_attach_direct(), suppressing warning by using
>> sysfs_create_link_nowarn() and adding debug message instead.
>>
>> Cc: Florian Fainelli <f.fainelli@gmail.com>
>> Fixes: a3995460491d ("net: phy: Relax error checking on sysfs_create_link()")
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> ---
>> drivers/net/phy/phy_device.c | 15 +++++++++++----
>> 1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 478405e..fe16f58 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -1012,10 +1012,17 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
>> err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
>> "attached_dev");
>> if (!err) {
>> - err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
>> - "phydev");
>> - if (err)
>> - goto error;
>> + err = sysfs_create_link_nowarn(&dev->dev.kobj,
>> + &phydev->mdio.dev.kobj,
>> + "phydev");
>> + if (err) {
>> + dev_err(&dev->dev, "could not add device link to %s err %d\n",
>> + kobject_name(&phydev->mdio.dev.kobj),
>> + err);
>
> dev_err() is not a "debugging" message :)
Sry for the mess. I've originally did it as dev_dbg() after searching for
other occurrences of sysfs_create_link_nowarn() in kernel.
And honestly, I was unsure what to use dbg or err here.
>
> What is a user going to do with this new error? If it's not important
> at all, why care about it?
Now I think that dev_err() is better to use here:
1) It will notify about link creation error in other drivers (which is
still not critical as networking functionality will not be broken and device
will be able to boot (in case of NFS usage for example).
2) in case of TI CPSW driver we can live with this error message and
it will stimulate us (or any other user of this driver) to find time and
do fix/rework TI CPSW driver.
>
>> + /* non-fatal - some net drivers can use one netdevice
>> + * with more then one phy
>> + */
>
> What about devices that do not have more than one phy and this call
> fails for? Shouldn't you check for that?
As I mentioned before, this is not critical error. More over, as per code and
commit a3995460491d ("net: phy: Relax error checking on sysfs_create_link()")
- the error of creating link phydev->netdev already ignored in PHYLIB due to
"incorrect" initialization sequence of some network drivers.
if no objection i will repost after fixing commit messages.
--
regards,
-grygorii
^ permalink raw reply
* [PATCH] Bluetooth: btrsi: rework dependencies
From: Arnd Bergmann @ 2018-03-15 15:42 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Kalle Valo, Arnd Bergmann
Cc: linux-bluetooth, linux-kernel, linux-wireless, netdev
The linkage between the bluetooth driver and the wireless
driver is not defined properly, leading to build problems
such as:
warning: (BT_HCIRSI) selects RSI_COEX which has unmet direct dependencies (NETDEVICES && WLAN && WLAN_VENDOR_RSI && BT_HCIRSI && RSI_91X)
drivers/net/wireless/rsi/rsi_91x_main.o: In function `rsi_read_pkt':
(.text+0x205): undefined reference to `rsi_bt_ops'
To actually make it work, we need the following steps:
- remove the bogus 'select RSI_COEX', this is already covered
by the default
- change RSI_COEX to a 'bool' symbol so that the #ifdefs work
all the time
- ensure that BT_HCIRSI is built-in whenever RSI_91X is built-in
- prevent BT_HCIRSI from being enabled when CONFIG_BT=m and
RSI_91X=y, as this cannot work
Fixes: 38aa4da50483 ("Bluetooth: btrsi: add new rsi bluetooth driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/bluetooth/Kconfig | 9 ++++++++-
drivers/bluetooth/Makefile | 2 +-
drivers/net/wireless/rsi/Kconfig | 6 +-----
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index d8bbd661dbdb..6b3e8bf69d07 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -394,8 +394,9 @@ config BT_QCOMSMD
config BT_HCIRSI
tristate "Redpine HCI support"
+ depends on RSI_91X
+ depends on !(BT=m && RSI_91X=y)
default n
- select RSI_COEX
help
Redpine BT driver.
This driver handles BT traffic from upper layers and pass
@@ -404,4 +405,10 @@ config BT_HCIRSI
Say Y here to compile support for HCI over Redpine into the
kernel or say M to compile as a module.
+config BT_HCIRSI_MODULE
+ tristate
+ # ensure that the BT_HCIRSI driver is visible to the core
+ default y if BT_HCIRSI=m && RSI_91X=y
+ default BT_HCIRSI
+
endmenu
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 03cfc1b20c4a..9e8d22712ff3 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_BT_QCA) += btqca.o
obj-$(CONFIG_BT_HCIUART_NOKIA) += hci_nokia.o
-obj-$(CONFIG_BT_HCIRSI) += btrsi.o
+obj-$(CONFIG_BT_HCIRSI_MODULE) += btrsi.o
btmrvl-y := btmrvl_main.o
btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o
diff --git a/drivers/net/wireless/rsi/Kconfig b/drivers/net/wireless/rsi/Kconfig
index f004be33fcfa..bc6195767c61 100644
--- a/drivers/net/wireless/rsi/Kconfig
+++ b/drivers/net/wireless/rsi/Kconfig
@@ -43,12 +43,8 @@ config RSI_USB
Select M (recommended), if you have a RSI 1x1 wireless module.
config RSI_COEX
- bool "Redpine Signals WLAN BT Coexistence support"
- depends on BT_HCIRSI && RSI_91X
- default y
+ def_bool BT_HCIRSI && RSI_91X
---help---
This option enables the WLAN BT coex support in rsi drivers.
- Select M (recommended), if you have want to use this feature
- and you have RS9113 module.
endif # WLAN_VENDOR_RSI
--
2.9.0
^ permalink raw reply related
* Re: [RFC PATCH 0/2] net:setup XPS mapping for each online CPU
From: Eric Dumazet @ 2018-03-15 15:31 UTC (permalink / raw)
To: Paolo Abeni
Cc: netdev, David Miller, Jeff Kirsher, intel-wired-lan,
Alexander Duyck
In-Reply-To: <cover.1521124830.git.pabeni@redhat.com>
On Thu, Mar 15, 2018 at 8:08 AM Paolo Abeni <pabeni@redhat.com> wrote:
> Currently, most MQ netdevice setup the default XPS configuration mapping
1-1
> the first real_num_tx_queues queues and CPUs and no mapping is created for
> the CPUs with id greater then real_num_tx_queues, if any.
> As a result, the xmit path for unconnected sockets on such cores
experiences a
> relevant overhead in netdev_pick_tx(), which needs to dissect each packet
and
> compute its hash.
> Such scenario is easily triggered. e.g. from DNS server under relevant
load, as
> the user-space process is moved away from the CPUs serving the softirqs
(note:
> this is beneficial for the overall DNS server performances).
> This series introduces an helper to easily setup up XPS mapping for all
the
> online CPUs, and use it in the ixgbe driver, demonstrating a relevant
> performance improvement in the above scenario.
> Paolo Abeni (2):
> net: introduce netif_set_xps()
> ixgbe: setup XPS via netif_set_xps()
Resent, not HTML this time, sorry for duplication.
I truly believe XPS should not be setup by devices.
XPS is policy, and policy does belong to user space.
User space knows that CPU 2 and 3 (pure examples) are reserved for storage
interrupts, not NIC ones.
Note that if XPS is not setup, MQ queue selection is just fine by default ;
^ permalink raw reply
* Re: [PATCH 0/5] DPAA Ethernet fixes
From: David Miller @ 2018-03-15 15:15 UTC (permalink / raw)
To: madalin.bucur
Cc: joakim.tjernlund, linuxppc-dev, netdev, linux-kernel, leoyang.li,
camelia.groza, linux-arm-kernel
In-Reply-To: <AM5PR04MB3267BC402A80D9E772BC8903ECD00@AM5PR04MB3267.eurprd04.prod.outlook.com>
From: Madalin-cristian Bucur <madalin.bucur@nxp.com>
Date: Thu, 15 Mar 2018 09:32:35 +0000
>> -----Original Message-----
>> From: Joakim Tjernlund [mailto:Joakim.Tjernlund@infinera.com]
>> Sent: Wednesday, March 14, 2018 8:43 PM
>> To: davem@davemloft.net; Madalin-cristian Bucur
>> <madalin.bucur@nxp.com>
>>
>> On Wed, 2018-03-14 at 08:37 -0500, Madalin Bucur wrote:
>> > Hi,
>> >
>> > This patch set is addressing several issues in the DPAA Ethernet
>> > driver suite:
>> >
>> > - module unload crash caused by wrong reference to device being left
>> > in the cleanup code after the DSA related changes
>> > - scheduling wile atomic bug in QMan code revealed during dpaa_eth
>> > module unload
>> > - a couple of error counter fixes, a duplicated init in dpaa_eth.
>>
>> hmm, some of these(all?) bugs are in stable too, CC: stable perhaps?
>
> Hi Jocke,
>
> I did not check that, they should be added.
Networking patches are not queued to stable by CC:'ing stable.
Instead you just simply need to ask me explicitly for -stable submission
which I will do at the appropriate time after the fixes have been able
to cook in Linus's tree for a little while.
I've queued this series up for that purpose, thanks.
^ permalink raw reply
* Re: [PATCH] net: dev_forward_skb(): Scrub packet's per-netns info only when crossing netns
From: Daniel Borkmann @ 2018-03-15 15:13 UTC (permalink / raw)
To: Shmulik Ladkani
Cc: Liran Alon, davem, netdev, linux-kernel, idan.brown, Yuval Shaia
In-Reply-To: <20180315145038.16df4fea@halley>
On 03/15/2018 01:50 PM, Shmulik Ladkani wrote:
> On Thu, 15 Mar 2018 12:56:13 +0100 Daniel Borkmann <daniel@iogearbox.net> wrote:
>> On 03/15/2018 10:21 AM, Shmulik Ladkani wrote:
>>>
>>> Regarding veth xmit, it does makes sense to preserve the fields if not
>>> crossing netns. This is also the case when one uses tc mirred.
>>>
>>> Regarding bpf redirect, well, it depends on the expectations of each bpf
>>> program.
>>> I'd argue that preserving the fields (at least the mark field) in the
>>> *non* xnet makes sense and provides more information and therefore more
>>> capabilities; Alas this might change behavior already being relied on.
>>>
>>> Maybe Daniel can comment on the matter.
>>
>> Overall I think it might be nice to not need scrubbing skb in such cases,
>> although my concern would be that this has potential to break existing
>> setups when they would expect mark being zero on other veth peer in any
>> case since it's the behavior for a long time already. The safer option
>> would be to have some sort of explicit opt-in e.g. on link creation to let
>> the skb->mark pass through unscrubbed. This would definitely be a useful
>> option e.g. when mark is set in the netns facing veth via clsact/egress
>> on xmit and when the container is unprivileged anyway.
>
> For the veth xmit case, an opt-in flag which disables mark scrubbing in
> the *non* xnet veth-pair seems reasonable.
>
> But what about bpf_redirect BPF_F_INGRESS, in setups not invovling
> containers?
> Currently bpf_redirect is implemented using dev_forward_skb which
> *fully* scrubs the skb, even if the target device is on same netns as
> skb->dev is.
>
> One might use ebpf programs that perform BPF_F_INGRESS bpf_redirect, for
> example for demuxing skbs arriving on some "master" device into various
> "slave" devices using specialized critiria.
>
> It would be beneficial to have the mark preserved when skb is injected
> to the slave device's rx path (especially when it's on the same netns).
Right, I think also here the easiest would be to have a BPF_F_PRESERVE_MARK
flag to opt-in in general case (xnet/non-xnet) and where helper bails out
on unknown flag, but also for the redirect in the same netns I think it would
be useful to have a similar redirect mode as in ipvlan master where instead
of dev_forward_skb() you would set the skb->dev = dev and have a similar
notion of RX_HANDLER_ANOTHER. Was thinking about the latter more recently
but haven't gotten to implement it yet.
> Liran's patch fixes this - but at the cost of changing existing behavior
> for BPF_F_INGRESS users (formerly: fully scrubbed; post patch: scrubbed
> only if xnet).
>
> I wonder, do you know of implementations that actually RELY on the fact
> that BPF_F_INGRESS actually clears the mark, in the *non* xnet case?
Not that I'm aware of right now, but hard to tell what other people run
in the wild.
But lets presume for a sec you would _not_ scrub it, then how are users
supposed to make use of this? The feature/bug may not be critical enough
(well, otherwise it wouldn't have been like this for long time) for stable,
so to write an app relying on it the behavior will change from kernel A to
kernel B, where you need to end up having a full blown veth run-time test
in order to figure it out before you can use it, not really useful either.
Thanks,
Daniel
^ permalink raw reply
* [RFC PATCH 2/2] ixgbe: setup XPS via netif_set_xps()
From: Paolo Abeni @ 2018-03-15 15:08 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Jeff Kirsher, Eric Dumazet, intel-wired-lan,
Alexander Duyck
In-Reply-To: <cover.1521124830.git.pabeni@redhat.com>
Before this commit, ixgbe with the default setting lacks XPS mapping
for CPUs id greater than the number of tx queues.
As a consequence the xmit path for such CPUs experience a relevant cost
in __netdev_pick_tx, mainly due to skb_tx_hash(), as reported by the perf
tool:
7.55%--netdev_pick_tx
|
--6.92%--__netdev_pick_tx
|
--6.35%--__skb_tx_hash
|
--5.94%--__skb_get_hash
|
--3.22%--__skb_flow_dissect
in the following scenario:
ethtool -L em1 combined 1
taskset 2 netperf -H 192.168.1.1 -t UDP_STREAM -- -m 1
MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.101.1 () port 0 AF_INET
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
212992 1 10.00 11497225 0 9.20
After this commit the perf tool reports:
0.85%--__netdev_pick_tx
and netperf reports:
MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.101.1 () port 0 AF_INET
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
212992 1 10.00 12736058 0 10.19
roughly +10% in xmit tput.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 13 +++----------
3 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index c1e3a0039ea5..04aaecce81d2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -293,7 +293,6 @@ enum ixgbe_ring_state_t {
__IXGBE_RX_CSUM_UDP_ZERO_ERR,
__IXGBE_RX_FCOE,
__IXGBE_TX_FDIR_INIT_DONE,
- __IXGBE_TX_XPS_INIT_DONE,
__IXGBE_TX_DETECT_HANG,
__IXGBE_HANG_CHECK_ARMED,
__IXGBE_TX_XDP_RING,
@@ -827,6 +826,7 @@ enum ixgbe_state_t {
__IXGBE_PTP_RUNNING,
__IXGBE_PTP_TX_IN_PROGRESS,
__IXGBE_RESET_REQUESTED,
+ __IXGBE_TX_XPS_INIT_DONE,
};
struct ixgbe_cb {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index c0e6ab42e0e1..da4e6416e8eb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -3224,6 +3224,7 @@ static int ixgbe_set_channels(struct net_device *dev,
#endif
/* use setup TC to update any traffic class queue mapping */
+ clear_bit(__IXGBE_TX_XPS_INIT_DONE, &adapter->state);
return ixgbe_setup_tc(dev, adapter->hw_tcs);
}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 85369423452d..5bd45fc737fa 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3566,16 +3566,6 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
ring->atr_sample_rate = 0;
}
- /* initialize XPS */
- if (!test_and_set_bit(__IXGBE_TX_XPS_INIT_DONE, &ring->state)) {
- struct ixgbe_q_vector *q_vector = ring->q_vector;
-
- if (q_vector)
- netif_set_xps_queue(ring->netdev,
- &q_vector->affinity_mask,
- ring->queue_index);
- }
-
clear_bit(__IXGBE_HANG_CHECK_ARMED, &ring->state);
/* reinitialize tx_buffer_info */
@@ -5626,6 +5616,9 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter)
int err;
u32 ctrl_ext;
+ if (!test_and_set_bit(__IXGBE_TX_XPS_INIT_DONE, &adapter->state))
+ netif_set_xps(adapter->netdev);
+
ixgbe_get_hw_control(adapter);
ixgbe_setup_gpie(adapter);
--
2.14.3
^ permalink raw reply related
* [RFC PATCH 1/2] net: introduce netif_set_xps()
From: Paolo Abeni @ 2018-03-15 15:08 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Jeff Kirsher, Eric Dumazet, intel-wired-lan,
Alexander Duyck
In-Reply-To: <cover.1521124830.git.pabeni@redhat.com>
netif_set_xps() configures XPS on the given netdevice so
that XPS mapping exists for each online CPU. Also, factor out an
unlocked version of netif_set_xps_queue() to allow configuring
all the netdev queues acquiring the xps lock only once.
Netdevice can leverage such helper replacing all the per queue call
to netif_set_xps_queue() with a single netif_set_xps().
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/linux/netdevice.h | 6 +++++
net/core/dev.c | 58 +++++++++++++++++++++++++++++++++++------------
2 files changed, 50 insertions(+), 14 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5fbb9f1da7fd..95727ccf0865 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3193,6 +3193,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
#ifdef CONFIG_XPS
int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
u16 index);
+int netif_set_xps(struct net_device *dev);
#else
static inline int netif_set_xps_queue(struct net_device *dev,
const struct cpumask *mask,
@@ -3200,6 +3201,11 @@ static inline int netif_set_xps_queue(struct net_device *dev,
{
return 0;
}
+
+int netif_set_xps(struct net_device *dev)
+{
+ return 0;
+}
#endif
u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
diff --git a/net/core/dev.c b/net/core/dev.c
index 12a9aad0b057..5a8d3d9ef9b4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2177,8 +2177,8 @@ static struct xps_map *expand_xps_map(struct xps_map *map,
return new_map;
}
-int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
- u16 index)
+int __netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
+ u16 index)
{
struct xps_dev_maps *dev_maps, *new_dev_maps = NULL;
int i, cpu, tci, numa_node_id = -2;
@@ -2197,18 +2197,14 @@ int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
if (maps_sz < L1_CACHE_BYTES)
maps_sz = L1_CACHE_BYTES;
- mutex_lock(&xps_map_mutex);
-
dev_maps = xmap_dereference(dev->xps_maps);
/* allocate memory for queue storage */
for_each_cpu_and(cpu, cpu_online_mask, mask) {
if (!new_dev_maps)
new_dev_maps = kzalloc(maps_sz, GFP_KERNEL);
- if (!new_dev_maps) {
- mutex_unlock(&xps_map_mutex);
+ if (!new_dev_maps)
return -ENOMEM;
- }
tci = cpu * num_tc + tc;
map = dev_maps ? xmap_dereference(dev_maps->cpu_map[tci]) :
@@ -2295,7 +2291,7 @@ int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
NUMA_NO_NODE);
if (!dev_maps)
- goto out_no_maps;
+ return 0;
/* removes queue from unused CPUs */
for_each_possible_cpu(cpu) {
@@ -2312,11 +2308,8 @@ int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
RCU_INIT_POINTER(dev->xps_maps, NULL);
kfree_rcu(dev_maps, rcu);
}
-
-out_no_maps:
- mutex_unlock(&xps_map_mutex);
-
return 0;
+
error:
/* remove any maps that we added */
for_each_possible_cpu(cpu) {
@@ -2330,13 +2323,50 @@ int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
}
}
- mutex_unlock(&xps_map_mutex);
-
kfree(new_dev_maps);
return -ENOMEM;
}
+
+int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
+ u16 index)
+{
+ int ret;
+
+ mutex_lock(&xps_map_mutex);
+ ret = __netif_set_xps_queue(dev, mask, index);
+ mutex_unlock(&xps_map_mutex);
+ return ret;
+}
EXPORT_SYMBOL(netif_set_xps_queue);
+int netif_set_xps(struct net_device *dev)
+{
+ cpumask_var_t queuemask;
+ int cpu, queue, err = 0;
+
+ if (!alloc_cpumask_var(&queuemask, GFP_KERNEL))
+ return -ENOMEM;
+
+ mutex_lock(&xps_map_mutex);
+ for (queue = 0; queue < dev->real_num_tx_queues; ++queue) {
+ cpumask_clear(queuemask);
+ for (cpu = queue; cpu < nr_cpu_ids;
+ cpu += dev->real_num_tx_queues)
+ cpumask_set_cpu(cpu, queuemask);
+
+ err = __netif_set_xps_queue(dev, queuemask, queue);
+ if (err)
+ goto out;
+ }
+
+out:
+ mutex_unlock(&xps_map_mutex);
+
+ free_cpumask_var(queuemask);
+ return err;
+}
+EXPORT_SYMBOL(netif_set_xps);
+
#endif
void netdev_reset_tc(struct net_device *dev)
{
--
2.14.3
^ permalink raw reply related
* [RFC PATCH 0/2] net:setup XPS mapping for each online CPU
From: Paolo Abeni @ 2018-03-15 15:08 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Jeff Kirsher, Eric Dumazet, intel-wired-lan,
Alexander Duyck
Currently, most MQ netdevice setup the default XPS configuration mapping 1-1
the first real_num_tx_queues queues and CPUs and no mapping is created for
the CPUs with id greater then real_num_tx_queues, if any.
As a result, the xmit path for unconnected sockets on such cores experiences a
relevant overhead in netdev_pick_tx(), which needs to dissect each packet and
compute its hash.
Such scenario is easily triggered. e.g. from DNS server under relevant load, as
the user-space process is moved away from the CPUs serving the softirqs (note:
this is beneficial for the overall DNS server performances).
This series introduces an helper to easily setup up XPS mapping for all the
online CPUs, and use it in the ixgbe driver, demonstrating a relevant
performance improvement in the above scenario.
Paolo Abeni (2):
net: introduce netif_set_xps()
ixgbe: setup XPS via netif_set_xps()
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 13 ++----
include/linux/netdevice.h | 6 +++
net/core/dev.c | 58 ++++++++++++++++++------
5 files changed, 55 insertions(+), 25 deletions(-)
--
2.14.3
^ 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