* [PATCH V2 net-next 5/7] net: hns3: remove explicit conversion to bool
From: Huazhong Tan @ 2019-09-05 13:31 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Guojia Liao, Huazhong Tan
In-Reply-To: <1567690302-16648-1-git-send-email-tanhuazhong@huawei.com>
From: Guojia Liao <liaoguojia@huawei.com>
Relational and logical operators evaluate to bool,
explicit conversion is overly verbose and unnecessary.
Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 76e1c84..dde752f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6174,7 +6174,7 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
bool clear;
hdev->fd_en = enable;
- clear = hdev->fd_active_type == HCLGE_FD_ARFS_ACTIVE ? true : false;
+ clear = hdev->fd_active_type == HCLGE_FD_ARFS_ACTIVE;
if (!enable)
hclge_del_all_fd_entries(handle, clear);
else
--
2.7.4
^ permalink raw reply related
* [PATCH V2 net-next 1/7] net: hns3: fix error VF index when setting VLAN offload
From: Huazhong Tan @ 2019-09-05 13:31 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Jian Shen, Huazhong Tan
In-Reply-To: <1567690302-16648-1-git-send-email-tanhuazhong@huawei.com>
From: Jian Shen <shenjian15@huawei.com>
In original codes, the VF index used incorrectly in function
hclge_set_vlan_rx_offload_cfg() and hclge_set_vlan_rx_offload_cfg().
When VF id is greater than 8, for example 9, it will set the
same bit with VF id 1.
This patch fixes it by using vport->vport_id % HCLGE_VF_NUM_PER_CMD /
HCLGE_VF_NUM_PER_BYTE as the array index, instead of vport->vport_id /
HCLGE_VF_NUM_PER_CMD.
Fixes: 052ece6dc19c ("net: hns3: add ethtool related offload command")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 2b65f27..0e1225c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -7691,6 +7691,7 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport)
struct hclge_vport_vtag_tx_cfg_cmd *req;
struct hclge_dev *hdev = vport->back;
struct hclge_desc desc;
+ u16 bmap_index;
int status;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_TX_CFG, false);
@@ -7713,8 +7714,10 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport)
hnae3_set_bit(req->vport_vlan_cfg, HCLGE_CFG_NIC_ROCE_SEL_B, 0);
req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD;
- req->vf_bitmap[req->vf_offset] =
- 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
+ bmap_index = vport->vport_id % HCLGE_VF_NUM_PER_CMD /
+ HCLGE_VF_NUM_PER_BYTE;
+ req->vf_bitmap[bmap_index] =
+ 1U << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
status = hclge_cmd_send(&hdev->hw, &desc, 1);
if (status)
@@ -7731,6 +7734,7 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport)
struct hclge_vport_vtag_rx_cfg_cmd *req;
struct hclge_dev *hdev = vport->back;
struct hclge_desc desc;
+ u16 bmap_index;
int status;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_RX_CFG, false);
@@ -7746,8 +7750,10 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport)
vcfg->vlan2_vlan_prionly ? 1 : 0);
req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD;
- req->vf_bitmap[req->vf_offset] =
- 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
+ bmap_index = vport->vport_id % HCLGE_VF_NUM_PER_CMD /
+ HCLGE_VF_NUM_PER_BYTE;
+ req->vf_bitmap[bmap_index] =
+ 1U << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
status = hclge_cmd_send(&hdev->hw, &desc, 1);
if (status)
--
2.7.4
^ permalink raw reply related
* [PATCH V2 net-next 2/7] net: hns3: fix double free bug when setting ringparam
From: Huazhong Tan @ 2019-09-05 13:31 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Huazhong Tan
In-Reply-To: <1567690302-16648-1-git-send-email-tanhuazhong@huawei.com>
The system will panic when change the ringparam in HNS3 drivers:
[ 1459.627727] hns3 0000:bd:00.0 eth6: Changing Tx/Rx ring ds from 1024/1024 to 24/24
[ 1459.635766] hns3 0000:bd:00.0 eth6: link down
[ 1459.640788] BUG: Bad page state in process ethtool pfn:203f75c18
[ 1459.646940] page:ffff7ee4ffd70600 refcount:0 mapcount:0 mapping:ffff993fff40f400 index:0x0 compound_mapcount: 0
[ 1459.656987] flags: 0x9fffe00000010200(slab|head)
[ 1459.661591] raw: 9fffe00000010200 dead000000000100 dead000000000122 ffff993fff40f400
[ 1459.669302] raw: 0000000000000000 0000000080100010 00000000ffffffff 0000000000000000
[ 1459.677016] page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
[ 1459.683432] bad because of flags: 0x200(slab)
[ 1459.687775] Modules linked in: ib_ipoib ib_umad rpcrdma ib_iser libiscsi scsi_transport_iscsi hns_roce_hw_v2 crct10dif_ce hns3 ses hclge hnae3 hisi_hpre hisi_zip qm uacce ip_tables x_tables hisi_sas_v3_hw hisi_sas_main libsas scsi_transport_sas
[ 1459.709329] CPU: 14 PID: 17244 Comm: ethtool Tainted: G O 5.3.0-rc4-00415-gc86f057 #1
[ 1459.718419] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B040.01 07/26/2019
[ 1459.727248] Call trace:
[ 1459.729688] dump_backtrace+0x0/0x150
[ 1459.733335] show_stack+0x24/0x30
[ 1459.736639] dump_stack+0xa0/0xc4
[ 1459.739943] bad_page+0xf0/0x158
[ 1459.743157] free_pages_check_bad+0x84/0xa0
[ 1459.747322] __free_pages_ok+0x348/0x378
[ 1459.751228] page_frag_free+0x80/0x88
[ 1459.754877] skb_free_head+0x38/0x48
[ 1459.758436] skb_release_data+0x134/0x160
[ 1459.762427] skb_release_all+0x30/0x40
[ 1459.766158] consume_skb+0x38/0x108
[ 1459.769633] __dev_kfree_skb_any+0x58/0x68
[ 1459.773718] hns3_fini_ring+0x48/0x58 [hns3]
[ 1459.777970] hns3_set_ringparam+0x2a8/0x418 [hns3]
[ 1459.782741] dev_ethtool+0x5f4/0x2080
[ 1459.786390] dev_ioctl+0x190/0x3d8
[ 1459.789777] sock_do_ioctl+0xf8/0x220
[ 1459.793423] sock_ioctl+0x3bc/0x490
[ 1459.796896] do_vfs_ioctl+0xc4/0x868
[ 1459.800454] ksys_ioctl+0x8c/0xa0
[ 1459.803752] __arm64_sys_ioctl+0x28/0x38
[ 1459.807658] el0_svc_common.constprop.0+0xe0/0x1e0
[ 1459.812426] el0_svc_handler+0x34/0x90
[ 1459.816158] el0_svc+0x10/0x14
[ 1459.819220] Disabling lock debugging due to kernel taint
[ 1459.825182] ------------[ cut here ]------------
Since ndo_stop will reclaim the RX's skb allocated by the driver,
so the backed up ring parameter should not keep this info.
Fixes: a723fb8efe29 ("net: hns3: refine for set ring parameters")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index c52eccc..aa692b1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -908,9 +908,11 @@ static struct hns3_enet_ring *hns3_backup_ringparam(struct hns3_nic_priv *priv)
if (!tmp_rings)
return NULL;
- for (i = 0; i < handle->kinfo.num_tqps * 2; i++)
+ for (i = 0; i < handle->kinfo.num_tqps * 2; i++) {
memcpy(&tmp_rings[i], priv->ring_data[i].ring,
sizeof(struct hns3_enet_ring));
+ tmp_rings[i].skb = NULL;
+ }
return tmp_rings;
}
--
2.7.4
^ permalink raw reply related
* [PATCH V2 net-next 3/7] net: hns3: fix mis-assignment to hdev->reset_level in hclge_reset
From: Huazhong Tan @ 2019-09-05 13:31 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Huazhong Tan
In-Reply-To: <1567690302-16648-1-git-send-email-tanhuazhong@huawei.com>
Since hclge_get_reset_level may return HNAE3_NONE_RESET,
so hdev->reset_level can not be assigned with the return
value in the hclge_reset(), otherwise, it will cause
the use of hdev->reset_level in hclge_reset_event get
into error.
Fixes: 012fcb52f67c ("net: hns3: activate reset timer when calling reset_event")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 0e1225c..76e1c84 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -3619,6 +3619,7 @@ static int hclge_reset_stack(struct hclge_dev *hdev)
static void hclge_reset(struct hclge_dev *hdev)
{
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
+ enum hnae3_reset_type reset_level;
int ret;
/* Initialize ae_dev reset status as well, in case enet layer wants to
@@ -3697,10 +3698,10 @@ static void hclge_reset(struct hclge_dev *hdev)
* it should be handled as soon as possible. since some errors
* need this kind of reset to fix.
*/
- hdev->reset_level = hclge_get_reset_level(ae_dev,
- &hdev->default_reset_request);
- if (hdev->reset_level != HNAE3_NONE_RESET)
- set_bit(hdev->reset_level, &hdev->reset_request);
+ reset_level = hclge_get_reset_level(ae_dev,
+ &hdev->default_reset_request);
+ if (reset_level != HNAE3_NONE_RESET)
+ set_bit(reset_level, &hdev->reset_request);
return;
--
2.7.4
^ permalink raw reply related
* Re: [PATCH] hostap: remove set but not used variable 'copied' in prism2_io_debug_proc_read
From: Kalle Valo @ 2019-09-05 13:45 UTC (permalink / raw)
To: zhong jiang; +Cc: kvalo, davem, linux-wireless, netdev, linux-kernel
In-Reply-To: <5D6E1DF2.1000109@huawei.com>
zhong jiang <zhongjiang@huawei.com> writes:
> Please ignore the patch. Because the hostap_proc.c is marked as 'obsolete'.
You mean marked in the MAINTAINERS file? I don't see that as a problem,
I can (and should) still apply any patches submitted to hostap driver.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply
* pull-request: wireless-drivers 2019-09-05
From: Kalle Valo @ 2019-09-05 13:58 UTC (permalink / raw)
To: David Miller; +Cc: linux-wireless, netdev, linux-kernel
Hi Dave,
here's a pull request to net tree for v5.3, more info below. Please let
me know if there are any problems.
Kalle
The following changes since commit 089cf7f6ecb266b6a4164919a2e69bd2f938374a:
Linux 5.3-rc7 (2019-09-02 09:57:40 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git tags/wireless-drivers-for-davem-2019-09-05
for you to fetch changes up to 8b51dc7291473093c821195c4b6af85fadedbc2f:
rsi: fix a double free bug in rsi_91x_deinit() (2019-09-03 16:54:48 +0300)
----------------------------------------------------------------
wireless-drivers fixes for 5.3
Fourth set of fixes for 5.3, and hopefully really the last one. Quite
a few CVE fixes this time but at least to my knowledge none of them
have a known exploit.
mt76
* workaround firmware hang by disabling hardware encryption on MT7630E
* disable 5GHz band for MT7630E as it's not working properly
mwifiex
* fix IE parsing to avoid a heap buffer overflow
iwlwifi
* fix for QuZ device initialisation
rt2x00
* another fix for rekeying
* revert a commit causing degradation in rx signal levels
rsi
* fix a double free
----------------------------------------------------------------
Hui Peng (1):
rsi: fix a double free bug in rsi_91x_deinit()
Luca Coelho (1):
iwlwifi: assign directly to iwl_trans->cfg in QuZ detection
Stanislaw Gruszka (4):
mt76: mt76x0e: don't use hw encryption for MT7630E
mt76: mt76x0e: disable 5GHz band for MT7630E
rt2x00: clear up IV's on key removal
Revert "rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band"
Wen Huang (1):
mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 24 +++++++-------
drivers/net/wireless/marvell/mwifiex/ie.c | 3 ++
drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 9 +++++-
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | 5 +++
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 15 ++++++++-
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 37 +++++++++++-----------
drivers/net/wireless/rsi/rsi_91x_usb.c | 1 -
7 files changed, 60 insertions(+), 34 deletions(-)
^ permalink raw reply
* Re: [PATCH 0/2] Revert and rework on the metadata accelreation
From: Jason Gunthorpe @ 2019-09-05 13:59 UTC (permalink / raw)
To: Jason Wang
Cc: mst@redhat.com, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, aarcange@redhat.com,
jglisse@redhat.com, linux-mm@kvack.org
In-Reply-To: <20190905122736.19768-1-jasowang@redhat.com>
On Thu, Sep 05, 2019 at 08:27:34PM +0800, Jason Wang wrote:
> Hi:
>
> Per request from Michael and Jason, the metadata accelreation is
> reverted in this version and rework in next version.
>
> Please review.
>
> Thanks
>
> Jason Wang (2):
> Revert "vhost: access vq metadata through kernel virtual address"
> vhost: re-introducing metadata acceleration through kernel virtual
> address
There are a bunch of patches in the queue already that will help
vhost, and I a working on one for next cycle that will help alot more
too.
I think you should apply the revert this cycle and rebase the other
patch for next..
Jason
^ permalink raw reply
* [PATCH] lan743x: remove redundant assignment to variable rx_process_result
From: Colin King @ 2019-09-05 14:01 UTC (permalink / raw)
To: Bryan Whitehead, Microchip Linux Driver Support, David S . Miller,
netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable rx_process_result is being initialized with a value that
is never read and is being re-assigned immediately afterwards. The
assignment is redundant, so replace it with the return from function
lan743x_rx_process_packet.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 15a8be6bad27..a43140f7b5eb 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2172,9 +2172,8 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight)
}
count = 0;
while (count < weight) {
- int rx_process_result = -1;
+ int rx_process_result = lan743x_rx_process_packet(rx);
- rx_process_result = lan743x_rx_process_packet(rx);
if (rx_process_result == RX_PROCESS_RESULT_PACKET_RECEIVED) {
count++;
} else if (rx_process_result ==
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] hostap: remove set but not used variable 'copied' in prism2_io_debug_proc_read
From: zhong jiang @ 2019-09-05 14:10 UTC (permalink / raw)
To: Kalle Valo; +Cc: davem, linux-wireless, netdev, linux-kernel
In-Reply-To: <87zhjij1q6.fsf@tynnyri.adurom.net>
On 2019/9/5 21:45, Kalle Valo wrote:
> zhong jiang <zhongjiang@huawei.com> writes:
>
>> Please ignore the patch. Because the hostap_proc.c is marked as 'obsolete'.
> You mean marked in the MAINTAINERS file? I don't see that as a problem,
> I can (and should) still apply any patches submitted to hostap driver.
>
I hit the following issue when checking the patch by checkpatch.pl
WARNING: drivers/net/wireless/intersil/hostap/hostap_proc.c is marked as 'obsolete' in the MAINTAINERS hierarchy.
No unnecessary modifications please.
I certainly hope it can be appiled to upstream if the above check doesn't matter.
Thanks,
zhong jiang
^ permalink raw reply
* Re: [PATCH] net/skbuff: silence warnings under memory pressure
From: Qian Cai @ 2019-09-05 14:09 UTC (permalink / raw)
To: Eric Dumazet, Sergey Senozhatsky
Cc: Sergey Senozhatsky, Michal Hocko, davem, netdev, linux-mm,
linux-kernel, Petr Mladek, Steven Rostedt
In-Reply-To: <165827b5-6783-f4f8-69d6-b088dd97eb45@gmail.com>
On Thu, 2019-09-05 at 10:32 +0200, Eric Dumazet wrote:
>
> On 9/4/19 10:42 PM, Qian Cai wrote:
>
> > To summary, those look to me are all good long-term improvement that would
> > reduce the likelihood of this kind of livelock in general especially for
> > other
> > unknown allocations that happen while processing softirqs, but it is still
> > up to
> > the air if it fixes it 100% in all situations as printk() is going to take
> > more
> > time and could deal with console hardware that involve irq_exit() anyway.
> >
> > On the other hand, adding __GPF_NOWARN in the build_skb() allocation will
> > fix
> > this known NET_TX_SOFTIRQ case which is common when softirqd involved at
> > least
> > in short-term. It even have a benefit to reduce the overall warn_alloc()
> > noise
> > out there.
> >
> > I can resubmit with an update changelog. Does it make any sense?
>
> It does not make sense.
>
> We have thousands other GFP_ATOMIC allocations in the networking stacks.
Instead of repeatedly make generalize statements, could you enlighten me with
some concrete examples that have the similar properties which would trigger a
livelock,
- guaranteed GFP_ATOMIC allocations when processing softirq batches.
- the allocation has a fallback mechanism that is unnecessary to warn a failure.
I thought "skb" is a special-case here as every packet sent or received is
handled using this data structure.
>
> Soon you will have to send more and more patches adding __GFP_NOWARN once
> your workloads/tests can hit all these various points.
I doubt so.
>
> It is really time to fix this problem generically, instead of having
> to review hundreds of patches.
>
> This was my initial feedback really, nothing really has changed since.
I feel like you may not follow the thread closely. There are more details
uncovered in the last few days and narrowed down to the culprits.
>
> The ability to send a warning with a stack trace, holding the cpu
> for many milliseconds should not be decided case by case, otherwise
> every call points will decide to opt-out from the harmful warnings.
That is not really the reasons anymore why I asked to add a __GPF_NOWARN here.
^ permalink raw reply
* Re: [PATCH] hostap: remove set but not used variable 'copied' in prism2_io_debug_proc_read
From: Kalle Valo @ 2019-09-05 14:19 UTC (permalink / raw)
To: zhong jiang; +Cc: davem, linux-wireless, netdev, linux-kernel
In-Reply-To: <5D711760.20903@huawei.com>
zhong jiang <zhongjiang@huawei.com> writes:
> On 2019/9/5 21:45, Kalle Valo wrote:
>> zhong jiang <zhongjiang@huawei.com> writes:
>>
>>> Please ignore the patch. Because the hostap_proc.c is marked as 'obsolete'.
>> You mean marked in the MAINTAINERS file? I don't see that as a problem,
>> I can (and should) still apply any patches submitted to hostap driver.
>>
> I hit the following issue when checking the patch by checkpatch.pl
>
> WARNING: drivers/net/wireless/intersil/hostap/hostap_proc.c is marked
> as 'obsolete' in the MAINTAINERS hierarchy.
> No unnecessary modifications please.
>
> I certainly hope it can be appiled to upstream if the above check doesn't matter.
I have no idea why checkpatch says like that and I'm going to just
ignore that warning. As long as the driver is in the tree I think it
should be improved.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply
* [PATCH] rtlwifi: rtl8821ae: make array static const and remove redundant assignment
From: Colin King @ 2019-09-05 15:00 UTC (permalink / raw)
To: Ping-Ke Shih, Kalle Valo, David S . Miller, Larry Finger,
linux-wireless, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The array channel_all can be make static const rather than populating
it on the stack, this makes the code smaller. Also, variable place
is being initialized with a value that is never read, so this assignment
is redundant and can be removed.
Before:
text data bss dec hex filename
118537 9591 0 128128 1f480 realtek/rtlwifi/rtl8821ae/phy.o
After:
text data bss dec hex filename
118331 9687 0 128018 1f412 realtek/rtlwifi/rtl8821ae/phy.o
Saves 110 bytes, (gcc version 9.2.1, amd64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 408af144098e..979e434a4e73 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -3613,14 +3613,14 @@ u8 rtl8821ae_phy_sw_chnl(struct ieee80211_hw *hw)
u8 _rtl8812ae_get_right_chnl_place_for_iqk(u8 chnl)
{
- u8 channel_all[TARGET_CHNL_NUM_2G_5G_8812] = {
+ static const u8 channel_all[TARGET_CHNL_NUM_2G_5G_8812] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54,
56, 58, 60, 62, 64, 100, 102, 104, 106, 108,
110, 112, 114, 116, 118, 120, 122, 124, 126,
128, 130, 132, 134, 136, 138, 140, 149, 151,
153, 155, 157, 159, 161, 163, 165};
- u8 place = chnl;
+ u8 place;
if (chnl > 14) {
for (place = 14; place < sizeof(channel_all); place++)
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] net/skbuff: silence warnings under memory pressure
From: Eric Dumazet @ 2019-09-05 15:06 UTC (permalink / raw)
To: Qian Cai, Eric Dumazet, Sergey Senozhatsky
Cc: Sergey Senozhatsky, Michal Hocko, davem, netdev, linux-mm,
linux-kernel, Petr Mladek, Steven Rostedt
In-Reply-To: <1567692555.5576.91.camel@lca.pw>
On 9/5/19 4:09 PM, Qian Cai wrote:
>
> I feel like you may not follow the thread closely. There are more details
> uncovered in the last few days and narrowed down to the culprits.
>
I have followed the thread closely, thank you very much.
I am happy that the problem is addressed as I suggested.
Ie not individual patches adding selected __GFP_NOWARN.
^ permalink raw reply
* [PATCH net-next v2 1/4] ravb: correct typo in FBP field of SFO register
From: Simon Horman @ 2019-09-05 15:10 UTC (permalink / raw)
To: David Miller, Sergei Shtylyov
Cc: Magnus Damm, netdev, linux-renesas-soc, Simon Horman
In-Reply-To: <20190905151059.26794-1-horms+renesas@verge.net.au>
The field name is FBP rather than FPB.
This field is unused and could equally be removed from the driver entirely.
But there seems no harm in leaving as documentation of the presence of the
field.
Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
v2 - Simon Horman
* Accumulated tags
* Claimed authorship - a whole one line
* No mangled diff this time
v1 - Simon Horman
* Extracted from larger patch
* Wrote changelog
---
drivers/net/ethernet/renesas/ravb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index ac9195add811..2596a95a4300 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -317,7 +317,7 @@ enum UFCD_BIT {
/* SFO */
enum SFO_BIT {
- SFO_FPB = 0x0000003F,
+ SFO_FBP = 0x0000003F,
};
/* RTC */
--
2.11.0
^ permalink raw reply related
* [PATCH net-next v2 0/4] ravb: remove use of undocumented registers
From: Simon Horman @ 2019-09-05 15:10 UTC (permalink / raw)
To: David Miller, Sergei Shtylyov
Cc: Magnus Damm, netdev, linux-renesas-soc, Simon Horman
Hi,
this short series cleans up the RAVB driver a little.
The first patch corrects the spelling of the FBP field of SFO register.
This register field is unused and should have no run-time effect.
The remaining patches remove the use of undocumented registers
after some consultation with the internal Renesas BSP team.
Changes in v2:
* Corrected mangled state of first patch
* Patches 2/4 and 3/4 split out of a large patch
* Accumulated acks
* Tweaked changelog
* Claimed authorship of all patches
v1 of this series was tested on the following platforms.
No behaviour change is expected in v2.
* E3 Ebisu
* H3 Salvator-XS (ES2.0)
* M3-W Salvator-XS
* M3-N Salvator-XS
* RZ/G1C iW-RainboW-G23S
Simon Horman (4):
ravb: correct typo in FBP field of SFO register
ravb: remove undocumented counter processing
ravb: remove undocumented endianness selection
ravb: TROCR register is only present on R-Car Gen3
drivers/net/ethernet/renesas/ravb.h | 9 ++-------
drivers/net/ethernet/renesas/ravb_main.c | 21 ++++-----------------
2 files changed, 6 insertions(+), 24 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH net-next v2 4/4] ravb: TROCR register is only present on R-Car Gen3
From: Simon Horman @ 2019-09-05 15:10 UTC (permalink / raw)
To: David Miller, Sergei Shtylyov
Cc: Magnus Damm, netdev, linux-renesas-soc, Simon Horman
In-Reply-To: <20190905151059.26794-1-horms+renesas@verge.net.au>
Only use the TROCR register on R-Car Gen3 as it is not present on other
SoCs.
Offsets used for the undocumented registers are considered reserved and
should not be written to. After some internal investigation with Renesas it
remains unclear why this driver accesses these fields on R-Car Gen2 but
regardless of what the historical reasons are the current code is
considered incorrect.
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
v2
* Accumulated tags
* Updated changelog
---
drivers/net/ethernet/renesas/ravb.h | 2 +-
drivers/net/ethernet/renesas/ravb_main.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bdb051f04b0c..a9c89d5d8898 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -193,7 +193,7 @@ enum ravb_reg {
GECMR = 0x05b0,
MAHR = 0x05c0,
MALR = 0x05c8,
- TROCR = 0x0700, /* Undocumented? */
+ TROCR = 0x0700, /* R-Car Gen3 only */
CEFCR = 0x0740,
FRECR = 0x0748,
TSFRCR = 0x0750,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index b538cc6fdbb7..de9aa8c47f1c 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1621,8 +1621,10 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev)
stats0 = &priv->stats[RAVB_BE];
stats1 = &priv->stats[RAVB_NC];
- nstats->tx_dropped += ravb_read(ndev, TROCR);
- ravb_write(ndev, 0, TROCR); /* (write clear) */
+ if (priv->chip_id == RCAR_GEN3) {
+ nstats->tx_dropped += ravb_read(ndev, TROCR);
+ ravb_write(ndev, 0, TROCR); /* (write clear) */
+ }
nstats->rx_packets = stats0->rx_packets + stats1->rx_packets;
nstats->tx_packets = stats0->tx_packets + stats1->tx_packets;
--
2.11.0
^ permalink raw reply related
* [PATCH net-next v2 3/4] ravb: remove undocumented endianness selection
From: Simon Horman @ 2019-09-05 15:10 UTC (permalink / raw)
To: David Miller, Sergei Shtylyov
Cc: Magnus Damm, netdev, linux-renesas-soc, Simon Horman
In-Reply-To: <20190905151059.26794-1-horms+renesas@verge.net.au>
This patch removes the use of the undocumented BOC bit of the CCC register.
Current documentation for EtherAVB (ravb) describes the offset of what the
driver uses as the BOC bit as reserved and that only a value of 0 should be
written. After some internal investigation with Renesas it remains unclear
why this driver accesses these fields but regardless of what the historical
reasons are the current code is considered incorrect.
Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
v2
* New patch broken out of larger patch
---
drivers/net/ethernet/renesas/ravb.h | 1 -
drivers/net/ethernet/renesas/ravb_main.c | 6 ------
2 files changed, 7 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 70eeceb7f8ae..bdb051f04b0c 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -216,7 +216,6 @@ enum CCC_BIT {
CCC_CSEL_HPB = 0x00010000,
CCC_CSEL_ETH_TX = 0x00020000,
CCC_CSEL_GMII_REF = 0x00030000,
- CCC_BOC = 0x00100000, /* Undocumented? */
CCC_LBME = 0x01000000,
};
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 4d1f274cded0..b538cc6fdbb7 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -447,12 +447,6 @@ static int ravb_dmac_init(struct net_device *ndev)
ravb_ring_format(ndev, RAVB_BE);
ravb_ring_format(ndev, RAVB_NC);
-#if defined(__LITTLE_ENDIAN)
- ravb_modify(ndev, CCC, CCC_BOC, 0);
-#else
- ravb_modify(ndev, CCC, CCC_BOC, CCC_BOC);
-#endif
-
/* Set AVB RX */
ravb_write(ndev,
RCR_EFFS | RCR_ENCF | RCR_ETS0 | RCR_ESF | 0x18000000, RCR);
--
2.11.0
^ permalink raw reply related
* [PATCH net-next v2 2/4] ravb: remove undocumented counter processing
From: Simon Horman @ 2019-09-05 15:10 UTC (permalink / raw)
To: David Miller, Sergei Shtylyov
Cc: Magnus Damm, netdev, linux-renesas-soc, Simon Horman
In-Reply-To: <20190905151059.26794-1-horms+renesas@verge.net.au>
This patch removes the use of the undocumented counter registers
CDCR, LCCR, CERCR, CEECR.
Offsets used for undocumented registers are considered reserved and
should not be written to. After some internal investigation with Renesas
it remains unclear why this driver accesses these fields but regardless of
what the historical reasons are the current code is considered incorrect.
Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
v2
* New patch broken out of larger patch
---
drivers/net/ethernet/renesas/ravb.h | 4 ----
drivers/net/ethernet/renesas/ravb_main.c | 9 ---------
2 files changed, 13 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 2596a95a4300..70eeceb7f8ae 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -194,15 +194,11 @@ enum ravb_reg {
MAHR = 0x05c0,
MALR = 0x05c8,
TROCR = 0x0700, /* Undocumented? */
- CDCR = 0x0708, /* Undocumented? */
- LCCR = 0x0710, /* Undocumented? */
CEFCR = 0x0740,
FRECR = 0x0748,
TSFRCR = 0x0750,
TLFRCR = 0x0758,
RFCR = 0x0760,
- CERCR = 0x0768, /* Undocumented? */
- CEECR = 0x0770, /* Undocumented? */
MAFCR = 0x0778,
};
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 6cacd5e893ac..4d1f274cded0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1629,15 +1629,6 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev)
nstats->tx_dropped += ravb_read(ndev, TROCR);
ravb_write(ndev, 0, TROCR); /* (write clear) */
- nstats->collisions += ravb_read(ndev, CDCR);
- ravb_write(ndev, 0, CDCR); /* (write clear) */
- nstats->tx_carrier_errors += ravb_read(ndev, LCCR);
- ravb_write(ndev, 0, LCCR); /* (write clear) */
-
- nstats->tx_carrier_errors += ravb_read(ndev, CERCR);
- ravb_write(ndev, 0, CERCR); /* (write clear) */
- nstats->tx_carrier_errors += ravb_read(ndev, CEECR);
- ravb_write(ndev, 0, CEECR); /* (write clear) */
nstats->rx_packets = stats0->rx_packets + stats1->rx_packets;
nstats->tx_packets = stats0->tx_packets + stats1->tx_packets;
--
2.11.0
^ permalink raw reply related
* Re: [PATCH] net/skbuff: silence warnings under memory pressure
From: Eric Dumazet @ 2019-09-05 15:14 UTC (permalink / raw)
To: Qian Cai, Eric Dumazet, Sergey Senozhatsky
Cc: Sergey Senozhatsky, Michal Hocko, davem, netdev, linux-mm,
linux-kernel, Petr Mladek, Steven Rostedt
In-Reply-To: <1567692555.5576.91.camel@lca.pw>
On 9/5/19 4:09 PM, Qian Cai wrote:
> Instead of repeatedly make generalize statements, could you enlighten me with
> some concrete examples that have the similar properties which would trigger a
> livelock,
>
> - guaranteed GFP_ATOMIC allocations when processing softirq batches.
> - the allocation has a fallback mechanism that is unnecessary to warn a failure.
>
> I thought "skb" is a special-case here as every packet sent or received is
> handled using this data structure.
>
Just 'git grep GFP_ATOMIC -- net' and carefully study all the places.
You will discover many allocations done for incoming packets.
All of them can fail and trigger a trace.
Please fix the problem for good, do not pretend addressing the skb allocations
will solve it.
The skb allocation can succeed, then the following allocation might fail.
skb are one of the many objects that networking need to allocate dynamically.
^ permalink raw reply
* Re: [PATCH net 03/11] bonding: split IFF_BONDING into IFF_BONDING and IFF_BONDING_SLAVE
From: Taehee Yoo @ 2019-09-05 15:21 UTC (permalink / raw)
To: Jay Vosburgh
Cc: David Miller, Netdev, vfalico, Andy Gospodarek,
Jiří Pírko, sd, Roopa Prabhu, saeedm, manishc,
rahulv, kys, haiyangz, sthemmin, sashal, hare, varun, ubraun,
kgraul
In-Reply-To: <22680.1567624963@famine>
On Thu, 5 Sep 2019 at 04:22, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
>
Hi Jay,
Thank you for the review!
> Taehee Yoo <ap420073@gmail.com> wrote:
>
> >The IFF_BONDING means bonding master or bonding slave device.
> >
> >->ndo_add_slave() sets IFF_BONDING flag and ->ndo_del_slave() removes
> >IFF_BONDING flag.
> >This routine makes a problem in the nesting bonding structure.
> >
> >bond1<--bond2
> >
> >Both bond0 and bond1 are bonding device and these should keep having
> >IFF_BONDING flag until they are removed.
> >But bond1 would lose IFF_BONDING at ->ndo_del_slave because that routine
> >can not check whether the slave device is the bonding type or not.
> >So that this patch splits the IFF_BONDING into theIFF_BONDING and
> >the IFF_BONDING_SLAVE. The IFF_BONDING is bonding master flag and
> >IFF_BONDING_SLAVE is bonding slave flag.
> >
> >Test commands:
> > ip link add bond0 type bond
> > ip link add bond1 type bond
> > ip link set bond1 master bond0
> > ip link set bond1 nomaster
> > ip link del bond1 type bond
> > ip link add bond1 type bond
> >
> >Splat looks like:
> >[ 149.201107] proc_dir_entry 'bonding/bond1' already registered
> >[ 149.208013] WARNING: CPU: 1 PID: 1308 at fs/proc/generic.c:361 proc_register+0x2a9/0x3e0
> >[ 149.208866] Modules linked in: bonding veth openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv4 ip_tables6
> >[ 149.208866] CPU: 1 PID: 1308 Comm: ip Not tainted 5.3.0-rc7+ #322
> >[ 149.208866] RIP: 0010:proc_register+0x2a9/0x3e0
> >[ 149.208866] Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 39 01 00 00 48 8b 04 24 48 89 ea 48 c7 c7 a0 a0 13 89 48 8b b0 0
> >[ 149.208866] RSP: 0018:ffff88810df9f098 EFLAGS: 00010286
> >[ 149.208866] RAX: dffffc0000000008 RBX: ffff8880b5d3aa50 RCX: ffffffff87cdec92
> >[ 149.208866] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff888116bf6a8c
> >[ 149.208866] RBP: ffff8880b5d3acd3 R08: ffffed1022d7ff71 R09: ffffed1022d7ff71
> >[ 149.208866] R10: 0000000000000001 R11: ffffed1022d7ff70 R12: ffff8880b5d3abe8
> >[ 149.208866] R13: ffff8880b5d3acd2 R14: dffffc0000000000 R15: ffffed1016ba759a
> >[ 149.208866] FS: 00007f4bd1f650c0(0000) GS:ffff888116a00000(0000) knlGS:0000000000000000
> >[ 149.208866] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> >[ 149.208866] CR2: 000055e7ca686118 CR3: 0000000106fd4000 CR4: 00000000001006e0
> >[ 149.208866] Call Trace:
> >[ 149.208866] proc_create_seq_private+0xb3/0xf0
> >[ 149.208866] bond_create_proc_entry+0x1b3/0x3f0 [bonding]
> >[ 149.208866] bond_netdev_event+0x433/0x970 [bonding]
> >[ 149.208866] ? __module_text_address+0x13/0x140
> >[ 149.208866] notifier_call_chain+0x90/0x160
> >[ 149.208866] register_netdevice+0x9b3/0xd70
> >[ 149.208866] ? alloc_netdev_mqs+0x854/0xc10
> >[ 149.208866] ? netdev_change_features+0xa0/0xa0
> >[ 149.208866] ? rtnl_create_link+0x2ed/0xad0
> >[ 149.208866] bond_newlink+0x2a/0x60 [bonding]
> >[ 149.208866] __rtnl_newlink+0xb75/0x1180
> >[ ... ]
> >
> >Fixes: 0b680e753724 ("[PATCH] bonding: Add priv_flag to avoid event mishandling")
>
> I'm not sure this Fixes is technically correct, as I don't think
> nesting bonds has induced an oops since 2006. I don't think nesting
> bonds really does anything useful, but it's been allowed for years (but
> has been broken on and off all that time) so I'm a bit leery of simply
> disallowing nesting of bonds for fear it would break something already
> in use.
>
> In any event, it would be desirable if this fix could be changed
> to not need a new priv_flag, as this patch would consume the last free
> bit in netdev_priv_flags. A bond master device that is also a slave
> should have IFF_MASTER set in dev->flags, which could be tested at
> removal time to avoid clearing IFF_BONDING.
>
I have been testing another way that doesn't add a new flag and that
just checks IFF_MASTER and IFF_BONDING when an interface is being deleted.
I think it is simple and works well. so I will send a v2 patch after
some more tests.
Thank you!
> -J
>
> >Signed-off-by: Taehee Yoo <ap420073@gmail.com>
> >---
> > drivers/net/bonding/bond_main.c | 13 +++++--------
> > .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +-
> > drivers/net/hyperv/netvsc_drv.c | 3 +--
> > drivers/scsi/fcoe/fcoe.c | 2 +-
> > drivers/target/iscsi/cxgbit/cxgbit_cm.c | 2 +-
> > include/linux/netdevice.h | 9 ++++++---
> > 6 files changed, 15 insertions(+), 16 deletions(-)
> >
> >diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> >index 931d9d935686..abd008c31c9a 100644
> >--- a/drivers/net/bonding/bond_main.c
> >+++ b/drivers/net/bonding/bond_main.c
> >@@ -1560,7 +1560,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
> > goto err_restore_mac;
> > }
> >
> >- slave_dev->priv_flags |= IFF_BONDING;
> >+ slave_dev->priv_flags |= IFF_BONDING_SLAVE;
> > /* initialize slave stats */
> > dev_get_stats(new_slave->dev, &new_slave->slave_stats);
> >
> >@@ -1816,7 +1816,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
> > slave_disable_netpoll(new_slave);
> >
> > err_close:
> >- slave_dev->priv_flags &= ~IFF_BONDING;
> >+ slave_dev->priv_flags &= ~IFF_BONDING_SLAVE;
> > dev_close(slave_dev);
> >
> > err_restore_mac:
> >@@ -2017,7 +2017,7 @@ static int __bond_release_one(struct net_device *bond_dev,
> > else
> > dev_set_mtu(slave_dev, slave->original_mtu);
> >
> >- slave_dev->priv_flags &= ~IFF_BONDING;
> >+ slave_dev->priv_flags &= ~IFF_BONDING_SLAVE;
> >
> > bond_free_slave(slave);
> >
> >@@ -3221,10 +3221,7 @@ static int bond_netdev_event(struct notifier_block *this,
> > netdev_dbg(event_dev, "%s received %s\n",
> > __func__, netdev_cmd_to_name(event));
> >
> >- if (!(event_dev->priv_flags & IFF_BONDING))
> >- return NOTIFY_DONE;
> >-
> >- if (event_dev->flags & IFF_MASTER) {
> >+ if (netif_is_bond_master(event_dev)) {
> > int ret;
> >
> > ret = bond_master_netdev_event(event, event_dev);
> >@@ -3232,7 +3229,7 @@ static int bond_netdev_event(struct notifier_block *this,
> > return ret;
> > }
> >
> >- if (event_dev->flags & IFF_SLAVE)
> >+ if (netif_is_bond_slave(event_dev))
> > return bond_slave_netdev_event(event, event_dev);
> >
> > return NOTIFY_DONE;
> >diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> >index 58e2eaf77014..5e0389ba1f13 100644
> >--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> >+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> >@@ -3340,7 +3340,7 @@ static void netxen_config_master(struct net_device *dev, unsigned long event)
> > * released and is dev_close()ed in bond_release()
> > * just before IFF_BONDING is stripped.
> > */
> >- if (!master && dev->priv_flags & IFF_BONDING)
> >+ if (!master && netif_is_bond_slave(dev))
> > netxen_free_ip_list(adapter, true);
> > }
> >
> >diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> >index e8fce6d715ef..6831202d9bcb 100644
> >--- a/drivers/net/hyperv/netvsc_drv.c
> >+++ b/drivers/net/hyperv/netvsc_drv.c
> >@@ -2439,8 +2439,7 @@ static int netvsc_netdev_event(struct notifier_block *this,
> > return NOTIFY_DONE;
> >
> > /* Avoid Bonding master dev with same MAC registering as VF */
> >- if ((event_dev->priv_flags & IFF_BONDING) &&
> >- (event_dev->flags & IFF_MASTER))
> >+ if (netif_is_bond_master(event_dev))
> > return NOTIFY_DONE;
> >
> > switch (event) {
> >diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
> >index 00dd47bcbb1e..750a6540eb9d 100644
> >--- a/drivers/scsi/fcoe/fcoe.c
> >+++ b/drivers/scsi/fcoe/fcoe.c
> >@@ -307,7 +307,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
> > }
> >
> > /* Do not support for bonding device */
> >- if (netdev->priv_flags & IFF_BONDING && netdev->flags & IFF_MASTER) {
> >+ if (netif_is_bond_master(netdev)) {
> > FCOE_NETDEV_DBG(netdev, "Bonded interfaces not supported\n");
> > return -EOPNOTSUPP;
> > }
> >diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> >index c70caf4ea490..16c8cae333b2 100644
> >--- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> >+++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> >@@ -247,7 +247,7 @@ struct cxgbit_device *cxgbit_find_device(struct net_device *ndev, u8 *port_id)
> >
> > static struct net_device *cxgbit_get_real_dev(struct net_device *ndev)
> > {
> >- if (ndev->priv_flags & IFF_BONDING) {
> >+ if (netif_is_bond_master(ndev) || netif_is_bond_slave(ndev)) {
> > pr_err("Bond devices are not supported. Interface:%s\n",
> > ndev->name);
> > return NULL;
> >diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> >index 5bb5756129af..a2c47f43e54b 100644
> >--- a/include/linux/netdevice.h
> >+++ b/include/linux/netdevice.h
> >@@ -1441,7 +1441,7 @@ struct net_device_ops {
> > *
> > * @IFF_802_1Q_VLAN: 802.1Q VLAN device
> > * @IFF_EBRIDGE: Ethernet bridging device
> >- * @IFF_BONDING: bonding master or slave
> >+ * @IFF_BONDING: bonding master
> > * @IFF_ISATAP: ISATAP interface (RFC4214)
> > * @IFF_WAN_HDLC: WAN HDLC device
> > * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
> >@@ -1474,6 +1474,7 @@ struct net_device_ops {
> > * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device
> > * @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device
> > * @IFF_LIVE_RENAME_OK: rename is allowed while device is up and running
> >+ * @IFF_BONDING_SLAVE: bonding slave
> > */
> > enum netdev_priv_flags {
> > IFF_802_1Q_VLAN = 1<<0,
> >@@ -1507,6 +1508,7 @@ enum netdev_priv_flags {
> > IFF_FAILOVER_SLAVE = 1<<28,
> > IFF_L3MDEV_RX_HANDLER = 1<<29,
> > IFF_LIVE_RENAME_OK = 1<<30,
> >+ IFF_BONDING_SLAVE = 1<<31,
> > };
> >
> > #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
> >@@ -1539,6 +1541,7 @@ enum netdev_priv_flags {
> > #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE
> > #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
> > #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
> >+#define IFF_BONDING_SLAVE IFF_BONDING_SLAVE
> >
> > /**
> > * struct net_device - The DEVICE structure.
> >@@ -4569,12 +4572,12 @@ static inline bool netif_is_macvlan_port(const struct net_device *dev)
> >
> > static inline bool netif_is_bond_master(const struct net_device *dev)
> > {
> >- return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
> >+ return dev->priv_flags & IFF_BONDING;
> > }
> >
> > static inline bool netif_is_bond_slave(const struct net_device *dev)
> > {
> >- return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
> >+ return dev->priv_flags & IFF_BONDING_SLAVE;
> > }
> >
> > static inline bool netif_supports_nofcs(struct net_device *dev)
> >--
> >2.17.1
> >
>
> ---
> -Jay Vosburgh, jay.vosburgh@canonical.com
^ permalink raw reply
* pull-request: bpf-next 2019-09-05
From: Daniel Borkmann @ 2019-09-05 15:23 UTC (permalink / raw)
To: davem; +Cc: daniel, ast, netdev, bpf
Hi David,
The following pull-request contains BPF updates for your *net-next* tree.
The main changes are:
1) Add the ability to use unaligned chunks in the AF_XDP umem. By
relaxing where the chunks can be placed, it allows to use an
arbitrary buffer size and place whenever there is a free
address in the umem. Helps more seamless DPDK AF_XDP driver
integration. Support for i40e, ixgbe and mlx5e, from Kevin and
Maxim.
2) Addition of a wakeup flag for AF_XDP tx and fill rings so the
application can wake up the kernel for rx/tx processing which
avoids busy-spinning of the latter, useful when app and driver
is located on the same core. Support for i40e, ixgbe and mlx5e,
from Magnus and Maxim.
3) bpftool fixes for printf()-like functions so compiler can actually
enforce checks, bpftool build system improvements for custom output
directories, and addition of 'bpftool map freeze' command, from Quentin.
4) Support attaching/detaching XDP programs from 'bpftool net' command,
from Daniel.
5) Automatic xskmap cleanup when AF_XDP socket is released, and several
barrier/{read,write}_once fixes in AF_XDP code, from Björn.
6) Relicense of bpf_helpers.h/bpf_endian.h for future libbpf
inclusion as well as libbpf versioning improvements, from Andrii.
7) Several new BPF kselftests for verifier precision tracking, from Alexei.
8) Several BPF kselftest fixes wrt endianess to run on s390x, from Ilya.
9) And more BPF kselftest improvements all over the place, from Stanislav.
10) Add simple BPF map op cache for nfp driver to batch dumps, from Jakub.
11) AF_XDP socket umem mapping improvements for 32bit archs, from Ivan.
12) Add BPF-to-BPF call and BTF line info support for s390x JIT, from Yauheni.
13) Small optimization in arm64 JIT to spare 1 insns for BPF_MOD, from Jerin.
14) Fix an error check in bpf_tcp_gen_syncookie() helper, from Petar.
15) Various minor fixes and cleanups, from Nathan, Masahiro, Masanari,
Peter, Wei, Yue.
Please consider pulling these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
Thanks a lot!
----------------------------------------------------------------
The following changes since commit c162610c7db2e9611a7b3ec806f9c97fcfec0b0b:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next (2019-08-13 18:22:57 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
for you to fetch changes up to 593f191a8005110e20302039834c116676d69be1:
Merge branch 'bpf-af-xdp-barrier-fixes' (2019-09-05 14:11:53 +0200)
----------------------------------------------------------------
Alexei Starovoitov (8):
Merge branch 'bpftool-net-attach'
Merge branch 'fix-printf'
Merge branch 'btf_get_next_id'
bpf: introduce verifier internal test flag
tools/bpf: sync bpf.h
selftests/bpf: verifier precise tests
selftests/bpf: add precision tracking test
selftests/bpf: precision tracking tests
Andrii Nakryiko (2):
libbpf: make libbpf.map source of truth for libbpf version
libbpf: relicense bpf_helpers.h and bpf_endian.h
Björn Töpel (6):
xsk: remove AF_XDP socket from map when the socket is released
xsk: support BPF_EXIST and BPF_NOEXIST flags in XSKMAP
xsk: avoid store-tearing when assigning queues
xsk: avoid store-tearing when assigning umem
xsk: use state member for socket synchronization
xsk: lock the control mutex in sock_diag interface
Daniel Borkmann (10):
Merge branch 'bpf-af-xdp-wakeup'
Merge branch 'bpf-sk-storage-clone'
Merge branch 'bpf-af-xdp-xskmap-improvements'
Merge branch 'bpf-precision-tracking-tests'
Merge branch 'bpf-misc-test-fixes'
Merge branch 'bpf-bpftool-build-improvements'
Merge branch 'bpf-nfp-map-op-cache'
Merge branch 'bpf-xdp-unaligned-chunk'
Merge branch 'bpf-selftest-endianess-fixes'
Merge branch 'bpf-af-xdp-barrier-fixes'
Daniel T. Lee (4):
tools: bpftool: add net attach command to attach XDP on interface
tools: bpftool: add net detach command to detach XDP on interface
tools: bpftool: add bash-completion for net attach/detach
tools: bpftool: add documentation for net attach/detach
Ilya Leoshkevich (5):
btf: do not use CONFIG_OUTPUT_FORMAT
selftests/bpf: introduce bpf_cpu_to_be64 and bpf_be64_to_cpu
selftests/bpf: fix "ctx:write sysctl:write read ok" on s390
selftests/bpf: improve unexpected success reporting in test_syctl
selftests/bpf: fix endianness issues in test_sysctl
Ivan Khoronzhuk (3):
libbpf: use LFS (_FILE_OFFSET_BITS) instead of direct mmap2 syscall
xdp: xdp_umem: replace kmap on vmap for umem map
samples: bpf: syscall_nrs: use mmap2 if defined
Jakub Kicinski (2):
nfp: bpf: rework MTU checking
nfp: bpf: add simple map op cache
Jerin Jacob (1):
arm64: bpf: optimize modulo operation
Kevin Laatz (13):
i40e: simplify Rx buffer recycle
ixgbe: simplify Rx buffer recycle
xsk: add support to allow unaligned chunk placement
i40e: modify driver for handling offsets
ixgbe: modify driver for handling offsets
mlx5e: modify driver for handling offsets
libbpf: add flags to umem config
samples/bpf: add unaligned chunks mode support to xdpsock
samples/bpf: add buffer recycling for unaligned chunks to xdpsock
samples/bpf: use hugepages in xdpsock app
doc/af_xdp: include unaligned chunk case
i40e: fix xdp handle calculations
ixgbe: fix xdp handle calculations
Magnus Karlsson (6):
xsk: replace ndo_xsk_async_xmit with ndo_xsk_wakeup
xsk: add support for need_wakeup flag in AF_XDP rings
i40e: add support for AF_XDP need_wakeup feature
ixgbe: add support for AF_XDP need_wakeup feature
libbpf: add support for need_wakeup flag in AF_XDP part
samples/bpf: add use of need_wakeup flag in xdpsock
Masahiro Yamada (1):
bpf: add include guard to tnum.h
Masanari Iida (1):
selftests/bpf: Fix a typo in test_offload.py
Maxim Mikityanskiy (4):
net/mlx5e: Move the SW XSK code from NAPI poll to a separate function
net/mlx5e: Add AF_XDP need_wakeup support
net: Don't call XDP_SETUP_PROG when nothing is changed
net/mlx5e: Allow XSK frames smaller than a page
Nathan Chancellor (1):
test_bpf: Fix a new clang warning about xor-ing two numbers
Petar Penkov (2):
selftests/bpf: fix race in test_tcp_rtt test
bpf: fix error check in bpf_tcp_gen_syncookie
Peter Wu (4):
bpf: clarify description for CONFIG_BPF_EVENTS
bpf: fix 'struct pt_reg' typo in documentation
bpf: clarify when bpf_trace_printk discards lines
bpf: sync bpf.h to tools/
Quentin Monnet (19):
tools: bpftool: compile with $(EXTRA_WARNINGS)
tools: bpftool: fix arguments for p_err() in do_event_pipe()
tools: bpftool: fix format strings and arguments for jsonw_printf()
tools: bpftool: fix argument for p_err() in BTF do_dump()
tools: bpftool: fix format string for p_err() in query_flow_dissector()
tools: bpftool: fix format string for p_err() in detect_common_prefix()
tools: bpftool: move "__printf()" attributes to header file
bpf: add BTF ids in procfs for file descriptors to BTF objects
bpf: add new BPF_BTF_GET_NEXT_ID syscall command
tools: bpf: synchronise BPF UAPI header with tools
libbpf: refactor bpf_*_get_next_id() functions
libbpf: add bpf_btf_get_next_id() to cycle through BTF objects
tools: bpftool: implement "bpftool btf show|list"
tools: bpftool: show frozen status for maps
tools: bpftool: add "bpftool map freeze" subcommand
tools: bpftool: ignore make built-in rules for getting kernel version
tools: bpftool: improve and check builds for different make invocations
tools: bpf: account for generated feature/ and libbpf/ directories
tools: bpftool: do not link twice against libbpf.a in Makefile
Stanislav Fomichev (11):
bpf: export bpf_map_inc_not_zero
bpf: support cloning sk storage on accept()
bpf: sync bpf.h to tools/
selftests/bpf: add sockopt clone/inheritance test
selftests/bpf: test_progs: test__skip
selftests/bpf: test_progs: remove global fail/success counts
selftests/bpf: test_progs: remove asserts from subtests
selftests/bpf: test_progs: remove unused ret
selftests/bpf: remove wrong nhoff in flow dissector test
selftests/bpf: test_progs: fix verbose mode garbage
selftests/bpf: test_progs: add missing to CHECK_FAIL
Wei Yongjun (1):
btf: fix return value check in btf_vmlinux_init()
Yauheni Kaliuta (2):
bpf: s390: add JIT support for multi-function programs
bpf: s390: add JIT support for bpf line info
YueHaibing (1):
bpf: Use PTR_ERR_OR_ZERO in xsk_map_inc()
Documentation/networking/af_xdp.rst | 10 +-
arch/arm64/net/bpf_jit.h | 3 +
arch/arm64/net/bpf_jit_comp.c | 6 +-
arch/s390/net/bpf_jit_comp.c | 67 +++-
drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +-
drivers/net/ethernet/intel/i40e/i40e_xsk.c | 52 ++-
drivers/net/ethernet/intel/i40e/i40e_xsk.h | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +-
.../net/ethernet/intel/ixgbe/ixgbe_txrx_common.h | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 49 ++-
.../net/ethernet/mellanox/mlx5/core/en/params.c | 23 +-
.../net/ethernet/mellanox/mlx5/core/en/params.h | 2 +
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 8 +-
.../net/ethernet/mellanox/mlx5/core/en/xsk/rx.c | 5 +-
.../net/ethernet/mellanox/mlx5/core/en/xsk/rx.h | 14 +
.../net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 15 +-
.../net/ethernet/mellanox/mlx5/core/en/xsk/tx.c | 2 +-
.../net/ethernet/mellanox/mlx5/core/en/xsk/tx.h | 14 +-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 7 +-
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 27 +-
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 187 ++++++++++-
drivers/net/ethernet/netronome/nfp/bpf/fw.h | 1 +
drivers/net/ethernet/netronome/nfp/bpf/main.c | 33 ++
drivers/net/ethernet/netronome/nfp/bpf/main.h | 24 ++
drivers/net/ethernet/netronome/nfp/bpf/offload.c | 3 +
drivers/net/ethernet/netronome/nfp/nfp_net.h | 2 +-
.../net/ethernet/netronome/nfp/nfp_net_common.c | 9 +-
include/linux/bpf.h | 5 +
include/linux/bpf_verifier.h | 1 +
include/linux/netdevice.h | 14 +-
include/linux/tnum.h | 6 +
include/net/bpf_sk_storage.h | 10 +
include/net/xdp_sock.h | 122 ++++++-
include/uapi/linux/bpf.h | 15 +-
include/uapi/linux/if_xdp.h | 22 ++
kernel/bpf/btf.c | 16 +-
kernel/bpf/syscall.c | 21 +-
kernel/bpf/sysfs_btf.c | 9 +-
kernel/bpf/verifier.c | 5 +-
kernel/bpf/xskmap.c | 133 ++++++--
kernel/trace/Kconfig | 3 +-
lib/test_bpf.c | 2 +-
net/core/bpf_sk_storage.c | 104 +++++-
net/core/dev.c | 15 +-
net/core/filter.c | 2 +-
net/core/sock.c | 9 +-
net/xdp/xdp_umem.c | 67 +++-
net/xdp/xsk.c | 349 +++++++++++++++++----
net/xdp/xsk.h | 13 +
net/xdp/xsk_diag.c | 5 +-
net/xdp/xsk_queue.h | 71 ++++-
samples/bpf/syscall_nrs.c | 6 +
samples/bpf/tracex5_kern.c | 13 +
samples/bpf/xdpsock_user.c | 243 +++++++++-----
scripts/link-vmlinux.sh | 6 +-
tools/bpf/.gitignore | 1 +
tools/bpf/Makefile | 5 +-
tools/bpf/bpftool/.gitignore | 2 +
tools/bpf/bpftool/Documentation/bpftool-btf.rst | 7 +
tools/bpf/bpftool/Documentation/bpftool-map.rst | 9 +
tools/bpf/bpftool/Documentation/bpftool-net.rst | 57 +++-
tools/bpf/bpftool/Makefile | 31 +-
tools/bpf/bpftool/bash-completion/bpftool | 89 +++++-
tools/bpf/bpftool/btf.c | 344 +++++++++++++++++++-
tools/bpf/bpftool/btf_dumper.c | 8 +-
tools/bpf/bpftool/cgroup.c | 2 +-
tools/bpf/bpftool/common.c | 4 +-
tools/bpf/bpftool/json_writer.c | 6 +-
tools/bpf/bpftool/json_writer.h | 6 +-
tools/bpf/bpftool/main.c | 2 +-
tools/bpf/bpftool/main.h | 4 +-
tools/bpf/bpftool/map.c | 64 +++-
tools/bpf/bpftool/map_perf_ring.c | 4 +-
tools/bpf/bpftool/net.c | 178 ++++++++++-
tools/bpf/bpftool/perf.c | 4 +
tools/include/linux/compiler-gcc.h | 2 +
tools/include/uapi/linux/bpf.h | 15 +-
tools/include/uapi/linux/if_xdp.h | 22 ++
tools/lib/bpf/Makefile | 26 +-
tools/lib/bpf/bpf.c | 24 +-
tools/lib/bpf/bpf.h | 1 +
tools/lib/bpf/libbpf.map | 6 +
tools/lib/bpf/xsk.c | 86 ++---
tools/lib/bpf/xsk.h | 33 ++
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/Makefile | 6 +-
tools/testing/selftests/bpf/bpf_endian.h | 16 +-
tools/testing/selftests/bpf/bpf_helpers.h | 2 +-
.../testing/selftests/bpf/prog_tests/bpf_obj_id.c | 20 +-
.../selftests/bpf/prog_tests/bpf_verif_scale.c | 9 +-
.../selftests/bpf/prog_tests/flow_dissector.c | 5 +-
.../selftests/bpf/prog_tests/get_stack_raw_tp.c | 3 -
.../testing/selftests/bpf/prog_tests/global_data.c | 20 +-
tools/testing/selftests/bpf/prog_tests/l4lb_all.c | 9 +-
tools/testing/selftests/bpf/prog_tests/map_lock.c | 38 +--
.../testing/selftests/bpf/prog_tests/pkt_access.c | 4 +-
.../selftests/bpf/prog_tests/pkt_md_access.c | 4 +-
.../selftests/bpf/prog_tests/queue_stack_map.c | 8 +-
.../selftests/bpf/prog_tests/reference_tracking.c | 4 +-
.../testing/selftests/bpf/prog_tests/send_signal.c | 43 ++-
tools/testing/selftests/bpf/prog_tests/spinlock.c | 16 +-
.../selftests/bpf/prog_tests/stacktrace_build_id.c | 7 +-
.../bpf/prog_tests/stacktrace_build_id_nmi.c | 7 +-
.../selftests/bpf/prog_tests/stacktrace_map.c | 17 +-
.../bpf/prog_tests/stacktrace_map_raw_tp.c | 9 +-
.../selftests/bpf/prog_tests/task_fd_query_rawtp.c | 3 -
.../selftests/bpf/prog_tests/task_fd_query_tp.c | 5 -
.../testing/selftests/bpf/prog_tests/tcp_estats.c | 4 +-
tools/testing/selftests/bpf/prog_tests/xdp.c | 4 +-
.../selftests/bpf/prog_tests/xdp_adjust_tail.c | 4 +-
.../selftests/bpf/prog_tests/xdp_noinline.c | 8 +-
.../testing/selftests/bpf/progs/sockopt_inherit.c | 97 ++++++
.../selftests/bpf/progs/test_lwt_seg6local.c | 16 +-
tools/testing/selftests/bpf/progs/test_seg6_loop.c | 8 +-
tools/testing/selftests/bpf/test_bpftool_build.sh | 143 +++++++++
tools/testing/selftests/bpf/test_offload.py | 2 +-
tools/testing/selftests/bpf/test_progs.c | 42 ++-
tools/testing/selftests/bpf/test_progs.h | 19 +-
tools/testing/selftests/bpf/test_sockopt_inherit.c | 253 +++++++++++++++
tools/testing/selftests/bpf/test_sysctl.c | 130 +++++---
tools/testing/selftests/bpf/test_tcp_rtt.c | 31 ++
tools/testing/selftests/bpf/test_verifier.c | 68 +++-
tools/testing/selftests/bpf/verifier/precise.c | 194 ++++++++++++
124 files changed, 3489 insertions(+), 698 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/sockopt_inherit.c
create mode 100755 tools/testing/selftests/bpf/test_bpftool_build.sh
create mode 100644 tools/testing/selftests/bpf/test_sockopt_inherit.c
create mode 100644 tools/testing/selftests/bpf/verifier/precise.c
^ permalink raw reply
* Re: [PATCH REPOST 1/2] can: flexcan: fix deadlock when using self wakeup
From: Marc Kleine-Budde @ 2019-09-05 15:24 UTC (permalink / raw)
To: Sean Nyekjaer, Joakim Zhang, linux-can@vger.kernel.org
Cc: wg@grandegger.com, netdev@vger.kernel.org, dl-linux-imx,
Martin Hundebøll
In-Reply-To: <1655f342-7aaf-5e36-d141-d00eee84f3ec@geanix.com>
[-- Attachment #1.1: Type: text/plain, Size: 947 bytes --]
On 9/5/19 3:17 PM, Sean Nyekjaer wrote:
>
>
> On 05/09/2019 09.10, Joakim Zhang wrote:
>> Hi Sean,
>>
>> Could you update lastest flexcan driver using linux-can-next/flexcan and then merge below two patches from linux-can/testing?
>> d0b53616716e (HEAD -> testing, origin/testing) can: flexcan: add LPSR mode support for i.MX7D
>> 803eb6bad65b can: flexcan: fix deadlock when using self wakeup
>>
>> Best Regards,
>> Joakim Zhang
>
> The testing branch have some UBI bugs, when suspending it crashes...
> So will have to leave this, until they are resolved :-)
For what it's worth, I've rebased the testing branch to the latest
net/master.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* [PATCH bpf-next v2 0/6] selftests/bpf: move sockopt tests under test_progs
From: Stanislav Fomichev @ 2019-09-05 15:27 UTC (permalink / raw)
To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev
Now that test_progs is shaping into more generic test framework,
let's convert sockopt tests to it. This requires adding
a helper to create and join a cgroup first (test__join_cgroup).
Since we already hijack stdout/stderr that shouldn't be
a problem (cgroup helpers log to stderr).
The rest of the patches just move sockopt tests files under prog_tests/
and do the required small adjustments.
v2:
* don't create a subtest per sockopt test, too verbose (Alexei
Starovoitov)
Stanislav Fomichev (6):
selftests/bpf: test_progs: add test__join_cgroup helper
selftests/bpf: test_progs: convert test_sockopt
selftests/bpf: test_progs: convert test_sockopt_sk
selftests/bpf: test_progs: convert test_sockopt_multi
selftests/bpf: test_progs: convert test_sockopt_inherit
selftests/bpf: test_progs: convert test_tcp_rtt
tools/testing/selftests/bpf/.gitignore | 5 -
tools/testing/selftests/bpf/Makefile | 12 +--
.../{test_sockopt.c => prog_tests/sockopt.c} | 50 ++-------
.../sockopt_inherit.c} | 102 ++++++++----------
.../sockopt_multi.c} | 62 ++---------
.../sockopt_sk.c} | 60 +++--------
.../{test_tcp_rtt.c => prog_tests/tcp_rtt.c} | 83 +++++---------
tools/testing/selftests/bpf/test_progs.c | 38 +++++++
tools/testing/selftests/bpf/test_progs.h | 4 +-
9 files changed, 142 insertions(+), 274 deletions(-)
rename tools/testing/selftests/bpf/{test_sockopt.c => prog_tests/sockopt.c} (96%)
rename tools/testing/selftests/bpf/{test_sockopt_inherit.c => prog_tests/sockopt_inherit.c} (72%)
rename tools/testing/selftests/bpf/{test_sockopt_multi.c => prog_tests/sockopt_multi.c} (83%)
rename tools/testing/selftests/bpf/{test_sockopt_sk.c => prog_tests/sockopt_sk.c} (79%)
rename tools/testing/selftests/bpf/{test_tcp_rtt.c => prog_tests/tcp_rtt.c} (76%)
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply
* [PATCH bpf-next v2 1/6] selftests/bpf: test_progs: add test__join_cgroup helper
From: Stanislav Fomichev @ 2019-09-05 15:27 UTC (permalink / raw)
To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190905152709.111193-1-sdf@google.com>
test__join_cgroup() combines the following operations that usually
go hand in hand and returns cgroup fd:
* setup cgroup environment (make sure cgroupfs is mounted)
* mkdir cgroup
* join cgroup
It also marks a test as a "cgroup cleanup needed" and removes cgroup
state after the test is done.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/Makefile | 4 +--
tools/testing/selftests/bpf/test_progs.c | 38 ++++++++++++++++++++++++
tools/testing/selftests/bpf/test_progs.h | 1 +
3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c7595b4ed55d..e145954d3765 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -102,7 +102,7 @@ $(OUTPUT)/test_socket_cookie: cgroup_helpers.c
$(OUTPUT)/test_sockmap: cgroup_helpers.c
$(OUTPUT)/test_tcpbpf_user: cgroup_helpers.c
$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c
-$(OUTPUT)/test_progs: trace_helpers.c
+$(OUTPUT)/test_progs: cgroup_helpers.c trace_helpers.c
$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c
$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c
$(OUTPUT)/test_netcnt: cgroup_helpers.c
@@ -196,7 +196,7 @@ $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(OUTPUT)/libbpf.a\
| $(ALU32_BUILD_DIR)
$(CC) $(TEST_PROGS_CFLAGS) $(CFLAGS) \
-o $(ALU32_BUILD_DIR)/test_progs_32 \
- test_progs.c test_stub.c trace_helpers.c prog_tests/*.c \
+ test_progs.c test_stub.c cgroup_helpers.c trace_helpers.c prog_tests/*.c \
$(OUTPUT)/libbpf.a $(LDLIBS)
$(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index e8616e778cb5..af75a1c7a458 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -2,6 +2,7 @@
/* Copyright (c) 2017 Facebook
*/
#include "test_progs.h"
+#include "cgroup_helpers.h"
#include "bpf_rlimit.h"
#include <argp.h>
#include <string.h>
@@ -17,6 +18,7 @@ struct prog_test_def {
int error_cnt;
int skip_cnt;
bool tested;
+ bool need_cgroup_cleanup;
const char *subtest_name;
int subtest_num;
@@ -122,6 +124,39 @@ void test__fail(void)
env.test->error_cnt++;
}
+int test__join_cgroup(const char *path)
+{
+ int fd;
+
+ if (!env.test->need_cgroup_cleanup) {
+ if (setup_cgroup_environment()) {
+ fprintf(stderr,
+ "#%d %s: Failed to setup cgroup environment\n",
+ env.test->test_num, env.test->test_name);
+ return -1;
+ }
+
+ env.test->need_cgroup_cleanup = true;
+ }
+
+ fd = create_and_get_cgroup(path);
+ if (fd < 0) {
+ fprintf(stderr,
+ "#%d %s: Failed to create cgroup '%s' (errno=%d)\n",
+ env.test->test_num, env.test->test_name, path, errno);
+ return fd;
+ }
+
+ if (join_cgroup(path)) {
+ fprintf(stderr,
+ "#%d %s: Failed to join cgroup '%s' (errno=%d)\n",
+ env.test->test_num, env.test->test_name, path, errno);
+ return -1;
+ }
+
+ return fd;
+}
+
struct ipv4_packet pkt_v4 = {
.eth.h_proto = __bpf_constant_htons(ETH_P_IP),
.iph.ihl = 5,
@@ -530,6 +565,9 @@ int main(int argc, char **argv)
fprintf(env.stdout, "#%d %s:%s\n",
test->test_num, test->test_name,
test->error_cnt ? "FAIL" : "OK");
+
+ if (test->need_cgroup_cleanup)
+ cleanup_cgroup_environment();
}
stdio_restore();
printf("Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n",
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
index c8edb9464ba6..e518bd5da3e2 100644
--- a/tools/testing/selftests/bpf/test_progs.h
+++ b/tools/testing/selftests/bpf/test_progs.h
@@ -71,6 +71,7 @@ extern void test__force_log();
extern bool test__start_subtest(const char *name);
extern void test__skip(void);
extern void test__fail(void);
+extern int test__join_cgroup(const char *path);
#define MAGIC_BYTES 123
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related
* [PATCH bpf-next v2 2/6] selftests/bpf: test_progs: convert test_sockopt
From: Stanislav Fomichev @ 2019-09-05 15:27 UTC (permalink / raw)
To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190905152709.111193-1-sdf@google.com>
Move the files, adjust includes, remove entry from Makefile & .gitignore
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/.gitignore | 1 -
tools/testing/selftests/bpf/Makefile | 3 +-
.../{test_sockopt.c => prog_tests/sockopt.c} | 50 +++----------------
3 files changed, 8 insertions(+), 46 deletions(-)
rename tools/testing/selftests/bpf/{test_sockopt.c => prog_tests/sockopt.c} (96%)
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index 60c9338cd9b4..0315120eac8f 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -39,7 +39,6 @@ libbpf.so.*
test_hashmap
test_btf_dump
xdping
-test_sockopt
test_sockopt_sk
test_sockopt_multi
test_sockopt_inherit
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e145954d3765..08e2183974d5 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -28,7 +28,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \
test_cgroup_storage test_select_reuseport test_section_names \
test_netcnt test_tcpnotify_user test_sock_fields test_sysctl test_hashmap \
- test_btf_dump test_cgroup_attach xdping test_sockopt test_sockopt_sk \
+ test_btf_dump test_cgroup_attach xdping test_sockopt_sk \
test_sockopt_multi test_sockopt_inherit test_tcp_rtt
BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
@@ -109,7 +109,6 @@ $(OUTPUT)/test_netcnt: cgroup_helpers.c
$(OUTPUT)/test_sock_fields: cgroup_helpers.c
$(OUTPUT)/test_sysctl: cgroup_helpers.c
$(OUTPUT)/test_cgroup_attach: cgroup_helpers.c
-$(OUTPUT)/test_sockopt: cgroup_helpers.c
$(OUTPUT)/test_sockopt_sk: cgroup_helpers.c
$(OUTPUT)/test_sockopt_multi: cgroup_helpers.c
$(OUTPUT)/test_sockopt_inherit: cgroup_helpers.c
diff --git a/tools/testing/selftests/bpf/test_sockopt.c b/tools/testing/selftests/bpf/prog_tests/sockopt.c
similarity index 96%
rename from tools/testing/selftests/bpf/test_sockopt.c
rename to tools/testing/selftests/bpf/prog_tests/sockopt.c
index 23bd0819382d..64cffb94307c 100644
--- a/tools/testing/selftests/bpf/test_sockopt.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt.c
@@ -1,22 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
-
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <linux/filter.h>
-#include <bpf/bpf.h>
-#include <bpf/libbpf.h>
-
-#include "bpf_rlimit.h"
-#include "bpf_util.h"
+#include <test_progs.h>
#include "cgroup_helpers.h"
-#define CG_PATH "/sockopt"
-
static char bpf_log_buf[4096];
static bool verbose;
@@ -983,39 +968,18 @@ static int run_test(int cgroup_fd, struct sockopt_test *test)
return ret;
}
-int main(int args, char **argv)
+void test_sockopt(void)
{
- int err = EXIT_FAILURE, error_cnt = 0;
int cgroup_fd, i;
- if (setup_cgroup_environment())
- goto cleanup_obj;
-
- cgroup_fd = create_and_get_cgroup(CG_PATH);
- if (cgroup_fd < 0)
- goto cleanup_cgroup_env;
-
- if (join_cgroup(CG_PATH))
- goto cleanup_cgroup;
+ cgroup_fd = test__join_cgroup("/sockopt");
+ if (CHECK_FAIL(cgroup_fd < 0))
+ return;
for (i = 0; i < ARRAY_SIZE(tests); i++) {
- int err = run_test(cgroup_fd, &tests[i]);
-
- if (err)
- error_cnt++;
-
- printf("#%d %s: %s\n", i, err ? "FAIL" : "PASS",
- tests[i].descr);
+ printf("#%d %s:\n", i, tests[i].descr);
+ CHECK_FAIL(run_test(cgroup_fd, &tests[i]));
}
- printf("Summary: %ld PASSED, %d FAILED\n",
- ARRAY_SIZE(tests) - error_cnt, error_cnt);
- err = error_cnt ? EXIT_FAILURE : EXIT_SUCCESS;
-
-cleanup_cgroup:
close(cgroup_fd);
-cleanup_cgroup_env:
- cleanup_cgroup_environment();
-cleanup_obj:
- return err;
}
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related
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