* [PATCH net-next 1/2] net: marvell: mvpp2: add mvpp2_is_xlg() helper
From: Russell King @ 2019-02-11 10:23 UTC (permalink / raw)
To: Antoine Tenart, Maxime Chevallier
Cc: Baruch Siach, Sven Auhagen, David S. Miller, netdev
Add a mvpp2_is_xlg() helper to identify whether the interface mode
should be using the XLGMAC rather than the GMAC.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index fdd538c28f8a..03c79618bfef 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -965,6 +965,11 @@ mvpp2_shared_interrupt_mask_unmask(struct mvpp2_port *port, bool mask)
}
/* Port configuration routines */
+static bool mvpp2_is_xlg(phy_interface_t interface)
+{
+ return interface == PHY_INTERFACE_MODE_10GKR ||
+ interface == PHY_INTERFACE_MODE_XAUI;
+}
static void mvpp22_gop_init_rgmii(struct mvpp2_port *port)
{
@@ -1196,9 +1201,7 @@ static void mvpp2_port_enable(struct mvpp2_port *port)
u32 val;
/* Only GOP port 0 has an XLG MAC */
- if (port->gop_id == 0 &&
- (port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
- port->phy_interface == PHY_INTERFACE_MODE_10GKR)) {
+ if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface)) {
val = readl(port->base + MVPP22_XLG_CTRL0_REG);
val |= MVPP22_XLG_CTRL0_PORT_EN |
MVPP22_XLG_CTRL0_MAC_RESET_DIS;
@@ -1217,9 +1220,7 @@ static void mvpp2_port_disable(struct mvpp2_port *port)
u32 val;
/* Only GOP port 0 has an XLG MAC */
- if (port->gop_id == 0 &&
- (port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
- port->phy_interface == PHY_INTERFACE_MODE_10GKR)) {
+ if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface)) {
val = readl(port->base + MVPP22_XLG_CTRL0_REG);
val &= ~MVPP22_XLG_CTRL0_PORT_EN;
writel(val, port->base + MVPP22_XLG_CTRL0_REG);
@@ -3161,8 +3162,7 @@ static void mvpp22_mode_reconfigure(struct mvpp2_port *port)
ctrl3 = readl(port->base + MVPP22_XLG_CTRL3_REG);
ctrl3 &= ~MVPP22_XLG_CTRL3_MACMODESELECT_MASK;
- if (port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
- port->phy_interface == PHY_INTERFACE_MODE_10GKR)
+ if (mvpp2_is_xlg(port->phy_interface))
ctrl3 |= MVPP22_XLG_CTRL3_MACMODESELECT_10G;
else
ctrl3 |= MVPP22_XLG_CTRL3_MACMODESELECT_GMAC;
@@ -3170,9 +3170,7 @@ static void mvpp22_mode_reconfigure(struct mvpp2_port *port)
writel(ctrl3, port->base + MVPP22_XLG_CTRL3_REG);
}
- if (port->gop_id == 0 &&
- (port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
- port->phy_interface == PHY_INTERFACE_MODE_10GKR))
+ if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface))
mvpp2_xlg_max_rx_size_set(port);
else
mvpp2_gmac_max_rx_size_set(port);
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 2/2] net: marvell: mvpp2: use mvpp2_is_xlg() helper elsewhere
From: Russell King @ 2019-02-11 10:23 UTC (permalink / raw)
To: Antoine Tenart, Maxime Chevallier
Cc: Baruch Siach, Sven Auhagen, David S. Miller, netdev
There are several places which make the decision whether to access the
XLGMAC vs GMAC that only check for PHY_INTERFACE_MODE_10GKR and not its
XAUI variant. Switch these to use the new helper so that we have
consistency through the driver.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 03c79618bfef..94c92a49f12f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1106,7 +1106,7 @@ static void mvpp22_gop_unmask_irq(struct mvpp2_port *port)
if (port->gop_id == 0) {
/* Enable the XLG/GIG irqs for this port */
val = readl(port->base + MVPP22_XLG_EXT_INT_MASK);
- if (port->phy_interface == PHY_INTERFACE_MODE_10GKR)
+ if (mvpp2_is_xlg(port->phy_interface))
val |= MVPP22_XLG_EXT_INT_MASK_XLG;
else
val |= MVPP22_XLG_EXT_INT_MASK_GIG;
@@ -2471,8 +2471,7 @@ static irqreturn_t mvpp2_link_status_isr(int irq, void *dev_id)
mvpp22_gop_mask_irq(port);
- if (port->gop_id == 0 &&
- port->phy_interface == PHY_INTERFACE_MODE_10GKR) {
+ if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface)) {
val = readl(port->base + MVPP22_XLG_INT_STAT);
if (val & MVPP22_XLG_INT_STAT_LINK) {
event = true;
@@ -4680,7 +4679,7 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
bool change_interface = port->phy_interface != state->interface;
/* Check for invalid configuration */
- if (state->interface == PHY_INTERFACE_MODE_10GKR && port->gop_id != 0) {
+ if (mvpp2_is_xlg(state->interface) && port->gop_id != 0) {
netdev_err(dev, "Invalid mode on %s\n", dev->name);
return;
}
@@ -4700,7 +4699,7 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
}
/* mac (re)configuration */
- if (state->interface == PHY_INTERFACE_MODE_10GKR)
+ if (mvpp2_is_xlg(state->interface))
mvpp2_xlg_config(port, mode, state);
else if (phy_interface_mode_is_rgmii(state->interface) ||
phy_interface_mode_is_8023z(state->interface) ||
@@ -4722,8 +4721,7 @@ static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode,
struct mvpp2_port *port = netdev_priv(dev);
u32 val;
- if (!phylink_autoneg_inband(mode) &&
- interface != PHY_INTERFACE_MODE_10GKR) {
+ if (!phylink_autoneg_inband(mode) && !mvpp2_is_xlg(interface)) {
val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
val &= ~MVPP2_GMAC_FORCE_LINK_DOWN;
val |= MVPP2_GMAC_FORCE_LINK_PASS;
@@ -4743,8 +4741,7 @@ static void mvpp2_mac_link_down(struct net_device *dev, unsigned int mode,
struct mvpp2_port *port = netdev_priv(dev);
u32 val;
- if (!phylink_autoneg_inband(mode) &&
- interface != PHY_INTERFACE_MODE_10GKR) {
+ if (!phylink_autoneg_inband(mode) && !mvpp2_is_xlg(interface)) {
val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
val &= ~MVPP2_GMAC_FORCE_LINK_PASS;
val |= MVPP2_GMAC_FORCE_LINK_DOWN;
--
2.7.4
^ permalink raw reply related
* Re: [PATCH for-next 1/4] devlink: refactor validation of finding required arguments
From: Jiri Pirko @ 2019-02-11 10:29 UTC (permalink / raw)
To: Aya Levin
Cc: David Ahern, netdev, David S. Miller, Jiri Pirko, Moshe Shemesh,
Eran Ben Elisha, Tal Alon, Ariel Almog
In-Reply-To: <1549823329-10377-2-git-send-email-ayal@mellanox.com>
Sun, Feb 10, 2019 at 07:28:46PM CET, ayal@mellanox.com wrote:
>Introducing argument's metadata structure matching a bitmap flag per
>required argument and an error message if missing. Using this static
>array to refactor validation of finding required arguments in devlink
>command line and to ease further maintenance.
>
>Signed-off-by: Aya Levin <ayal@mellanox.com>
>Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
>---
> devlink/devlink.c | 155 +++++++++++++++++-------------------------------------
> 1 file changed, 47 insertions(+), 108 deletions(-)
>
>diff --git a/devlink/devlink.c b/devlink/devlink.c
>index d823512a4030..a05755385a49 100644
>--- a/devlink/devlink.c
>+++ b/devlink/devlink.c
>@@ -39,6 +39,7 @@
> #define PARAM_CMODE_RUNTIME_STR "runtime"
> #define PARAM_CMODE_DRIVERINIT_STR "driverinit"
> #define PARAM_CMODE_PERMANENT_STR "permanent"
>+#define DL_ARGS_REQUIRED_MAX_ERR_LEN 80
>
> static int g_new_line_count;
>
>@@ -950,6 +951,51 @@ static int param_cmode_get(const char *cmodestr,
> return 0;
> }
>
>+struct dl_args_metadata {
>+ uint32_t o_flag;
>+ char err_msg[DL_ARGS_REQUIRED_MAX_ERR_LEN];
>+};
>+
>+static const struct dl_args_metadata dl_args_required[] = {
>+ {DL_OPT_PORT_TYPE, "Port type not set.\n"},
>+ {DL_OPT_PORT_COUNT, "Port split count option expected.\n"},
>+ {DL_OPT_SB_POOL, "Pool index option expected.\n"},
>+ {DL_OPT_SB_SIZE, "Pool size option expected.\n"},
>+ {DL_OPT_SB_TYPE, "Pool type option expected.\n"},
>+ {DL_OPT_SB_THTYPE, "Pool threshold type option expected.\n"},
>+ {DL_OPT_SB_TH, "Threshold option expected.\n"},
>+ {DL_OPT_SB_TC, "TC index option expected.\n"},
>+ {DL_OPT_ESWITCH_MODE, "E-Switch mode option expected.\n"},
>+ {DL_OPT_ESWITCH_INLINE_MODE, "E-Switch inline-mode option expected.\n"},
>+ {DL_OPT_DPIPE_TABLE_NAME, "Dpipe table name expected\n"},
>+ {DL_OPT_DPIPE_TABLE_COUNTERS, "Dpipe table counter state expected\n"},
>+ {DL_OPT_ESWITCH_ENCAP_MODE, "E-Switch encapsulation option expected.\n"},
>+ {DL_OPT_PARAM_NAME, "Parameter name expected.\n"},
>+ {DL_OPT_PARAM_VALUE, "Value to set expected.\n"},
>+ {DL_OPT_PARAM_CMODE, "Configuration mode expected.\n"},
>+ {DL_OPT_REGION_SNAPSHOT_ID, "Region snapshot id expected.\n"},
>+ {DL_OPT_REGION_ADDRESS, "Region address value expected.\n"},
>+ {DL_OPT_REGION_LENGTH, "Region length value expected.\n"},
Remove the "\n" from there and put it to the pr_err() call.
>+};
>+
>+static int validate_finding_required_dl_args(uint32_t o_required,
Please maintain the current naming scheme of functions. This should be
named something like:
dl_args_finding_required_validate()
>+ uint32_t o_found)
>+{
>+ uint32_t dl_args_required_size;
>+ uint32_t o_flag;
>+ int i;
>+
>+ dl_args_required_size = ARRAY_SIZE(dl_args_required);
>+ for (i = 0; i < dl_args_required_size; i++) {
>+ o_flag = dl_args_required[i].o_flag;
>+ if ((o_required & o_flag) && !(o_found & o_flag)) {
>+ pr_err("%s", dl_args_required[i].err_msg);
>+ return -EINVAL;
>+ }
>+ }
>+ return 0;
>+}
>+
[...]
^ permalink raw reply
* Re: [PATCH for-next 2/4] devlink: fix print of uint64_t
From: Jiri Pirko @ 2019-02-11 10:32 UTC (permalink / raw)
To: Aya Levin
Cc: David Ahern, netdev, David S. Miller, Jiri Pirko, Moshe Shemesh,
Eran Ben Elisha, Tal Alon, Ariel Almog
In-Reply-To: <1549823329-10377-3-git-send-email-ayal@mellanox.com>
Sun, Feb 10, 2019 at 07:28:47PM CET, ayal@mellanox.com wrote:
> This patch prints uint64_t with its corresponding format and avoid implicit
> cast to uint32_t.
Drop the space at the beginning of the lines.
Otherwise this looks fine.
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply
* Re: [PATCH for-next 4/4] devlink: add health command support
From: Jiri Pirko @ 2019-02-11 10:41 UTC (permalink / raw)
To: Aya Levin
Cc: David Ahern, netdev, David S. Miller, Jiri Pirko, Moshe Shemesh,
Eran Ben Elisha, Tal Alon, Ariel Almog
In-Reply-To: <1549823329-10377-5-git-send-email-ayal@mellanox.com>
Sun, Feb 10, 2019 at 07:28:49PM CET, ayal@mellanox.com wrote:
>This patch adds support for the following commands:
>devlink health show [DEV reporter REPORTE_NAME]
>devlink health recover DEV reporter REPORTER_NAME
>devlink health diagnose DEV reporter REPORTER_NAME
>devlink health dump show DEV reporter REPORTER_NAME
>devlink health dump clear DEV reporter REPORTER_NAME
>devlink health set DEV reporter REPORTER_NAME NAME VALUE
>
> * show: Devlink health show command displays status and configuration info on
> specific reporter on a device or dump the info on all reporters on all
> devices.
> * recover: Devlink health recover enables the user to initiate a
> recovery on a reporter. This operation will increment the recoveries
> counter displayed in the show command.
> * diagnose: Devlink health diagnose enables the user to retrieve diagnostics data
> on a reporter on a device. The command's output is a free text defined
> by the reporter.
> * dump show: Devlink health dump show displays the last saved dump. Devlink
> health saves a single dump. If a dump is not already stored by
> the Devlink for this reporter, Devlink generates a new dump. The
> dump can be generated automatically when a reporter reports on an
> error or manually by user's request.
> dump output is defined by the reporter.
> * dump clear: Devlink health dump clear, deletes the last saved dump file.
> * set: Devlink health set, enables the user to configure:
> 1) grace_period [msec] time interval between auto recoveries.
> 2) auto_recover [true/false] whether the devlink should execute
> automatic recover on error.
>
>Examples:
>$devlink health show pci/0000:00:09.0 reporter tx
>pci/0000:00:09.0:
>name tx
> state healthy #err 0 #recover 1 last_dump_ts N/A
> parameters:
> grace period 600 auto_recover true
>$devlink health diagnose pci/0000:00:09.0 reporter tx
>SQs:
> sqn: 4283 HW state: 1 stopped: false
> sqn: 4288 HW state: 1 stopped: false
> sqn: 4293 HW state: 1 stopped: false
> sqn: 4298 HW state: 1 stopped: false
> sqn: 4303 HW state: 1 stopped: false
>$devlink health dump show pci/0000:00:09.0 reporter tx
>TX dump data
>$devlink health dump clear pci/0000:00:09.0 reporter tx
>$devlink health set pci/0000:00:09.0 reporter tx grace_period 3500
>$devlink health set pci/0000:00:09.0 reporter tx auto_recover false
>
>Signed-off-by: Aya Levin <ayal@mellanox.com>
>Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
>---
> devlink/devlink.c | 551 ++++++++++++++++++++++++++++++++++++++++++-
> include/uapi/linux/devlink.h | 23 ++
> man/man8/devlink-health.8 | 176 ++++++++++++++
> man/man8/devlink.8 | 7 +-
> 4 files changed, 755 insertions(+), 2 deletions(-)
755 lines is too much for one patch.
For easier review, please split this patch into separate patchset,
preferably per-cmd.
^ permalink raw reply
* Re: [PATCH net-next 1/2] net: marvell: mvpp2: add mvpp2_is_xlg() helper
From: Maxime Chevallier @ 2019-02-11 11:01 UTC (permalink / raw)
To: Russell King
Cc: Antoine Tenart, Baruch Siach, Sven Auhagen, David S. Miller,
netdev
In-Reply-To: <E1gt8k2-0007iA-DL@rmk-PC.armlinux.org.uk>
Hello Russell,
On Mon, 11 Feb 2019 10:23:10 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:
>Add a mvpp2_is_xlg() helper to identify whether the interface mode
>should be using the XLGMAC rather than the GMAC.
>
>Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thanks,
Maxime
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: marvell: mvpp2: use mvpp2_is_xlg() helper elsewhere
From: Maxime Chevallier @ 2019-02-11 11:02 UTC (permalink / raw)
To: Russell King
Cc: Antoine Tenart, Baruch Siach, Sven Auhagen, David S. Miller,
netdev
In-Reply-To: <E1gt8k7-0007iN-I2@rmk-PC.armlinux.org.uk>
Hello Russell,
On Mon, 11 Feb 2019 10:23:15 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:
>There are several places which make the decision whether to access the
>XLGMAC vs GMAC that only check for PHY_INTERFACE_MODE_10GKR and not its
>XAUI variant. Switch these to use the new helper so that we have
>consistency through the driver.
>
>Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thanks,
Maxime
^ permalink raw reply
* [PATCH][net-next] devlink: use direct return of genlmsg_reply
From: Li RongQing @ 2019-02-11 11:09 UTC (permalink / raw)
To: netdev
This can remove redundant check
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
net/core/devlink.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index e6a015b8ac9b..76a9d287dbec 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4355,11 +4355,8 @@ static int devlink_fmsg_snd(struct devlink_fmsg *fmsg,
err = -EMSGSIZE;
goto nla_put_failure;
}
- err = genlmsg_reply(skb, info);
- if (err)
- return err;
- return 0;
+ return genlmsg_reply(skb, info);
nla_put_failure:
nlmsg_free(skb);
--
2.16.2
^ permalink raw reply related
* Re: [RFC] apparently bogus logics in unix_find_other() since 2002
From: Solar Designer @ 2019-02-11 11:21 UTC (permalink / raw)
To: Al Viro; +Cc: netdev, David Miller
In-Reply-To: <20190210042414.GH2217@ZenIV.linux.org.uk>
On Sun, Feb 10, 2019 at 04:24:22AM +0000, Al Viro wrote:
> In "net/unix/af_unix.c: Set ATIME on socket inode" (back in
> 2002) we'd grown something rather odd in unix_find_other(). In the
> original patch it was
> u=unix_find_socket_byname(sunname, len, type, hash);
> - if (!u)
> + if (u) {
> + struct dentry *dentry;
> + dentry = u->protinfo.af_unix.dentry;
> + if (dentry)
> + UPDATE_ATIME(dentry->d_inode);
> + } else
> goto fail;
It's this commit:
https://github.com/dmgerman/linux-bitkeeper/commit/80cbc5b9c7393c4456236543ca1e639ea0841c19
There are two hunks in that patch: one after "if (sunname->sun_path[0])"
and the other after "else". I just did some more digging and found the
private discussion of the time, as well as a previous revision of the
patch (against 2.2.21, whereas the committed one was against 2.4.x of
the same era). Even the earliest revision I found already has both
hunks. I couldn't find any discussion as to why the second hunk was
possibly needed. It is quite possible that I had added it in error.
The original problem this patch addressed was stmpclean deleting sockets
that were still actively used - specifically, PostgreSQL's. I found
that I also tested the patch on /dev/log and X11 sockets. However, I
can't find any indication of me ever testing with the first hunk only,
so it's quite possible I wrote both hunks at once and only tested both.
> These days the code is
>
> u = unix_find_socket_byname(net, sunname, len, type, hash);
> if (u) {
> struct dentry *dentry;
> dentry = unix_sk(u)->path.dentry;
> if (dentry)
> touch_atime(&unix_sk(u)->path);
> } else
> goto fail;
>
> but the logics is the same. It's the abstract address case - we have
> '\0' in sunname->sun_path[0]. How in hell could that possibly have
> non-NULL ->path.dentry and what would it be?
This is probably in fact impossible.
I think it'd make sense to drop this logic, reverting to:
if (!u)
goto fail;
and then see if atime on an actively used socket in /tmp or on /dev/log
keeps getting updated (due to the first hunk of the above commit).
Alexander
^ permalink raw reply
* [PATCH net-next] net/tls: Do not use async crypto for non-data records
From: Vakul Garg @ 2019-02-11 11:31 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com,
davem@davemloft.net, doronrk@fb.com, Vakul Garg
Addition of tls1.3 support broke tls1.2 handshake when async crypto
accelerator is used. This is because the record type for non-data
records is not propagated to user application. Also when async
decryption happens, the decryption does not stop when two different
types of records get dequeued and submitted for decryption. To address
it, we decrypt tls1.2 non-data records in synchronous way. We check
whether the record we just processed has same type as the previous one
before checking for async condition and jumping to dequeue next record.
Fixes: 130b392c6cd6b ("net: tls: Add tls 1.3 support")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
net/tls/tls_sw.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index fe8c287cbaa1..ae4784734547 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1645,10 +1645,10 @@ int tls_sw_recvmsg(struct sock *sk,
do {
bool retain_skb = false;
- bool async = false;
bool zc = false;
int to_decrypt;
int chunk = 0;
+ bool async;
skb = tls_wait_data(sk, psock, flags, timeo, &err);
if (!skb) {
@@ -1674,18 +1674,21 @@ int tls_sw_recvmsg(struct sock *sk,
tls_ctx->crypto_recv.info.version != TLS_1_3_VERSION)
zc = true;
+ /* Do not use async mode if record is non-data */
+ if (ctx->control == TLS_RECORD_TYPE_DATA)
+ async = ctx->async_capable;
+ else
+ async = false;
+
err = decrypt_skb_update(sk, skb, &msg->msg_iter,
- &chunk, &zc, ctx->async_capable);
+ &chunk, &zc, async);
if (err < 0 && err != -EINPROGRESS) {
tls_err_abort(sk, EBADMSG);
goto recv_end;
}
- if (err == -EINPROGRESS) {
- async = true;
+ if (err == -EINPROGRESS)
num_async++;
- goto pick_next_record;
- }
if (!cmsg) {
int cerr;
@@ -1704,6 +1707,9 @@ int tls_sw_recvmsg(struct sock *sk,
goto recv_end;
}
+ if (async)
+ goto pick_next_record;
+
if (!zc) {
if (rxm->full_len > len) {
retain_skb = true;
--
2.13.6
^ permalink raw reply related
* [PATCH] ipv6: propagate genlmsg_reply return code
From: Li RongQing @ 2019-02-11 11:32 UTC (permalink / raw)
To: netdev
genlmsg_reply can fail, so propagate its return code
Fixes: 915d7e5e593 ("ipv6: sr: add code base for control plane support of SR-IPv6")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
net/ipv6/seg6.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index 8d0ba757a46c..9b2f272ca164 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -221,9 +221,7 @@ static int seg6_genl_get_tunsrc(struct sk_buff *skb, struct genl_info *info)
rcu_read_unlock();
genlmsg_end(msg, hdr);
- genlmsg_reply(msg, info);
-
- return 0;
+ return genlmsg_reply(msg, info);
nla_put_failure:
rcu_read_unlock();
--
2.16.2
^ permalink raw reply related
* Re: [PATCH v4.19.y] ip: fail fast on IP defrag errors
From: Greg KH @ 2019-02-11 11:44 UTC (permalink / raw)
To: Zubin Mithra; +Cc: netdev, posk, edumazet, willemb, davem
In-Reply-To: <20190122174344.112456-1-zsm@chromium.org>
On Tue, Jan 22, 2019 at 09:43:44AM -0800, Zubin Mithra wrote:
> From: Peter Oskolkov <posk@google.com>
>
> commit 0ff89efb524631ac9901b81446b453c29711c376 upstream
>
> The current behavior of IP defragmentation is inconsistent:
> - some overlapping/wrong length fragments are dropped without
> affecting the queue;
> - most overlapping fragments cause the whole frag queue to be dropped.
>
> This patch brings consistency: if a bad fragment is detected,
> the whole frag queue is dropped. Two major benefits:
> - fail fast: corrupted frag queues are cleared immediately, instead of
> by timeout;
> - testing of overlapping fragments is now much easier: any kind of
> random fragment length mutation now leads to the frag queue being
> discarded (IP packet dropped); before this patch, some overlaps were
> "corrected", with tests not seeing expected packet drops.
>
> Note that in one case (see "if (end&7)" conditional) the current
> behavior is preserved as there are concerns that this could be
> legitimate padding.
>
> Signed-off-by: Peter Oskolkov <posk@google.com>
> Reviewed-by: Eric Dumazet <edumazet@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Zubin Mithra <zsm@chromium.org>
> ---
> Backport Note:
> - Syzkaller reported a UAF, as 0ff89efb5246 ("ip: fail fast on IP defrag
> errors") was not applied prior to applying d5f9565c8d5a ("net: ipv4: do
> not handle duplicate fragments as overlapping").
> Conflicts occur when 0ff89efb5246 is now applied onto 4.14.y/4.19.y,
> which this patch addresses.
> - An alternative to this patch would be to do the following :-
> - revert "net: ipv4: do not handle duplicate fragments as overlapping"
> (d5f9565c8d5ad on 4.19.y, 95b4b711444a on 4.14.y)
> - apply "ip: fail fast on IP defrag errors" (0ff89efb5246)
> - apply "net: ipv4: do not handle duplicate fragments as overlapping"
> (ade446403bfb)
This patch does not apply to the current 4.19.y tree (well, on top of my
latest patches that are queued for the next release).
Can you refresh it after the next 4.19.y release in a few days and
resend it along with a new 4.14.y patch as well?
thanks,
greg k-h
^ permalink raw reply
* Re: TC stats / hw offload question
From: Edward Cree @ 2019-02-11 11:44 UTC (permalink / raw)
To: Jamal Hadi Salim, netdev
Cc: Jiri Pirko, Cong Wang, Or Gerlitz, Andy Gospodarek, PJ Waskiewicz,
Anjali Singhai Jain, Jakub Kicinski
In-Reply-To: <561205a6-101b-c86b-e77d-6ebdcf31a56d@mojatatu.com>
On 09/02/19 17:39, Jamal Hadi Salim wrote:
> On 2019-02-08 5:26 a.m., Edward Cree wrote:
>> I can't find any stats counters on
>> the "match" either in the software path or the offload API.
>
> Hasnt been necessary thus far.
> Is your end goal to match and count?
My end goal is to implement TC offload in some hw we're designing
here at Solarflare. So I'm trying to determine what hardware is
expected/required to do.
It might be possible to design our new hw so that we can attach a
counter to every action, if that's what TC wants. But since the
other vendors don't seem to do that, I wondered if there was a
reason, or if perhaps the counter resources (and PCI bw to read
them) could be saved if all those separate counters aren't really
needed. Right now the design we are considering would only count
packets as-matched, i.e. before any edits. That's fine for encap
— you can calculate the bytes correction in SW — but not for decap
since in principle the length of the RXed outer headers could
vary (e.g. you might have IP options there).
-Ed
^ permalink raw reply
* [PATCH] net: phylink: only call mac_config() during resolve when link is up
From: Russell King @ 2019-02-11 11:46 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev
There's little point calling mac_config() when the link is down.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 9b8dd0d0ee42..79af2e5c9dd5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -306,6 +306,13 @@ static void phylink_mac_config(struct phylink *pl,
pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
}
+static void phylink_mac_config_up(struct phylink *pl,
+ const struct phylink_link_state *state)
+{
+ if (state->link)
+ phylink_mac_config(pl, state);
+}
+
static void phylink_mac_an_restart(struct phylink *pl)
{
if (pl->link_config.an_enabled &&
@@ -405,12 +412,12 @@ static void phylink_resolve(struct work_struct *w)
case MLO_AN_PHY:
link_state = pl->phy_state;
phylink_resolve_flow(pl, &link_state);
- phylink_mac_config(pl, &link_state);
+ phylink_mac_config_up(pl, &link_state);
break;
case MLO_AN_FIXED:
phylink_get_fixed_state(pl, &link_state);
- phylink_mac_config(pl, &link_state);
+ phylink_mac_config_up(pl, &link_state);
break;
case MLO_AN_INBAND:
--
2.7.4
^ permalink raw reply related
* [PATCH] net: phylink: add phylink_init_eee() helper
From: Russell King @ 2019-02-11 11:46 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev
Provide phylink_init_eee() to allow MAC drivers to initialise PHY EEE
from within the ethtool set_eee() method.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 18 ++++++++++++++++++
include/linux/phylink.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 79af2e5c9dd5..81bacdb2a8ab 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1281,6 +1281,24 @@ int phylink_get_eee_err(struct phylink *pl)
EXPORT_SYMBOL_GPL(phylink_get_eee_err);
/**
+ * phylink_init_eee() - init and check the EEE features
+ * @pl: a pointer to a &struct phylink returned from phylink_create()
+ * @clk_stop_enable: allow PHY to stop receive clock
+ *
+ * Must be called either with RTNL held or within mac_link_up()
+ */
+int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
+{
+ int ret = -EOPNOTSUPP;
+
+ if (pl->phydev)
+ ret = phy_init_eee(pl->phydev, clk_stop_enable);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(phylink_init_eee);
+
+/**
* phylink_ethtool_get_eee() - read the energy efficient ethernet parameters
* @pl: a pointer to a &struct phylink returned from phylink_create()
* @eee: a pointer to a &struct ethtool_eee for the read parameters
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 021fc6595856..f57059e4353f 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -220,6 +220,7 @@ void phylink_ethtool_get_pauseparam(struct phylink *,
int phylink_ethtool_set_pauseparam(struct phylink *,
struct ethtool_pauseparam *);
int phylink_get_eee_err(struct phylink *);
+int phylink_init_eee(struct phylink *, bool);
int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
--
2.7.4
^ permalink raw reply related
* Re: [PATCH bpf-next 2/3] selftests: bpf: extend sub-register mode compilation to all bpf object files
From: Jiong Wang @ 2019-02-11 11:47 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev, oss-drivers
In-Reply-To: <20190211040412.wvulodgvz3jcnida@ast-mbp>
> On 11 Feb 2019, at 04:04, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
> On Fri, Feb 08, 2019 at 05:41:20PM +0000, Jiong Wang wrote:
>> At the moment, we only do extra sub-register mode compilation on bpf object
>> files used by "test_progs". These object files are really loaded and
>> executed.
>>
>> This patch further extends sub-register mode compilation to all bpf object
>> files, even those without corresponding runtime tests. Because this could
>> help testing LLVM sub-register code-gen, kernel bpf selftest has much more
>> C testcases with reasonable size and complexity compared with LLVM
>> testsuite which only contains unit tests.
>>
>> There were some file duplication inside BPF_OBJ_FILES_DUAL_COMPILE which
>> is removed now.
>>
>> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
>> ---
>> tools/testing/selftests/bpf/Makefile | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>> index 383d2ff..70b2570 100644
>> --- a/tools/testing/selftests/bpf/Makefile
>> +++ b/tools/testing/selftests/bpf/Makefile
>> @@ -35,20 +35,15 @@ BPF_OBJ_FILES = \
>> sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
>> get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
>> test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
>> - xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o
>> -
>> -# Objects are built with default compilation flags and with sub-register
>> -# code-gen enabled.
>> -BPF_OBJ_FILES_DUAL_COMPILE = \
>> - test_pkt_access.o test_pkt_access.o test_xdp.o test_adjust_tail.o \
>> - test_l4lb.o test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
>> + xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
>> + test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
>> + test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
>> test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
>> - test_stacktrace_map.o test_stacktrace_map.o test_stacktrace_build_id.o \
>> - test_stacktrace_build_id.o test_get_stack_rawtp.o \
>> - test_get_stack_rawtp.o test_tracepoint.o test_sk_lookup_kern.o \
>> - test_queue_map.o test_stack_map.o
>> + test_stacktrace_map.o test_stacktrace_build_id.o \
>> + test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
>> + test_stack_map.o
>>
>> -TEST_GEN_FILES = $(BPF_OBJ_FILES) $(BPF_OBJ_FILES_DUAL_COMPILE)
>> +TEST_GEN_FILES = $(BPF_OBJ_FILES)
>>
>> # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
>> # support which is the first version to contain both ALU32 and JMP32
>> @@ -58,7 +53,7 @@ SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
>> $(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
>> grep 'if w')
>
> build and test servers can be different.
> Would it make sense to use -mcpu=v3 instead of -mcpu=probe ?
Have the same thoughts initially, but was worried the situation where doing native
bpf selftest, build/test on same machine and llvm is new but kernel is old.
I think remove the runtime kernel criteria make sense if for bpf selftest, separation
between build and test server are often, for example cross-compilation are used.
Will add a new patch to make this change.
>
> Also while testing test_progs_32 fails like this:
> libbpf: failed to open ./bpf_flow.o: No such file or directory
> libbpf: failed to open ./test_spin_lock.o: No such file or directory
> test_spin_lock:bpf_prog_load errno 2
>
> Do you see the same ?
Hmm, I haven’t see the same. This is expected to happen before this patch, but should
not after. Because bpf_flow and test_spin_lock were added after the initial JMP32 patch
set.
Noticed there is patch conflict between this patch and KaFai’s latest test_sock_fields
change. Perhaps this patch hasn’t been applied successfully when doing the test on your
env?
Regards,
Jiong
^ permalink raw reply
* Re: [PATCH bpf-next 3/3] selftests: bpf: centre kernel bpf objects under new subdir "kern_progs"
From: Jiong Wang @ 2019-02-11 11:47 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev, oss-drivers
In-Reply-To: <20190211040613.kc4zp7nedue6jt4k@ast-mbp>
> On 11 Feb 2019, at 04:06, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
> On Fri, Feb 08, 2019 at 05:41:21PM +0000, Jiong Wang wrote:
>> At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES.
>> Listing them manually sometimes causing patch conflict when people are
>> adding new testcases simultaneously.
>>
>> It is better to centre all the related source files under a subdir
>> "kern_progs", then auto-generate the object file list.
>>
>> Suggested-by: Alexei Starovoitov <ast@kernel.org>
>> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
>> ---
>> tools/testing/selftests/bpf/Makefile | 26 +++++-----------------
>> .../selftests/bpf/{ => kern_progs}/bpf_flow.c | 0
>> .../selftests/bpf/{ => kern_progs}/connect4_prog.c | 0
>> .../selftests/bpf/{ => kern_progs}/connect6_prog.c | 0
>> .../selftests/bpf/{ => kern_progs}/dev_cgroup.c | 0
>
> Thanks a lot for the patch.
> A tiny bit of bikeshedding...
> 'kern_progs' feels a bit too long and awkward to type.
> May be just 'progs’ ?
Ack, will do the change in v2.
Regards,
Jiong
^ permalink raw reply
* [PATCH rdma-next 0/2] Followup changes to mlx5-next branch
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
linux-netdev
From: Leon Romanovsky <leonro@mellanox.com>
Hi,
There are two small cleanups needed after prefetch MR code was merged.
Thanks
Leon Romanovsky (2):
net/mlx5: Align ODP capability function with netdev coding style
net/mlx5: Factor out HCA capabilities functions
.../net/ethernet/mellanox/mlx5/core/main.c | 62 ++++++++++++-------
1 file changed, 39 insertions(+), 23 deletions(-)
--
2.19.1
^ permalink raw reply
* [PATCH mlx5-next 1/2] net/mlx5: Align ODP capability function with netdev coding style
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
linux-netdev
In-Reply-To: <20190211115608.22677-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Update newly introduced function to be aligned to netdev coding style.
Fixes: 46861e3e88be ("net/mlx5: Set ODP SRQ support in firmware")
Reported-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index e38aa206ab6d..6d45518edbdc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -461,9 +461,9 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
{
- void *set_ctx;
void *set_hca_cap;
- int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
+ void *set_ctx;
+ int set_sz;
int err;
if (!MLX5_CAP_GEN(dev, pg))
@@ -473,15 +473,12 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
if (err)
return err;
- /**
- * If all bits are cleared we shouldn't try to set it
- * or we might fail while trying to access a reserved bit.
- */
if (!(MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive) ||
MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive) ||
MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)))
return 0;
+ set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
set_ctx = kzalloc(set_sz, GFP_KERNEL);
if (!set_ctx)
return -ENOMEM;
@@ -492,13 +489,13 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
/* set ODP SRQ support for RC/UD and XRC transports */
MLX5_SET(odp_cap, set_hca_cap, ud_odp_caps.srq_receive,
- (MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive)));
+ MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive));
MLX5_SET(odp_cap, set_hca_cap, rc_odp_caps.srq_receive,
- (MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive)));
+ MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive));
MLX5_SET(odp_cap, set_hca_cap, xrc_odp_caps.srq_receive,
- (MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)));
+ MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive));
err = set_caps(dev, set_ctx, set_sz, MLX5_SET_HCA_CAP_OP_MOD_ODP);
--
2.19.1
^ permalink raw reply related
* [PATCH mlx5-next 2/2] net/mlx5: Factor out HCA capabilities functions
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
linux-netdev
In-Reply-To: <20190211115608.22677-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Combine all HCA capabilities setters under one function
and compile out the ODP related function in case kernel
was compiled without ODP support.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/main.c | 47 +++++++++++++------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 6d45518edbdc..d7145ab6105d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -459,6 +459,7 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
return err;
}
+#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
{
void *set_hca_cap;
@@ -502,6 +503,7 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
kfree(set_ctx);
return err;
}
+#endif
static int handle_hca_cap(struct mlx5_core_dev *dev)
{
@@ -576,6 +578,35 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
return err;
}
+static int set_hca_cap(struct mlx5_core_dev *dev)
+{
+ struct pci_dev *pdev = dev->pdev;
+ int err;
+
+ err = handle_hca_cap(dev);
+ if (err) {
+ dev_err(&pdev->dev, "handle_hca_cap failed\n");
+ goto out;
+ }
+
+ err = handle_hca_cap_atomic(dev);
+ if (err) {
+ dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n");
+ goto out;
+ }
+
+#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
+ err = handle_hca_cap_odp(dev);
+ if (err) {
+ dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
+ goto out;
+ }
+#endif
+
+out:
+ return err;
+}
+
static int set_hca_ctrl(struct mlx5_core_dev *dev)
{
struct mlx5_reg_host_endianness he_in;
@@ -963,21 +994,9 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto reclaim_boot_pages;
}
- err = handle_hca_cap(dev);
+ err = set_hca_cap(dev);
if (err) {
- dev_err(&pdev->dev, "handle_hca_cap failed\n");
- goto reclaim_boot_pages;
- }
-
- err = handle_hca_cap_atomic(dev);
- if (err) {
- dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n");
- goto reclaim_boot_pages;
- }
-
- err = handle_hca_cap_odp(dev);
- if (err) {
- dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
+ dev_err(&pdev->dev, "set_hca_cap failed\n");
goto reclaim_boot_pages;
}
--
2.19.1
^ permalink raw reply related
* [PATCH bpf-next v2 1/4] selftests: bpf: add "alu32" to .gitignore
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>
"alu32" is a build dir and contains various files for BPF sub-register
code-gen testing.
This patch tells git to ignore it.
Suggested-by: Yonghong Song <yhs@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index dd093bd..e47168d 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -29,3 +29,4 @@ test_netcnt
test_section_names
test_tcpnotify_user
test_libbpf
+alu32
--
2.7.4
^ permalink raw reply related
* [PATCH bpf-next v2 0/4] selftests: bpf: improve bpf object file rules
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
This set improves bpf object file related rules in selftests Makefile.
- tell git to ignore the build dir "alu32".
- extend sub-register mode compilation to all bpf object files to give
LLVM compiler bpf back-end more exercise.
- auto-generate bpf kernel object file list.
- relax sub-register mode compilation criteria.
v1 -> v2:
- rename "kern_progs" to "progs". (Alexei)
- spin a new patch to remove build server kernel requirement for
sub-register mode compilation (Alexei)
- rebase on top of KaFai’s latest "test_sock_fields" patch set.
Jiong Wang (4):
selftests: bpf: add "alu32" to .gitignore
selftests: bpf: extend sub-register mode compilation to all bpf object
files
selftests: bpf: centre kernel bpf objects under new subdir "progs"
selftests: bpf: relax sub-register mode compilation criteria
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/Makefile | 45 ++++++----------------
tools/testing/selftests/bpf/{ => progs}/bpf_flow.c | 0
.../selftests/bpf/{ => progs}/connect4_prog.c | 0
.../selftests/bpf/{ => progs}/connect6_prog.c | 0
.../testing/selftests/bpf/{ => progs}/dev_cgroup.c | 0
.../selftests/bpf/{ => progs}/get_cgroup_id_kern.c | 0
.../selftests/bpf/{ => progs}/netcnt_prog.c | 0
.../selftests/bpf/{ => progs}/sample_map_ret0.c | 0
.../selftests/bpf/{ => progs}/sample_ret0.c | 0
.../selftests/bpf/{ => progs}/sendmsg4_prog.c | 0
.../selftests/bpf/{ => progs}/sendmsg6_prog.c | 0
.../selftests/bpf/{ => progs}/socket_cookie_prog.c | 0
.../selftests/bpf/{ => progs}/sockmap_parse_prog.c | 0
.../bpf/{ => progs}/sockmap_tcp_msg_prog.c | 0
.../bpf/{ => progs}/sockmap_verdict_prog.c | 0
.../selftests/bpf/{ => progs}/test_adjust_tail.c | 0
.../selftests/bpf/{ => progs}/test_btf_haskv.c | 0
.../selftests/bpf/{ => progs}/test_btf_nokv.c | 0
.../bpf/{ => progs}/test_get_stack_rawtp.c | 0
.../testing/selftests/bpf/{ => progs}/test_l4lb.c | 0
.../selftests/bpf/{ => progs}/test_l4lb_noinline.c | 0
.../bpf/{ => progs}/test_lirc_mode2_kern.c | 0
.../selftests/bpf/{ => progs}/test_lwt_seg6local.c | 0
.../selftests/bpf/{ => progs}/test_map_in_map.c | 0
.../selftests/bpf/{ => progs}/test_map_lock.c | 0
.../selftests/bpf/{ => progs}/test_obj_id.c | 0
.../selftests/bpf/{ => progs}/test_pkt_access.c | 0
.../selftests/bpf/{ => progs}/test_pkt_md_access.c | 0
.../selftests/bpf/{ => progs}/test_queue_map.c | 0
.../bpf/{ => progs}/test_select_reuseport_kern.c | 0
.../bpf/{ => progs}/test_sk_lookup_kern.c | 0
.../bpf/{ => progs}/test_skb_cgroup_id_kern.c | 0
.../bpf/{ => progs}/test_sock_fields_kern.c | 0
.../selftests/bpf/{ => progs}/test_sockhash_kern.c | 0
.../selftests/bpf/{ => progs}/test_sockmap_kern.c | 0
.../selftests/bpf/{ => progs}/test_spin_lock.c | 0
.../selftests/bpf/{ => progs}/test_stack_map.c | 0
.../bpf/{ => progs}/test_stacktrace_build_id.c | 0
.../bpf/{ => progs}/test_stacktrace_map.c | 0
.../selftests/bpf/{ => progs}/test_tcp_estats.c | 0
.../selftests/bpf/{ => progs}/test_tcpbpf_kern.c | 0
.../bpf/{ => progs}/test_tcpnotify_kern.c | 0
.../selftests/bpf/{ => progs}/test_tracepoint.c | 0
.../selftests/bpf/{ => progs}/test_tunnel_kern.c | 0
tools/testing/selftests/bpf/{ => progs}/test_xdp.c | 0
.../selftests/bpf/{ => progs}/test_xdp_meta.c | 0
.../selftests/bpf/{ => progs}/test_xdp_noinline.c | 0
.../selftests/bpf/{ => progs}/test_xdp_redirect.c | 0
.../selftests/bpf/{ => progs}/test_xdp_vlan.c | 0
.../testing/selftests/bpf/{ => progs}/xdp_dummy.c | 0
51 files changed, 12 insertions(+), 34 deletions(-)
rename tools/testing/selftests/bpf/{ => progs}/bpf_flow.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/connect4_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/connect6_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/dev_cgroup.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/get_cgroup_id_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/netcnt_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sample_map_ret0.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sample_ret0.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sendmsg4_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sendmsg6_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/socket_cookie_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_parse_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_tcp_msg_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_verdict_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_adjust_tail.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_btf_haskv.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_btf_nokv.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_get_stack_rawtp.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_l4lb.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_l4lb_noinline.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_lirc_mode2_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_lwt_seg6local.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_map_in_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_map_lock.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_obj_id.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_pkt_access.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_pkt_md_access.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_queue_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_select_reuseport_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sk_lookup_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_skb_cgroup_id_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sock_fields_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sockhash_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sockmap_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_spin_lock.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stack_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_build_id.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcp_estats.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcpbpf_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcpnotify_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tracepoint.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tunnel_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_meta.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_noinline.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_redirect.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_vlan.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/xdp_dummy.c (100%)
--
2.7.4
^ permalink raw reply
* [PATCH bpf-next v2 2/4] selftests: bpf: extend sub-register mode compilation to all bpf object files
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>
At the moment, we only do extra sub-register mode compilation on bpf object
files used by "test_progs". These object files are really loaded and
executed.
This patch further extends sub-register mode compilation to all bpf object
files, even those without corresponding runtime tests. Because this could
help testing LLVM sub-register code-gen, kernel bpf selftest has much more
C testcases with reasonable size and complexity compared with LLVM
testsuite which only contains unit tests.
There were some file duplication inside BPF_OBJ_FILES_DUAL_COMPILE which
is removed now.
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/Makefile | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c7e1e32..f2c1147 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -36,20 +36,14 @@ BPF_OBJ_FILES = \
get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
- test_sock_fields_kern.o
-
-# Objects are built with default compilation flags and with sub-register
-# code-gen enabled.
-BPF_OBJ_FILES_DUAL_COMPILE = \
- test_pkt_access.o test_pkt_access.o test_xdp.o test_adjust_tail.o \
- test_l4lb.o test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
+ test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
+ test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
- test_stacktrace_map.o test_stacktrace_map.o test_stacktrace_build_id.o \
- test_stacktrace_build_id.o test_get_stack_rawtp.o \
- test_get_stack_rawtp.o test_tracepoint.o test_sk_lookup_kern.o \
- test_queue_map.o test_stack_map.o
+ test_stacktrace_map.o test_stacktrace_build_id.o \
+ test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
+ test_stack_map.o test_sock_fields_kern.o
-TEST_GEN_FILES = $(BPF_OBJ_FILES) $(BPF_OBJ_FILES_DUAL_COMPILE)
+TEST_GEN_FILES = $(BPF_OBJ_FILES)
# Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
# support which is the first version to contain both ALU32 and JMP32
@@ -59,7 +53,7 @@ SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
$(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
grep 'if w')
ifneq ($(SUBREG_CODEGEN),)
-TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES_DUAL_COMPILE))
+TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES))
endif
# Order correspond to 'make run_tests' order
--
2.7.4
^ permalink raw reply related
* [PATCH bpf-next v2 3/4] selftests: bpf: centre kernel bpf objects under new subdir "progs"
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>
At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES.
Listing them manually sometimes causing patch conflict when people are
adding new testcases simultaneously.
It is better to centre all the related source files under a subdir
"progs", then auto-generate the object file list.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/Makefile | 26 +++++-----------------
tools/testing/selftests/bpf/{ => progs}/bpf_flow.c | 0
.../selftests/bpf/{ => progs}/connect4_prog.c | 0
.../selftests/bpf/{ => progs}/connect6_prog.c | 0
.../testing/selftests/bpf/{ => progs}/dev_cgroup.c | 0
.../selftests/bpf/{ => progs}/get_cgroup_id_kern.c | 0
.../selftests/bpf/{ => progs}/netcnt_prog.c | 0
.../selftests/bpf/{ => progs}/sample_map_ret0.c | 0
.../selftests/bpf/{ => progs}/sample_ret0.c | 0
.../selftests/bpf/{ => progs}/sendmsg4_prog.c | 0
.../selftests/bpf/{ => progs}/sendmsg6_prog.c | 0
.../selftests/bpf/{ => progs}/socket_cookie_prog.c | 0
.../selftests/bpf/{ => progs}/sockmap_parse_prog.c | 0
.../bpf/{ => progs}/sockmap_tcp_msg_prog.c | 0
.../bpf/{ => progs}/sockmap_verdict_prog.c | 0
.../selftests/bpf/{ => progs}/test_adjust_tail.c | 0
.../selftests/bpf/{ => progs}/test_btf_haskv.c | 0
.../selftests/bpf/{ => progs}/test_btf_nokv.c | 0
.../bpf/{ => progs}/test_get_stack_rawtp.c | 0
.../testing/selftests/bpf/{ => progs}/test_l4lb.c | 0
.../selftests/bpf/{ => progs}/test_l4lb_noinline.c | 0
.../bpf/{ => progs}/test_lirc_mode2_kern.c | 0
.../selftests/bpf/{ => progs}/test_lwt_seg6local.c | 0
.../selftests/bpf/{ => progs}/test_map_in_map.c | 0
.../selftests/bpf/{ => progs}/test_map_lock.c | 0
.../selftests/bpf/{ => progs}/test_obj_id.c | 0
.../selftests/bpf/{ => progs}/test_pkt_access.c | 0
.../selftests/bpf/{ => progs}/test_pkt_md_access.c | 0
.../selftests/bpf/{ => progs}/test_queue_map.c | 0
.../bpf/{ => progs}/test_select_reuseport_kern.c | 0
.../bpf/{ => progs}/test_sk_lookup_kern.c | 0
.../bpf/{ => progs}/test_skb_cgroup_id_kern.c | 0
.../bpf/{ => progs}/test_sock_fields_kern.c | 0
.../selftests/bpf/{ => progs}/test_sockhash_kern.c | 0
.../selftests/bpf/{ => progs}/test_sockmap_kern.c | 0
.../selftests/bpf/{ => progs}/test_spin_lock.c | 0
.../selftests/bpf/{ => progs}/test_stack_map.c | 0
.../bpf/{ => progs}/test_stacktrace_build_id.c | 0
.../bpf/{ => progs}/test_stacktrace_map.c | 0
.../selftests/bpf/{ => progs}/test_tcp_estats.c | 0
.../selftests/bpf/{ => progs}/test_tcpbpf_kern.c | 0
.../bpf/{ => progs}/test_tcpnotify_kern.c | 0
.../selftests/bpf/{ => progs}/test_tracepoint.c | 0
.../selftests/bpf/{ => progs}/test_tunnel_kern.c | 0
tools/testing/selftests/bpf/{ => progs}/test_xdp.c | 0
.../selftests/bpf/{ => progs}/test_xdp_meta.c | 0
.../selftests/bpf/{ => progs}/test_xdp_noinline.c | 0
.../selftests/bpf/{ => progs}/test_xdp_redirect.c | 0
.../selftests/bpf/{ => progs}/test_xdp_vlan.c | 0
.../testing/selftests/bpf/{ => progs}/xdp_dummy.c | 0
50 files changed, 5 insertions(+), 21 deletions(-)
rename tools/testing/selftests/bpf/{ => progs}/bpf_flow.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/connect4_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/connect6_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/dev_cgroup.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/get_cgroup_id_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/netcnt_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sample_map_ret0.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sample_ret0.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sendmsg4_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sendmsg6_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/socket_cookie_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_parse_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_tcp_msg_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/sockmap_verdict_prog.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_adjust_tail.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_btf_haskv.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_btf_nokv.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_get_stack_rawtp.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_l4lb.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_l4lb_noinline.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_lirc_mode2_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_lwt_seg6local.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_map_in_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_map_lock.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_obj_id.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_pkt_access.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_pkt_md_access.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_queue_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_select_reuseport_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sk_lookup_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_skb_cgroup_id_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sock_fields_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sockhash_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_sockmap_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_spin_lock.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stack_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_build_id.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_map.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcp_estats.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcpbpf_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tcpnotify_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tracepoint.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_tunnel_kern.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_meta.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_noinline.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_redirect.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/test_xdp_vlan.c (100%)
rename tools/testing/selftests/bpf/{ => progs}/xdp_dummy.c (100%)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index f2c1147..575746e 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -25,24 +25,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
test_netcnt test_tcpnotify_user test_sock_fields
-BPF_OBJ_FILES = \
- test_xdp_redirect.o test_xdp_meta.o sockmap_parse_prog.o \
- sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o \
- test_tcpnotify_kern.o sample_map_ret0.o test_tcpbpf_kern.o \
- sockmap_tcp_msg_prog.o connect4_prog.o connect6_prog.o \
- test_btf_haskv.o test_btf_nokv.o test_sockmap_kern.o \
- test_tunnel_kern.o test_sockhash_kern.o test_lwt_seg6local.o \
- sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
- get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
- test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
- xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
- test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
- test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
- test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
- test_stacktrace_map.o test_stacktrace_build_id.o \
- test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
- test_stack_map.o test_sock_fields_kern.o
-
+BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
TEST_GEN_FILES = $(BPF_OBJ_FILES)
# Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
@@ -184,7 +167,8 @@ $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \
$(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \
trace_helpers.c $(OUTPUT)/libbpf.a $(LDLIBS)
-$(ALU32_BUILD_DIR)/%.o: %.c $(ALU32_BUILD_DIR) $(ALU32_BUILD_DIR)/test_progs_32
+$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
+ $(ALU32_BUILD_DIR)/test_progs_32
$(CLANG) $(CLANG_FLAGS) \
-O2 -target bpf -emit-llvm -c $< -o - | \
$(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \
@@ -196,7 +180,7 @@ endif
# Have one program compiled without "-target bpf" to test whether libbpf loads
# it successfully
-$(OUTPUT)/test_xdp.o: test_xdp.c
+$(OUTPUT)/test_xdp.o: progs/test_xdp.c
$(CLANG) $(CLANG_FLAGS) \
-O2 -emit-llvm -c $< -o - | \
$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
@@ -204,7 +188,7 @@ ifeq ($(DWARF2BTF),y)
$(BTF_PAHOLE) -J $@
endif
-$(OUTPUT)/%.o: %.c
+$(OUTPUT)/%.o: progs/%.c
$(CLANG) $(CLANG_FLAGS) \
-O2 -target bpf -emit-llvm -c $< -o - | \
$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
diff --git a/tools/testing/selftests/bpf/bpf_flow.c b/tools/testing/selftests/bpf/progs/bpf_flow.c
similarity index 100%
rename from tools/testing/selftests/bpf/bpf_flow.c
rename to tools/testing/selftests/bpf/progs/bpf_flow.c
diff --git a/tools/testing/selftests/bpf/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect4_prog.c
rename to tools/testing/selftests/bpf/progs/connect4_prog.c
diff --git a/tools/testing/selftests/bpf/connect6_prog.c b/tools/testing/selftests/bpf/progs/connect6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect6_prog.c
rename to tools/testing/selftests/bpf/progs/connect6_prog.c
diff --git a/tools/testing/selftests/bpf/dev_cgroup.c b/tools/testing/selftests/bpf/progs/dev_cgroup.c
similarity index 100%
rename from tools/testing/selftests/bpf/dev_cgroup.c
rename to tools/testing/selftests/bpf/progs/dev_cgroup.c
diff --git a/tools/testing/selftests/bpf/get_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/get_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/netcnt_prog.c b/tools/testing/selftests/bpf/progs/netcnt_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/netcnt_prog.c
rename to tools/testing/selftests/bpf/progs/netcnt_prog.c
diff --git a/tools/testing/selftests/bpf/sample_map_ret0.c b/tools/testing/selftests/bpf/progs/sample_map_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_map_ret0.c
rename to tools/testing/selftests/bpf/progs/sample_map_ret0.c
diff --git a/tools/testing/selftests/bpf/sample_ret0.c b/tools/testing/selftests/bpf/progs/sample_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_ret0.c
rename to tools/testing/selftests/bpf/progs/sample_ret0.c
diff --git a/tools/testing/selftests/bpf/sendmsg4_prog.c b/tools/testing/selftests/bpf/progs/sendmsg4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg4_prog.c
rename to tools/testing/selftests/bpf/progs/sendmsg4_prog.c
diff --git a/tools/testing/selftests/bpf/sendmsg6_prog.c b/tools/testing/selftests/bpf/progs/sendmsg6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg6_prog.c
rename to tools/testing/selftests/bpf/progs/sendmsg6_prog.c
diff --git a/tools/testing/selftests/bpf/socket_cookie_prog.c b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/socket_cookie_prog.c
rename to tools/testing/selftests/bpf/progs/socket_cookie_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_parse_prog.c b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_parse_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_verdict_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c
diff --git a/tools/testing/selftests/bpf/test_adjust_tail.c b/tools/testing/selftests/bpf/progs/test_adjust_tail.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_adjust_tail.c
rename to tools/testing/selftests/bpf/progs/test_adjust_tail.c
diff --git a/tools/testing/selftests/bpf/test_btf_haskv.c b/tools/testing/selftests/bpf/progs/test_btf_haskv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_haskv.c
rename to tools/testing/selftests/bpf/progs/test_btf_haskv.c
diff --git a/tools/testing/selftests/bpf/test_btf_nokv.c b/tools/testing/selftests/bpf/progs/test_btf_nokv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_nokv.c
rename to tools/testing/selftests/bpf/progs/test_btf_nokv.c
diff --git a/tools/testing/selftests/bpf/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_get_stack_rawtp.c
rename to tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c
diff --git a/tools/testing/selftests/bpf/test_l4lb.c b/tools/testing/selftests/bpf/progs/test_l4lb.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb.c
rename to tools/testing/selftests/bpf/progs/test_l4lb.c
diff --git a/tools/testing/selftests/bpf/test_l4lb_noinline.c b/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb_noinline.c
rename to tools/testing/selftests/bpf/progs/test_l4lb_noinline.c
diff --git a/tools/testing/selftests/bpf/test_lirc_mode2_kern.c b/tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lirc_mode2_kern.c
rename to tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c
diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.c b/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lwt_seg6local.c
rename to tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
diff --git a/tools/testing/selftests/bpf/test_map_in_map.c b/tools/testing/selftests/bpf/progs/test_map_in_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_in_map.c
rename to tools/testing/selftests/bpf/progs/test_map_in_map.c
diff --git a/tools/testing/selftests/bpf/test_map_lock.c b/tools/testing/selftests/bpf/progs/test_map_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_lock.c
rename to tools/testing/selftests/bpf/progs/test_map_lock.c
diff --git a/tools/testing/selftests/bpf/test_obj_id.c b/tools/testing/selftests/bpf/progs/test_obj_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_obj_id.c
rename to tools/testing/selftests/bpf/progs/test_obj_id.c
diff --git a/tools/testing/selftests/bpf/test_pkt_access.c b/tools/testing/selftests/bpf/progs/test_pkt_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_access.c
rename to tools/testing/selftests/bpf/progs/test_pkt_access.c
diff --git a/tools/testing/selftests/bpf/test_pkt_md_access.c b/tools/testing/selftests/bpf/progs/test_pkt_md_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_md_access.c
rename to tools/testing/selftests/bpf/progs/test_pkt_md_access.c
diff --git a/tools/testing/selftests/bpf/test_queue_map.c b/tools/testing/selftests/bpf/progs/test_queue_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_queue_map.c
rename to tools/testing/selftests/bpf/progs/test_queue_map.c
diff --git a/tools/testing/selftests/bpf/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_select_reuseport_kern.c
rename to tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
diff --git a/tools/testing/selftests/bpf/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sk_lookup_kern.c
rename to tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
diff --git a/tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/test_sock_fields_kern.c b/tools/testing/selftests/bpf/progs/test_sock_fields_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sock_fields_kern.c
rename to tools/testing/selftests/bpf/progs/test_sock_fields_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockhash_kern.c b/tools/testing/selftests/bpf/progs/test_sockhash_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockhash_kern.c
rename to tools/testing/selftests/bpf/progs/test_sockhash_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockmap_kern.c b/tools/testing/selftests/bpf/progs/test_sockmap_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockmap_kern.c
rename to tools/testing/selftests/bpf/progs/test_sockmap_kern.c
diff --git a/tools/testing/selftests/bpf/test_spin_lock.c b/tools/testing/selftests/bpf/progs/test_spin_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_spin_lock.c
rename to tools/testing/selftests/bpf/progs/test_spin_lock.c
diff --git a/tools/testing/selftests/bpf/test_stack_map.c b/tools/testing/selftests/bpf/progs/test_stack_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stack_map.c
rename to tools/testing/selftests/bpf/progs/test_stack_map.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_build_id.c b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_build_id.c
rename to tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_map.c b/tools/testing/selftests/bpf/progs/test_stacktrace_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_map.c
rename to tools/testing/selftests/bpf/progs/test_stacktrace_map.c
diff --git a/tools/testing/selftests/bpf/test_tcp_estats.c b/tools/testing/selftests/bpf/progs/test_tcp_estats.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcp_estats.c
rename to tools/testing/selftests/bpf/progs/test_tcp_estats.c
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpbpf_kern.c
rename to tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpnotify_kern.c
rename to tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
diff --git a/tools/testing/selftests/bpf/test_tracepoint.c b/tools/testing/selftests/bpf/progs/test_tracepoint.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tracepoint.c
rename to tools/testing/selftests/bpf/progs/test_tracepoint.c
diff --git a/tools/testing/selftests/bpf/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tunnel_kern.c
rename to tools/testing/selftests/bpf/progs/test_tunnel_kern.c
diff --git a/tools/testing/selftests/bpf/test_xdp.c b/tools/testing/selftests/bpf/progs/test_xdp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp.c
rename to tools/testing/selftests/bpf/progs/test_xdp.c
diff --git a/tools/testing/selftests/bpf/test_xdp_meta.c b/tools/testing/selftests/bpf/progs/test_xdp_meta.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_meta.c
rename to tools/testing/selftests/bpf/progs/test_xdp_meta.c
diff --git a/tools/testing/selftests/bpf/test_xdp_noinline.c b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_noinline.c
rename to tools/testing/selftests/bpf/progs/test_xdp_noinline.c
diff --git a/tools/testing/selftests/bpf/test_xdp_redirect.c b/tools/testing/selftests/bpf/progs/test_xdp_redirect.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_redirect.c
rename to tools/testing/selftests/bpf/progs/test_xdp_redirect.c
diff --git a/tools/testing/selftests/bpf/test_xdp_vlan.c b/tools/testing/selftests/bpf/progs/test_xdp_vlan.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_vlan.c
rename to tools/testing/selftests/bpf/progs/test_xdp_vlan.c
diff --git a/tools/testing/selftests/bpf/xdp_dummy.c b/tools/testing/selftests/bpf/progs/xdp_dummy.c
similarity index 100%
rename from tools/testing/selftests/bpf/xdp_dummy.c
rename to tools/testing/selftests/bpf/progs/xdp_dummy.c
--
2.7.4
^ permalink raw reply related
* [PATCH bpf-next v2 4/4] selftests: bpf: relax sub-register mode compilation criteria
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>
Sub-register mode compilation was enabled only when there are eBPF "v3"
processor supports at both compilation time inside LLVM and runtime inside
kernel.
Given separation betwen build and test server could be often, this patch
removes the runtime support criteria.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 575746e..c3edf47 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -28,12 +28,11 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
TEST_GEN_FILES = $(BPF_OBJ_FILES)
-# Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
-# support which is the first version to contain both ALU32 and JMP32
-# instructions.
+# Also test sub-register code-gen if LLVM has eBPF v3 processor support which
+# contains both ALU32 and JMP32 instructions.
SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
$(CLANG) -target bpf -O2 -emit-llvm -S -x c - -o - | \
- $(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
+ $(LLC) -mattr=+alu32 -mcpu=v3 2>&1 | \
grep 'if w')
ifneq ($(SUBREG_CODEGEN),)
TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES))
--
2.7.4
^ 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