* (unknown)
From: David Miller @ 2018-10-19 17:46 UTC (permalink / raw)
To: dhowells; +Cc: netdev, linux-afs
In-Reply-To: <11408.1539960053@warthog.procyon.org.uk>
From: David Howells <dhowells@redhat.com>
Date: Fri, 19 Oct 2018 15:40:53 +0100
> Is there going to be a merge of net into net-next before the merge
> window opens? Or do you have a sample merge that I can rebase my
> afs-next branch on?
I'll be doing a net to net-next merge some time today.
^ permalink raw reply
* [net 1/1] tipc: eliminate message disordering during binding table update
From: Jon Maloy @ 2018-10-19 17:55 UTC (permalink / raw)
To: davem, netdev
Cc: gordan.mihaljevic, tung.q.nguyen, hoang.h.le, jon.maloy,
canh.d.luu, ying.xue, tipc-discussion
We have seen the following race scenario:
1) named_distribute() builds a "bulk" message, containing a PUBLISH
item for a certain publication. This is based on the contents of
the binding tables's 'cluster_scope' list.
2) tipc_named_withdraw() removes the same publication from the list,
bulds a WITHDRAW message and distributes it to all cluster nodes.
3) tipc_named_node_up(), which was calling named_distribute(), sends
out the bulk message built under 1)
4) The WITHDRAW message arrives at the just detected node, finds
no corresponding publication, and is dropped.
5) The PUBLISH item arrives at the same node, is added to its binding
table, and remains there forever.
This arrival disordering was earlier taken care of by the backlog queue,
originally added for a different purpose, which was removed in the
commit referred to below, but we now need a different solution.
In this commit, we replace the rcu lock protecting the 'cluster_scope'
list with a regular RW lock which comprises even the sending of the
bulk message. This both guarantees both the list integrity and the
message sending order. We will later add a commit which cleans up
this code further.
Note that this commit needs recently added commit d3092b2efca1 ("tipc:
fix unsafe rcu locking when accessing publication list") to apply
cleanly.
Fixes: 37922ea4a310 ("tipc: permit overlapping service ranges in name table")
Reported-by: Tuong Lien Tong <tuong.t.lien@dektech.com.au>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/name_distr.c | 18 ++++++++++--------
net/tipc/name_table.c | 1 +
net/tipc/name_table.h | 1 +
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 3cfeb9d..61219f0 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -94,8 +94,9 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
list_add_tail_rcu(&publ->binding_node, &nt->node_scope);
return NULL;
}
- list_add_tail_rcu(&publ->binding_node, &nt->cluster_scope);
-
+ write_lock_bh(&nt->cluster_scope_lock);
+ list_add_tail(&publ->binding_node, &nt->cluster_scope);
+ write_unlock_bh(&nt->cluster_scope_lock);
skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
if (!skb) {
pr_warn("Publication distribution failure\n");
@@ -112,11 +113,13 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
*/
struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ)
{
+ struct name_table *nt = tipc_name_table(net);
struct sk_buff *buf;
struct distr_item *item;
- list_del_rcu(&publ->binding_node);
-
+ write_lock_bh(&nt->cluster_scope_lock);
+ list_del(&publ->binding_node);
+ write_unlock_bh(&nt->cluster_scope_lock);
if (publ->scope == TIPC_NODE_SCOPE)
return NULL;
@@ -147,7 +150,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_rcu(publ, pls, binding_node) {
+ list_for_each_entry(publ, pls, binding_node) {
/* Prepare next buffer: */
if (!skb) {
skb = named_prepare_buf(net, PUBLICATION, msg_rem,
@@ -189,11 +192,10 @@ void tipc_named_node_up(struct net *net, u32 dnode)
__skb_queue_head_init(&head);
- rcu_read_lock();
+ read_lock_bh(&nt->cluster_scope_lock);
named_distribute(net, &head, dnode, &nt->cluster_scope);
- rcu_read_unlock();
-
tipc_node_xmit(net, &head, dnode, 0);
+ read_unlock_bh(&nt->cluster_scope_lock);
}
/**
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 66d5b2c..bff241f 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -744,6 +744,7 @@ int tipc_nametbl_init(struct net *net)
INIT_LIST_HEAD(&nt->node_scope);
INIT_LIST_HEAD(&nt->cluster_scope);
+ rwlock_init(&nt->cluster_scope_lock);
tn->nametbl = nt;
spin_lock_init(&tn->nametbl_lock);
return 0;
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 892bd75..f790663 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -100,6 +100,7 @@ struct name_table {
struct hlist_head services[TIPC_NAMETBL_SIZE];
struct list_head node_scope;
struct list_head cluster_scope;
+ rwlock_t cluster_scope_lock;
u32 local_publ_count;
};
--
2.1.4
^ permalink raw reply related
* Re: [PATCH v2 net-next 0/8] net: dsa: microchip: Modify KSZ9477 DSA driver in preparation to add other KSZ switch drivers
From: Florian Fainelli @ 2018-10-19 17:56 UTC (permalink / raw)
To: Tristram.Ha, marek.vasut
Cc: arkadis, UNGLinuxDriver, netdev, andrew, pavel, ruediger.schmitt
In-Reply-To: <93AF473E2DA327428DE3D46B72B1E9FD411AC863@CHN-SV-EXMX02.mchp-main.com>
On 08/16/2018 02:34 PM, Tristram.Ha@microchip.com wrote:
>> -----Original Message-----
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Sent: Wednesday, August 15, 2018 5:29 PM
>> To: Tristram Ha - C24268 <Tristram.Ha@microchip.com>; Andrew Lunn
>> <andrew@lunn.ch>; Pavel Machek <pavel@ucw.cz>; Ruediger Schmitt
>> <ruediger.schmitt@philips.com>
>> Cc: Arkadi Sharshevsky <arkadis@mellanox.com>; UNGLinuxDriver
>> <UNGLinuxDriver@microchip.com>; netdev@vger.kernel.org
>> Subject: Re: [PATCH v2 net-next 0/8] net: dsa: microchip: Modify KSZ9477
>> DSA driver in preparation to add other KSZ switch drivers
>>
>> On 12/05/2017 05:46 PM, Tristram.Ha@microchip.com wrote:
>>> From: Tristram Ha <Tristram.Ha@microchip.com>
>>>
>>> This series of patches is to modify the original KSZ9477 DSA driver so
>>> that other KSZ switch drivers can be added and use the common code.
>>>
>>> There are several steps to accomplish this achievement. First is to
>>> rename some function names with a prefix to indicate chip specific
>>> function. Second is to move common code into header that can be shared.
>>> Last is to modify tag_ksz.c so that it can handle many tail tag formats
>>> used by different KSZ switch drivers.
>>>
>>> ksz_common.c will contain the common code used by all KSZ switch drivers.
>>> ksz9477.c will contain KSZ9477 code from the original ksz_common.c.
>>> ksz9477_spi.c is renamed from ksz_spi.c.
>>> ksz9477_reg.h is renamed from ksz_9477_reg.h.
>>> ksz_common.h is added to provide common code access to KSZ switch
>>> drivers.
>>> ksz_spi.h is added to provide common SPI access functions to KSZ SPI
>>> drivers.
>>
>> Is something gating this series from getting included? It's been nearly
>> 8 months now and this has not been include nor resubmitted, any plans to
>> rebase that patch series and work towards inclusion in net-next when it
>> opens back again?
>>
>> Thank you!
>
> Sorry for the long delay. I will restart my kernel submission effort next month
> after finishing the work on current development project.
>
Tristram, any chance of resubmitting this or should someone with access
to those switches take up your series and submit it?
--
Florian
^ permalink raw reply
* [PATCH][next] igc: fix error return handling from call to netif_set_real_num_tx_queues
From: Colin King @ 2018-10-19 18:16 UTC (permalink / raw)
To: Sasha Neftin, Jeff Kirsher, David S . Miller, intel-wired-lan
Cc: kernel-janitors, netdev
From: Colin Ian King <colin.king@canonical.com>
The call to netif_set_real_num_tx_queues is not assigning the error
return to variable err even though the next line checks err for an
error. Fix this by adding the missing err assignment.
Detected by CoverityScan, CID#1474551 ("Logically dead code")
Fixes: 3df25e4c1e66 ("igc: Add interrupt support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 9d85707e8a81..80ddbd987764 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -3358,7 +3358,7 @@ static int __igc_open(struct net_device *netdev, bool resuming)
goto err_req_irq;
/* Notify the stack of the actual queue counts. */
- netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues);
+ err = netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues);
if (err)
goto err_set_queues;
--
2.19.1
^ permalink raw reply related
* Re: C45 Phys and PHY_FORCING state
From: Florian Fainelli @ 2018-10-19 18:43 UTC (permalink / raw)
To: Jose Abreu, Andrew Lunn
Cc: David S. Miller, netdev@vger.kernel.org, Joao Pinto
In-Reply-To: <cd0c9fe6-8b13-041b-1f80-caf3c6250df5@synopsys.com>
On 10/19/2018 05:02 AM, Jose Abreu wrote:
> Hello Andrew and Florian,
>
> Currently I have a 10G C45 phy that is fixed at 10G link. This
> version does not support auto negotiation so I'm turning off the
> feature in phydev struct field. I found out that when I do this
> phylib is not composing C45 frames and is instead using C22. This
> is due to call to genphy_udpate_link() which doesn't work on my
> phy because it doesn't support C22.
>
> If I apply attached patch then things work perfectly fine. Can
> you please review it ?
Looks reasonable, I could not find other functions in the state machine
that were not already abstracting the clause type, or letting a driver
callback be called. Can you submit this as a formal patch against
net-next (and not attached, but inline)?
I would suggest creating a helper, e.g: phy_update_link() that way
everything is well namespaced and clear within the state machine itself.
--
Florian
^ permalink raw reply
* [PATCH net-next 7/7] net: hns3: Add enable and process hw errors of TM scheduler
From: Salil Mehta @ 2018-10-19 19:15 UTC (permalink / raw)
To: davem
Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
linux-kernel, linuxarm, Shiju Jose
In-Reply-To: <20181019191532.10088-1-salil.mehta@huawei.com>
From: Shiju Jose <shiju.jose@huawei.com>
This patch enables and process hw errors of TM scheduler and
QCN(Quantized Congestion Control).
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 8 +
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 286 +++++++++++++++++++++
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h | 3 +
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +
4 files changed, 303 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
index f23cf78..872cd4b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
@@ -211,6 +211,12 @@ enum hclge_opcode_type {
HCLGE_OPC_LED_STATUS_CFG = 0xB000,
/* Error INT commands */
+ HCLGE_TM_SCH_ECC_INT_EN = 0x0829,
+ HCLGE_TM_SCH_ECC_ERR_RINT_CMD = 0x082d,
+ HCLGE_TM_SCH_ECC_ERR_RINT_CE = 0x082f,
+ HCLGE_TM_SCH_ECC_ERR_RINT_NFE = 0x0830,
+ HCLGE_TM_SCH_ECC_ERR_RINT_FE = 0x0831,
+ HCLGE_TM_SCH_MBIT_ECC_INFO_CMD = 0x0833,
HCLGE_COMMON_ECC_INT_CFG = 0x1505,
HCLGE_IGU_EGU_TNL_INT_QUERY = 0x1802,
HCLGE_IGU_EGU_TNL_INT_EN = 0x1803,
@@ -218,6 +224,8 @@ enum hclge_opcode_type {
HCLGE_IGU_COMMON_INT_QUERY = 0x1805,
HCLGE_IGU_COMMON_INT_EN = 0x1806,
HCLGE_IGU_COMMON_INT_CLR = 0x1807,
+ HCLGE_TM_QCN_MEM_INT_CFG = 0x1A14,
+ HCLGE_TM_QCN_MEM_INT_INFO_CMD = 0x1A17,
HCLGE_PPP_CMD0_INT_CMD = 0x2100,
HCLGE_PPP_CMD1_INT_CMD = 0x2101,
HCLGE_NCSI_INT_QUERY = 0x2400,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
index ea73def..f7e363b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
@@ -213,6 +213,129 @@ static const struct hclge_hw_error hclge_ppp_mpf_int3[] = {
{ /* sentinel */ }
};
+struct hclge_tm_sch_ecc_info {
+ const char *name;
+};
+
+static const struct hclge_tm_sch_ecc_info hclge_tm_sch_ecc_err[7][15] = {
+ {
+ { .name = "QSET_QUEUE_CTRL:PRI_LEN TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPA_LEN TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPB_LEN TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRA_LEN TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRB_LEN TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPA_HPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPB_HPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRA_HPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRB_HPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:QS_LINKLIST TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPA_TPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:SPB_TPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRA_TPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:WRRB_TPTR TAB" },
+ { .name = "QSET_QUEUE_CTRL:QS_DEFICITCNT TAB" },
+ },
+ {
+ { .name = "ROCE_QUEUE_CTRL:QS_LEN TAB" },
+ { .name = "ROCE_QUEUE_CTRL:QS_TPTR TAB" },
+ { .name = "ROCE_QUEUE_CTRL:QS_HPTR TAB" },
+ { .name = "ROCE_QUEUE_CTRL:QLINKLIST TAB" },
+ { .name = "ROCE_QUEUE_CTRL:QCLEN TAB" },
+ },
+ {
+ { .name = "NIC_QUEUE_CTRL:QS_LEN TAB" },
+ { .name = "NIC_QUEUE_CTRL:QS_TPTR TAB" },
+ { .name = "NIC_QUEUE_CTRL:QS_HPTR TAB" },
+ { .name = "NIC_QUEUE_CTRL:QLINKLIST TAB" },
+ { .name = "NIC_QUEUE_CTRL:QCLEN TAB" },
+ },
+ {
+ { .name = "RAM_CFG_CTRL:CSHAP TAB" },
+ { .name = "RAM_CFG_CTRL:PSHAP TAB" },
+ },
+ {
+ { .name = "SHAPER_CTRL:PSHAP TAB" },
+ },
+ {
+ { .name = "MSCH_CTRL" },
+ },
+ {
+ { .name = "TOP_CTRL" },
+ },
+};
+
+static const struct hclge_hw_error hclge_tm_sch_err_int[] = {
+ { .int_msk = BIT(0), .msg = "tm_sch_ecc_1bit_err" },
+ { .int_msk = BIT(1), .msg = "tm_sch_ecc_mbit_err" },
+ { .int_msk = BIT(2), .msg = "tm_sch_port_shap_sub_fifo_wr_full_err" },
+ { .int_msk = BIT(3), .msg = "tm_sch_port_shap_sub_fifo_rd_empty_err" },
+ { .int_msk = BIT(4), .msg = "tm_sch_pg_pshap_sub_fifo_wr_full_err" },
+ { .int_msk = BIT(5), .msg = "tm_sch_pg_pshap_sub_fifo_rd_empty_err" },
+ { .int_msk = BIT(6), .msg = "tm_sch_pg_cshap_sub_fifo_wr_full_err" },
+ { .int_msk = BIT(7), .msg = "tm_sch_pg_cshap_sub_fifo_rd_empty_err" },
+ { .int_msk = BIT(8), .msg = "tm_sch_pri_pshap_sub_fifo_wr_full_err" },
+ { .int_msk = BIT(9), .msg = "tm_sch_pri_pshap_sub_fifo_rd_empty_err" },
+ { .int_msk = BIT(10), .msg = "tm_sch_pri_cshap_sub_fifo_wr_full_err" },
+ { .int_msk = BIT(11), .msg = "tm_sch_pri_cshap_sub_fifo_rd_empty_err" },
+ { .int_msk = BIT(12),
+ .msg = "tm_sch_port_shap_offset_fifo_wr_full_err" },
+ { .int_msk = BIT(13),
+ .msg = "tm_sch_port_shap_offset_fifo_rd_empty_err" },
+ { .int_msk = BIT(14),
+ .msg = "tm_sch_pg_pshap_offset_fifo_wr_full_err" },
+ { .int_msk = BIT(15),
+ .msg = "tm_sch_pg_pshap_offset_fifo_rd_empty_err" },
+ { .int_msk = BIT(16),
+ .msg = "tm_sch_pg_cshap_offset_fifo_wr_full_err" },
+ { .int_msk = BIT(17),
+ .msg = "tm_sch_pg_cshap_offset_fifo_rd_empty_err" },
+ { .int_msk = BIT(18),
+ .msg = "tm_sch_pri_pshap_offset_fifo_wr_full_err" },
+ { .int_msk = BIT(19),
+ .msg = "tm_sch_pri_pshap_offset_fifo_rd_empty_err" },
+ { .int_msk = BIT(20),
+ .msg = "tm_sch_pri_cshap_offset_fifo_wr_full_err" },
+ { .int_msk = BIT(21),
+ .msg = "tm_sch_pri_cshap_offset_fifo_rd_empty_err" },
+ { .int_msk = BIT(22), .msg = "tm_sch_rq_fifo_wr_full_err" },
+ { .int_msk = BIT(23), .msg = "tm_sch_rq_fifo_rd_empty_err" },
+ { .int_msk = BIT(24), .msg = "tm_sch_nq_fifo_wr_full_err" },
+ { .int_msk = BIT(25), .msg = "tm_sch_nq_fifo_rd_empty_err" },
+ { .int_msk = BIT(26), .msg = "tm_sch_roce_up_fifo_wr_full_err" },
+ { .int_msk = BIT(27), .msg = "tm_sch_roce_up_fifo_rd_empty_err" },
+ { .int_msk = BIT(28), .msg = "tm_sch_rcb_byte_fifo_wr_full_err" },
+ { .int_msk = BIT(29), .msg = "tm_sch_rcb_byte_fifo_rd_empty_err" },
+ { .int_msk = BIT(30), .msg = "tm_sch_ssu_byte_fifo_wr_full_err" },
+ { .int_msk = BIT(31), .msg = "tm_sch_ssu_byte_fifo_rd_empty_err" },
+ { /* sentinel */ }
+};
+
+static const struct hclge_hw_error hclge_qcn_ecc_err_int[] = {
+ { .int_msk = BIT(0), .msg = "qcn_byte_mem_ecc_1bit_err" },
+ { .int_msk = BIT(1), .msg = "qcn_byte_mem_ecc_mbit_err" },
+ { .int_msk = BIT(2), .msg = "qcn_time_mem_ecc_1bit_err" },
+ { .int_msk = BIT(3), .msg = "qcn_time_mem_ecc_mbit_err" },
+ { .int_msk = BIT(4), .msg = "qcn_fb_mem_ecc_1bit_err" },
+ { .int_msk = BIT(5), .msg = "qcn_fb_mem_ecc_mbit_err" },
+ { .int_msk = BIT(6), .msg = "qcn_link_mem_ecc_1bit_err" },
+ { .int_msk = BIT(7), .msg = "qcn_link_mem_ecc_mbit_err" },
+ { .int_msk = BIT(8), .msg = "qcn_rate_mem_ecc_1bit_err" },
+ { .int_msk = BIT(9), .msg = "qcn_rate_mem_ecc_mbit_err" },
+ { .int_msk = BIT(10), .msg = "qcn_tmplt_mem_ecc_1bit_err" },
+ { .int_msk = BIT(11), .msg = "qcn_tmplt_mem_ecc_mbit_err" },
+ { .int_msk = BIT(12), .msg = "qcn_shap_cfg_mem_ecc_1bit_err" },
+ { .int_msk = BIT(13), .msg = "qcn_shap_cfg_mem_ecc_mbit_err" },
+ { .int_msk = BIT(14), .msg = "qcn_gp0_barrel_mem_ecc_1bit_err" },
+ { .int_msk = BIT(15), .msg = "qcn_gp0_barrel_mem_ecc_mbit_err" },
+ { .int_msk = BIT(16), .msg = "qcn_gp1_barrel_mem_ecc_1bit_err" },
+ { .int_msk = BIT(17), .msg = "qcn_gp1_barrel_mem_ecc_mbit_err" },
+ { .int_msk = BIT(18), .msg = "qcn_gp2_barrel_mem_ecc_1bit_err" },
+ { .int_msk = BIT(19), .msg = "qcn_gp2_barrel_mem_ecc_mbit_err" },
+ { .int_msk = BIT(20), .msg = "qcn_gp3_barral_mem_ecc_1bit_err" },
+ { .int_msk = BIT(21), .msg = "qcn_gp3_barral_mem_ecc_mbit_err" },
+ { /* sentinel */ }
+};
+
static void hclge_log_error(struct device *dev,
const struct hclge_hw_error *err_list,
u32 err_sts)
@@ -501,6 +624,47 @@ static int hclge_enable_ppp_error(struct hclge_dev *hdev, bool en)
return ret;
}
+int hclge_enable_tm_hw_error(struct hclge_dev *hdev, bool en)
+{
+ struct device *dev = &hdev->pdev->dev;
+ struct hclge_desc desc;
+ int ret;
+
+ /* enable TM SCH hw errors */
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_TM_SCH_ECC_INT_EN, false);
+ if (en)
+ desc.data[0] = cpu_to_le32(HCLGE_TM_SCH_ECC_ERR_INT_EN);
+ else
+ desc.data[0] = 0;
+
+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (ret) {
+ dev_err(dev, "failed(%d) to configure TM SCH errors\n", ret);
+ return ret;
+ }
+
+ /* enable TM QCN hw errors */
+ ret = hclge_cmd_query_error(hdev, &desc, HCLGE_TM_QCN_MEM_INT_CFG,
+ 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read TM QCN CFG status\n", ret);
+ return ret;
+ }
+
+ hclge_cmd_reuse_desc(&desc, false);
+ if (en)
+ desc.data[1] = cpu_to_le32(HCLGE_TM_QCN_MEM_ERR_INT_EN);
+ else
+ desc.data[1] = 0;
+
+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (ret)
+ dev_err(dev,
+ "failed(%d) to configure TM QCN mem errors\n", ret);
+
+ return ret;
+}
+
static void hclge_process_common_error(struct hclge_dev *hdev,
enum hclge_err_int_type type)
{
@@ -736,6 +900,125 @@ static void hclge_process_ppp_error(struct hclge_dev *hdev,
ret);
}
+static void hclge_process_tm_sch_error(struct hclge_dev *hdev)
+{
+ struct device *dev = &hdev->pdev->dev;
+ const struct hclge_tm_sch_ecc_info *tm_sch_ecc_info;
+ struct hclge_desc desc;
+ u32 ecc_info;
+ u8 module_no;
+ u8 ram_no;
+ int ret;
+
+ /* read TM scheduler errors */
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_SCH_MBIT_ECC_INFO_CMD, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read SCH mbit ECC err info\n", ret);
+ return;
+ }
+ ecc_info = le32_to_cpu(desc.data[0]);
+
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_SCH_ECC_ERR_RINT_CMD, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read SCH ECC err status\n", ret);
+ return;
+ }
+
+ /* log TM scheduler errors */
+ if (le32_to_cpu(desc.data[0])) {
+ hclge_log_error(dev, &hclge_tm_sch_err_int[0],
+ le32_to_cpu(desc.data[0]));
+ if (le32_to_cpu(desc.data[0]) & 0x2) {
+ module_no = (ecc_info >> 20) & 0xF;
+ ram_no = (ecc_info >> 16) & 0xF;
+ tm_sch_ecc_info =
+ &hclge_tm_sch_ecc_err[module_no][ram_no];
+ dev_warn(dev, "ecc err module:ram=%s\n",
+ tm_sch_ecc_info->name);
+ dev_warn(dev, "ecc memory address = 0x%x\n",
+ ecc_info & 0xFFFF);
+ }
+ }
+
+ /* clear TM scheduler errors */
+ ret = hclge_cmd_clear_error(hdev, &desc, NULL, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to clear TM SCH error status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_SCH_ECC_ERR_RINT_CE, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read SCH CE status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_clear_error(hdev, &desc, NULL, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to clear TM SCH CE status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_SCH_ECC_ERR_RINT_NFE, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read SCH NFE status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_clear_error(hdev, &desc, NULL, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to clear TM SCH NFE status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_SCH_ECC_ERR_RINT_FE, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read SCH FE status\n", ret);
+ return;
+ }
+
+ ret = hclge_cmd_clear_error(hdev, &desc, NULL, 0, 0);
+ if (ret)
+ dev_err(dev, "failed(%d) to clear TM SCH FE status\n", ret);
+}
+
+static void hclge_process_tm_qcn_error(struct hclge_dev *hdev)
+{
+ struct device *dev = &hdev->pdev->dev;
+ struct hclge_desc desc;
+ int ret;
+
+ /* read QCN errors */
+ ret = hclge_cmd_query_error(hdev, &desc,
+ HCLGE_TM_QCN_MEM_INT_INFO_CMD, 0, 0, 0);
+ if (ret) {
+ dev_err(dev, "failed(%d) to read QCN ECC err status\n", ret);
+ return;
+ }
+
+ /* log QCN errors */
+ if (le32_to_cpu(desc.data[0]))
+ hclge_log_error(dev, &hclge_qcn_ecc_err_int[0],
+ le32_to_cpu(desc.data[0]));
+
+ /* clear QCN errors */
+ ret = hclge_cmd_clear_error(hdev, &desc, NULL, 0, 0);
+ if (ret)
+ dev_err(dev, "failed(%d) to clear QCN error status\n", ret);
+}
+
+static void hclge_process_tm_error(struct hclge_dev *hdev,
+ enum hclge_err_int_type type)
+{
+ hclge_process_tm_sch_error(hdev);
+ hclge_process_tm_qcn_error(hdev);
+}
+
static const struct hclge_hw_blk hw_blk[] = {
{ .msk = BIT(0), .name = "IGU_EGU",
.enable_error = hclge_enable_igu_egu_error,
@@ -743,6 +1026,9 @@ static const struct hclge_hw_blk hw_blk[] = {
{ .msk = BIT(5), .name = "COMMON",
.enable_error = hclge_enable_common_error,
.process_error = hclge_process_common_error, },
+ { .msk = BIT(4), .name = "TM",
+ .enable_error = hclge_enable_tm_hw_error,
+ .process_error = hclge_process_tm_error, },
{ .msk = BIT(1), .name = "PPP",
.enable_error = hclge_enable_ppp_error,
.process_error = hclge_process_ppp_error, },
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
index c6d3739..e0e3b58 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
@@ -37,6 +37,8 @@
#define HCLGE_PPP_MPF_ECC_ERR_INT2_EN_MASK 0x003F
#define HCLGE_PPP_MPF_ECC_ERR_INT3_EN 0x003F
#define HCLGE_PPP_MPF_ECC_ERR_INT3_EN_MASK 0x003F
+#define HCLGE_TM_SCH_ECC_ERR_INT_EN 0x3
+#define HCLGE_TM_QCN_MEM_ERR_INT_EN 0xFFFFFF
#define HCLGE_NCSI_ERR_INT_EN 0x3
#define HCLGE_NCSI_ERR_INT_TYPE 0x9
@@ -76,5 +78,6 @@ struct hclge_hw_error {
};
int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state);
+int hclge_enable_tm_hw_error(struct hclge_dev *hdev, bool en);
pci_ers_result_t hclge_process_ras_hw_error(struct hnae3_ae_dev *ae_dev);
#endif
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 082ea97..5234b53 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6881,6 +6881,12 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
return ret;
}
+ /* Re-enable the TM hw error interrupts because
+ * they get disabled on core/global reset.
+ */
+ if (hclge_enable_tm_hw_error(hdev, true))
+ dev_err(&pdev->dev, "failed to enable TM hw error interrupts\n");
+
dev_info(&pdev->dev, "Reset done, %s driver initialization finished.\n",
HCLGE_DRIVER_NAME);
--
2.7.4
^ permalink raw reply related
* Re: [PATCH net-next] net: ethernet: ti: cpsw: don't flush mcast entries while switch promisc mode
From: Ivan Khoronzhuk @ 2018-10-19 19:24 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: davem, linux-omap, netdev, linux-kernel
In-Reply-To: <36da9bb2-38b7-cc70-9569-8895e20c6d1f@ti.com>
On Fri, Oct 19, 2018 at 12:23:28PM -0500, Grygorii Strashko wrote:
>
>
>On 10/19/18 7:04 AM, Ivan Khoronzhuk wrote:
>>On Thu, Oct 18, 2018 at 07:03:06PM -0500, Grygorii Strashko wrote:
>>>
>>>
>>>On 10/18/18 1:00 PM, Ivan Khoronzhuk wrote:
>>>>No need now to flush mcast entries in switch mode while toggling to
>>>>promiscuous mode. It's not needed as vlan reg_mcast = ALL_PORTS
>>>>and mcast/vlan ports = ALL_PORTS, the same happening for vlan
>>>>unreg_mcast, it's set to ALL_PORT_MASK just after calling promisc
>>>>mode routine by calling set allmulti. I suppose main reason to flush
>>>>them is to use unreg_mcast to receive all to host port. Thus, now, all
>>>>mcast packets are received anyway and no reason to flush mcast entries
>>>>unsafely, as they were synced with __dev_mc_sync() previously and are
>>>>not restored. Another way is to _dev_mc_unsync() them, but no need.
>>>
>>>User have possibility to add additional mcast entries or edit
>>>existing in switch-mode, which is now done using custom tool. So,
>>>Host in promisc
>>>mode will not receive packets for mcast address X if port mask for this
>>>addr set to (ALL_PORTS - HOST_PORT). Am I missing smth?
>>
>>I didn't take into account the custom tool changing entries directly,
>>but even in this case there is at least a couple of interesting
>>questions:
>>
>>1) Before the patch applied only several days ago -
>> 5da1948969bc1991920987ce4361ea56046e5a98
>> "ti: cpsw: fix lost of mcast packets while rx_mode update"
>> It was impossible to do correctly anyway, as all mcast entries not
>> in the mc list were flushed (after rx_mode cb), by:
>> cpsw_ale_flush_multicast(cpsw->ale, ALE_ALL_PORTS, vid);
>> and those in mc, rewritten by adding them back in corrected form.
>> ... or this cb was not supposed to be called at all ...
>
>It's not allowed to manipulate ALE table in dual_mac mode, so your
>patches are safe in dual_mac mode. For switch-mode (unless we move
>forward with switch dev) standard linux interfaces allows create
>default mcast entries which then (if required) corrected using custom
>tool now.
It's not related to my patches at all, this as it was from very beginning.
My proposition with __dev_mc_unsync(priv->ndev, NULL) is safe as for
dual_mac mode as for switch mode.
>
>>
>>2) What is the reason to add mcast switch entires
>> (ALL_PORTS - HOST_PORT) if its function is added anyway by
>> unreq_mcast & (ALL_PORTS - HOST_PORT) ?
>> So, doesn't matter it's added or not - it will work :-|.
>
>because in switch mode not all traffic directed to the Host port -
No objections, that's exactly I'm talking about here, only p1&p2.
And looks like you forgot about single port board reusing switch
implementation, which by fact is not a switch but reuse this code.
Proposition to flush all its mcast table w/o restore - softly
speaking isn't best choice.
>only in promisc mode. Reason safety and performance - Host should not
>receive traffic which is not designated for it.
Any objections.
>
>promiscuous in switch mode:
>- disables learning
>- enables unicast flooding to Host port
>- enables unregistered multi-cast flooding to the Host port
>In other words, CPSW will continue forwarding packets between P1&P2,
>but also will "duplicate" packets to Host port. This will work only
>for
>vlans which have host port as member.
Sorry, but what part was not clearly described in the cover letter?
If you mean vlan entries added not by linux (linux vlans have host
port), and having no host port as a memeber - flush() hasn't been
helping in this case also.
>
>>
>>3) Even so, toggling promisc mode will clear all these changes anyway,
>> even I will call _dev_mc_unsync() after flushing them.
>
>there can be records which are not under control of Linux now.
yes, and they are flushed w/o restore (along with linux ones).
that's why fix is needed.
>
>>
>>4) If user can tune ALE table by hand, what stops him do it after moving
>> to promisc mode, seems he knows what he's doing?
>>
>>5) It could be possible only for not default vlan entries, but mcast
>> vlan support is not supported yet. Who is gona restore those
>> entries after promisc off?
>>
>>This behaviour is arguable, and flushing mcast entries can bring more
>>issues then leaving. For me it doesn't matter, I can archive the same
>>by adding after flush one line, it's even shorter:
>>__dev_mc_unsync(priv->ndev, NULL);
>
>Again, unless we move forward with switch dev you can't assume that
>Linux stack has full control over ALE table.
and that's why Linux stack is flushing all not created by it mcast entries...
but this what it was doing w/o my changes ).
after my patch it won't, Look:
- it adds/removes entries under control of linux
- it doesn't touch entries added whoever but not a linux
- it restores only entries added linux
(it was before also, but with flushing all not related entries..
..deleting what you don't want to delete)
>Sry, hence this patch is
>not a fix and can introduce changes in current behavior and cause
>regression reports - NACK.
Sorry but what regression you are talking about, what the problem with
__dev_mc_unsync(priv->ndev, NULL)? after flush? This is more than fix.
Restoring entries that were under control of linux is not a fix?
It doesn't touch anything added by custom tool and restores entries
in mc list like it was before. According to your comments, it seems
absolutely one fix you need, ...and don't forget about BBB with one port.
>
>--
>regards,
>-grygorii
--
Regards,
Ivan Khoronzhuk
^ permalink raw reply
* Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
From: Martin Lau @ 2018-10-19 19:36 UTC (permalink / raw)
To: Edward Cree
Cc: Yonghong Song, Alexei Starovoitov, daniel@iogearbox.net,
netdev@vger.kernel.org, Kernel Team
In-Reply-To: <852b205b-1d32-1d85-5dcf-0edfa8efcd6a@solarflare.com>
On Fri, Oct 19, 2018 at 06:04:11PM +0100, Edward Cree wrote:
> On 18/10/18 22:19, Martin Lau wrote:
> > As I have mentioned earlier, it is also special to
> > the kernel because the BTF verifier and bpf_prog_load()
> > need to do different checks for FUNC and FUNC_PROTO to
> > ensure they are sane.
> >
> > First, we need to agree that the kernel needs to verify
> > them differently.
> >
> > and then we can proceed to discuss how to distinguish them.
> > We picked the current way to avoid adding a
> > new BTF function section and keep it
> > strict forward to distinguish them w/o relying
> > on other hints from 'struct btf_type'.
> >
> > Are you suggesting another way of doing it?
> But you *do* have such a new section.
> The patch comment talks about a 'FuncInfo Table' which appears to
Note that the new section, which contains the FuncInfo Table,
is in a new ELF section ".BTF.ext" instead of the ".BTF".
It is not in the ".BTF" section because it is only useful during
bpf_prog_load().
I was meaning a new function section within ".BTF".
> map (section, insn_idx) to type_id. (I think this gets added in
> .BTF.ext per patch 9?) So when you're looking at a FUNC type
> because you looked up a type_id from that table, you know it's
> the signature of a subprogram, and you're checking it as such.
> Whereas, if you were doing something with some other type and it
> referenced a FUNC type (e.g., in the patch comment's example,
> you're checking foo's first argument against the type bar) in
> its type_id, you know you're using it as a formal type (a FUNC_
> PROTO in your parlance) and not as a subprogram.
> The context in which you are using a type entry tells you which
> kind it is. And the verifier can and should be smart enough to
> know what it's doing in this way.
>
> And it's entirely reasonable for the same type entry to get used
> for both those cases; in my example, you'd have a FUNC type for
> int foo(int), referenced both by the func_info entry for foo
> and by the PTR type for bar. And if you had another subprogram
> int baz(int), its func_info entry could reference the same
> type_id, because the (reference to the) name of the function
> should live in the func_info, not in the type.
IIUC, I think what you are suggesting here is to use (type_id, name)
to describe DW_TAG_subprogram "int foo1(int) {}", "int foo2(int) {}",
"int foo3(int) {}" where type_id here is referring to the same
DW_TAG_subroutine_type, and only define that _one_
DW_TAG_subroutine_type in the BTF "type" section.
That will require more manipulation/type-merging in the dwarf2btf
process and it could get quite complicated.
Note that CTF is also fully spelling out the return type
and arg types for each DW_TAG_subprogram in a separate
function section (still within the same ELF section).
The only difference here is they are merged into the type
section and FUNC_PROTO is added.
If the concern is having both FUNC and FUNC_PROTO is confusing,
we could go back to the CTF way which adds a new function section
in ".BTF" and it is only for DW_TAG_subprogram.
BTF_KIND_FUNC_PROTO is then no longer necessary.
Some of new BTF verifier checkings may actually go away also.
The down side is there will be two id spaces.
>
> What you are proposing seems to be saying "if we have this
> particular special btf_kind, then this BTF entry doesn't just
> define a type, it declares a subprogram of that type". Oh,
> and with the name of the type as the subprogram name. Which
> just creates blurry confusion as to whether BTF entries define
> types or declare objects; IMNSHO the correct approach is for
> objects to be declared elsewhere and to reference BTF types by
> their type_id.
> Which is what the func_info table in patch 9 appears to do.
>
> (It also rather bothers me the way we are using special type
> names to associate maps with their k/v types, rather than
> extending the records in the maps section to include type_ids
> referencing them. It's the same kind of weird implicitness,
> and if I'd spotted it when it was going in I'd've nacked it,
> but I suppose it's ABI now and too late to change.)
>
> -Ed
^ permalink raw reply
* Re: [PATCH ghak90 (was ghak32) V4 02/10] audit: add container id
From: Paul Moore @ 2018-10-19 19:38 UTC (permalink / raw)
To: rgb
Cc: containers, linux-api, linux-audit, linux-fsdevel, linux-kernel,
netdev, netfilter-devel, ebiederm, luto, carlos, dhowells, viro,
simo, Eric Paris, Serge Hallyn
In-Reply-To: <12396e378a78ee8dd38c75f7730d67d8fbb08e02.1533065887.git.rgb@redhat.com>
On Tue, Jul 31, 2018 at 4:11 PM Richard Guy Briggs <rgb@redhat.com> wrote:
>
> Implement the proc fs write to set the audit container identifier of a
> process, emitting an AUDIT_CONTAINER_OP record to document the event.
>
> This is a write from the container orchestrator task to a proc entry of
> the form /proc/PID/audit_containerid where PID is the process ID of the
> newly created task that is to become the first task in a container, or
> an additional task added to a container.
>
> The write expects up to a u64 value (unset: 18446744073709551615).
>
> The writer must have capability CAP_AUDIT_CONTROL.
>
> This will produce a record such as this:
> type=CONTAINER_ID msg=audit(2018-06-06 12:39:29.636:26949) : op=set opid=2209 old-contid=18446744073709551615 contid=123456 pid=628 auid=root uid=root tty=ttyS0 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 comm=bash exe=/usr/bin/bash res=yes
You need to update the record type in the example above.
> The "op" field indicates an initial set. The "pid" to "ses" fields are
> the orchestrator while the "opid" field is the object's PID, the process
> being "contained". Old and new audit container identifier values are
> given in the "contid" fields, while res indicates its success.
I understand Steve's concern around the "op" field, but I think it
might be a bit premature to think we might not need to do some sort of
audit container ID management in the future that would want to make
use of the CONTAINER_OP message type. I would like to see the "op"
field preserved.
> It is not permitted to unset the audit container identifier.
> A child inherits its parent's audit container identifier.
>
> See: https://github.com/linux-audit/audit-kernel/issues/90
> See: https://github.com/linux-audit/audit-userspace/issues/51
> See: https://github.com/linux-audit/audit-testsuite/issues/64
> See: https://github.com/linux-audit/audit-kernel/wiki/RFE-Audit-Container-ID
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> Acked-by: Serge Hallyn <serge@hallyn.com>
> Acked-by: Steve Grubb <sgrubb@redhat.com>
> ---
> fs/proc/base.c | 37 +++++++++++++++++++++++++
> include/linux/audit.h | 24 ++++++++++++++++
> include/uapi/linux/audit.h | 2 ++
> kernel/auditsc.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 131 insertions(+)
...
> @@ -2112,6 +2114,72 @@ int audit_set_loginuid(kuid_t loginuid)
> }
>
> /**
> + * audit_set_contid - set current task's audit_context contid
> + * @contid: contid value
> + *
> + * Returns 0 on success, -EPERM on permission failure.
> + *
> + * Called (set) from fs/proc/base.c::proc_contid_write().
> + */
> +int audit_set_contid(struct task_struct *task, u64 contid)
> +{
> + u64 oldcontid;
> + int rc = 0;
> + struct audit_buffer *ab;
> + uid_t uid;
> + struct tty_struct *tty;
> + char comm[sizeof(current->comm)];
> +
> + task_lock(task);
> + /* Can't set if audit disabled */
> + if (!task->audit) {
> + task_unlock(task);
> + return -ENOPROTOOPT;
> + }
> + oldcontid = audit_get_contid(task);
> + read_lock(&tasklist_lock);
I assume lockdep was happy with nesting the tasklist_lock inside the task lock?
> + /* Don't allow the audit containerid to be unset */
> + if (!audit_contid_valid(contid))
> + rc = -EINVAL;
> + /* if we don't have caps, reject */
> + else if (!capable(CAP_AUDIT_CONTROL))
> + rc = -EPERM;
> + /* if task has children or is not single-threaded, deny */
> + else if (!list_empty(&task->children))
> + rc = -EBUSY;
> + else if (!(thread_group_leader(task) && thread_group_empty(task)))
> + rc = -EALREADY;
> + read_unlock(&tasklist_lock);
> + if (!rc)
> + task->audit->contid = contid;
> + task_unlock(task);
> +
> + if (!audit_enabled)
> + return rc;
> +
> + ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_CONTAINER_OP);
> + if (!ab)
> + return rc;
> +
> + uid = from_kuid(&init_user_ns, task_uid(current));
> + tty = audit_get_tty(current);
> + audit_log_format(ab, "op=set opid=%d old-contid=%llu contid=%llu pid=%d uid=%u auid=%u tty=%s ses=%u",
> + task_tgid_nr(task), oldcontid, contid,
> + task_tgid_nr(current), uid,
> + from_kuid(&init_user_ns, audit_get_loginuid(current)),
> + tty ? tty_name(tty) : "(none)",
> + audit_get_sessionid(current));
> + audit_put_tty(tty);
> + audit_log_task_context(ab);
> + audit_log_format(ab, " comm=");
> + audit_log_untrustedstring(ab, get_task_comm(comm, current));
> + audit_log_d_path_exe(ab, current->mm);
> + audit_log_format(ab, " res=%d", !rc);
> + audit_log_end(ab);
> + return rc;
> +}
--
paul moore
www.paul-moore.com
^ permalink raw reply
* [PATCH net-next 2/4] net/ipv6: Remove ip_idx arg to in6_dump_addrs
From: David Ahern @ 2018-10-19 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, David Ahern
In-Reply-To: <20181019194530.3590-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
ip_idx is always 0 going into in6_dump_addrs; it is passed as a pointer
to save the last good index into cb. Since cb is already argument to
in6_dump_addrs, just save the value there.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv6/addrconf.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e39c284e2954..6b659846ff8a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4955,14 +4955,13 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
/* called with rcu_read_lock() */
static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
- struct netlink_callback *cb,
- int s_ip_idx, int *p_ip_idx,
+ struct netlink_callback *cb, int s_ip_idx,
struct inet6_fill_args *fillargs)
{
struct ifmcaddr6 *ifmca;
struct ifacaddr6 *ifaca;
+ int ip_idx = 0;
int err = 1;
- int ip_idx = *p_ip_idx;
read_lock_bh(&idev->lock);
switch (fillargs->type) {
@@ -5012,7 +5011,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
break;
}
read_unlock_bh(&idev->lock);
- *p_ip_idx = ip_idx;
+ cb->args[2] = ip_idx;
return err;
}
@@ -5081,16 +5080,15 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
};
struct net *net = sock_net(skb->sk);
struct net *tgt_net = net;
+ int idx, s_idx, s_ip_idx;
int h, s_h;
- int idx, ip_idx;
- int s_idx, s_ip_idx;
struct net_device *dev;
struct inet6_dev *idev;
struct hlist_head *head;
s_h = cb->args[0];
s_idx = idx = cb->args[1];
- s_ip_idx = ip_idx = cb->args[2];
+ s_ip_idx = cb->args[2];
if (cb->strict_check) {
int err;
@@ -5111,12 +5109,11 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
goto cont;
if (h > s_h || idx > s_idx)
s_ip_idx = 0;
- ip_idx = 0;
idev = __in6_dev_get(dev);
if (!idev)
goto cont;
- if (in6_dump_addrs(idev, skb, cb, s_ip_idx, &ip_idx,
+ if (in6_dump_addrs(idev, skb, cb, s_ip_idx,
&fillargs) < 0)
goto done;
cont:
@@ -5127,7 +5124,6 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
rcu_read_unlock();
cb->args[0] = h;
cb->args[1] = idx;
- cb->args[2] = ip_idx;
if (fillargs.netnsid >= 0)
put_net(tgt_net);
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 0/4] net: Add support for dumping addresses for a specific device
From: David Ahern @ 2018-10-19 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, David Ahern
From: David Ahern <dsahern@gmail.com>
Use the recently added kernel side filter infrastructure to add support
for dumping addresses only for a specific device.
Patch 1 creates an IPv4 version similar to IPv6's in6_dump_addrs function.
Patch 2 simplifies in6_dump_addrs by moving index tracking of IP
addresses from inet6_dump_addr to in6_dump_addrs.
Patches 3 and 4 use the device-based address dump helpers to limit a
dump to just the addresses on a specific device.
David Ahern (4):
net/ipv4: Move loop over addresses in dumps into in_dev_dump_addr
net/ipv6: Remove ip_idx arg to in6_dump_addrs
net/ipv4: Add support for dumping addresses for a specific device
net/ipv6: Add support for dumping addresses for a specific device
net/ipv4/devinet.c | 77 +++++++++++++++++++++++++++++++++++++++--------------
net/ipv6/addrconf.c | 43 +++++++++++++++++++-----------
2 files changed, 85 insertions(+), 35 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH net-next 3/4] net/ipv4: Add support for dumping addresses for a specific device
From: David Ahern @ 2018-10-19 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, David Ahern
In-Reply-To: <20181019194530.3590-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
If an RTM_GETADDR dump request has ifa_index set in the ifaddrmsg
header, then return only the addresses for that device.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv4/devinet.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 67f382c560ba..63d5b58fbfdb 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -109,6 +109,7 @@ struct inet_fill_args {
int event;
unsigned int flags;
int netnsid;
+ int ifindex;
};
#define IN4_ADDR_HSIZE_SHIFT 8
@@ -1663,8 +1664,9 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
static int inet_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
struct inet_fill_args *fillargs,
struct net **tgt_net, struct sock *sk,
- struct netlink_ext_ack *extack)
+ struct netlink_callback *cb)
{
+ struct netlink_ext_ack *extack = cb->extack;
struct nlattr *tb[IFA_MAX+1];
struct ifaddrmsg *ifm;
int err, i;
@@ -1679,9 +1681,11 @@ static int inet_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
NL_SET_ERR_MSG(extack, "ipv4: Invalid values in header for address dump request");
return -EINVAL;
}
- if (ifm->ifa_index) {
- NL_SET_ERR_MSG(extack, "ipv4: Filter by device index not supported for address dump");
- return -EINVAL;
+
+ fillargs->ifindex = ifm->ifa_index;
+ if (fillargs->ifindex) {
+ cb->answer_flags |= NLM_F_DUMP_FILTERED;
+ fillargs->flags |= NLM_F_DUMP_FILTERED;
}
err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX,
@@ -1765,9 +1769,22 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
if (cb->strict_check) {
err = inet_valid_dump_ifaddr_req(nlh, &fillargs, &tgt_net,
- skb->sk, cb->extack);
+ skb->sk, cb);
if (err < 0)
return err;
+
+ if (fillargs.ifindex) {
+ dev = __dev_get_by_index(tgt_net, fillargs.ifindex);
+ if (!dev)
+ return -ENODEV;
+
+ in_dev = __in_dev_get_rtnl(dev);
+ if (in_dev) {
+ err = in_dev_dump_addr(in_dev, skb, cb, s_ip_idx,
+ &fillargs);
+ }
+ goto put_tgt_net;
+ }
}
for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
@@ -1800,6 +1817,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
done:
cb->args[0] = h;
cb->args[1] = idx;
+put_tgt_net:
if (fillargs.netnsid >= 0)
put_net(tgt_net);
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 1/4] net/ipv4: Move loop over addresses on a device into in_dev_dump_addr
From: David Ahern @ 2018-10-19 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, David Ahern
In-Reply-To: <20181019194530.3590-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
Similar to IPv6 move the logic that walks over the ipv4 address list
for a device into a helper.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv4/devinet.c | 49 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 15 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index d122ebbe5980..67f382c560ba 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1713,6 +1713,32 @@ static int inet_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
return 0;
}
+static int in_dev_dump_addr(struct in_device *in_dev, struct sk_buff *skb,
+ struct netlink_callback *cb, int s_ip_idx,
+ struct inet_fill_args *fillargs)
+{
+ struct in_ifaddr *ifa;
+ int ip_idx = 0;
+ int err;
+
+ for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next, ip_idx++) {
+ if (ip_idx < s_ip_idx)
+ continue;
+
+ err = inet_fill_ifaddr(skb, ifa, fillargs);
+ if (err < 0)
+ goto done;
+
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
+ }
+ err = 0;
+
+done:
+ cb->args[2] = ip_idx;
+
+ return err;
+}
+
static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
{
const struct nlmsghdr *nlh = cb->nlh;
@@ -1727,19 +1753,17 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
struct net *tgt_net = net;
int h, s_h;
int idx, s_idx;
- int ip_idx, s_ip_idx;
+ int s_ip_idx;
struct net_device *dev;
struct in_device *in_dev;
- struct in_ifaddr *ifa;
struct hlist_head *head;
+ int err;
s_h = cb->args[0];
s_idx = idx = cb->args[1];
- s_ip_idx = ip_idx = cb->args[2];
+ s_ip_idx = cb->args[2];
if (cb->strict_check) {
- int err;
-
err = inet_valid_dump_ifaddr_req(nlh, &fillargs, &tgt_net,
skb->sk, cb->extack);
if (err < 0)
@@ -1761,15 +1785,11 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
if (!in_dev)
goto cont;
- for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
- ifa = ifa->ifa_next, ip_idx++) {
- if (ip_idx < s_ip_idx)
- continue;
- if (inet_fill_ifaddr(skb, ifa, &fillargs) < 0) {
- rcu_read_unlock();
- goto done;
- }
- nl_dump_check_consistent(cb, nlmsg_hdr(skb));
+ err = in_dev_dump_addr(in_dev, skb, cb, s_ip_idx,
+ &fillargs);
+ if (err < 0) {
+ rcu_read_unlock();
+ goto done;
}
cont:
idx++;
@@ -1780,7 +1800,6 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
done:
cb->args[0] = h;
cb->args[1] = idx;
- cb->args[2] = ip_idx;
if (fillargs.netnsid >= 0)
put_net(tgt_net);
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 4/4] net/ipv6: Add support for dumping addresses for a specific device
From: David Ahern @ 2018-10-19 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, David Ahern
In-Reply-To: <20181019194530.3590-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
If an RTM_GETADDR dump request has ifa_index set in the ifaddrmsg
header, then return only the addresses for that device.
Since inet6_dump_addr is reused for multicast and anycast addresses,
this adds support for device specfic dumps of RTM_GETMULTICAST and
RTM_GETANYCAST as well.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv6/addrconf.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6b659846ff8a..45b84dd5c4eb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4821,6 +4821,7 @@ struct inet6_fill_args {
int event;
unsigned int flags;
int netnsid;
+ int ifindex;
enum addr_type_t type;
};
@@ -5018,8 +5019,9 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
static int inet6_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
struct inet6_fill_args *fillargs,
struct net **tgt_net, struct sock *sk,
- struct netlink_ext_ack *extack)
+ struct netlink_callback *cb)
{
+ struct netlink_ext_ack *extack = cb->extack;
struct nlattr *tb[IFA_MAX+1];
struct ifaddrmsg *ifm;
int err, i;
@@ -5034,9 +5036,11 @@ static int inet6_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for address dump request");
return -EINVAL;
}
- if (ifm->ifa_index) {
- NL_SET_ERR_MSG_MOD(extack, "Filter by device index not supported for address dump");
- return -EINVAL;
+
+ fillargs->ifindex = ifm->ifa_index;
+ if (fillargs->ifindex) {
+ cb->answer_flags |= NLM_F_DUMP_FILTERED;
+ fillargs->flags |= NLM_F_DUMP_FILTERED;
}
err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX,
@@ -5094,9 +5098,21 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
int err;
err = inet6_valid_dump_ifaddr_req(nlh, &fillargs, &tgt_net,
- skb->sk, cb->extack);
+ skb->sk, cb);
if (err < 0)
return err;
+
+ if (fillargs.ifindex) {
+ dev = __dev_get_by_index(tgt_net, fillargs.ifindex);
+ if (!dev)
+ return -ENODEV;
+ idev = __in6_dev_get(dev);
+ if (idev) {
+ err = in6_dump_addrs(idev, skb, cb, s_ip_idx,
+ &fillargs);
+ }
+ goto put_tgt_net;
+ }
}
rcu_read_lock();
@@ -5124,6 +5140,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
rcu_read_unlock();
cb->args[0] = h;
cb->args[1] = idx;
+put_tgt_net:
if (fillargs.netnsid >= 0)
put_net(tgt_net);
--
2.11.0
^ permalink raw reply related
* Re: [PATCH bpf-next v3 0/7] Implement queue/stack maps
From: Daniel Borkmann @ 2018-10-19 20:08 UTC (permalink / raw)
To: Mauricio Vasquez B, Alexei Starovoitov, netdev; +Cc: Song Liu
In-Reply-To: <153986856416.9127.9618539079636149043.stgit@kernel>
On 10/18/2018 03:16 PM, Mauricio Vasquez B wrote:
> In some applications this is needed have a pool of free elements, for
> example the list of free L4 ports in a SNAT. None of the current maps allow
> to do it as it is not possible to get any element without having they key
> it is associated to, even if it were possible, the lack of locking mecanishms in
> eBPF would do it almost impossible to be implemented without data races.
>
> This patchset implements two new kind of eBPF maps: queue and stack.
> Those maps provide to eBPF programs the peek, push and pop operations, and for
> userspace applications a new bpf_map_lookup_and_delete_elem() is added.
>
> Signed-off-by: Mauricio Vasquez B <mauricio.vasquez@polito.it>
>
> v2 -> v3:
> - Remove "almost dead code" in syscall.c
> - Remove unnecessary copy_from_user in bpf_map_lookup_and_delete_elem
> - Rebase
>
> v1 -> v2:
> - Put ARG_PTR_TO_UNINIT_MAP_VALUE logic into a separated patch
> - Fix missing __this_cpu_dec & preempt_enable calls in kernel/bpf/syscall.c
>
> RFC v4 -> v1:
> - Remove roundup to power of 2 in memory allocation
> - Remove count and use a free slot to check if queue/stack is empty
> - Use if + assigment for wrapping indexes
> - Fix some minor style issues
> - Squash two patches together
>
> RFC v3 -> RFC v4:
> - Revert renaming of kernel/bpf/stackmap.c
> - Remove restriction on value size
> - Remove len arguments from peek/pop helpers
> - Add new ARG_PTR_TO_UNINIT_MAP_VALUE
>
> RFC v2 -> RFC v3:
> - Return elements by value instead that by reference
> - Implement queue/stack base on array and head + tail indexes
> - Rename stack trace related files to avoid confusion and conflicts
>
> RFC v1 -> RFC v2:
> - Create two separate maps instead of single one + flags
> - Implement bpf_map_lookup_and_delete syscall
> - Support peek operation
> - Define replacement policy through flags in the update() method
> - Add eBPF side tests
>
> ---
>
> Mauricio Vasquez B (7):
> bpf: rename stack trace map operations
> bpf/syscall: allow key to be null in map functions
> bpf/verifier: add ARG_PTR_TO_UNINIT_MAP_VALUE
> bpf: add queue and stack maps
> bpf: add MAP_LOOKUP_AND_DELETE_ELEM syscall
> Sync uapi/bpf.h to tools/include
> selftests/bpf: add test cases for queue and stack maps
>
>
> include/linux/bpf.h | 7
> include/linux/bpf_types.h | 4
> include/uapi/linux/bpf.h | 30 ++
> kernel/bpf/Makefile | 2
> kernel/bpf/core.c | 3
> kernel/bpf/helpers.c | 43 +++
> kernel/bpf/queue_stack_maps.c | 288 ++++++++++++++++++++
> kernel/bpf/stackmap.c | 2
> kernel/bpf/syscall.c | 91 ++++++
> kernel/bpf/verifier.c | 28 ++
> net/core/filter.c | 6
> tools/include/uapi/linux/bpf.h | 30 ++
> tools/lib/bpf/bpf.c | 12 +
> tools/lib/bpf/bpf.h | 2
> tools/testing/selftests/bpf/Makefile | 5
> tools/testing/selftests/bpf/bpf_helpers.h | 7
> tools/testing/selftests/bpf/test_maps.c | 122 ++++++++
> tools/testing/selftests/bpf/test_progs.c | 99 +++++++
> tools/testing/selftests/bpf/test_queue_map.c | 4
> tools/testing/selftests/bpf/test_queue_stack_map.h | 59 ++++
> tools/testing/selftests/bpf/test_stack_map.c | 4
> 21 files changed, 834 insertions(+), 14 deletions(-)
> create mode 100644 kernel/bpf/queue_stack_maps.c
> create mode 100644 tools/testing/selftests/bpf/test_queue_map.c
> create mode 100644 tools/testing/selftests/bpf/test_queue_stack_map.h
> create mode 100644 tools/testing/selftests/bpf/test_stack_map.c
>
> --
>
Series:
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply
* [PATCH net] qlcnic: fix a return in qlcnic_dcb_get_capability()
From: Dan Carpenter @ 2018-10-19 20:11 UTC (permalink / raw)
To: Shahed Shaikh, Sucheta Chakraborty
Cc: Manish Chopra, Dept-GELinuxNICDev, David S. Miller, netdev,
kernel-janitors
These functions are supposed to return one on failure and zero on
success. Returning a zero here could cause uninitialized variable
bugs in several of the callers. For example:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
error: uninitialized symbol 'caps'.
Fixes: 48365e485275 ("qlcnic: dcb: Add support for CEE Netlink interface.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
index 4b76c69fe86d..834208e55f7b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,
struct qlcnic_adapter *adapter = netdev_priv(netdev);
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
- return 0;
+ return 1;
switch (capid) {
case DCB_CAP_ATTR_PG:
--
2.11.0
^ permalink raw reply related
* [PATCH net-next] net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode
From: Ivan Khoronzhuk @ 2018-10-19 20:25 UTC (permalink / raw)
To: grygorii.strashko, davem
Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk
After flushing all mcast entries from the table, the ones contained in
mc list of ndev are not restored when promisc mode is toggled off,
because they are considered as synched with ALE, thus, in order to
restore them after promisc mode - reset syncing info. This fix
touches only switch mode devices, including single port boards
like Beagle Bone.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
Based on net-nex/master
and is logical continuation of the
https://lore.kernel.org/patchwork/patch/1001633/
drivers/net/ethernet/ti/cpsw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 226be2a56c1f..f7753b240ced 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -640,6 +640,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
/* Clear all mcast from ALE */
cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS, -1);
+ __dev_mc_unsync(ndev, NULL);
/* Flood All Unicast Packets to Host port */
cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2-next] iplink: Remove flags argument from iplink_get
From: David Ahern @ 2018-10-19 20:28 UTC (permalink / raw)
To: netdev, stephen; +Cc: David Ahern
From: David Ahern <dsahern@gmail.com>
iplink_get has 1 caller and the flags arg is 0, so just remove it.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
ip/ip_common.h | 2 +-
ip/ipaddress.c | 2 +-
ip/iplink.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 200be5e23dd1..458a9cb7ff2c 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -91,7 +91,7 @@ void vrf_reset(void);
int netns_identify_pid(const char *pidstr, char *name, int len);
int do_seg6(int argc, char **argv);
-int iplink_get(unsigned int flags, char *name, __u32 filt_mask);
+int iplink_get(char *name, __u32 filt_mask);
int iplink_ifla_xstats(int argc, char **argv);
int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index c0c1fbbe4c74..9481f241cb36 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1940,7 +1940,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
* the link device
*/
if (filter_dev && filter.group == -1 && do_link == 1) {
- if (iplink_get(0, filter_dev, RTEXT_FILTER_VF) < 0) {
+ if (iplink_get(filter_dev, RTEXT_FILTER_VF) < 0) {
perror("Cannot send link get request");
delete_json_obj();
exit(1);
diff --git a/ip/iplink.c b/ip/iplink.c
index 50ccb49a0263..9f39e3826c19 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1087,11 +1087,11 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
return 0;
}
-int iplink_get(unsigned int flags, char *name, __u32 filt_mask)
+int iplink_get(char *name, __u32 filt_mask)
{
struct iplink_req req = {
.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
- .n.nlmsg_flags = NLM_F_REQUEST | flags,
+ .n.nlmsg_flags = NLM_F_REQUEST,
.n.nlmsg_type = RTM_GETLINK,
.i.ifi_family = preferred_family,
};
--
2.11.0
^ permalink raw reply related
* Re: [PATCH bpf-next v3 0/7] Implement queue/stack maps
From: Alexei Starovoitov @ 2018-10-19 20:30 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Mauricio Vasquez B, Alexei Starovoitov, netdev, Song Liu
In-Reply-To: <831d49fa-c131-b66a-80d2-65f8172467d5@iogearbox.net>
On Fri, Oct 19, 2018 at 10:08:08PM +0200, Daniel Borkmann wrote:
> On 10/18/2018 03:16 PM, Mauricio Vasquez B wrote:
> > In some applications this is needed have a pool of free elements, for
> > example the list of free L4 ports in a SNAT. None of the current maps allow
> > to do it as it is not possible to get any element without having they key
> > it is associated to, even if it were possible, the lack of locking mecanishms in
> > eBPF would do it almost impossible to be implemented without data races.
> >
> > This patchset implements two new kind of eBPF maps: queue and stack.
> > Those maps provide to eBPF programs the peek, push and pop operations, and for
> > userspace applications a new bpf_map_lookup_and_delete_elem() is added.
> >
> > Signed-off-by: Mauricio Vasquez B <mauricio.vasquez@polito.it>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Applied, Thanks
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: Extend the sk_lookup() helper to XDP hookpoint.
From: Daniel Borkmann @ 2018-10-19 20:32 UTC (permalink / raw)
To: Joe Stringer, Martin KaFai Lau
Cc: Nitin Hande, netdev, ast, Jesper Brouer, john fastabend
In-Reply-To: <CAOftzPjyeD2-nGW+NPC4sbxLcQY_CFT5HikXYeKUEWCbRcrpQg@mail.gmail.com>
On 10/19/2018 06:47 PM, Joe Stringer wrote:
> On Thu, 18 Oct 2018 at 22:07, Martin Lau <kafai@fb.com> wrote:
>> On Thu, Oct 18, 2018 at 04:52:40PM -0700, Joe Stringer wrote:
>>> On Thu, 18 Oct 2018 at 14:20, Daniel Borkmann <daniel@iogearbox.net> wrote:
>>>> On 10/18/2018 11:06 PM, Joe Stringer wrote:
>>>>> On Thu, 18 Oct 2018 at 11:54, Nitin Hande <nitin.hande@gmail.com> wrote:
>>>> [...]
>>>>>> Open Issue
>>>>>> * The underlying code relies on presence of an skb to find out the
>>>>>> right sk for the case of REUSEPORT socket option. Since there is
>>>>>> no skb available at XDP hookpoint, the helper function will return
>>>>>> the first available sk based off the 5 tuple hash. If the desire
>>>>>> is to return a particular sk matching reuseport_cb function, please
>>>>>> suggest way to tackle it, which can be addressed in a future commit.
>>>>
>>>>>> Signed-off-by: Nitin Hande <Nitin.Hande@gmail.com>
>>>>>
>>>>> Thanks Nitin, LGTM overall.
>>>>>
>>>>> The REUSEPORT thing suggests that the usage of this helper from XDP
>>>>> layer may lead to a different socket being selected vs. the equivalent
>>>>> call at TC hook, or other places where the selection may occur. This
>>>>> could be a bit counter-intuitive.
>>>>>
>>>>> One thought I had to work around this was to introduce a flag,
>>>>> something like BPF_F_FIND_REUSEPORT_SK_BY_HASH. This flag would
>>>>> effectively communicate in the API that the bpf_sk_lookup_xxx()
>>>>> functions will only select a REUSEPORT socket based on the hash and
>>>>> not by, for example BPF_PROG_TYPE_SK_REUSEPORT programs. The absence
>>>>> of the flag would support finding REUSEPORT sockets by other
>>>>> mechanisms (which would be allowed for now from TC hooks but would be
>>>>> disallowed from XDP, since there's no specific plan to support this).
>>>>
>>>> Hmm, given skb is NULL here the only way to lookup the socket in such
>>>> scenario is based on hash, that is, inet_ehashfn() / inet6_ehashfn(),
>>>> perhaps alternative is to pass this hash in from XDP itself to the
>>>> helper so it could be custom selector. Do you have a specific use case
>>>> on this for XDP (just curious)?
>>>
>>> I don't have a use case for SO_REUSEPORT introspection from XDP, so
>>> I'm primarily thinking from the perspective of making the behaviour
>>> clear in the API in a way that leaves open the possibility for a
>>> reasonable implementation in future. From that perspective, my main
>>> concern is that it may surprise some BPF writers that the same
>>> "bpf_sk_lookup_tcp()" call (with identical parameters) may have
>>> different behaviour at TC vs. XDP layers, as the BPF selection of
>>> sockets is respected at TC but not at XDP.
>>>
>>> FWIW we're already out of parameters for the actual call, so if we
>>> wanted to allow passing a hash in, we'd need to either dedicate half
>>> the 'flags' field for this configurable hash, or consider adding the
>>> new hash parameter to 'struct bpf_sock_tuple'.
>>>
>>> +Martin for any thoughts on SO_REUSEPORT and XDP here.
>> The XDP/TC prog has read access to the sk fields through
>> 'struct bpf_sock'?
>>
>> A quick thought...
>> Considering all sk in the same reuse->socks[] share
>> many things (e.g. family,type,protocol,ip,port..etc are the same),
>> I wonder returning which particular sk from reuse->socks[] will
>> matter too much since most of the fields from 'struct bpf_sock' will
>> be the same. Some of fields in 'struct bpf_sock' could be different
>> though, like priority? Hence, another possibility is to limit the
>> accessible fields for the XDP prog. Only allow accessing the fields
>> that must be the same among the sk in the same reuse->socks[].
>
> This sounds pretty reasonable to me.
Agree, and in any case this difference in returned sk selection should
probably also be documented in the uapi helper description.
^ permalink raw reply
* Re: [PATCH net-next v2] netpoll: allow cleanup to be synchronous
From: Neil Horman @ 2018-10-19 20:34 UTC (permalink / raw)
To: Debabrata Banerjee; +Cc: David S . Miller, netdev
In-Reply-To: <20181018151826.8373-1-dbanerje@akamai.com>
On Thu, Oct 18, 2018 at 11:18:26AM -0400, Debabrata Banerjee wrote:
> This fixes a problem introduced by:
> commit 2cde6acd49da ("netpoll: Fix __netpoll_rcu_free so that it can hold the rtnl lock")
>
> When using netconsole on a bond, __netpoll_cleanup can asynchronously
> recurse multiple times, each __netpoll_free_async call can result in
> more __netpoll_free_async's. This means there is now a race between
> cleanup_work queues on multiple netpoll_info's on multiple devices and
> the configuration of a new netpoll. For example if a netconsole is set
> to enable 0, reconfigured, and enable 1 immediately, this netconsole
> will likely not work.
>
> Given the reason for __netpoll_free_async is it can be called when rtnl
> is not locked, if it is locked, we should be able to execute
> synchronously. It appears to be locked everywhere it's called from.
>
> Generalize the design pattern from the teaming driver for current
> callers of __netpoll_free_async.
>
I presume you've tested this with some of the stacked devices? I think I'm ok
with this change, but I'd like confirmation that its worked.
Neil
> CC: Neil Horman <nhorman@tuxdriver.com>
> CC: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
> ---
> drivers/net/bonding/bond_main.c | 3 ++-
> drivers/net/macvlan.c | 2 +-
> drivers/net/team/team.c | 5 +----
> include/linux/netpoll.h | 4 +---
> net/8021q/vlan_dev.c | 3 +--
> net/bridge/br_device.c | 2 +-
> net/core/netpoll.c | 20 +++++---------------
> net/dsa/slave.c | 2 +-
> 8 files changed, 13 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index ee28ec9e0aba..ffa37adb7681 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -963,7 +963,8 @@ static inline void slave_disable_netpoll(struct slave *slave)
> return;
>
> slave->np = NULL;
> - __netpoll_free_async(np);
> +
> + __netpoll_free(np);
> }
>
> static void bond_poll_controller(struct net_device *bond_dev)
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index cfda146f3b3b..fc8d5f1ee1ad 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -1077,7 +1077,7 @@ static void macvlan_dev_netpoll_cleanup(struct net_device *dev)
>
> vlan->netpoll = NULL;
>
> - __netpoll_free_async(netpoll);
> + __netpoll_free(netpoll);
> }
> #endif /* CONFIG_NET_POLL_CONTROLLER */
>
> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> index d887016e54b6..db633ae9f784 100644
> --- a/drivers/net/team/team.c
> +++ b/drivers/net/team/team.c
> @@ -1104,10 +1104,7 @@ static void team_port_disable_netpoll(struct team_port *port)
> return;
> port->np = NULL;
>
> - /* Wait for transmitting packets to finish before freeing. */
> - synchronize_rcu_bh();
> - __netpoll_cleanup(np);
> - kfree(np);
> + __netpoll_free(np);
> }
> #else
> static int team_port_enable_netpoll(struct team_port *port)
> diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
> index 3ef82d3a78db..676f1ff161a9 100644
> --- a/include/linux/netpoll.h
> +++ b/include/linux/netpoll.h
> @@ -31,8 +31,6 @@ struct netpoll {
> bool ipv6;
> u16 local_port, remote_port;
> u8 remote_mac[ETH_ALEN];
> -
> - struct work_struct cleanup_work;
> };
>
> struct netpoll_info {
> @@ -63,7 +61,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt);
> int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
> int netpoll_setup(struct netpoll *np);
> void __netpoll_cleanup(struct netpoll *np);
> -void __netpoll_free_async(struct netpoll *np);
> +void __netpoll_free(struct netpoll *np);
> void netpoll_cleanup(struct netpoll *np);
> void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
> struct net_device *dev);
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index 546af0e73ac3..ff720f1ebf73 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -756,8 +756,7 @@ static void vlan_dev_netpoll_cleanup(struct net_device *dev)
> return;
>
> vlan->netpoll = NULL;
> -
> - __netpoll_free_async(netpoll);
> + __netpoll_free(netpoll);
> }
> #endif /* CONFIG_NET_POLL_CONTROLLER */
>
> diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
> index e053a4e43758..c6abf927f0c9 100644
> --- a/net/bridge/br_device.c
> +++ b/net/bridge/br_device.c
> @@ -344,7 +344,7 @@ void br_netpoll_disable(struct net_bridge_port *p)
>
> p->np = NULL;
>
> - __netpoll_free_async(np);
> + __netpoll_free(np);
> }
>
> #endif
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index de1d1ba92f2d..6ac71624ead4 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -591,7 +591,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
>
> np->dev = ndev;
> strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
> - INIT_WORK(&np->cleanup_work, netpoll_async_cleanup);
>
> if (ndev->priv_flags & IFF_DISABLE_NETPOLL) {
> np_err(np, "%s doesn't support polling, aborting\n",
> @@ -790,10 +789,6 @@ void __netpoll_cleanup(struct netpoll *np)
> {
> struct netpoll_info *npinfo;
>
> - /* rtnl_dereference would be preferable here but
> - * rcu_cleanup_netpoll path can put us in here safely without
> - * holding the rtnl, so plain rcu_dereference it is
> - */
> npinfo = rtnl_dereference(np->dev->npinfo);
> if (!npinfo)
> return;
> @@ -814,21 +809,16 @@ void __netpoll_cleanup(struct netpoll *np)
> }
> EXPORT_SYMBOL_GPL(__netpoll_cleanup);
>
> -static void netpoll_async_cleanup(struct work_struct *work)
> +void __netpoll_free(struct netpoll *np)
> {
> - struct netpoll *np = container_of(work, struct netpoll, cleanup_work);
> + ASSERT_RTNL();
>
> - rtnl_lock();
> + /* Wait for transmitting packets to finish before freeing. */
> + synchronize_rcu_bh();
> __netpoll_cleanup(np);
> - rtnl_unlock();
> kfree(np);
> }
> -
> -void __netpoll_free_async(struct netpoll *np)
> -{
> - schedule_work(&np->cleanup_work);
> -}
> -EXPORT_SYMBOL_GPL(__netpoll_free_async);
> +EXPORT_SYMBOL_GPL(__netpoll_free);
>
> void netpoll_cleanup(struct netpoll *np)
> {
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 3f840b6eea69..3679e13b2ead 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -722,7 +722,7 @@ static void dsa_slave_netpoll_cleanup(struct net_device *dev)
>
> p->netpoll = NULL;
>
> - __netpoll_free_async(netpoll);
> + __netpoll_free(netpoll);
> }
>
> static void dsa_slave_poll_controller(struct net_device *dev)
> --
> 2.19.1
>
>
^ permalink raw reply
* Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
From: Martin Lau @ 2018-10-19 20:35 UTC (permalink / raw)
To: Edward Cree
Cc: Yonghong Song, Alexei Starovoitov, daniel@iogearbox.net,
netdev@vger.kernel.org, Kernel Team
In-Reply-To: <20181019193548.g4neaudunoan5gvn@kafai-mbp.dhcp.thefacebook.com>
On Fri, Oct 19, 2018 at 12:36:49PM -0700, Martin Lau wrote:
> On Fri, Oct 19, 2018 at 06:04:11PM +0100, Edward Cree wrote:
> > On 18/10/18 22:19, Martin Lau wrote:
> > > As I have mentioned earlier, it is also special to
> > > the kernel because the BTF verifier and bpf_prog_load()
> > > need to do different checks for FUNC and FUNC_PROTO to
> > > ensure they are sane.
> > >
> > > First, we need to agree that the kernel needs to verify
> > > them differently.
> > >
> > > and then we can proceed to discuss how to distinguish them.
> > > We picked the current way to avoid adding a
> > > new BTF function section and keep it
> > > strict forward to distinguish them w/o relying
> > > on other hints from 'struct btf_type'.
> > >
> > > Are you suggesting another way of doing it?
> > But you *do* have such a new section.
> > The patch comment talks about a 'FuncInfo Table' which appears to
> Note that the new section, which contains the FuncInfo Table,
> is in a new ELF section ".BTF.ext" instead of the ".BTF".
> It is not in the ".BTF" section because it is only useful during
> bpf_prog_load().
>
> I was meaning a new function section within ".BTF".
>
> > map (section, insn_idx) to type_id. (I think this gets added in
> > .BTF.ext per patch 9?) So when you're looking at a FUNC type
> > because you looked up a type_id from that table, you know it's
> > the signature of a subprogram, and you're checking it as such.
> > Whereas, if you were doing something with some other type and it
> > referenced a FUNC type (e.g., in the patch comment's example,
> > you're checking foo's first argument against the type bar) in
> > its type_id, you know you're using it as a formal type (a FUNC_
> > PROTO in your parlance) and not as a subprogram.
> > The context in which you are using a type entry tells you which
> > kind it is. And the verifier can and should be smart enough to
> > know what it's doing in this way.
> >
> > And it's entirely reasonable for the same type entry to get used
> > for both those cases; in my example, you'd have a FUNC type for
> > int foo(int), referenced both by the func_info entry for foo
> > and by the PTR type for bar. And if you had another subprogram
> > int baz(int), its func_info entry could reference the same
> > type_id, because the (reference to the) name of the function
> > should live in the func_info, not in the type.
> IIUC, I think what you are suggesting here is to use (type_id, name)
> to describe DW_TAG_subprogram "int foo1(int) {}", "int foo2(int) {}",
> "int foo3(int) {}" where type_id here is referring to the same
> DW_TAG_subroutine_type, and only define that _one_
> DW_TAG_subroutine_type in the BTF "type" section.
>
> That will require more manipulation/type-merging in the dwarf2btf
> process and it could get quite complicated.
>
> Note that CTF is also fully spelling out the return type
> and arg types for each DW_TAG_subprogram in a separate
> function section (still within the same ELF section).
> The only difference here is they are merged into the type
> section and FUNC_PROTO is added.
>
> If the concern is having both FUNC and FUNC_PROTO is confusing,
> we could go back to the CTF way which adds a new function section
> in ".BTF" and it is only for DW_TAG_subprogram.
> BTF_KIND_FUNC_PROTO is then no longer necessary.
> Some of new BTF verifier checkings may actually go away also.
> The down side is there will be two id spaces.
Discussed a bit offline with folks about the two id spaces
situation and it is not good for debugging purpose.
If we must get rid of FUNC_PROTO, it is better to use the
name_off==0 check instead of adding a new function section.
We will go for this path in the next respin.
>
> >
> > What you are proposing seems to be saying "if we have this
> > particular special btf_kind, then this BTF entry doesn't just
> > define a type, it declares a subprogram of that type". Oh,
> > and with the name of the type as the subprogram name. Which
> > just creates blurry confusion as to whether BTF entries define
> > types or declare objects; IMNSHO the correct approach is for
> > objects to be declared elsewhere and to reference BTF types by
> > their type_id.
> > Which is what the func_info table in patch 9 appears to do.
> >
> > (It also rather bothers me the way we are using special type
> > names to associate maps with their k/v types, rather than
> > extending the records in the maps section to include type_ids
> > referencing them. It's the same kind of weird implicitness,
> > and if I'd spotted it when it was going in I'd've nacked it,
> > but I suppose it's ABI now and too late to change.)
> >
> > -Ed
^ permalink raw reply
* Re: [PATCH net v2] net/sched: act_gact: properly init 'goto chain'
From: Cong Wang @ 2018-10-19 20:40 UTC (permalink / raw)
To: Davide Caratti
Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
Linux Kernel Network Developers
In-Reply-To: <33333af24adf6ef97013445c51f8ce7bd3c87a82.camel@redhat.com>
On Thu, Oct 18, 2018 at 8:30 AM Davide Caratti <dcaratti@redhat.com> wrote:
> The alternative is, we systematically forbid usage of 'goto chain' in
> tcfg_paction, so that:
>
> # tc f a dev v0 egress matchall action <whatever> random determ goto chain 4 5
>
> is systematically rejected with -EINVAL. This comand never worked, so we
> are not breaking anything in userspace.
This is exactly why I asked you if we really need to support it. :)
If no one finds it useful, disallowing it is a good solution here, as
we don't need
to introduce any additional code to handle filter chains.
^ permalink raw reply
* [PATCH iproute2-next] Tree wide: Drop sockaddr_nl arg
From: David Ahern @ 2018-10-19 20:44 UTC (permalink / raw)
To: netdev, stephen; +Cc: David Ahern
From: David Ahern <dsahern@gmail.com>
No command, filter, or print function uses the sockaddr_nl arg,
so just drop it.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
bridge/br_common.h | 9 +++------
bridge/fdb.c | 2 +-
bridge/link.c | 3 +--
bridge/mdb.c | 2 +-
bridge/monitor.c | 9 ++++-----
bridge/vlan.c | 12 +++---------
genl/ctrl.c | 10 ++++------
genl/genl.c | 3 +--
genl/genl_utils.h | 3 +--
include/libnetlink.h | 6 ++----
include/ll_map.h | 3 +--
ip/ip_common.h | 36 ++++++++++++------------------------
ip/ipaddress.c | 26 ++++++++++----------------
ip/ipaddrlabel.c | 4 ++--
ip/ipfou.c | 3 +--
ip/ipila.c | 3 +--
ip/ipl2tp.c | 6 ++----
ip/iplink.c | 9 +++------
ip/iplink_bridge.c | 3 +--
ip/ipmacsec.c | 3 +--
ip/ipmonitor.c | 25 ++++++++++++-------------
ip/ipmroute.c | 2 +-
ip/ipneigh.c | 2 +-
ip/ipnetconf.c | 8 +++-----
ip/ipnetns.c | 5 ++---
ip/ipntable.c | 3 +--
ip/ipprefix.c | 2 +-
ip/iproute.c | 17 +++++++----------
ip/iprule.c | 11 ++++-------
ip/ipseg6.c | 5 ++---
ip/iptoken.c | 2 +-
ip/iptuntap.c | 3 +--
ip/rtmon.c | 7 +++----
ip/tcp_metrics.c | 5 ++---
ip/tunnel.c | 3 +--
ip/xfrm.h | 6 ++----
ip/xfrm_monitor.c | 37 +++++++++++++++----------------------
ip/xfrm_policy.c | 9 +++------
ip/xfrm_state.c | 11 ++++-------
lib/libnetlink.c | 7 +++----
lib/ll_map.c | 3 +--
misc/ifstat.c | 6 ++----
misc/ss.c | 31 ++++++++++++-------------------
tc/m_action.c | 6 ++----
tc/tc_class.c | 3 +--
tc/tc_common.h | 8 ++++----
tc/tc_filter.c | 4 ++--
tc/tc_monitor.c | 11 +++++------
tc/tc_qdisc.c | 6 ++----
49 files changed, 155 insertions(+), 248 deletions(-)
diff --git a/bridge/br_common.h b/bridge/br_common.h
index 00a4e9ea125d..23d653df931d 100644
--- a/bridge/br_common.h
+++ b/bridge/br_common.h
@@ -7,12 +7,9 @@
((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(__u32))))
void print_vlan_info(struct rtattr *tb, int ifindex);
-int print_linkinfo(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_fdb(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_mdb(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+int print_linkinfo(struct nlmsghdr *n, void *arg);
+int print_fdb(struct nlmsghdr *n, void *arg);
+int print_mdb(struct nlmsghdr *n, void *arg);
int do_fdb(int argc, char **argv);
int do_mdb(int argc, char **argv);
diff --git a/bridge/fdb.c b/bridge/fdb.c
index 828fdab264cb..d759f7ec12e2 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -126,7 +126,7 @@ static void fdb_print_stats(FILE *fp, const struct nda_cacheinfo *ci)
}
}
-int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_fdb(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct ndmsg *r = NLMSG_DATA(n);
diff --git a/bridge/link.c b/bridge/link.c
index 4a14845da591..3290c16f0951 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -190,8 +190,7 @@ static void print_af_spec(struct rtattr *attr, int ifindex)
print_vlan_info(aftb[IFLA_BRIDGE_VLAN_INFO], ifindex);
}
-int print_linkinfo(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int print_linkinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct ifinfomsg *ifi = NLMSG_DATA(n);
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 03fcc91f0219..855a6a4552c7 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -225,7 +225,7 @@ static void print_router_entries(FILE *fp, struct nlmsghdr *n,
close_json_array(PRINT_JSON, NULL);
}
-int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_mdb(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct br_port_msg *r = NLMSG_DATA(n);
diff --git a/bridge/monitor.c b/bridge/monitor.c
index d294269e1092..82bc6b407a06 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -35,8 +35,7 @@ static void usage(void)
exit(-1);
}
-static int accept_msg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int accept_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
@@ -50,19 +49,19 @@ static int accept_msg(const struct sockaddr_nl *who,
if (prefix_banner)
fprintf(fp, "[LINK]");
- return print_linkinfo(who, n, arg);
+ return print_linkinfo(n, arg);
case RTM_NEWNEIGH:
case RTM_DELNEIGH:
if (prefix_banner)
fprintf(fp, "[NEIGH]");
- return print_fdb(who, n, arg);
+ return print_fdb(n, arg);
case RTM_NEWMDB:
case RTM_DELMDB:
if (prefix_banner)
fprintf(fp, "[MDB]");
- return print_mdb(who, n, arg);
+ return print_mdb(n, arg);
case NLMSG_TSTAMP:
print_nlmsg_timestamp(fp, n);
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 239907bdad89..a111d5e66439 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -347,9 +347,7 @@ static void print_vlan_tunnel_info(FILE *fp, struct rtattr *tb, int ifindex)
close_vlan_port();
}
-static int print_vlan_tunnel(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int print_vlan_tunnel(struct nlmsghdr *n, void *arg)
{
struct ifinfomsg *ifm = NLMSG_DATA(n);
struct rtattr *tb[IFLA_MAX+1];
@@ -392,9 +390,7 @@ static int print_vlan_tunnel(const struct sockaddr_nl *who,
return 0;
}
-static int print_vlan(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int print_vlan(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct ifinfomsg *ifm = NLMSG_DATA(n);
@@ -513,9 +509,7 @@ static void print_vlan_stats_attr(struct rtattr *attr, int ifindex)
}
-static int print_vlan_stats(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int print_vlan_stats(struct nlmsghdr *n, void *arg)
{
struct if_stats_msg *ifsm = NLMSG_DATA(n);
struct rtattr *tb[IFLA_STATS_MAX+1];
diff --git a/genl/ctrl.c b/genl/ctrl.c
index 0d9c5f2517b7..6133336ab435 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -174,8 +174,7 @@ static int print_ctrl_grp(FILE *fp, struct rtattr *arg, __u32 ctrl_ver)
/*
* The controller sends one nlmsg per family
*/
-static int print_ctrl(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int print_ctrl(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
struct rtattr *tb[CTRL_ATTR_MAX + 1];
@@ -279,10 +278,9 @@ static int print_ctrl(const struct sockaddr_nl *who,
return 0;
}
-static int print_ctrl2(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_ctrl2(struct nlmsghdr *n, void *arg)
{
- return print_ctrl(who, NULL, n, arg);
+ return print_ctrl(NULL, n, arg);
}
static int ctrl_list(int cmd, int argc, char **argv)
@@ -339,7 +337,7 @@ static int ctrl_list(int cmd, int argc, char **argv)
goto ctrl_done;
}
- if (print_ctrl2(NULL, answer, (void *) stdout) < 0) {
+ if (print_ctrl2(answer, (void *) stdout) < 0) {
fprintf(stderr, "Dump terminated\n");
goto ctrl_done;
}
diff --git a/genl/genl.c b/genl/genl.c
index 253c4450a3b9..aba3c13afd34 100644
--- a/genl/genl.c
+++ b/genl/genl.c
@@ -34,8 +34,7 @@ static void *BODY;
static struct genl_util *genl_list;
-static int print_nofopt(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int print_nofopt(struct nlmsghdr *n, void *arg)
{
fprintf((FILE *) arg, "unknown genl type ..\n");
return 0;
diff --git a/genl/genl_utils.h b/genl/genl_utils.h
index 3de0da34bdba..cc1f3fb76596 100644
--- a/genl/genl_utils.h
+++ b/genl/genl_utils.h
@@ -10,8 +10,7 @@ struct genl_util
struct genl_util *next;
char name[16];
int (*parse_genlopt)(struct genl_util *fu, int argc, char **argv);
- int (*print_genlopt)(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+ int (*print_genlopt)(struct nlmsghdr *n, void *arg);
};
int genl_ctrl_resolve_family(const char *family);
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 04264b871ce4..fa8de093d484 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -88,11 +88,9 @@ struct rtnl_ctrl_data {
int nsid;
};
-typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
- struct nlmsghdr *n, void *);
+typedef int (*rtnl_filter_t)(struct nlmsghdr *n, void *);
-typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *,
- struct rtnl_ctrl_data *,
+typedef int (*rtnl_listen_filter_t)(struct rtnl_ctrl_data *,
struct nlmsghdr *n, void *);
typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off,
diff --git a/include/ll_map.h b/include/ll_map.h
index 8546ff928bc0..fb708191c22c 100644
--- a/include/ll_map.h
+++ b/include/ll_map.h
@@ -2,8 +2,7 @@
#ifndef __LL_MAP_H__
#define __LL_MAP_H__ 1
-int ll_remember_index(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+int ll_remember_index(struct nlmsghdr *n, void *arg);
void ll_init_map(struct rtnl_handle *rth);
unsigned ll_name_to_index(const char *name);
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 458a9cb7ff2c..53668f598cd2 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -27,14 +27,10 @@ struct link_filter {
};
int get_operstate(const char *name);
-int print_linkinfo(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_addrinfo(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_addrlabel(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_neigh(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+int print_linkinfo(struct nlmsghdr *n, void *arg);
+int print_addrinfo(struct nlmsghdr *n, void *arg);
+int print_addrlabel(struct nlmsghdr *n, void *arg);
+int print_neigh(struct nlmsghdr *n, void *arg);
int ipaddr_list_link(int argc, char **argv);
void ipaddr_get_vf_rate(int, int *, int *, const char *);
void iplink_usage(void) __attribute__((noreturn));
@@ -45,21 +41,15 @@ void ipaddr_reset_filter(int oneline, int ifindex);
void ipneigh_reset_filter(int ifindex);
void ipnetconf_reset_filter(int ifindex);
-int print_route(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_mroute(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_prefix(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_rule(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
-int print_netconf(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+int print_route(struct nlmsghdr *n, void *arg);
+int print_mroute(struct nlmsghdr *n, void *arg);
+int print_prefix(struct nlmsghdr *n, void *arg);
+int print_rule(struct nlmsghdr *n, void *arg);
+int print_netconf(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg);
void netns_map_init(void);
void netns_nsid_socket_init(void);
-int print_nsid(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+int print_nsid(struct nlmsghdr *n, void *arg);
char *get_name_from_nsid(int nsid);
int get_netnsid_from_name(const char *name);
int set_netnsid_from_name(const char *name, int nsid);
@@ -129,8 +119,7 @@ struct link_util {
FILE *);
int (*parse_ifla_xstats)(struct link_util *,
int, char **);
- int (*print_ifla_xstats)(const struct sockaddr_nl *,
- struct nlmsghdr *, void *);
+ int (*print_ifla_xstats)(struct nlmsghdr *, void *);
};
struct link_util *get_link_kind(const char *kind);
@@ -140,8 +129,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type);
/* iplink_bridge.c */
void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
int bridge_parse_xstats(struct link_util *lu, int argc, char **argv);
-int bridge_print_xstats(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg);
+int bridge_print_xstats(struct nlmsghdr *n, void *arg);
/* iproute_lwtunnel.c */
int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp);
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 9481f241cb36..cd8cc76a3473 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -824,8 +824,7 @@ static void print_link_event(FILE *f, __u32 event)
}
}
-int print_linkinfo(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int print_linkinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct ifinfomsg *ifi = NLMSG_DATA(n);
@@ -1261,8 +1260,7 @@ static int ifa_label_match_rta(int ifindex, const struct rtattr *rta)
return fnmatch(filter.label, label, 0);
}
-int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+int print_addrinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct ifaddrmsg *ifa = NLMSG_DATA(n);
@@ -1478,7 +1476,7 @@ static int print_selected_addrinfo(struct ifinfomsg *ifi,
continue;
open_json_object(NULL);
- print_addrinfo(NULL, n, fp);
+ print_addrinfo(n, fp);
close_json_object();
}
close_json_array(PRINT_JSON, NULL);
@@ -1491,8 +1489,7 @@ static int print_selected_addrinfo(struct ifinfomsg *ifi,
}
-static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int store_nlmsg(struct nlmsghdr *n, void *arg)
{
struct nlmsg_chain *lchain = (struct nlmsg_chain *)arg;
struct nlmsg_list *h;
@@ -1510,7 +1507,7 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
lchain->head = h;
lchain->tail = h;
- ll_remember_index(who, n, NULL);
+ ll_remember_index(n, NULL);
return 0;
}
@@ -1553,8 +1550,7 @@ static int ipadd_dump_check_magic(void)
return 0;
}
-static int save_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int save_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret;
@@ -1567,15 +1563,14 @@ static int save_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
return ret == n->nlmsg_len ? 0 : ret;
}
-static int show_handler(const struct sockaddr_nl *nl,
- struct rtnl_ctrl_data *ctrl,
+static int show_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
struct ifaddrmsg *ifa = NLMSG_DATA(n);
open_json_object(NULL);
print_int(PRINT_ANY, "index", "if%d:\n", ifa->ifa_index);
- print_addrinfo(NULL, n, stdout);
+ print_addrinfo(n, stdout);
close_json_object();
return 0;
}
@@ -1600,8 +1595,7 @@ static int ipaddr_showdump(void)
exit(err);
}
-static int restore_handler(const struct sockaddr_nl *nl,
- struct rtnl_ctrl_data *ctrl,
+static int restore_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
int ret;
@@ -1970,7 +1964,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
open_json_object(NULL);
if (brief || !no_link)
- res = print_linkinfo(NULL, n, stdout);
+ res = print_linkinfo(n, stdout);
if (res >= 0 && filter.family != AF_PACKET)
print_selected_addrinfo(ifi, ainfo->head, stdout);
if (res > 0 && !do_link && show_stats)
diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
index 845fe4c5db27..3714e41785c0 100644
--- a/ip/ipaddrlabel.c
+++ b/ip/ipaddrlabel.c
@@ -54,7 +54,7 @@ static void usage(void)
exit(-1);
}
-int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_addrlabel(struct nlmsghdr *n, void *arg)
{
struct ifaddrlblmsg *ifal = NLMSG_DATA(n);
int len = n->nlmsg_len;
@@ -196,7 +196,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv)
}
-static int flush_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int flush_addrlabel(struct nlmsghdr *n, void *arg)
{
struct rtnl_handle rth2;
struct rtmsg *r = NLMSG_DATA(n);
diff --git a/ip/ipfou.c b/ip/ipfou.c
index 0cb5e3c7a0c7..346522ddb7f7 100644
--- a/ip/ipfou.c
+++ b/ip/ipfou.c
@@ -137,8 +137,7 @@ static int do_del(int argc, char **argv)
return 0;
}
-static int print_fou_mapping(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_fou_mapping(struct nlmsghdr *n, void *arg)
{
struct genlmsghdr *ghdr;
struct rtattr *tb[FOU_ATTR_MAX + 1];
diff --git a/ip/ipila.c b/ip/ipila.c
index 895fe0cdaf77..11fbb5fae805 100644
--- a/ip/ipila.c
+++ b/ip/ipila.c
@@ -81,8 +81,7 @@ static void print_ila_locid(const char *tag, int attr, struct rtattr *tb[])
print_string(PRINT_ANY, tag, "%-20s", abuf);
}
-static int print_ila_mapping(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_ila_mapping(struct nlmsghdr *n, void *arg)
{
struct genlmsghdr *ghdr;
struct rtattr *tb[ILA_ATTR_MAX + 1];
diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 16561eccd458..4308b5911965 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -437,8 +437,7 @@ static int get_response(struct nlmsghdr *n, void *arg)
return 0;
}
-static int session_nlmsg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int session_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret = get_response(n, arg);
@@ -476,8 +475,7 @@ static int get_session(struct l2tp_data *p)
return 0;
}
-static int tunnel_nlmsg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int tunnel_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret = get_response(n, arg);
diff --git a/ip/iplink.c b/ip/iplink.c
index 9f39e3826c19..b5519201fef7 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -199,8 +199,7 @@ static int get_addr_gen_mode(const char *mode)
#if IPLINK_IOCTL_COMPAT
static int have_rtnl_newlink = -1;
-static int accept_msg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int accept_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(n);
@@ -1107,7 +1106,7 @@ int iplink_get(char *name, __u32 filt_mask)
return -2;
open_json_object(NULL);
- print_linkinfo(NULL, answer, stdout);
+ print_linkinfo(answer, stdout);
close_json_object();
free(answer);
@@ -1536,9 +1535,7 @@ struct af_stats_ctx {
int ifindex;
};
-static int print_af_stats(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int print_af_stats(struct nlmsghdr *n, void *arg)
{
struct if_stats_msg *ifsm = NLMSG_DATA(n);
struct rtattr *tb[IFLA_STATS_MAX+1];
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 3008e44b7d72..0ba6be3f47da 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -757,8 +757,7 @@ static void bridge_print_stats_attr(FILE *f, struct rtattr *attr, int ifindex)
}
}
-int bridge_print_xstats(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int bridge_print_xstats(struct nlmsghdr *n, void *arg)
{
struct if_stats_msg *ifsm = NLMSG_DATA(n);
struct rtattr *tb[IFLA_STATS_MAX+1];
diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c
index fa56e0eee774..646bd891730f 100644
--- a/ip/ipmacsec.c
+++ b/ip/ipmacsec.c
@@ -929,8 +929,7 @@ static void print_rxsc_list(struct rtattr *sc)
close_json_array(PRINT_JSON, NULL);
}
-static int process(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int process(struct nlmsghdr *n, void *arg)
{
struct genlmsghdr *ghdr;
struct rtattr *attrs[MACSEC_ATTR_MAX + 1];
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index a93b62cd6624..9d5ac2b5e4d2 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -52,8 +52,7 @@ static void print_headers(FILE *fp, char *label, struct rtnl_ctrl_data *ctrl)
fprintf(fp, "%s", label);
}
-static int accept_msg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int accept_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
@@ -75,32 +74,32 @@ static int accept_msg(const struct sockaddr_nl *who,
if (r->rtm_family == RTNL_FAMILY_IPMR ||
r->rtm_family == RTNL_FAMILY_IP6MR) {
print_headers(fp, "[MROUTE]", ctrl);
- print_mroute(who, n, arg);
+ print_mroute(n, arg);
return 0;
} else {
print_headers(fp, "[ROUTE]", ctrl);
- print_route(who, n, arg);
+ print_route(n, arg);
return 0;
}
}
case RTM_NEWLINK:
case RTM_DELLINK:
- ll_remember_index(who, n, NULL);
+ ll_remember_index(n, NULL);
print_headers(fp, "[LINK]", ctrl);
- print_linkinfo(who, n, arg);
+ print_linkinfo(n, arg);
return 0;
case RTM_NEWADDR:
case RTM_DELADDR:
print_headers(fp, "[ADDR]", ctrl);
- print_addrinfo(who, n, arg);
+ print_addrinfo(n, arg);
return 0;
case RTM_NEWADDRLABEL:
case RTM_DELADDRLABEL:
print_headers(fp, "[ADDRLABEL]", ctrl);
- print_addrlabel(who, n, arg);
+ print_addrlabel(n, arg);
return 0;
case RTM_NEWNEIGH:
@@ -114,18 +113,18 @@ static int accept_msg(const struct sockaddr_nl *who,
}
print_headers(fp, "[NEIGH]", ctrl);
- print_neigh(who, n, arg);
+ print_neigh(n, arg);
return 0;
case RTM_NEWPREFIX:
print_headers(fp, "[PREFIX]", ctrl);
- print_prefix(who, n, arg);
+ print_prefix(n, arg);
return 0;
case RTM_NEWRULE:
case RTM_DELRULE:
print_headers(fp, "[RULE]", ctrl);
- print_rule(who, n, arg);
+ print_rule(n, arg);
return 0;
case NLMSG_TSTAMP:
@@ -135,13 +134,13 @@ static int accept_msg(const struct sockaddr_nl *who,
case RTM_NEWNETCONF:
case RTM_DELNETCONF:
print_headers(fp, "[NETCONF]", ctrl);
- print_netconf(who, ctrl, n, arg);
+ print_netconf(ctrl, n, arg);
return 0;
case RTM_DELNSID:
case RTM_NEWNSID:
print_headers(fp, "[NSID]", ctrl);
- print_nsid(who, n, arg);
+ print_nsid(n, arg);
return 0;
case NLMSG_ERROR:
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index c5dfa9cb1538..4d8867d3219f 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -52,7 +52,7 @@ struct rtfilter {
inet_prefix msrc;
} filter;
-int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_mroute(struct nlmsghdr *n, void *arg)
{
struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 042d01fd24c2..6041c467749c 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -237,7 +237,7 @@ static void print_neigh_state(unsigned int nud)
close_json_array(PRINT_JSON, NULL);
}
-int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_neigh(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct ndmsg *r = NLMSG_DATA(n);
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 21822e367e11..0e946ca34b4a 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -55,8 +55,7 @@ static struct rtattr *netconf_rta(struct netconfmsg *ncm)
+ NLMSG_ALIGN(sizeof(struct netconfmsg)));
}
-int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
- struct nlmsghdr *n, void *arg)
+int print_netconf(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct netconfmsg *ncm = NLMSG_DATA(n);
@@ -154,10 +153,9 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
return 0;
}
-static int print_netconf2(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_netconf2(struct nlmsghdr *n, void *arg)
{
- return print_netconf(who, NULL, n, arg);
+ return print_netconf(NULL, n, arg);
}
void ipnetconf_reset_filter(int ifindex)
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index e8500c773994..0eac18cf2682 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -43,8 +43,7 @@ static struct rtnl_handle rtnsh = { .fd = -1 };
static int have_rtnl_getnsid = -1;
-static int ipnetns_accept_msg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int ipnetns_accept_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(n);
@@ -284,7 +283,7 @@ static int netns_get_name(int nsid, char *name)
return -ENOENT;
}
-int print_nsid(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_nsid(struct nlmsghdr *n, void *arg)
{
struct rtgenmsg *rthdr = NLMSG_DATA(n);
struct rtattr *tb[NETNSA_MAX+1];
diff --git a/ip/ipntable.c b/ip/ipntable.c
index ce3f4614e32b..5b61dd5cb001 100644
--- a/ip/ipntable.c
+++ b/ip/ipntable.c
@@ -520,8 +520,7 @@ static void print_ndtstats(const struct ndt_stats *ndts)
print_nl();
}
-static int print_ntable(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_ntable(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct ndtmsg *ndtm = NLMSG_DATA(n);
diff --git a/ip/ipprefix.c b/ip/ipprefix.c
index 20f23ca799aa..466af2088d90 100644
--- a/ip/ipprefix.c
+++ b/ip/ipprefix.c
@@ -35,7 +35,7 @@
#define IF_PREFIX_ONLINK 0x01
#define IF_PREFIX_AUTOCONF 0x02
-int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_prefix(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct prefixmsg *prefix = NLMSG_DATA(n);
diff --git a/ip/iproute.c b/ip/iproute.c
index 699635923764..1326a6574fbe 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -708,7 +708,7 @@ static void print_rta_multipath(FILE *fp, const struct rtmsg *r,
}
}
-int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_route(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct rtmsg *r = NLMSG_DATA(n);
@@ -1580,8 +1580,7 @@ static int iproute_flush_cache(void)
static __u32 route_dump_magic = 0x45311224;
-static int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int save_route(struct nlmsghdr *n, void *arg)
{
int ret;
int len = n->nlmsg_len;
@@ -2082,7 +2081,7 @@ static int iproute_get(int argc, char **argv)
int len = answer->nlmsg_len;
struct rtattr *tb[RTA_MAX+1];
- if (print_route(NULL, answer, (void *)stdout) < 0) {
+ if (print_route(answer, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
free(answer);
return -1;
@@ -2126,7 +2125,7 @@ static int iproute_get(int argc, char **argv)
return -2;
}
- if (print_route(NULL, answer, (void *)stdout) < 0) {
+ if (print_route(answer, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
free(answer);
return -1;
@@ -2144,8 +2143,7 @@ static int rtattr_cmp(const struct rtattr *rta1, const struct rtattr *rta2)
return memcmp(RTA_DATA(rta1), RTA_DATA(rta2), RTA_PAYLOAD(rta1));
}
-static int restore_handler(const struct sockaddr_nl *nl,
- struct rtnl_ctrl_data *ctrl,
+static int restore_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
struct rtmsg *r = NLMSG_DATA(n);
@@ -2231,11 +2229,10 @@ static int iproute_restore(void)
return 0;
}
-static int show_handler(const struct sockaddr_nl *nl,
- struct rtnl_ctrl_data *ctrl,
+static int show_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
- print_route(nl, n, stdout);
+ print_route(n, stdout);
return 0;
}
diff --git a/ip/iprule.c b/ip/iprule.c
index 60fd4c7e9f93..d89d808d8909 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -181,7 +181,7 @@ static bool filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
return true;
}
-int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_rule(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct fib_rule_hdr *frh = NLMSG_DATA(n);
@@ -442,8 +442,7 @@ static int save_rule_prep(void)
return 0;
}
-static int save_rule(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int save_rule(struct nlmsghdr *n, void *arg)
{
int ret;
@@ -456,8 +455,7 @@ static int save_rule(const struct sockaddr_nl *who,
return ret == n->nlmsg_len ? 0 : ret;
}
-static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int flush_rule(struct nlmsghdr *n, void *arg)
{
struct rtnl_handle rth2;
struct fib_rule_hdr *frh = NLMSG_DATA(n);
@@ -650,8 +648,7 @@ static int rule_dump_check_magic(void)
return 0;
}
-static int restore_handler(const struct sockaddr_nl *nl,
- struct rtnl_ctrl_data *ctrl,
+static int restore_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
int ret;
diff --git a/ip/ipseg6.c b/ip/ipseg6.c
index 6f5ae4d239f7..33076e726de6 100644
--- a/ip/ipseg6.c
+++ b/ip/ipseg6.c
@@ -99,8 +99,7 @@ static void print_tunsrc(struct rtattr *attrs[])
"tunsrc addr %s\n", dst);
}
-static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int process_msg(struct nlmsghdr *n, void *arg)
{
struct rtattr *attrs[SEG6_ATTR_MAX + 1];
struct genlmsghdr *ghdr;
@@ -180,7 +179,7 @@ static int seg6_do_cmd(void)
if (rtnl_talk(&grth, &req.n, &answer) < 0)
return -2;
new_json_obj(json);
- if (process_msg(NULL, answer, stdout) < 0) {
+ if (process_msg(answer, stdout) < 0) {
fprintf(stderr, "Error parsing reply\n");
exit(1);
}
diff --git a/ip/iptoken.c b/ip/iptoken.c
index 8605e75c4edc..f1194c3e1aa4 100644
--- a/ip/iptoken.c
+++ b/ip/iptoken.c
@@ -42,7 +42,7 @@ static void usage(void)
exit(-1);
}
-static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int print_token(struct nlmsghdr *n, void *arg)
{
struct rtnl_dump_args *args = arg;
FILE *fp = args->fp;
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 8c84e6206fa9..528055a0bf46 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -386,8 +386,7 @@ static int tuntap_filter_req(struct nlmsghdr *nlh, int reqlen)
return 0;
}
-static int print_tuntap(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_tuntap(struct nlmsghdr *n, void *arg)
{
struct ifinfomsg *ifi = NLMSG_DATA(n);
struct rtattr *tb[IFLA_MAX+1];
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 7d2405d724a6..7373443f2f8a 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -43,7 +43,7 @@ static void write_stamp(FILE *fp)
fwrite((void *)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
}
-static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
+static int dump_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
@@ -55,10 +55,9 @@ static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
return 0;
}
-static int dump_msg2(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int dump_msg2(struct nlmsghdr *n, void *arg)
{
- return dump_msg(who, NULL, n, arg);
+ return dump_msg(NULL, n, arg);
}
static void usage(void)
diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c
index ad3d6f363003..72ef3ab5cfda 100644
--- a/ip/tcp_metrics.c
+++ b/ip/tcp_metrics.c
@@ -156,8 +156,7 @@ static void print_tcp_metrics(struct rtattr *a)
}
}
-static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int process_msg(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *) arg;
struct genlmsghdr *ghdr;
@@ -501,7 +500,7 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv)
} else if (atype >= 0) {
if (rtnl_talk(&grth, &req.n, &answer) < 0)
return -2;
- if (process_msg(NULL, answer, stdout) < 0) {
+ if (process_msg(answer, stdout) < 0) {
fprintf(stderr, "Dump terminated\n");
exit(1);
}
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 20fe6d7d72f1..d0d55f37169e 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -321,8 +321,7 @@ static void tnl_print_stats(const struct rtnl_link_stats64 *s)
s->tx_carrier_errors, s->tx_dropped);
}
-static int print_nlmsg_tunnel(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int print_nlmsg_tunnel(struct nlmsghdr *n, void *arg)
{
struct tnl_print_nlmsg_info *info = arg;
struct ifinfomsg *ifi = NLMSG_DATA(n);
diff --git a/ip/xfrm.h b/ip/xfrm.h
index 71be574d90d8..3b158ad71c13 100644
--- a/ip/xfrm.h
+++ b/ip/xfrm.h
@@ -104,10 +104,8 @@ struct xfrm_filter {
extern struct xfrm_filter filter;
-int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg);
-int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg);
+int xfrm_state_print(struct nlmsghdr *n, void *arg);
+int xfrm_policy_print(struct nlmsghdr *n, void *arg);
int do_xfrm_state(int argc, char **argv);
int do_xfrm_policy(int argc, char **argv);
int do_xfrm_monitor(int argc, char **argv);
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index 5d086768560e..eb07af17cadf 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -43,8 +43,7 @@ static void usage(void)
exit(-1);
}
-static int xfrm_acquire_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_acquire_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct xfrm_user_acquire *xacq = NLMSG_DATA(n);
@@ -105,8 +104,7 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who,
return 0;
}
-static int xfrm_state_flush_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_state_flush_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct xfrm_usersa_flush *xsf = NLMSG_DATA(n);
@@ -135,8 +133,7 @@ static int xfrm_state_flush_print(const struct sockaddr_nl *who,
return 0;
}
-static int xfrm_policy_flush_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_policy_flush_print(struct nlmsghdr *n, void *arg)
{
struct rtattr *tb[XFRMA_MAX+1];
FILE *fp = (FILE *)arg;
@@ -173,8 +170,7 @@ static int xfrm_policy_flush_print(const struct sockaddr_nl *who,
return 0;
}
-static int xfrm_report_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_report_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct xfrm_user_report *xrep = NLMSG_DATA(n);
@@ -236,8 +232,7 @@ static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, F
fprintf(fp, " SPI 0x%x", ntohl(sa_id->spi));
}
-static int xfrm_ae_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_ae_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct xfrm_aevent_id *id = NLMSG_DATA(n);
@@ -261,8 +256,7 @@ static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a)
fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a));
}
-static int xfrm_mapping_print(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int xfrm_mapping_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct xfrm_user_mapping *map = NLMSG_DATA(n);
@@ -281,8 +275,7 @@ static int xfrm_mapping_print(const struct sockaddr_nl *who,
return 0;
}
-static int xfrm_accept_msg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int xfrm_accept_msg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
@@ -302,31 +295,31 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who,
case XFRM_MSG_DELSA:
case XFRM_MSG_UPDSA:
case XFRM_MSG_EXPIRE:
- xfrm_state_print(who, n, arg);
+ xfrm_state_print(n, arg);
return 0;
case XFRM_MSG_NEWPOLICY:
case XFRM_MSG_DELPOLICY:
case XFRM_MSG_UPDPOLICY:
case XFRM_MSG_POLEXPIRE:
- xfrm_policy_print(who, n, arg);
+ xfrm_policy_print(n, arg);
return 0;
case XFRM_MSG_ACQUIRE:
- xfrm_acquire_print(who, n, arg);
+ xfrm_acquire_print(n, arg);
return 0;
case XFRM_MSG_FLUSHSA:
- xfrm_state_flush_print(who, n, arg);
+ xfrm_state_flush_print(n, arg);
return 0;
case XFRM_MSG_FLUSHPOLICY:
- xfrm_policy_flush_print(who, n, arg);
+ xfrm_policy_flush_print(n, arg);
return 0;
case XFRM_MSG_REPORT:
- xfrm_report_print(who, n, arg);
+ xfrm_report_print(n, arg);
return 0;
case XFRM_MSG_NEWAE:
- xfrm_ae_print(who, n, arg);
+ xfrm_ae_print(n, arg);
return 0;
case XFRM_MSG_MAPPING:
- xfrm_mapping_print(who, n, arg);
+ xfrm_mapping_print(n, arg);
return 0;
default:
break;
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index d54402691ca0..feccaadac2db 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -453,8 +453,7 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo,
return 1;
}
-int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+int xfrm_policy_print(struct nlmsghdr *n, void *arg)
{
struct rtattr *tb[XFRMA_MAX+1];
struct rtattr *rta;
@@ -681,7 +680,7 @@ static int xfrm_policy_get(int argc, char **argv)
xfrm_policy_get_or_delete(argc, argv, 0, &n);
- if (xfrm_policy_print(NULL, n, (void *)stdout) < 0) {
+ if (xfrm_policy_print(n, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
@@ -694,9 +693,7 @@ static int xfrm_policy_get(int argc, char **argv)
* With an existing policy of nlmsg, make new nlmsg for deleting the policy
* and store it to buffer.
*/
-static int xfrm_policy_keep(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int xfrm_policy_keep(struct nlmsghdr *n, void *arg)
{
struct xfrm_buffer *xb = (struct xfrm_buffer *)arg;
struct rtnl_handle *rth = xb->rth;
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 913e9fa3bbdb..3cfcad1a4712 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -869,7 +869,7 @@ static int xfrm_state_allocspi(int argc, char **argv)
if (rtnl_talk(&rth, &req.n, &answer) < 0)
exit(2);
- if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) {
+ if (xfrm_state_print(answer, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
@@ -908,8 +908,7 @@ static int xfrm_state_filter_match(struct xfrm_usersa_info *xsinfo)
return 1;
}
-int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+int xfrm_state_print(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct rtattr *tb[XFRMA_MAX+1];
@@ -1063,7 +1062,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete)
if (rtnl_talk(&rth, &req.n, &answer) < 0)
exit(2);
- if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) {
+ if (xfrm_state_print(answer, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
@@ -1080,9 +1079,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete)
* With an existing state of nlmsg, make new nlmsg for deleting the state
* and store it to buffer.
*/
-static int xfrm_state_keep(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+static int xfrm_state_keep(struct nlmsghdr *n, void *arg)
{
struct xfrm_buffer *xb = (struct xfrm_buffer *)arg;
struct rtnl_handle *rth = xb->rth;
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index e8202f7915ba..fe4a7a4b9c71 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -674,7 +674,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
}
if (!rth->dump_fp) {
- err = a->filter(&nladdr, h, a->arg1);
+ err = a->filter(h, a->arg1);
if (err < 0) {
free(buf);
return err;
@@ -983,7 +983,7 @@ int rtnl_listen(struct rtnl_handle *rtnl,
exit(1);
}
- err = handler(&nladdr, &ctrl, h, jarg);
+ err = handler(&ctrl, h, jarg);
if (err < 0)
return err;
@@ -1005,7 +1005,6 @@ int rtnl_from_file(FILE *rtnl, rtnl_listen_filter_t handler,
void *jarg)
{
int status;
- struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
char buf[16384];
struct nlmsghdr *h = (struct nlmsghdr *)buf;
@@ -1044,7 +1043,7 @@ int rtnl_from_file(FILE *rtnl, rtnl_listen_filter_t handler,
return -1;
}
- err = handler(&nladdr, NULL, h, jarg);
+ err = handler(NULL, h, jarg);
if (err < 0)
return err;
}
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 32c8e4429fca..1b4095a7d873 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -77,8 +77,7 @@ static struct ll_cache *ll_get_by_name(const char *name)
return NULL;
}
-int ll_remember_index(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int ll_remember_index(struct nlmsghdr *n, void *arg)
{
unsigned int h;
const char *ifname;
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 3a0e780f7569..60efe6cb60fa 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -110,8 +110,7 @@ static int match(const char *id)
return 0;
}
-static int get_nlmsg_extended(const struct sockaddr_nl *who,
- struct nlmsghdr *m, void *arg)
+static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
{
struct if_stats_msg *ifsm = NLMSG_DATA(m);
struct rtattr *tb[IFLA_STATS_MAX+1];
@@ -154,8 +153,7 @@ static int get_nlmsg_extended(const struct sockaddr_nl *who,
return 0;
}
-static int get_nlmsg(const struct sockaddr_nl *who,
- struct nlmsghdr *m, void *arg)
+static int get_nlmsg(struct nlmsghdr *m, void *arg)
{
struct ifinfomsg *ifi = NLMSG_DATA(m);
struct rtattr *tb[IFLA_MAX+1];
diff --git a/misc/ss.c b/misc/ss.c
index f99b6874c228..c8970438ce73 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3156,8 +3156,7 @@ static int kill_inet_sock(struct nlmsghdr *h, void *arg, struct sockstat *s)
return rtnl_talk(rth, &req.nlh, NULL);
}
-static int show_one_inet_sock(const struct sockaddr_nl *addr,
- struct nlmsghdr *h, void *arg)
+static int show_one_inet_sock(struct nlmsghdr *h, void *arg)
{
int err;
struct inet_diag_arg *diag_arg = arg;
@@ -3548,8 +3547,7 @@ static void unix_stats_print(struct sockstat *s, struct filter *f)
proc_ctx_print(s);
}
-static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
- void *arg)
+static int unix_show_sock(struct nlmsghdr *nlh, void *arg)
{
struct filter *f = (struct filter *)arg;
struct unix_diag_msg *r = NLMSG_DATA(nlh);
@@ -3843,8 +3841,7 @@ static void packet_show_ring(struct packet_diag_ring *ring)
out(",features:0x%x", ring->pdr_features);
}
-static int packet_show_sock(const struct sockaddr_nl *addr,
- struct nlmsghdr *nlh, void *arg)
+static int packet_show_sock(struct nlmsghdr *nlh, void *arg)
{
const struct filter *f = arg;
struct packet_diag_msg *r = NLMSG_DATA(nlh);
@@ -4133,8 +4130,7 @@ static int netlink_show_one(struct filter *f,
return 0;
}
-static int netlink_show_sock(const struct sockaddr_nl *addr,
- struct nlmsghdr *nlh, void *arg)
+static int netlink_show_sock(struct nlmsghdr *nlh, void *arg)
{
struct filter *f = (struct filter *)arg;
struct netlink_diag_msg *r = NLMSG_DATA(nlh);
@@ -4257,8 +4253,7 @@ static void vsock_stats_print(struct sockstat *s, struct filter *f)
proc_ctx_print(s);
}
-static int vsock_show_sock(const struct sockaddr_nl *addr,
- struct nlmsghdr *nlh, void *arg)
+static int vsock_show_sock(struct nlmsghdr *nlh, void *arg)
{
struct filter *f = (struct filter *)arg;
struct vsock_diag_msg *r = NLMSG_DATA(nlh);
@@ -4311,8 +4306,7 @@ static void tipc_sock_addr_print(struct rtattr *net_addr, struct rtattr *id)
}
-static int tipc_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
- void *arg)
+static int tipc_show_sock(struct nlmsghdr *nlh, void *arg)
{
struct rtattr *stat[TIPC_NLA_SOCK_STAT_MAX + 1] = {};
struct rtattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {};
@@ -4400,8 +4394,7 @@ struct sock_diag_msg {
__u8 sdiag_family;
};
-static int generic_show_sock(const struct sockaddr_nl *addr,
- struct nlmsghdr *nlh, void *arg)
+static int generic_show_sock(struct nlmsghdr *nlh, void *arg)
{
struct sock_diag_msg *r = NLMSG_DATA(nlh);
struct inet_diag_arg inet_arg = { .f = arg, .protocol = IPPROTO_MAX };
@@ -4411,19 +4404,19 @@ static int generic_show_sock(const struct sockaddr_nl *addr,
case AF_INET:
case AF_INET6:
inet_arg.rth = inet_arg.f->rth_for_killing;
- ret = show_one_inet_sock(addr, nlh, &inet_arg);
+ ret = show_one_inet_sock(nlh, &inet_arg);
break;
case AF_UNIX:
- ret = unix_show_sock(addr, nlh, arg);
+ ret = unix_show_sock(nlh, arg);
break;
case AF_PACKET:
- ret = packet_show_sock(addr, nlh, arg);
+ ret = packet_show_sock(nlh, arg);
break;
case AF_NETLINK:
- ret = netlink_show_sock(addr, nlh, arg);
+ ret = netlink_show_sock(nlh, arg);
break;
case AF_VSOCK:
- ret = vsock_show_sock(addr, nlh, arg);
+ ret = vsock_show_sock(nlh, arg);
break;
default:
ret = -1;
diff --git a/tc/m_action.c b/tc/m_action.c
index 8993b93a5c4b..e90867fc6c25 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -386,9 +386,7 @@ tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts)
return 0;
}
-int print_action(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
- void *arg)
+int print_action(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct tcamsg *t = NLMSG_DATA(n);
@@ -541,7 +539,7 @@ static int tc_action_gd(int cmd, unsigned int flags,
if (cmd == RTM_GETACTION) {
new_json_obj(json);
- ret = print_action(NULL, ans, stdout);
+ ret = print_action(ans, stdout);
if (ret < 0) {
fprintf(stderr, "Dump terminated\n");
free(ans);
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 6b4ea48073f2..7e4e17fd7f39 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -296,8 +296,7 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
}
}
-int print_class(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int print_class(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct tcmsg *t = NLMSG_DATA(n);
diff --git a/tc/tc_common.h b/tc/tc_common.h
index 371ca7d04602..d8a6dfdeabd4 100644
--- a/tc/tc_common.h
+++ b/tc/tc_common.h
@@ -13,10 +13,10 @@ int do_action(int argc, char **argv, void *buf, size_t buflen);
int do_tcmonitor(int argc, char **argv);
int do_exec(int argc, char **argv);
-int print_action(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
-int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
-int print_qdisc(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
-int print_class(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
+int print_action(struct nlmsghdr *n, void *arg);
+int print_filter(struct nlmsghdr *n, void *arg);
+int print_qdisc(struct nlmsghdr *n, void *arg);
+int print_class(struct nlmsghdr *n, void *arg);
void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta);
struct tc_estimator;
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 15044b4bc6ed..e5c7bc4605a2 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -258,7 +258,7 @@ static int filter_chain_index_set;
static __u32 filter_block_index;
__u16 f_proto;
-int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+int print_filter(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct tcmsg *t = NLMSG_DATA(n);
@@ -592,7 +592,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
}
new_json_obj(json);
- print_filter(NULL, answer, (void *)stdout);
+ print_filter(answer, (void *)stdout);
delete_json_obj();
free(answer);
diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c
index 1f1ee08fb9cf..f8816cc53a46 100644
--- a/tc/tc_monitor.c
+++ b/tc/tc_monitor.c
@@ -34,8 +34,7 @@ static void usage(void)
}
-static int accept_tcmsg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int accept_tcmsg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
@@ -47,20 +46,20 @@ static int accept_tcmsg(const struct sockaddr_nl *who,
n->nlmsg_type == RTM_DELTFILTER ||
n->nlmsg_type == RTM_NEWCHAIN ||
n->nlmsg_type == RTM_DELCHAIN) {
- print_filter(who, n, arg);
+ print_filter(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_NEWTCLASS || n->nlmsg_type == RTM_DELTCLASS) {
- print_class(who, n, arg);
+ print_class(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_NEWQDISC || n->nlmsg_type == RTM_DELQDISC) {
- print_qdisc(who, n, arg);
+ print_qdisc(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_GETACTION || n->nlmsg_type == RTM_NEWACTION ||
n->nlmsg_type == RTM_DELACTION) {
- print_action(who, n, arg);
+ print_action(n, arg);
return 0;
}
if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index c1d2df0171a7..c5da5b5c1ed5 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -212,8 +212,7 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv)
static int filter_ifindex;
-int print_qdisc(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+int print_qdisc(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct tcmsg *t = NLMSG_DATA(n);
@@ -448,8 +447,7 @@ struct tc_qdisc_block_exists_ctx {
bool found;
};
-static int tc_qdisc_block_exists_cb(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int tc_qdisc_block_exists_cb(struct nlmsghdr *n, void *arg)
{
struct tc_qdisc_block_exists_ctx *ctx = arg;
struct tcmsg *t = NLMSG_DATA(n);
--
2.11.0
^ permalink raw reply related
* Re: [PATCH bpf-next v2 0/2] improve and fix barriers for walking perf ring buffer
From: Alexei Starovoitov @ 2018-10-19 20:45 UTC (permalink / raw)
To: Daniel Borkmann
Cc: peterz, paulmck, will.deacon, acme, yhs, john.fastabend, netdev
In-Reply-To: <20181019135103.3602-1-daniel@iogearbox.net>
On Fri, Oct 19, 2018 at 03:51:01PM +0200, Daniel Borkmann wrote:
> This set first adds smp_* barrier variants to tools infrastructure
> and updates perf and libbpf to make use of them. For details, please
> see individual patches, thanks!
>
> Arnaldo, if there are no objections, could this be routed via bpf-next
> with Acked-by's due to later dependencies in libbpf? Alternatively,
> I could also get the 2nd patch out during merge window, but perhaps
> it's okay to do in one go as there shouldn't be much conflict in perf
> itself.
>
> Thanks!
>
> v1 -> v2:
> - add common helper and switch to acquire/release variants
> when possible, thanks Peter!
Applied, Thanks
^ 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