* [PATCH v9 08/10] net: stmmac: snps,dwmac-mdio MDIOs are automatically registered
From: Corentin Labbe @ 2017-10-24 17:57 UTC (permalink / raw)
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
linux-I+IVW8TIWO2tmTQ+vhA3Yw, catalin.marinas-5wv7dgnIgG8,
will.deacon-5wv7dgnIgG8, peppe.cavallaro-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o, andrew-g2DYL2Zd6BY,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Corentin Labbe
In-Reply-To: <20171024175714.15840-1-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
stmmac bindings docs said that its mdio node must have
compatible = "snps,dwmac-mdio";
Since dwmac-sun8i does not have any good reasons to not doing it, all
their MDIO node must have it.
Since these compatible is automatically registered, dwmac-sun8i compatible
does not need to be in need_mdio_ids.
Signed-off-by: Corentin Labbe <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 8a280b48e3a9..9e616da0745d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -311,10 +311,6 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
bool mdio = true;
static const struct of_device_id need_mdio_ids[] = {
{ .compatible = "snps,dwc-qos-ethernet-4.10" },
- { .compatible = "allwinner,sun8i-a83t-emac" },
- { .compatible = "allwinner,sun8i-h3-emac" },
- { .compatible = "allwinner,sun8i-v3s-emac" },
- { .compatible = "allwinner,sun50i-a64-emac" },
{},
};
--
2.13.6
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v9 09/10] net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs
From: Corentin Labbe @ 2017-10-24 17:57 UTC (permalink / raw)
To: robh+dt, mark.rutland, maxime.ripard, wens, linux,
catalin.marinas, will.deacon, peppe.cavallaro, alexandre.torgue,
andrew, f.fainelli
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
Corentin Labbe
In-Reply-To: <20171024175714.15840-1-clabbe.montjoie@gmail.com>
The Allwinner H3 SoC have two distinct MDIO bus, only one could be
active at the same time.
The selection of the active MDIO bus are done via some bits in the EMAC
register of the system controller.
This patch implement this MDIO switch via a custom MDIO-mux.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 353 ++++++++++++++--------
2 files changed, 224 insertions(+), 130 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 97035766c291..e28c0d2c58e9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -159,6 +159,7 @@ config DWMAC_SUN8I
tristate "Allwinner sun8i GMAC support"
default ARCH_SUNXI
depends on OF && (ARCH_SUNXI || COMPILE_TEST)
+ select MDIO_BUS_MUX
---help---
Support for Allwinner H3 A83T A64 EMAC ethernet controllers.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 39c2122a4f26..b3eb344bb158 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/iopoll.h>
+#include <linux/mdio-mux.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_device.h>
@@ -41,14 +42,14 @@
* This value is used for disabling properly EMAC
* and used as a good starting value in case of the
* boot process(uboot) leave some stuff.
- * @internal_phy: Does the MAC embed an internal PHY
+ * @soc_has_internal_phy: Does the MAC embed an internal PHY
* @support_mii: Does the MAC handle MII
* @support_rmii: Does the MAC handle RMII
* @support_rgmii: Does the MAC handle RGMII
*/
struct emac_variant {
u32 default_syscon_value;
- int internal_phy;
+ bool soc_has_internal_phy;
bool support_mii;
bool support_rmii;
bool support_rgmii;
@@ -61,7 +62,8 @@ struct emac_variant {
* @rst_ephy: reference to the optional EPHY reset for the internal PHY
* @variant: reference to the current board variant
* @regmap: regmap for using the syscon
- * @use_internal_phy: Does the current PHY choice imply using the internal PHY
+ * @internal_phy_powered: Does the internal PHY is enabled
+ * @mux_handle: Internal pointer used by mdio-mux lib
*/
struct sunxi_priv_data {
struct clk *tx_clk;
@@ -70,12 +72,13 @@ struct sunxi_priv_data {
struct reset_control *rst_ephy;
const struct emac_variant *variant;
struct regmap *regmap;
- bool use_internal_phy;
+ bool internal_phy_powered;
+ void *mux_handle;
};
static const struct emac_variant emac_variant_h3 = {
.default_syscon_value = 0x58000,
- .internal_phy = PHY_INTERFACE_MODE_MII,
+ .soc_has_internal_phy = true,
.support_mii = true,
.support_rmii = true,
.support_rgmii = true
@@ -83,20 +86,20 @@ static const struct emac_variant emac_variant_h3 = {
static const struct emac_variant emac_variant_v3s = {
.default_syscon_value = 0x38000,
- .internal_phy = PHY_INTERFACE_MODE_MII,
+ .soc_has_internal_phy = true,
.support_mii = true
};
static const struct emac_variant emac_variant_a83t = {
.default_syscon_value = 0,
- .internal_phy = 0,
+ .soc_has_internal_phy = false,
.support_mii = true,
.support_rgmii = true
};
static const struct emac_variant emac_variant_a64 = {
.default_syscon_value = 0,
- .internal_phy = 0,
+ .soc_has_internal_phy = false,
.support_mii = true,
.support_rmii = true,
.support_rgmii = true
@@ -195,6 +198,9 @@ static const struct emac_variant emac_variant_a64 = {
#define H3_EPHY_LED_POL BIT(17) /* 1: active low, 0: active high */
#define H3_EPHY_SHUTDOWN BIT(16) /* 1: shutdown, 0: power up */
#define H3_EPHY_SELECT BIT(15) /* 1: internal PHY, 0: external PHY */
+#define H3_EPHY_MUX_MASK (H3_EPHY_SHUTDOWN | H3_EPHY_SELECT)
+#define DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID 1
+#define DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID 2
/* H3/A64 specific bits */
#define SYSCON_RMII_EN BIT(13) /* 1: enable RMII (overrides EPIT) */
@@ -634,6 +640,159 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv)
return 0;
}
+/* Search in mdio-mux node for internal PHY node and get its clk/reset */
+static int get_ephy_nodes(struct stmmac_priv *priv)
+{
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+ struct device_node *mdio_mux, *iphynode;
+ struct device_node *mdio_internal;
+ int ret;
+
+ mdio_mux = of_get_child_by_name(priv->device->of_node, "mdio-mux");
+ if (!mdio_mux) {
+ dev_err(priv->device, "Cannot get mdio-mux node\n");
+ return -ENODEV;
+ }
+
+ mdio_internal = of_find_compatible_node(mdio_mux, NULL,
+ "allwinner,sun8i-h3-mdio-internal");
+ if (!mdio_internal) {
+ dev_err(priv->device, "Cannot get internal_mdio node\n");
+ return -ENODEV;
+ }
+
+ /* Seek for internal PHY */
+ for_each_child_of_node(mdio_internal, iphynode) {
+ gmac->ephy_clk = of_clk_get(iphynode, 0);
+ if (IS_ERR(gmac->ephy_clk))
+ continue;
+ gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL);
+ if (IS_ERR(gmac->rst_ephy)) {
+ ret = PTR_ERR(gmac->rst_ephy);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+ continue;
+ }
+ dev_info(priv->device, "Found internal PHY node\n");
+ return 0;
+ }
+ return -ENODEV;
+}
+
+static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv)
+{
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+ int ret;
+
+ if (gmac->internal_phy_powered) {
+ dev_warn(priv->device, "Internal PHY already powered\n");
+ return 0;
+ }
+
+ dev_info(priv->device, "Powering internal PHY\n");
+ ret = clk_prepare_enable(gmac->ephy_clk);
+ if (ret) {
+ dev_err(priv->device, "Cannot enable internal PHY\n");
+ return ret;
+ }
+
+ /* Make sure the EPHY is properly reseted, as U-Boot may leave
+ * it at deasserted state, and thus it may fail to reset EMAC.
+ */
+ reset_control_assert(gmac->rst_ephy);
+
+ ret = reset_control_deassert(gmac->rst_ephy);
+ if (ret) {
+ dev_err(priv->device, "Cannot deassert internal phy\n");
+ clk_disable_unprepare(gmac->ephy_clk);
+ return ret;
+ }
+
+ gmac->internal_phy_powered = true;
+
+ return 0;
+}
+
+static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
+{
+ if (!gmac->internal_phy_powered)
+ return 0;
+
+ clk_disable_unprepare(gmac->ephy_clk);
+ reset_control_assert(gmac->rst_ephy);
+ gmac->internal_phy_powered = false;
+ return 0;
+}
+
+/* MDIO multiplexing switch function
+ * This function is called by the mdio-mux layer when it thinks the mdio bus
+ * multiplexer needs to switch.
+ * 'current_child' is the current value of the mux register
+ * 'desired_child' is the value of the 'reg' property of the target child MDIO
+ * node.
+ * The first time this function is called, current_child == -1.
+ * If current_child == desired_child, then the mux is already set to the
+ * correct bus.
+ */
+static int mdio_mux_syscon_switch_fn(int current_child, int desired_child,
+ void *data)
+{
+ struct stmmac_priv *priv = data;
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+ u32 reg, val;
+ int ret = 0;
+ bool need_power_ephy = false;
+
+ if (current_child ^ desired_child) {
+ regmap_read(gmac->regmap, SYSCON_EMAC_REG, ®);
+ switch (desired_child) {
+ case DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID:
+ dev_info(priv->device, "Switch mux to internal PHY");
+ val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT;
+
+ need_power_ephy = true;
+ break;
+ case DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID:
+ dev_info(priv->device, "Switch mux to external PHY");
+ val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SHUTDOWN;
+ need_power_ephy = false;
+ break;
+ default:
+ dev_err(priv->device, "Invalid child ID %x\n",
+ desired_child);
+ return -EINVAL;
+ }
+ regmap_write(gmac->regmap, SYSCON_EMAC_REG, val);
+ if (need_power_ephy) {
+ ret = sun8i_dwmac_power_internal_phy(priv);
+ if (ret)
+ return ret;
+ } else {
+ sun8i_dwmac_unpower_internal_phy(gmac);
+ }
+ /* After changing syscon value, the MAC need reset or it will
+ * use the last value (and so the last PHY set).
+ */
+ ret = sun8i_dwmac_reset(priv);
+ }
+ return ret;
+}
+
+static int sun8i_dwmac_register_mdio_mux(struct stmmac_priv *priv)
+{
+ int ret;
+ struct device_node *mdio_mux;
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+
+ mdio_mux = of_get_child_by_name(priv->device->of_node, "mdio-mux");
+ if (!mdio_mux)
+ return -ENODEV;
+
+ ret = mdio_mux_init(priv->device, mdio_mux, mdio_mux_syscon_switch_fn,
+ &gmac->mux_handle, priv, priv->mii);
+ return ret;
+}
+
static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
{
struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
@@ -648,35 +807,25 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
"Current syscon value is not the default %x (expect %x)\n",
val, reg);
- if (gmac->variant->internal_phy) {
- if (!gmac->use_internal_phy) {
- /* switch to external PHY interface */
- reg &= ~H3_EPHY_SELECT;
- } else {
- reg |= H3_EPHY_SELECT;
- reg &= ~H3_EPHY_SHUTDOWN;
- dev_dbg(priv->device, "Select internal_phy %x\n", reg);
-
- if (of_property_read_bool(priv->plat->phy_node,
- "allwinner,leds-active-low"))
- reg |= H3_EPHY_LED_POL;
- else
- reg &= ~H3_EPHY_LED_POL;
-
- /* Force EPHY xtal frequency to 24MHz. */
- reg |= H3_EPHY_CLK_SEL;
-
- ret = of_mdio_parse_addr(priv->device,
- priv->plat->phy_node);
- if (ret < 0) {
- dev_err(priv->device, "Could not parse MDIO addr\n");
- return ret;
- }
- /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
- * address. No need to mask it again.
- */
- reg |= ret << H3_EPHY_ADDR_SHIFT;
+ if (gmac->variant->soc_has_internal_phy) {
+ if (of_property_read_bool(priv->plat->phy_node,
+ "allwinner,leds-active-low"))
+ reg |= H3_EPHY_LED_POL;
+ else
+ reg &= ~H3_EPHY_LED_POL;
+
+ /* Force EPHY xtal frequency to 24MHz. */
+ reg |= H3_EPHY_CLK_SEL;
+
+ ret = of_mdio_parse_addr(priv->device, priv->plat->phy_node);
+ if (ret < 0) {
+ dev_err(priv->device, "Could not parse MDIO addr\n");
+ return ret;
}
+ /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
+ * address. No need to mask it again.
+ */
+ reg |= 1 << H3_EPHY_ADDR_SHIFT;
}
if (!of_property_read_u32(node, "allwinner,tx-delay-ps", &val)) {
@@ -746,81 +895,21 @@ static void sun8i_dwmac_unset_syscon(struct sunxi_priv_data *gmac)
regmap_write(gmac->regmap, SYSCON_EMAC_REG, reg);
}
-static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv)
+static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
{
- struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
- int ret;
-
- if (!gmac->use_internal_phy)
- return 0;
-
- ret = clk_prepare_enable(gmac->ephy_clk);
- if (ret) {
- dev_err(priv->device, "Cannot enable ephy\n");
- return ret;
- }
-
- /* Make sure the EPHY is properly reseted, as U-Boot may leave
- * it at deasserted state, and thus it may fail to reset EMAC.
- */
- reset_control_assert(gmac->rst_ephy);
+ struct sunxi_priv_data *gmac = priv;
- ret = reset_control_deassert(gmac->rst_ephy);
- if (ret) {
- dev_err(priv->device, "Cannot deassert ephy\n");
- clk_disable_unprepare(gmac->ephy_clk);
- return ret;
+ if (gmac->variant->soc_has_internal_phy) {
+ /* sun8i_dwmac_exit could be called with mdiomux uninit */
+ if (gmac->mux_handle)
+ mdio_mux_uninit(gmac->mux_handle);
+ if (gmac->internal_phy_powered)
+ sun8i_dwmac_unpower_internal_phy(gmac);
}
- return 0;
-}
-
-static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
-{
- if (!gmac->use_internal_phy)
- return 0;
-
- clk_disable_unprepare(gmac->ephy_clk);
- reset_control_assert(gmac->rst_ephy);
- return 0;
-}
-
-/* sun8i_power_phy() - Activate the PHY:
- * In case of error, no need to call sun8i_unpower_phy(),
- * it will be called anyway by sun8i_dwmac_exit()
- */
-static int sun8i_power_phy(struct stmmac_priv *priv)
-{
- int ret;
-
- ret = sun8i_dwmac_power_internal_phy(priv);
- if (ret)
- return ret;
-
- ret = sun8i_dwmac_set_syscon(priv);
- if (ret)
- return ret;
-
- /* After changing syscon value, the MAC need reset or it will use
- * the last value (and so the last PHY set.
- */
- ret = sun8i_dwmac_reset(priv);
- if (ret)
- return ret;
- return 0;
-}
-
-static void sun8i_unpower_phy(struct sunxi_priv_data *gmac)
-{
sun8i_dwmac_unset_syscon(gmac);
- sun8i_dwmac_unpower_internal_phy(gmac);
-}
-
-static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
-{
- struct sunxi_priv_data *gmac = priv;
- sun8i_unpower_phy(gmac);
+ reset_control_put(gmac->rst_ephy);
clk_disable_unprepare(gmac->tx_clk);
@@ -849,7 +938,7 @@ static struct mac_device_info *sun8i_dwmac_setup(void *ppriv)
if (!mac)
return NULL;
- ret = sun8i_power_phy(priv);
+ ret = sun8i_dwmac_set_syscon(priv);
if (ret)
return NULL;
@@ -889,6 +978,8 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
struct sunxi_priv_data *gmac;
struct device *dev = &pdev->dev;
int ret;
+ struct stmmac_priv *priv;
+ struct net_device *ndev;
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
@@ -932,29 +1023,6 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
}
plat_dat->interface = of_get_phy_mode(dev->of_node);
- if (plat_dat->interface == gmac->variant->internal_phy) {
- dev_info(&pdev->dev, "Will use internal PHY\n");
- gmac->use_internal_phy = true;
- gmac->ephy_clk = of_clk_get(plat_dat->phy_node, 0);
- if (IS_ERR(gmac->ephy_clk)) {
- ret = PTR_ERR(gmac->ephy_clk);
- dev_err(&pdev->dev, "Cannot get EPHY clock: %d\n", ret);
- return -EINVAL;
- }
-
- gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
- if (IS_ERR(gmac->rst_ephy)) {
- ret = PTR_ERR(gmac->rst_ephy);
- if (ret == -EPROBE_DEFER)
- return ret;
- dev_err(&pdev->dev, "No EPHY reset control found %d\n",
- ret);
- return -EINVAL;
- }
- } else {
- dev_info(&pdev->dev, "Will use external PHY\n");
- gmac->use_internal_phy = false;
- }
/* platform data specifying hardware features and callbacks.
* hardware features were copied from Allwinner drivers.
@@ -973,9 +1041,34 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret)
- sun8i_dwmac_exit(pdev, plat_dat->bsp_priv);
+ goto dwmac_exit;
+
+ ndev = dev_get_drvdata(&pdev->dev);
+ priv = netdev_priv(ndev);
+ /* The mux must be registered after parent MDIO
+ * so after stmmac_dvr_probe()
+ */
+ if (gmac->variant->soc_has_internal_phy) {
+ ret = get_ephy_nodes(priv);
+ if (ret)
+ goto dwmac_exit;
+ ret = sun8i_dwmac_register_mdio_mux(priv);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to register mux\n");
+ goto dwmac_mux;
+ }
+ } else {
+ ret = sun8i_dwmac_reset(priv);
+ if (ret)
+ goto dwmac_exit;
+ }
return ret;
+dwmac_mux:
+ sun8i_dwmac_unset_syscon(gmac);
+dwmac_exit:
+ sun8i_dwmac_exit(pdev, plat_dat->bsp_priv);
+return ret;
}
static const struct of_device_id sun8i_dwmac_match[] = {
--
2.13.6
^ permalink raw reply related
* [PATCH v9 10/10] net: stmmac: sun8i: Restore the compatibles
From: Corentin Labbe @ 2017-10-24 17:57 UTC (permalink / raw)
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
linux-I+IVW8TIWO2tmTQ+vhA3Yw, catalin.marinas-5wv7dgnIgG8,
will.deacon-5wv7dgnIgG8, peppe.cavallaro-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o, andrew-g2DYL2Zd6BY,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Corentin Labbe
In-Reply-To: <20171024175714.15840-1-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
The original dwmac-sun8i DT bindings have some issue on how to handle
integrated PHY and was reverted in last RC of 4.13.
But now we have a solution so we need to get back that was reverted.
This patch restore compatibles about dwmac-sun8i
This reverts commit ad4540cc5aa3 ("net: stmmac: sun8i: Remove the compatibles")
Signed-off-by: Corentin Labbe <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index b3eb344bb158..e5ff734d4f9b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -1072,6 +1072,14 @@ return ret;
}
static const struct of_device_id sun8i_dwmac_match[] = {
+ { .compatible = "allwinner,sun8i-h3-emac",
+ .data = &emac_variant_h3 },
+ { .compatible = "allwinner,sun8i-v3s-emac",
+ .data = &emac_variant_v3s },
+ { .compatible = "allwinner,sun8i-a83t-emac",
+ .data = &emac_variant_a83t },
+ { .compatible = "allwinner,sun50i-a64-emac",
+ .data = &emac_variant_a64 },
{ }
};
MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
--
2.13.6
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v9 02/10] dt-bindings: net: dwmac-sun8i: update documentation about integrated PHY
From: Corentin Labbe @ 2017-10-24 17:57 UTC (permalink / raw)
To: robh+dt, mark.rutland, maxime.ripard, wens, linux,
catalin.marinas, will.deacon, peppe.cavallaro, alexandre.torgue,
andrew, f.fainelli
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
Corentin Labbe
In-Reply-To: <20171024175714.15840-1-clabbe.montjoie@gmail.com>
This patch add documentation about the MDIO switch used on sun8i-h3-emac
for integrated PHY.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
.../devicetree/bindings/net/dwmac-sun8i.txt | 145 +++++++++++++++++++--
1 file changed, 133 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
index 725f3b187886..2600ce9ad3cc 100644
--- a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
+++ b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
@@ -4,18 +4,18 @@ This device is a platform glue layer for stmmac.
Please see stmmac.txt for the other unchanged properties.
Required properties:
-- compatible: should be one of the following string:
+- compatible: must be one of the following string:
"allwinner,sun8i-a83t-emac"
"allwinner,sun8i-h3-emac"
"allwinner,sun8i-v3s-emac"
"allwinner,sun50i-a64-emac"
- reg: address and length of the register for the device.
- interrupts: interrupt for the device
-- interrupt-names: should be "macirq"
+- interrupt-names: must be "macirq"
- clocks: A phandle to the reference clock for this device
-- clock-names: should be "stmmaceth"
+- clock-names: must be "stmmaceth"
- resets: A phandle to the reset control for this device
-- reset-names: should be "stmmaceth"
+- reset-names: must be "stmmaceth"
- phy-mode: See ethernet.txt
- phy-handle: See ethernet.txt
- #address-cells: shall be 1
@@ -39,23 +39,42 @@ Optional properties for the following compatibles:
- allwinner,leds-active-low: EPHY LEDs are active low
Required child node of emac:
-- mdio bus node: should be named mdio
+- mdio bus node: with compatible "snps,dwmac-mdio"
Required properties of the mdio node:
- #address-cells: shall be 1
- #size-cells: shall be 0
-The device node referenced by "phy" or "phy-handle" should be a child node
+The device node referenced by "phy" or "phy-handle" must be a child node
of the mdio node. See phy.txt for the generic PHY bindings.
-Required properties of the phy node with the following compatibles:
+The following compatibles require that the emac node have a mdio-mux child
+node called "mdio-mux":
+ - "allwinner,sun8i-h3-emac"
+ - "allwinner,sun8i-v3s-emac":
+Required properties for the mdio-mux node:
+ - compatible = "allwinner,sun8i-h3-mdio-mux"
+ - mdio-parent-bus: a phandle to EMAC mdio
+ - one child mdio for the integrated mdio with the compatible
+ "allwinner,sun8i-h3-mdio-internal"
+ - one child mdio for the external mdio if present (V3s have none)
+Required properties for the mdio-mux children node:
+ - reg: 1 for internal MDIO bus, 2 for external MDIO bus
+
+The following compatibles require a PHY node representing the integrated
+PHY, under the integrated MDIO bus node if an mdio-mux node is used:
- "allwinner,sun8i-h3-emac",
- "allwinner,sun8i-v3s-emac":
+
+Additional information regarding generic multiplexer properties can be found
+at Documentation/devicetree/bindings/net/mdio-mux.txt
+
+Required properties of the integrated phy node:
- clocks: a phandle to the reference clock for the EPHY
- resets: a phandle to the reset control for the EPHY
+- Must be a child of the integrated mdio
-Example:
-
+Example with integrated PHY:
emac: ethernet@1c0b000 {
compatible = "allwinner,sun8i-h3-emac";
syscon = <&syscon>;
@@ -72,13 +91,115 @@ emac: ethernet@1c0b000 {
phy-handle = <&int_mii_phy>;
phy-mode = "mii";
allwinner,leds-active-low;
+
+ mdio0: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "snps,dwmac-mdio";
+ };
+
+ mdio-mux {
+ compatible = "mdio-mux", "allwinner,sun8i-h3-mdio-mux";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ mdio-parent-bus = <&mdio0>;
+
+ int_mdio: mdio@1 {
+ compatible = "allwinner,sun8i-h3-mdio-internal";
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ int_mii_phy: ethernet-phy@1 {
+ reg = <1>;
+ clocks = <&ccu CLK_BUS_EPHY>;
+ resets = <&ccu RST_BUS_EPHY>;
+ phy-is-integrated;
+ };
+ };
+ ext_mdio: mdio@2 {
+ reg = <2>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+ };
+};
+
+Example with external PHY:
+emac: ethernet@1c0b000 {
+ compatible = "allwinner,sun8i-h3-emac";
+ syscon = <&syscon>;
+ reg = <0x01c0b000 0x104>;
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "macirq";
+ resets = <&ccu RST_BUS_EMAC>;
+ reset-names = "stmmaceth";
+ clocks = <&ccu CLK_BUS_EMAC>;
+ clock-names = "stmmaceth";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+ allwinner,leds-active-low;
+
+ mdio0: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "snps,dwmac-mdio";
+ };
+
+ mdio-mux {
+ compatible = "mdio-mux", "allwinner,sun8i-h3-mdio-mux";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ mdio-parent-bus = <&mdio0>;
+
+ int_mdio: mdio@1 {
+ compatible = "allwinner,sun8i-h3-mdio-internal";
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ int_mii_phy: ethernet-phy@1 {
+ reg = <1>;
+ clocks = <&ccu CLK_BUS_EPHY>;
+ resets = <&ccu RST_BUS_EPHY>;
+ };
+ };
+ ext_mdio: mdio@2 {
+ reg = <2>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ ext_rgmii_phy: ethernet-phy@1 {
+ reg = <1>;
+ };
+ }:
+ };
+};
+
+Example with SoC without integrated PHY
+
+emac: ethernet@1c0b000 {
+ compatible = "allwinner,sun8i-a83t-emac";
+ syscon = <&syscon>;
+ reg = <0x01c0b000 0x104>;
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "macirq";
+ resets = <&ccu RST_BUS_EMAC>;
+ reset-names = "stmmaceth";
+ clocks = <&ccu CLK_BUS_EMAC>;
+ clock-names = "stmmaceth";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+
mdio: mdio {
+ compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
- int_mii_phy: ethernet-phy@1 {
+ ext_rgmii_phy: ethernet-phy@1 {
reg = <1>;
- clocks = <&ccu CLK_BUS_EPHY>;
- resets = <&ccu RST_BUS_EPHY>;
};
};
};
--
2.13.6
^ permalink raw reply related
* [PATCH v9 06/10] arm64: dts: allwinner: Restore EMAC changes
From: Corentin Labbe @ 2017-10-24 17:57 UTC (permalink / raw)
To: robh+dt, mark.rutland, maxime.ripard, wens, linux,
catalin.marinas, will.deacon, peppe.cavallaro, alexandre.torgue,
andrew, f.fainelli
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
Corentin Labbe
In-Reply-To: <20171024175714.15840-1-clabbe.montjoie@gmail.com>
The original dwmac-sun8i DT bindings have some issue on how to handle
integrated PHY and was reverted in last RC of 4.13.
But now we have a solution so we need to get back that was reverted.
This patch restore arm64 DT about dwmac-sun8i
This reverts commit 87e1f5e8bb4b ("arm64: dts: allwinner: Revert EMAC changes")
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
.../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 16 ++++++++++++++++
.../boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 15 +++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 17 +++++++++++++++++
.../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 16 ++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 20 ++++++++++++++++++++
.../boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts | 17 +++++++++++++++++
.../boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts | 17 +++++++++++++++++
.../boot/dts/allwinner/sun50i-h5-orangepi-prime.dts | 17 +++++++++++++++++
8 files changed, 135 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
index d347f52e27f6..45bdbfb96126 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
@@ -51,6 +51,7 @@
compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
serial1 = &uart1;
};
@@ -69,6 +70,14 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&rgmii_pins>;
+ phy-mode = "rgmii";
+ phy-handle = <&ext_rgmii_phy>;
+ status = "okay";
+};
+
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
@@ -79,6 +88,13 @@
bias-pull-up;
};
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
index f82ccf332c0f..24f1aac366d6 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
@@ -48,3 +48,18 @@
/* TODO: Camera, touchscreen, etc. */
};
+
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&rgmii_pins>;
+ phy-mode = "rgmii";
+ phy-handle = <&ext_rgmii_phy>;
+ status = "okay";
+};
+
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index d06e34b5d192..806442d3e846 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -51,6 +51,7 @@
compatible = "pine64,pine64", "allwinner,sun50i-a64";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
@@ -71,6 +72,15 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&rmii_pins>;
+ phy-mode = "rmii";
+ phy-handle = <&ext_rmii_phy1>;
+ status = "okay";
+
+};
+
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
@@ -81,6 +91,13 @@
bias-pull-up;
};
+&mdio {
+ ext_rmii_phy1: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
index 17ccc12b58df..0eb2acedf8c3 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
@@ -53,6 +53,7 @@
"allwinner,sun50i-a64";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
};
@@ -76,6 +77,21 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&rgmii_pins>;
+ phy-mode = "rgmii";
+ phy-handle = <&ext_rgmii_phy>;
+ status = "okay";
+};
+
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&mmc2 {
pinctrl-names = "default";
pinctrl-0 = <&mmc2_pins>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 905af406dbd3..0650a1cda107 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -517,6 +517,26 @@
#size-cells = <0>;
};
+ emac: ethernet@1c30000 {
+ compatible = "allwinner,sun50i-a64-emac";
+ syscon = <&syscon>;
+ reg = <0x01c30000 0x10000>;
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "macirq";
+ resets = <&ccu RST_BUS_EMAC>;
+ reset-names = "stmmaceth";
+ clocks = <&ccu CLK_BUS_EMAC>;
+ clock-names = "stmmaceth";
+ status = "disabled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mdio: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+ };
+
gic: interrupt-controller@1c81000 {
compatible = "arm,gic-400";
reg = <0x01c81000 0x1000>,
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
index 1c2387bd5df6..6eb8092d8e57 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
@@ -50,6 +50,7 @@
compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
};
@@ -108,6 +109,22 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&emac_rgmii_pins>;
+ phy-supply = <®_gmac_3v3>;
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+ status = "okay";
+};
+
+&external_mdio {
+ ext_rgmii_phy: ethernet-phy@7 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <7>;
+ };
+};
+
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
index 4f77c8470f6c..a0ca925175aa 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
@@ -59,6 +59,7 @@
};
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
};
@@ -136,6 +137,22 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&emac_rgmii_pins>;
+ phy-supply = <®_gmac_3v3>;
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+ status = "okay";
+};
+
+&external_mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&ir {
pinctrl-names = "default";
pinctrl-0 = <&ir_pins_a>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
index 6be06873e5af..b47790650144 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
@@ -54,6 +54,7 @@
compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
};
@@ -143,6 +144,22 @@
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&emac_rgmii_pins>;
+ phy-supply = <®_gmac_3v3>;
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+ status = "okay";
+};
+
+&external_mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&ir {
pinctrl-names = "default";
pinctrl-0 = <&ir_pins_a>;
--
2.13.6
^ permalink raw reply related
* Re: [PATCH] net: sunrpc: svcauth_gss: use BUG_ON instead of if condition followed by BUG
From: Jeff Layton @ 2017-10-24 18:18 UTC (permalink / raw)
To: J. Bruce Fields, Weston Andros Adamson
Cc: Gustavo A. R. Silva, Trond Myklebust, Anna Schumaker,
David S. Miller, linux-nfs list, netdev,
linux-kernel@vger.kernel.org
In-Reply-To: <20171024175342.GA27853@fieldses.org>
On Tue, 2017-10-24 at 13:53 -0400, J. Bruce Fields wrote:
> On Tue, Oct 24, 2017 at 01:26:49PM -0400, Weston Andros Adamson wrote:
> > Is there a reason to BUG() in these places? Couldn't we WARN_ON_ONCE and return an error?
>
> I think the BUG() will just kill an nfsd thread that isn't holding any
> interesting locks.
>
Not necessarily. If panic_on_oops is set (and it usually is in
"production" setups), it'll crash the box there.
> The failures look unlikely. (Except for that read_u32... return, I
> wonder if we're missing a check there.)
>
Agreed, looks like you only hit an error if the read attempts to go out
of bounds. In principle that shouldn't ever happen (and I haven't seen
any reports of it).
Still...I agree with Dros that it's better to handle this without
oopsing if we can. We can return an error from either of those
functions. A sane error and a WARN_ONCE would be better here.
> --b.
>
> >
> > -dros
> >
> > > On Oct 23, 2017, at 4:31 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> > >
> > > In the past we've avoided BUG_ON(X) where X might have side effects, on
> > > the theory that it should actually be OK just to compile out BUG_ON()s.
> > > Has that changed?
> > >
> > > In any case, I don't find that this improves readability; dropping.
> > >
> > > --b.
> > >
> > > On Mon, Oct 23, 2017 at 01:16:35PM -0500, Gustavo A. R. Silva wrote:
> > > > Use BUG_ON instead of if condition followed by BUG.
> > > >
> > > > This issue was detected with the help of Coccinelle.
> > > >
> > > > Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> > > > ---
> > > > net/sunrpc/auth_gss/svcauth_gss.c | 9 +++------
> > > > 1 file changed, 3 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
> > > > index 7b1ee5a..a10ce43 100644
> > > > --- a/net/sunrpc/auth_gss/svcauth_gss.c
> > > > +++ b/net/sunrpc/auth_gss/svcauth_gss.c
> > > > @@ -855,11 +855,9 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
> > > > return stat;
> > > > if (integ_len > buf->len)
> > > > return stat;
> > > > - if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len))
> > > > - BUG();
> > > > + BUG_ON(xdr_buf_subsegment(buf, &integ_buf, 0, integ_len));
> > > > /* copy out mic... */
> > > > - if (read_u32_from_xdr_buf(buf, integ_len, &mic.len))
> > > > - BUG();
> > > > + BUG_ON(read_u32_from_xdr_buf(buf, integ_len, &mic.len));
> > > > if (mic.len > RPC_MAX_AUTH_SIZE)
> > > > return stat;
> > > > mic.data = kmalloc(mic.len, GFP_KERNEL);
> > > > @@ -1611,8 +1609,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
> > > > BUG_ON(integ_len % 4);
> > > > *p++ = htonl(integ_len);
> > > > *p++ = htonl(gc->gc_seq);
> > > > - if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len))
> > > > - BUG();
> > > > + BUG_ON(xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len));
> > > > if (resbuf->tail[0].iov_base == NULL) {
> > > > if (resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE > PAGE_SIZE)
> > > > goto out_err;
> > > > --
> > > > 2.7.4
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply
* Re: [PATCH v7 10/10] of: mdio: Prevent of_mdiobus_register from scanning mdio-mux nodes
From: Rob Herring @ 2017-10-24 18:46 UTC (permalink / raw)
To: Corentin Labbe
Cc: mark.rutland, maxime.ripard, wens, linux, catalin.marinas,
will.deacon, peppe.cavallaro, alexandre.torgue, andrew,
f.fainelli, frowand.list, netdev, devicetree, linux-arm-kernel,
linux-kernel, linux-sunxi
In-Reply-To: <20171018114458.17891-11-clabbe.montjoie@gmail.com>
On Wed, Oct 18, 2017 at 01:44:58PM +0200, Corentin Labbe wrote:
> Each child node of an MDIO node is scanned as a PHY when calling
> of_mdiobus_register() givint the following result:
> [ 18.175379] mdio_bus stmmac-0: /soc/ethernet@1c30000/mdio/mdio-mux has invalid PHY address
> [ 18.175408] mdio_bus stmmac-0: scan phy mdio-mux at address 0
> [ 18.175450] mdio_bus stmmac-0: scan phy mdio-mux at address 1
> [...]
> [ 18.176420] mdio_bus stmmac-0: scan phy mdio-mux at address 30
> [ 18.176452] mdio_bus stmmac-0: scan phy mdio-mux at address 31
>
> Since mdio-mux nodes are not PHY, this patch a way to to not scan
> them.
This can be dropped now, right?
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
> drivers/of/of_mdio.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
^ permalink raw reply
* Re: [PATCH v7 10/10] of: mdio: Prevent of_mdiobus_register from scanning mdio-mux nodes
From: Corentin Labbe @ 2017-10-24 19:02 UTC (permalink / raw)
To: Rob Herring
Cc: mark.rutland-5wv7dgnIgG8,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
linux-I+IVW8TIWO2tmTQ+vhA3Yw, catalin.marinas-5wv7dgnIgG8,
will.deacon-5wv7dgnIgG8, peppe.cavallaro-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o, andrew-g2DYL2Zd6BY,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w,
frowand.list-Re5JQEeQqe8AvxtiuMwx3w,
netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <20171024184654.ggfrsrjd3nobku5n@rob-hp-laptop>
On Tue, Oct 24, 2017 at 01:46:54PM -0500, Rob Herring wrote:
> On Wed, Oct 18, 2017 at 01:44:58PM +0200, Corentin Labbe wrote:
> > Each child node of an MDIO node is scanned as a PHY when calling
> > of_mdiobus_register() givint the following result:
> > [ 18.175379] mdio_bus stmmac-0: /soc/ethernet@1c30000/mdio/mdio-mux has invalid PHY address
> > [ 18.175408] mdio_bus stmmac-0: scan phy mdio-mux at address 0
> > [ 18.175450] mdio_bus stmmac-0: scan phy mdio-mux at address 1
> > [...]
> > [ 18.176420] mdio_bus stmmac-0: scan phy mdio-mux at address 30
> > [ 18.176452] mdio_bus stmmac-0: scan phy mdio-mux at address 31
> >
> > Since mdio-mux nodes are not PHY, this patch a way to to not scan
> > them.
>
> This can be dropped now, right?
Yes and it is dropped in my two last serie.
Forgot to said it in changelog
^ permalink raw reply
* Re: [PATCH] netfilter: ipvs: Convert timers to use timer_setup()
From: Julian Anastasov @ 2017-10-24 19:07 UTC (permalink / raw)
To: Kees Cook
Cc: David S. Miller, Wensong Zhang, Simon Horman, Pablo Neira Ayuso,
Jozsef Kadlecsik, Florian Westphal, netdev, lvs-devel,
netfilter-devel, coreteam, linux-kernel
In-Reply-To: <20171024084521.GA23684@beast>
Hello,
On Tue, 24 Oct 2017, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
>
> Cc: Wensong Zhang <wensong@linux-vs.org>
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Julian Anastasov <ja@ssi.bg>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: lvs-devel@vger.kernel.org
> Cc: netfilter-devel@vger.kernel.org
> Cc: coreteam@netfilter.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
Looks good to me,
Acked-by: Julian Anastasov <ja@ssi.bg>
> ---
> net/netfilter/ipvs/ip_vs_conn.c | 10 +++++-----
> net/netfilter/ipvs/ip_vs_ctl.c | 7 +++----
> net/netfilter/ipvs/ip_vs_est.c | 6 +++---
> net/netfilter/ipvs/ip_vs_lblc.c | 11 ++++++-----
> net/netfilter/ipvs/ip_vs_lblcr.c | 11 ++++++-----
> 5 files changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
> index 3d2ac71a83ec..3a43b3470331 100644
> --- a/net/netfilter/ipvs/ip_vs_conn.c
> +++ b/net/netfilter/ipvs/ip_vs_conn.c
> @@ -104,7 +104,7 @@ static inline void ct_write_unlock_bh(unsigned int key)
> spin_unlock_bh(&__ip_vs_conntbl_lock_array[key&CT_LOCKARRAY_MASK].l);
> }
>
> -static void ip_vs_conn_expire(unsigned long data);
> +static void ip_vs_conn_expire(struct timer_list *t);
>
> /*
> * Returns hash value for IPVS connection entry
> @@ -457,7 +457,7 @@ EXPORT_SYMBOL_GPL(ip_vs_conn_out_get_proto);
> static void __ip_vs_conn_put_notimer(struct ip_vs_conn *cp)
> {
> __ip_vs_conn_put(cp);
> - ip_vs_conn_expire((unsigned long)cp);
> + ip_vs_conn_expire(&cp->timer);
> }
>
> /*
> @@ -817,9 +817,9 @@ static void ip_vs_conn_rcu_free(struct rcu_head *head)
> kmem_cache_free(ip_vs_conn_cachep, cp);
> }
>
> -static void ip_vs_conn_expire(unsigned long data)
> +static void ip_vs_conn_expire(struct timer_list *t)
> {
> - struct ip_vs_conn *cp = (struct ip_vs_conn *)data;
> + struct ip_vs_conn *cp = from_timer(cp, t, timer);
> struct netns_ipvs *ipvs = cp->ipvs;
>
> /*
> @@ -909,7 +909,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af,
> }
>
> INIT_HLIST_NODE(&cp->c_list);
> - setup_timer(&cp->timer, ip_vs_conn_expire, (unsigned long)cp);
> + timer_setup(&cp->timer, ip_vs_conn_expire, 0);
> cp->ipvs = ipvs;
> cp->af = p->af;
> cp->daf = dest_af;
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 4f940d7eb2f7..b47e266c6eca 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1146,9 +1146,9 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
> return 0;
> }
>
> -static void ip_vs_dest_trash_expire(unsigned long data)
> +static void ip_vs_dest_trash_expire(struct timer_list *t)
> {
> - struct netns_ipvs *ipvs = (struct netns_ipvs *)data;
> + struct netns_ipvs *ipvs = from_timer(ipvs, t, dest_trash_timer);
> struct ip_vs_dest *dest, *next;
> unsigned long now = jiffies;
>
> @@ -4019,8 +4019,7 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
>
> INIT_LIST_HEAD(&ipvs->dest_trash);
> spin_lock_init(&ipvs->dest_trash_lock);
> - setup_timer(&ipvs->dest_trash_timer, ip_vs_dest_trash_expire,
> - (unsigned long) ipvs);
> + timer_setup(&ipvs->dest_trash_timer, ip_vs_dest_trash_expire, 0);
> atomic_set(&ipvs->ftpsvc_counter, 0);
> atomic_set(&ipvs->nullsvc_counter, 0);
> atomic_set(&ipvs->conn_out_counter, 0);
> diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
> index 457c6c193e13..489055091a9b 100644
> --- a/net/netfilter/ipvs/ip_vs_est.c
> +++ b/net/netfilter/ipvs/ip_vs_est.c
> @@ -97,12 +97,12 @@ static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum,
> }
>
>
> -static void estimation_timer(unsigned long arg)
> +static void estimation_timer(struct timer_list *t)
> {
> struct ip_vs_estimator *e;
> struct ip_vs_stats *s;
> u64 rate;
> - struct netns_ipvs *ipvs = (struct netns_ipvs *)arg;
> + struct netns_ipvs *ipvs = from_timer(ipvs, t, est_timer);
>
> spin_lock(&ipvs->est_lock);
> list_for_each_entry(e, &ipvs->est_list, list) {
> @@ -192,7 +192,7 @@ int __net_init ip_vs_estimator_net_init(struct netns_ipvs *ipvs)
> {
> INIT_LIST_HEAD(&ipvs->est_list);
> spin_lock_init(&ipvs->est_lock);
> - setup_timer(&ipvs->est_timer, estimation_timer, (unsigned long)ipvs);
> + timer_setup(&ipvs->est_timer, estimation_timer, 0);
> mod_timer(&ipvs->est_timer, jiffies + 2 * HZ);
> return 0;
> }
> diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
> index b6aa4a970c6e..d625179de485 100644
> --- a/net/netfilter/ipvs/ip_vs_lblc.c
> +++ b/net/netfilter/ipvs/ip_vs_lblc.c
> @@ -106,6 +106,7 @@ struct ip_vs_lblc_table {
> struct rcu_head rcu_head;
> struct hlist_head bucket[IP_VS_LBLC_TAB_SIZE]; /* hash bucket */
> struct timer_list periodic_timer; /* collect stale entries */
> + struct ip_vs_service *svc; /* pointer back to service */
> atomic_t entries; /* number of entries */
> int max_size; /* maximum size of entries */
> int rover; /* rover for expire check */
> @@ -294,10 +295,10 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_service *svc)
> * of the table.
> * The full expiration check is for this purpose now.
> */
> -static void ip_vs_lblc_check_expire(unsigned long data)
> +static void ip_vs_lblc_check_expire(struct timer_list *t)
> {
> - struct ip_vs_service *svc = (struct ip_vs_service *) data;
> - struct ip_vs_lblc_table *tbl = svc->sched_data;
> + struct ip_vs_lblc_table *tbl = from_timer(tbl, t, periodic_timer);
> + struct ip_vs_service *svc = tbl->svc;
> unsigned long now = jiffies;
> int goal;
> int i, j;
> @@ -369,12 +370,12 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc)
> tbl->rover = 0;
> tbl->counter = 1;
> tbl->dead = 0;
> + tbl->svc = svc;
>
> /*
> * Hook periodic timer for garbage collection
> */
> - setup_timer(&tbl->periodic_timer, ip_vs_lblc_check_expire,
> - (unsigned long)svc);
> + timer_setup(&tbl->periodic_timer, ip_vs_lblc_check_expire, 0);
> mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL);
>
> return 0;
> diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
> index c13ff575f9f7..84c57b62a588 100644
> --- a/net/netfilter/ipvs/ip_vs_lblcr.c
> +++ b/net/netfilter/ipvs/ip_vs_lblcr.c
> @@ -278,6 +278,7 @@ struct ip_vs_lblcr_table {
> atomic_t entries; /* number of entries */
> int max_size; /* maximum size of entries */
> struct timer_list periodic_timer; /* collect stale entries */
> + struct ip_vs_service *svc; /* pointer back to service */
> int rover; /* rover for expire check */
> int counter; /* counter for no expire */
> bool dead;
> @@ -458,10 +459,10 @@ static inline void ip_vs_lblcr_full_check(struct ip_vs_service *svc)
> * of the table.
> * The full expiration check is for this purpose now.
> */
> -static void ip_vs_lblcr_check_expire(unsigned long data)
> +static void ip_vs_lblcr_check_expire(struct timer_list *t)
> {
> - struct ip_vs_service *svc = (struct ip_vs_service *) data;
> - struct ip_vs_lblcr_table *tbl = svc->sched_data;
> + struct ip_vs_lblcr_table *tbl = from_timer(tbl, t, periodic_timer);
> + struct ip_vs_service *svc = tbl->svc;
> unsigned long now = jiffies;
> int goal;
> int i, j;
> @@ -532,12 +533,12 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
> tbl->rover = 0;
> tbl->counter = 1;
> tbl->dead = 0;
> + tbl->svc = svc;
>
> /*
> * Hook periodic timer for garbage collection
> */
> - setup_timer(&tbl->periodic_timer, ip_vs_lblcr_check_expire,
> - (unsigned long)svc);
> + timer_setup(&tbl->periodic_timer, ip_vs_lblcr_check_expire, 0);
> mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL);
>
> return 0;
> --
> 2.7.4
>
>
> --
> Kees Cook
> Pixel Security
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH] net: sunrpc: svcauth_gss: use BUG_ON instead of if condition followed by BUG
From: J. Bruce Fields @ 2017-10-24 19:07 UTC (permalink / raw)
To: Jeff Layton
Cc: Weston Andros Adamson, Gustavo A. R. Silva, Trond Myklebust,
Anna Schumaker, David S. Miller, linux-nfs list, netdev,
linux-kernel@vger.kernel.org
In-Reply-To: <1508869132.4780.14.camel@redhat.com>
On Tue, Oct 24, 2017 at 02:18:52PM -0400, Jeff Layton wrote:
> On Tue, 2017-10-24 at 13:53 -0400, J. Bruce Fields wrote:
> > On Tue, Oct 24, 2017 at 01:26:49PM -0400, Weston Andros Adamson wrote:
> > > Is there a reason to BUG() in these places? Couldn't we WARN_ON_ONCE and return an error?
> >
> > I think the BUG() will just kill an nfsd thread that isn't holding any
> > interesting locks.
> >
>
> Not necessarily. If panic_on_oops is set (and it usually is in
> "production" setups), it'll crash the box there.
Maybe they're getting what they asked for?
> > The failures look unlikely. (Except for that read_u32... return, I
> > wonder if we're missing a check there.)
>
> Agreed, looks like you only hit an error if the read attempts to go out
> of bounds. In principle that shouldn't ever happen (and I haven't seen
> any reports of it).
>
> Still...I agree with Dros that it's better to handle this without
> oopsing if we can. We can return an error from either of those
> functions. A sane error and a WARN_ONCE would be better here.
OK, OK, OK.
There are also some more BUGs that could use looking into if anyone
wants to.
--b.
commit eb754930662f
Author: J. Bruce Fields <bfields@redhat.com>
Date: Tue Oct 24 14:58:11 2017 -0400
rpc: remove some BUG()s
It would be kinder to WARN() and recover in several spots here instead
of BUG()ing.
Also, it looks like the read_u32_from_xdr_buf() call could actually
fail, though it might require a broken (or malicious) client, so convert
that to just an error return.
Reported-by: Weston Andros Adamson <dros@monkey.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 7b1ee5a0b03c..73165e9ca5bf 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -855,11 +855,13 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
return stat;
if (integ_len > buf->len)
return stat;
- if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len))
- BUG();
+ if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len)) {
+ WARN_ON_ONCE(1);
+ return stat;
+ }
/* copy out mic... */
if (read_u32_from_xdr_buf(buf, integ_len, &mic.len))
- BUG();
+ return stat;
if (mic.len > RPC_MAX_AUTH_SIZE)
return stat;
mic.data = kmalloc(mic.len, GFP_KERNEL);
@@ -1611,8 +1613,10 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
BUG_ON(integ_len % 4);
*p++ = htonl(integ_len);
*p++ = htonl(gc->gc_seq);
- if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len))
- BUG();
+ if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len)) {
+ WARN_ON_ONCE(1);
+ goto out_err;
+ }
if (resbuf->tail[0].iov_base == NULL) {
if (resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE > PAGE_SIZE)
goto out_err;
^ permalink raw reply related
* Re: [PATCH] wimax/i2400m: Remove VLAIS
From: Matthias Kaehlcke @ 2017-10-24 19:46 UTC (permalink / raw)
To: Inaky Perez-Gonzalez
Cc: linux-wimax, netdev, linux-kernel, Behan Webster, Mark Charlebois,
Arnd Bergmann, Guenter Roeck
In-Reply-To: <20171009194153.30467-1-mka@chromium.org>
El Mon, Oct 09, 2017 at 12:41:53PM -0700 Matthias Kaehlcke ha dit:
> From: Behan Webster <behanw@converseincode.com>
>
> Convert Variable Length Array in Struct (VLAIS) to valid C by converting
> local struct definition to use a flexible array. The structure is only
> used to define a cast of a buffer so the size of the struct is not used
> to allocate storage.
>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> Signed-off-by: Mark Charebois <charlebm@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
> drivers/net/wimax/i2400m/fw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
> index c9c711dcd0e6..a89b5685e68b 100644
> --- a/drivers/net/wimax/i2400m/fw.c
> +++ b/drivers/net/wimax/i2400m/fw.c
> @@ -652,7 +652,7 @@ static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk,
> struct device *dev = i2400m_dev(i2400m);
> struct {
> struct i2400m_bootrom_header cmd;
> - u8 cmd_payload[chunk_len];
> + u8 cmd_payload[];
> } __packed *buf;
> struct i2400m_bootrom_header ack;
ping
any comments on this?
^ permalink raw reply
* Re: [PATCH] net: sunrpc: svcauth_gss: use BUG_ON instead of if condition followed by BUG
From: Gustavo A. R. Silva @ 2017-10-24 20:12 UTC (permalink / raw)
To: J. Bruce Fields
Cc: Jeff Layton, Weston Andros Adamson, Trond Myklebust,
Anna Schumaker, David S. Miller, linux-nfs list, netdev,
linux-kernel
In-Reply-To: <20171024190723.GD27853@fieldses.org>
Quoting "J. Bruce Fields" <bfields@fieldses.org>:
> On Tue, Oct 24, 2017 at 02:18:52PM -0400, Jeff Layton wrote:
>> On Tue, 2017-10-24 at 13:53 -0400, J. Bruce Fields wrote:
>> > On Tue, Oct 24, 2017 at 01:26:49PM -0400, Weston Andros Adamson wrote:
>> > > Is there a reason to BUG() in these places? Couldn't we
>> WARN_ON_ONCE and return an error?
>> >
>> > I think the BUG() will just kill an nfsd thread that isn't holding any
>> > interesting locks.
>> >
>>
>> Not necessarily. If panic_on_oops is set (and it usually is in
>> "production" setups), it'll crash the box there.
>
> Maybe they're getting what they asked for?
>
>> > The failures look unlikely. (Except for that read_u32... return, I
>> > wonder if we're missing a check there.)
>>
>> Agreed, looks like you only hit an error if the read attempts to go out
>> of bounds. In principle that shouldn't ever happen (and I haven't seen
>> any reports of it).
>>
>> Still...I agree with Dros that it's better to handle this without
>> oopsing if we can. We can return an error from either of those
>> functions. A sane error and a WARN_ONCE would be better here.
>
> OK, OK, OK.
>
> There are also some more BUGs that could use looking into if anyone
> wants to.
>
> --b.
>
> commit eb754930662f
> Author: J. Bruce Fields <bfields@redhat.com>
> Date: Tue Oct 24 14:58:11 2017 -0400
>
> rpc: remove some BUG()s
>
> It would be kinder to WARN() and recover in several spots here instead
> of BUG()ing.
>
> Also, it looks like the read_u32_from_xdr_buf() call could actually
> fail, though it might require a broken (or malicious) client, so convert
> that to just an error return.
>
> Reported-by: Weston Andros Adamson <dros@monkey.org>
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>
> diff --git a/net/sunrpc/auth_gss/svcauth_gss.c
> b/net/sunrpc/auth_gss/svcauth_gss.c
> index 7b1ee5a0b03c..73165e9ca5bf 100644
> --- a/net/sunrpc/auth_gss/svcauth_gss.c
> +++ b/net/sunrpc/auth_gss/svcauth_gss.c
> @@ -855,11 +855,13 @@ unwrap_integ_data(struct svc_rqst *rqstp,
> struct xdr_buf *buf, u32 seq, struct g
> return stat;
> if (integ_len > buf->len)
> return stat;
> - if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len))
> - BUG();
> + if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len)) {
> + WARN_ON_ONCE(1);
> + return stat;
> + }
> /* copy out mic... */
> if (read_u32_from_xdr_buf(buf, integ_len, &mic.len))
> - BUG();
> + return stat;
> if (mic.len > RPC_MAX_AUTH_SIZE)
> return stat;
> mic.data = kmalloc(mic.len, GFP_KERNEL);
> @@ -1611,8 +1613,10 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
> BUG_ON(integ_len % 4);
> *p++ = htonl(integ_len);
> *p++ = htonl(gc->gc_seq);
> - if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len))
> - BUG();
> + if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len)) {
> + WARN_ON_ONCE(1);
> + goto out_err;
> + }
> if (resbuf->tail[0].iov_base == NULL) {
> if (resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE > PAGE_SIZE)
> goto out_err;
What about the following BUG() at net/sunrpc/svc_xprt.c:1058:
/*
* Remove a dead transport
*/
static void svc_delete_xprt(struct svc_xprt *xprt)
{
struct svc_serv *serv = xprt->xpt_server;
struct svc_deferred_req *dr;
/* Only do this once */
if (test_and_set_bit(XPT_DEAD, &xprt->xpt_flags))
BUG();
dprintk("svc: svc_delete_xprt(%p)\n", xprt);
xprt->xpt_ops->xpo_detach(xprt);
spin_lock_bh(&serv->sv_lock);
list_del_init(&xprt->xpt_list);
WARN_ON_ONCE(!list_empty(&xprt->xpt_ready));
if (test_bit(XPT_TEMP, &xprt->xpt_flags))
serv->sv_tmpcnt--;
spin_unlock_bh(&serv->sv_lock);
while ((dr = svc_deferred_dequeue(xprt)) != NULL)
kfree(dr);
call_xpt_users(xprt);
svc_xprt_put(xprt);
}
I'm suspicious about that comment above the _if_ condition: /* Only do
this once */
Would it help to replace that BUG with a WARN_ON_ONCE?
Thanks
^ permalink raw reply
* [PATCH net-next v3 04/10] devlink: Adding max PF MSI-X vectors perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT permanent config
parameter. Value is permanent, so becomes the new default value
for this device.
Value sets the maximum number of PF MSI-X vectors.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
include/uapi/linux/devlink.h | 3 +++
net/core/devlink.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index db512c5..5877ff9 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -262,10 +262,13 @@ enum devlink_dpipe_header_id {
* 1 = enable SR-IOV
* DEVLINK_PERM_CONFIG_NUM_VF_PER_PF:
* # of VFs per PF in SR-IOV mode
+ * DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT:
+ * Max # of MSI-X vectors per PF
*/
enum devlink_perm_config_param {
DEVLINK_PERM_CONFIG_SRIOV_ENABLED,
DEVLINK_PERM_CONFIG_NUM_VF_PER_PF,
+ DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT,
__DEVLINK_PERM_CONFIG_MAX,
DEVLINK_PERM_CONFIG_MAX = __DEVLINK_PERM_CONFIG_MAX - 1
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 18f2600..284e167 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1571,6 +1571,7 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1];
static const u8 devlink_perm_cfg_param_types[DEVLINK_PERM_CONFIG_MAX + 1] = {
[DEVLINK_PERM_CONFIG_SRIOV_ENABLED] = NLA_U8,
[DEVLINK_PERM_CONFIG_NUM_VF_PER_PF] = NLA_U32,
+ [DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT] = NLA_U32,
};
static int devlink_nl_single_param_get(struct sk_buff *msg,
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 02/10] devlink: Adding SR-IOV enablement perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding DEVLINK_PERM_CONFIG_SRIOV_ENABLED permanent config
parameter. Value is permanent, so becomes the new default
value for this device.
0 = Disable SR-IOV
1 = Enable SR-IOV
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
include/uapi/linux/devlink.h | 8 +++++++-
net/core/devlink.c | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 28ea961..ed520e7 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -256,8 +256,14 @@ enum devlink_dpipe_header_id {
DEVLINK_DPIPE_HEADER_IPV6,
};
-/* Permanent config parameters */
+/* Permanent config parameters:
+ * DEVLINK_PERM_CONFIG_SRIOV_ENABLED:
+ * 0 = disable SR-IOV
+ * 1 = enable SR-IOV
+ */
enum devlink_perm_config_param {
+ DEVLINK_PERM_CONFIG_SRIOV_ENABLED,
+
__DEVLINK_PERM_CONFIG_MAX,
DEVLINK_PERM_CONFIG_MAX = __DEVLINK_PERM_CONFIG_MAX - 1
};
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 4deb4da..58ba715 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1569,6 +1569,7 @@ static int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb,
static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1];
static const u8 devlink_perm_cfg_param_types[DEVLINK_PERM_CONFIG_MAX + 1] = {
+ [DEVLINK_PERM_CONFIG_SRIOV_ENABLED] = NLA_U8,
};
static int devlink_nl_single_param_get(struct sk_buff *msg,
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 00/10] Adding permanent config get/set to devlink
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
Changes since v2:
* Removed references to "NVRAM" in comments / commits.
* Add parameter descriptions to header file.
* Split bnxt patch into infrastructure, then one patch
for each new parameter.
* Cleaned up goofs (unused parameters leftover from v1)
* Used enum rather than u32 in prototype for perm_config_get()
and _set().
* Defined DEVLINK_ATTR_PERM_CONFIG_TYPE so future parameters
can use arbitrary types (not just U32 and smaller).
* Reverse Christmas tree local variable definitions.
* No longer return original/previous value of parameter in
response to set.
* Check parameter within enum limits before using it as array
index.
I have NOT implemented the following suggested changes:
* Have driver report what parameters and parameter options it
supports. Could be done in future patch by defining new
devlink op.
* Support parameters spread across multi-part netlink messages.
See discussion on list - this doesn't seem necessary even
for devices with large number of parameters.
* Support specifying per-VF config, if the VFs don't have
pci b/d/f associated with them. See discussion on list;
if/when this support is required, could add
DEVLINK_ATTR_PERM_CONFIG_VF_INDEX to describe, without
breaking UAPI.
* Rolling back previously set parameters in a collection of
sets, when one fails. Instead, we report back to user
which sets were successful, so they know which were set
and which weren't, and can decide how to proceed.
--
Adds a devlink command for getting & setting permanent /
persistent device configuration parameters, and enumerates
the parameters as nested devlink attributes.
bnxt driver patches makes use of these new devlink cmds.
Steve Lin (10):
devlink: Add permanent config parameter get/set operations
devlink: Adding SR-IOV enablement perm config param
devlink: Adding num VFs per PF permanent config param
devlink: Adding max PF MSI-X vectors perm config param
devlink: Adding num MSI-X vectors per VF perm config param
bnxt: Add devlink support for config get/set
bnxt: Adding SR-IOV enablement permanent cfg param
bnxt: Adding num VFs per PF perm config param
bnxt: Adding max PF MSI-X vectors perm config param
bnxt: Adding num MSI-X vectors per VF perm config param
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 281 +++++++++++++++++++-
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 17 ++
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 100 ++++++++
include/net/devlink.h | 6 +
include/uapi/linux/devlink.h | 33 +++
net/core/devlink.c | 299 ++++++++++++++++++++++
6 files changed, 730 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH net-next v3 03/10] devlink: Adding num VFs per PF permanent config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding DEVLINK_PERM_CONFIG_NUM_VF_PER_PF permanent config
parameter. Value is permanent, so becomes the new default
value for this device.
The value sets the number of VFs per PF in SR-IOV mode.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
include/uapi/linux/devlink.h | 3 +++
net/core/devlink.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index ed520e7..db512c5 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -260,9 +260,12 @@ enum devlink_dpipe_header_id {
* DEVLINK_PERM_CONFIG_SRIOV_ENABLED:
* 0 = disable SR-IOV
* 1 = enable SR-IOV
+ * DEVLINK_PERM_CONFIG_NUM_VF_PER_PF:
+ * # of VFs per PF in SR-IOV mode
*/
enum devlink_perm_config_param {
DEVLINK_PERM_CONFIG_SRIOV_ENABLED,
+ DEVLINK_PERM_CONFIG_NUM_VF_PER_PF,
__DEVLINK_PERM_CONFIG_MAX,
DEVLINK_PERM_CONFIG_MAX = __DEVLINK_PERM_CONFIG_MAX - 1
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 58ba715..18f2600 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1570,6 +1570,7 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1];
static const u8 devlink_perm_cfg_param_types[DEVLINK_PERM_CONFIG_MAX + 1] = {
[DEVLINK_PERM_CONFIG_SRIOV_ENABLED] = NLA_U8,
+ [DEVLINK_PERM_CONFIG_NUM_VF_PER_PF] = NLA_U32,
};
static int devlink_nl_single_param_get(struct sk_buff *msg,
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 01/10] devlink: Add permanent config parameter get/set operations
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Add support for permanent config parameter get/set commands. Used
for persistent device configuration parameters.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
include/net/devlink.h | 6 +
include/uapi/linux/devlink.h | 18 +++
net/core/devlink.c | 295 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 319 insertions(+)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index b9654e1..eb86031 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -270,6 +270,12 @@ struct devlink_ops {
int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode);
int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode);
int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode);
+ int (*perm_config_get)(struct devlink *devlink,
+ enum devlink_perm_config_param param, u8 type,
+ void *value);
+ int (*perm_config_set)(struct devlink *devlink,
+ enum devlink_perm_config_param param, u8 type,
+ void *value, u8 *restart_reqd);
};
static inline void *devlink_priv(struct devlink *devlink)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 0cbca96..28ea961 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -70,6 +70,10 @@ enum devlink_command {
DEVLINK_CMD_DPIPE_HEADERS_GET,
DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,
+ /* Permanent device config get/set */
+ DEVLINK_CMD_PERM_CONFIG_GET,
+ DEVLINK_CMD_PERM_CONFIG_SET,
+
/* add new commands above here */
__DEVLINK_CMD_MAX,
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
@@ -202,6 +206,14 @@ enum devlink_attr {
DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */
+ /* Permanent Configuration Parameters */
+ DEVLINK_ATTR_PERM_CONFIGS, /* nested */
+ DEVLINK_ATTR_PERM_CONFIG, /* nested */
+ DEVLINK_ATTR_PERM_CONFIG_PARAMETER, /* u32 */
+ DEVLINK_ATTR_PERM_CONFIG_TYPE, /* u8 */
+ DEVLINK_ATTR_PERM_CONFIG_VALUE, /* dynamic */
+ DEVLINK_ATTR_PERM_CONFIG_RESTART_REQUIRED, /* u8 */
+
/* add new attributes above here, update the policy in devlink.c */
__DEVLINK_ATTR_MAX,
@@ -244,4 +256,10 @@ enum devlink_dpipe_header_id {
DEVLINK_DPIPE_HEADER_IPV6,
};
+/* Permanent config parameters */
+enum devlink_perm_config_param {
+ __DEVLINK_PERM_CONFIG_MAX,
+ DEVLINK_PERM_CONFIG_MAX = __DEVLINK_PERM_CONFIG_MAX - 1
+};
+
#endif /* _UAPI_LINUX_DEVLINK_H_ */
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 7d430c1..4deb4da 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1566,6 +1566,285 @@ static int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb,
return 0;
}
+static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1];
+
+static const u8 devlink_perm_cfg_param_types[DEVLINK_PERM_CONFIG_MAX + 1] = {
+};
+
+static int devlink_nl_single_param_get(struct sk_buff *msg,
+ struct devlink *devlink,
+ u32 param, u8 type)
+{
+ const struct devlink_ops *ops = devlink->ops;
+ struct nlattr *param_attr;
+ void *value;
+ u32 val;
+ int err;
+
+ /* Allocate buffer for parameter value */
+ switch (type) {
+ case NLA_U8:
+ value = kmalloc(sizeof(u8), GFP_KERNEL);
+ break;
+ case NLA_U16:
+ value = kmalloc(sizeof(u16), GFP_KERNEL);
+ break;
+ case NLA_U32:
+ value = kmalloc(sizeof(u32), GFP_KERNEL);
+ break;
+ default:
+ return -EINVAL; /* Unsupported Type */
+ }
+
+ if (!value)
+ return -ENOMEM;
+
+ err = ops->perm_config_get(devlink, param, type, value);
+ if (err)
+ return err;
+
+ param_attr = nla_nest_start(msg, DEVLINK_ATTR_PERM_CONFIG);
+ if (!param_attr)
+ goto nonest_err;
+
+ if (nla_put_u32(msg, DEVLINK_ATTR_PERM_CONFIG_PARAMETER, param) ||
+ nla_put_u8(msg, DEVLINK_ATTR_PERM_CONFIG_TYPE, type))
+ goto nest_err;
+
+ switch (type) {
+ case NLA_U8:
+ val = *((u8 *)value);
+ if (nla_put_u8(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
+ goto nest_err;
+ break;
+ case NLA_U16:
+ val = *((u16 *)value);
+ if (nla_put_u16(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
+ goto nest_err;
+ break;
+ case NLA_U32:
+ val = *((u32 *)value);
+ if (nla_put_u32(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
+ goto nest_err;
+ break;
+ }
+ nla_nest_end(msg, param_attr);
+
+ kfree(value);
+
+ return err;
+
+nest_err:
+ nla_nest_cancel(msg, param_attr);
+nonest_err:
+ kfree(value);
+
+ return -EMSGSIZE;
+}
+
+static int devlink_nl_config_get_fill(struct sk_buff *msg,
+ struct devlink *devlink,
+ enum devlink_command cmd,
+ struct genl_info *info)
+{
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1];
+ struct nlattr *cfgparam_attr;
+ struct nlattr *attr;
+ void *hdr;
+ u32 param;
+ int err;
+ int rem;
+ u8 type;
+
+ hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq,
+ &devlink_nl_family, 0, cmd);
+ if (!hdr)
+ return -EMSGSIZE;
+
+ err = devlink_nl_put_handle(msg, devlink);
+ if (err)
+ goto nla_put_failure;
+
+ if (!info->attrs[DEVLINK_ATTR_PERM_CONFIGS]) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ cfgparam_attr = nla_nest_start(msg, DEVLINK_ATTR_PERM_CONFIGS);
+
+ nla_for_each_nested(attr, info->attrs[DEVLINK_ATTR_PERM_CONFIGS],
+ rem) {
+ err = nla_parse_nested(tb, DEVLINK_ATTR_MAX, attr,
+ devlink_nl_policy, NULL);
+ if (err)
+ goto nla_nest_failure;
+ if (!tb[DEVLINK_ATTR_PERM_CONFIG_PARAMETER] ||
+ !tb[DEVLINK_ATTR_PERM_CONFIG_TYPE])
+ continue;
+
+ param = nla_get_u32(tb[DEVLINK_ATTR_PERM_CONFIG_PARAMETER]);
+ type = nla_get_u8(tb[DEVLINK_ATTR_PERM_CONFIG_TYPE]);
+ if (param > DEVLINK_PERM_CONFIG_MAX ||
+ type > NLA_TYPE_MAX) {
+ continue;
+ }
+ /* Note if single_param_get fails, that param won't be in
+ * response msg, so caller will know which param(s) failed to
+ * get.
+ */
+ devlink_nl_single_param_get(msg, devlink, param, type);
+ }
+
+ nla_nest_end(msg, cfgparam_attr);
+
+ genlmsg_end(msg, hdr);
+ return 0;
+
+nla_nest_failure:
+ nla_nest_cancel(msg, cfgparam_attr);
+nla_put_failure:
+ genlmsg_cancel(msg, hdr);
+ return err;
+}
+
+static int devlink_nl_cmd_perm_config_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
+{
+ struct devlink *devlink = info->user_ptr[0];
+ struct sk_buff *msg;
+ int err;
+
+ if (!devlink->ops || !devlink->ops->perm_config_get)
+ return -EOPNOTSUPP;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+
+ err = devlink_nl_config_get_fill(msg, devlink,
+ DEVLINK_CMD_PERM_CONFIG_GET, info);
+
+ if (err) {
+ nlmsg_free(msg);
+ return err;
+ }
+
+ return genlmsg_reply(msg, info);
+}
+
+static int devlink_nl_single_param_set(struct sk_buff *msg,
+ struct devlink *devlink,
+ u32 param, u8 type, void *value)
+{
+ const struct devlink_ops *ops = devlink->ops;
+ struct nlattr *cfgparam_attr;
+ u8 need_restart;
+ int err;
+
+ /* Now set parameter */
+ err = ops->perm_config_set(devlink, param, type, value, &need_restart);
+ if (err)
+ return err;
+
+ cfgparam_attr = nla_nest_start(msg, DEVLINK_ATTR_PERM_CONFIG);
+ /* Update restart reqd - if any param needs restart, should be set */
+ if (need_restart) {
+ err = nla_put_u8(msg,
+ DEVLINK_ATTR_PERM_CONFIG_RESTART_REQUIRED, 1);
+ if (err)
+ goto nest_fail;
+ }
+
+ /* Since set was successful, write attr back to msg */
+ err = nla_put_u32(msg, DEVLINK_ATTR_PERM_CONFIG_PARAMETER, param);
+ if (err)
+ goto nest_fail;
+
+ nla_nest_end(msg, cfgparam_attr);
+
+ return 0;
+
+nest_fail:
+ nla_nest_cancel(msg, cfgparam_attr);
+ return err;
+}
+
+static int devlink_nl_cmd_perm_config_set_doit(struct sk_buff *skb,
+ struct genl_info *info)
+{
+ struct devlink *devlink = info->user_ptr[0];
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1];
+ struct nlattr *cfgparam_attr;
+ struct sk_buff *msg;
+ struct nlattr *attr;
+ void *value;
+ void *hdr;
+ u32 param;
+ u8 type;
+ int rem;
+ int err;
+
+ if (!devlink->ops || !devlink->ops->perm_config_get ||
+ !devlink->ops->perm_config_set)
+ return -EOPNOTSUPP;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+
+ hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq,
+ &devlink_nl_family, 0, DEVLINK_CMD_PERM_CONFIG_SET);
+ if (!hdr) {
+ err = -EMSGSIZE;
+ goto nla_msg_failure;
+ }
+
+ err = devlink_nl_put_handle(msg, devlink);
+ if (err)
+ goto nla_put_failure;
+
+ cfgparam_attr = nla_nest_start(msg, DEVLINK_ATTR_PERM_CONFIGS);
+
+ nla_for_each_nested(attr, info->attrs[DEVLINK_ATTR_PERM_CONFIGS], rem) {
+ err = nla_parse_nested(tb, DEVLINK_ATTR_MAX, attr,
+ devlink_nl_policy, NULL);
+ if (err)
+ goto nla_nest_failure;
+
+ if (!tb[DEVLINK_ATTR_PERM_CONFIG_PARAMETER] ||
+ !tb[DEVLINK_ATTR_PERM_CONFIG_TYPE] ||
+ !tb[DEVLINK_ATTR_PERM_CONFIG_VALUE])
+ continue;
+
+ param = nla_get_u32(tb[DEVLINK_ATTR_PERM_CONFIG_PARAMETER]);
+ type = nla_get_u8(tb[DEVLINK_ATTR_PERM_CONFIG_TYPE]);
+ if (param > DEVLINK_PERM_CONFIG_MAX ||
+ type > NLA_TYPE_MAX) {
+ continue;
+ }
+
+ value = nla_data(tb[DEVLINK_ATTR_PERM_CONFIG_VALUE]);
+
+ /* Note if single_param_set fails, that param won't be in
+ * response msg, so caller will know which param(s) failed to
+ * set.
+ */
+ devlink_nl_single_param_set(msg, devlink, param, type, value);
+ }
+
+ nla_nest_end(msg, cfgparam_attr);
+
+ genlmsg_end(msg, hdr);
+ return genlmsg_reply(msg, info);
+
+nla_nest_failure:
+ nla_nest_cancel(msg, cfgparam_attr);
+nla_put_failure:
+ genlmsg_cancel(msg, hdr);
+nla_msg_failure:
+ return err;
+}
+
int devlink_dpipe_match_put(struct sk_buff *skb,
struct devlink_dpipe_match *match)
{
@@ -2291,6 +2570,8 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = { .type = NLA_U8 },
[DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .type = NLA_NUL_STRING },
[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = { .type = NLA_U8 },
+ [DEVLINK_ATTR_PERM_CONFIG_PARAMETER] = { .type = NLA_U32 },
+ [DEVLINK_ATTR_PERM_CONFIG_TYPE] = { .type = NLA_U8 },
};
static const struct genl_ops devlink_nl_ops[] = {
@@ -2451,6 +2732,20 @@ static const struct genl_ops devlink_nl_ops[] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
},
+ {
+ .cmd = DEVLINK_CMD_PERM_CONFIG_GET,
+ .doit = devlink_nl_cmd_perm_config_get_doit,
+ .policy = devlink_nl_policy,
+ .flags = GENL_ADMIN_PERM,
+ .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
+ },
+ {
+ .cmd = DEVLINK_CMD_PERM_CONFIG_SET,
+ .doit = devlink_nl_cmd_perm_config_set_doit,
+ .policy = devlink_nl_policy,
+ .flags = GENL_ADMIN_PERM,
+ .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
+ },
};
static struct genl_family devlink_nl_family __ro_after_init = {
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 09/10] bnxt: Adding max PF MSI-X vectors perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding permanent config parameter for maximum number of PF
MSI-X vectors.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index 55913c4..c6e670c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -20,12 +20,16 @@
* 1 = enable SR-IOV
* DEVLINK_PERM_CONFIG_NUM_VF_PER_PF:
* # of VFs per PF in SR-IOV mode
+ * DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT:
+ * Max # of MSI-X vectors per PF
*/
struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
{DEVLINK_PERM_CONFIG_SRIOV_ENABLED, BNXT_DRV_PF,
BNXT_DRV_APPL_SHARED, 1, 401},
{DEVLINK_PERM_CONFIG_NUM_VF_PER_PF, BNXT_DRV_PF,
BNXT_DRV_APPL_FUNCTION, 8, 404},
+ {DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT, BNXT_DRV_PF,
+ BNXT_DRV_APPL_SHARED, 10, 108},
};
#define BNXT_NUM_DRV_CFGPARAM ARRAY_SIZE(bnxt_drv_cfgparam_list)
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 08/10] bnxt: Adding num VFs per PF perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding permanent config parameter for number of VFs per PF,
using devlink API for get/set operation.
Value sets the number of VFs per PF in SR-IOV mode.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index 6eb80c1..55913c4 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -18,10 +18,14 @@
* DEVLINK_PERM_CONFIG_SRIOV_ENABLED:
* 0 = disable SR-IOV
* 1 = enable SR-IOV
+ * DEVLINK_PERM_CONFIG_NUM_VF_PER_PF:
+ * # of VFs per PF in SR-IOV mode
*/
struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
{DEVLINK_PERM_CONFIG_SRIOV_ENABLED, BNXT_DRV_PF,
BNXT_DRV_APPL_SHARED, 1, 401},
+ {DEVLINK_PERM_CONFIG_NUM_VF_PER_PF, BNXT_DRV_PF,
+ BNXT_DRV_APPL_FUNCTION, 8, 404},
};
#define BNXT_NUM_DRV_CFGPARAM ARRAY_SIZE(bnxt_drv_cfgparam_list)
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 06/10] bnxt: Add devlink support for config get/set
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Implements get and set of configuration parameters using new devlink
config get/set API. Parameters themselves defined in later patches.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 262 +++++++++++++++++++++-
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 17 ++
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 100 +++++++++
3 files changed, 373 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index f3f6aa8..81ab77e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -14,11 +14,261 @@
#include "bnxt_vfr.h"
#include "bnxt_devlink.h"
-static const struct devlink_ops bnxt_dl_ops = {
+struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
+};
+
+#define BNXT_NUM_DRV_CFGPARAM ARRAY_SIZE(bnxt_drv_cfgparam_list)
+
+static int bnxt_nvm_read(struct bnxt *bp, int nvm_param, int idx,
+ void *buf, int size)
+{
+ struct hwrm_nvm_get_variable_input req = {0};
+ dma_addr_t dest_data_dma_addr;
+ void *dest_data_addr = NULL;
+ int bytesize;
+ int rc;
+
+ bytesize = (size + 7) / BITS_PER_BYTE;
+ dest_data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize,
+ &dest_data_dma_addr, GFP_KERNEL);
+ if (!dest_data_addr) {
+ netdev_err(bp->dev, "dma_alloc_coherent failure\n");
+ return -ENOMEM;
+ }
+
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_VARIABLE, -1, -1);
+ req.dest_data_addr = cpu_to_le64(dest_data_dma_addr);
+ req.data_len = cpu_to_le16(size);
+ req.option_num = cpu_to_le16(nvm_param);
+ req.index_0 = cpu_to_le16(idx);
+ if (idx != 0)
+ req.dimensions = cpu_to_le16(1);
+
+ rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+
+ memcpy(buf, dest_data_addr, bytesize);
+
+ dma_free_coherent(&bp->pdev->dev, bytesize, dest_data_addr,
+ dest_data_dma_addr);
+
+ return rc;
+}
+
+static int bnxt_nvm_write(struct bnxt *bp, int nvm_param, int idx,
+ const void *buf, int size)
+{
+ struct hwrm_nvm_set_variable_input req = {0};
+ dma_addr_t src_data_dma_addr;
+ void *src_data_addr = NULL;
+ int bytesize;
+ int rc;
+
+ bytesize = (size + 7) / BITS_PER_BYTE;
+
+ src_data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize,
+ &src_data_dma_addr, GFP_KERNEL);
+ if (!src_data_addr) {
+ netdev_err(bp->dev, "dma_alloc_coherent failure\n");
+ return -ENOMEM;
+ }
+
+ memcpy(src_data_addr, buf, bytesize);
+
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_SET_VARIABLE, -1, -1);
+ req.src_data_addr = cpu_to_le64(src_data_dma_addr);
+ req.data_len = cpu_to_le16(size);
+ req.option_num = cpu_to_le16(nvm_param);
+ req.index_0 = cpu_to_le16(idx);
+ if (idx != 0)
+ req.dimensions = cpu_to_le16(1);
+
+ rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+
+ dma_free_coherent(&bp->pdev->dev, bytesize, src_data_addr,
+ src_data_dma_addr);
+
+ return 0;
+}
+
+static int bnxt_dl_perm_config_set(struct devlink *devlink,
+ enum devlink_perm_config_param param,
+ u8 type, void *value, u8 *restart_reqd)
+{
+ struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
+ struct bnxt_drv_cfgparam *entry;
+ int idx = 0;
+ int ret = 0;
+ u32 bytesize;
+ u32 val32;
+ u16 val16;
+ u8 val8;
+ int i;
+
+ *restart_reqd = 0;
+
+ /* Find parameter in table */
+ for (i = 0; i < BNXT_NUM_DRV_CFGPARAM; i++) {
+ if (param == bnxt_drv_cfgparam_list[i].param) {
+ entry = &bnxt_drv_cfgparam_list[i];
+ break;
+ }
+ }
+
+ /* Not found */
+ if (i == BNXT_NUM_DRV_CFGPARAM)
+ return -EINVAL;
+
+ /* Check to see if this func type can access variable */
+ if (BNXT_PF(bp) && !(entry->func & BNXT_DRV_PF))
+ return -EOPNOTSUPP;
+ if (BNXT_VF(bp) && !(entry->func & BNXT_DRV_VF))
+ return -EOPNOTSUPP;
+
+ /* If parameter is per port or function, compute index */
+ if (entry->appl == BNXT_DRV_APPL_PORT) {
+ idx = bp->pf.port_id;
+ } else if (entry->appl == BNXT_DRV_APPL_FUNCTION) {
+ if (BNXT_PF(bp))
+ idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;
+ }
+
+ bytesize = (entry->bitlength + 7) / BITS_PER_BYTE;
+
+ /* If passed in type matches bytesize, pass value directly */
+ if ((bytesize == 1 && type == NLA_U8) ||
+ (bytesize == 2 && type == NLA_U16) ||
+ (bytesize == 4 && type == NLA_U32)) {
+ ret = bnxt_nvm_write(bp, entry->nvm_param, idx, value,
+ entry->bitlength);
+ } else {
+ /* Otherwise copy value to u32, then to driver type */
+ if (type == NLA_U8) {
+ memcpy(&val8, value, sizeof(val8));
+ val32 = val8;
+ } else if (type == NLA_U16) {
+ memcpy(&val16, value, sizeof(val16));
+ val32 = val16;
+ } else if (type == NLA_U32) {
+ memcpy(&val32, value, sizeof(val32));
+ } else {
+ /* Unsupported type */
+ return -EINVAL;
+ }
+
+ if (bytesize == 1) {
+ val8 = val32;
+ ret = bnxt_nvm_write(bp, entry->nvm_param, idx, &val8,
+ entry->bitlength);
+ } else if (bytesize == 2) {
+ val16 = val32;
+ ret = bnxt_nvm_write(bp, entry->nvm_param, idx, &val16,
+ entry->bitlength);
+ } else {
+ ret = bnxt_nvm_write(bp, entry->nvm_param, idx, &val32,
+ entry->bitlength);
+ }
+ }
+
+ /* Restart required for all nvm parameter writes */
+ *restart_reqd = 1;
+
+ return ret;
+}
+
+static int bnxt_dl_perm_config_get(struct devlink *devlink,
+ enum devlink_perm_config_param param,
+ u8 type, void *value)
+{
+ struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
+ struct bnxt_drv_cfgparam *entry;
+ u32 bytesize;
+ int idx = 0;
+ int err = 0;
+ void *data;
+ u32 val32;
+ u16 val16;
+ u8 val8;
+ int i;
+
+ /* Find parameter in table */
+ for (i = 0; i < BNXT_NUM_DRV_CFGPARAM; i++) {
+ if (param == bnxt_drv_cfgparam_list[i].param) {
+ entry = &bnxt_drv_cfgparam_list[i];
+ break;
+ }
+ }
+
+ /* Not found */
+ if (i == BNXT_NUM_DRV_CFGPARAM)
+ return -EINVAL;
+
+ /* Check to see if this func type can access variable */
+ if (BNXT_PF(bp) && !(entry->func & BNXT_DRV_PF))
+ return -EOPNOTSUPP;
+ if (BNXT_VF(bp) && !(entry->func & BNXT_DRV_VF))
+ return -EOPNOTSUPP;
+
+ /* If parameter is per port or function, compute index */
+ if (entry->appl == BNXT_DRV_APPL_PORT) {
+ idx = bp->pf.port_id;
+ } else if (entry->appl == BNXT_DRV_APPL_FUNCTION) {
+ if (BNXT_PF(bp))
+ idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;
+ }
+
+ /* Allocate space, retrieve value, and copy to result */
+ bytesize = (entry->bitlength + 7) / BITS_PER_BYTE;
+ data = kmalloc(bytesize, GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+ err = bnxt_nvm_read(bp, entry->nvm_param, idx, data, entry->bitlength);
+ if (err)
+ goto err_data;
+
+ /* if bytesize matches type requested, just copy data */
+ if ((bytesize == 1 && type == NLA_U8) ||
+ (bytesize == 2 && type == NLA_U16) ||
+ (bytesize == 4 && type == NLA_U32)) {
+ memcpy(value, data, bytesize);
+ } else {
+ /* Otherwise copy data to u32, then to requested type */
+ if (bytesize == 1) {
+ memcpy(&val8, data, sizeof(val8));
+ val32 = val8;
+ } else if (bytesize == 2) {
+ memcpy(&val16, data, sizeof(val16));
+ val32 = val16;
+ } else {
+ memcpy(&val32, data, sizeof(val32));
+ }
+
+ if (type == NLA_U8) {
+ val8 = val32;
+ memcpy(value, &val8, sizeof(val8));
+ } else if (type == NLA_U16) {
+ val16 = val32;
+ memcpy(value, &val16, sizeof(val16));
+ } else if (type == NLA_U32) {
+ memcpy(value, &val32, sizeof(val32));
+ } else {
+ /* Unsupported type */
+ err = -EINVAL;
+ }
+ }
+
+err_data:
+ kfree(data);
+
+ return err;
+}
+
+static struct devlink_ops bnxt_dl_ops = {
#ifdef CONFIG_BNXT_SRIOV
.eswitch_mode_set = bnxt_dl_eswitch_mode_set,
.eswitch_mode_get = bnxt_dl_eswitch_mode_get,
#endif /* CONFIG_BNXT_SRIOV */
+ .perm_config_get = bnxt_dl_perm_config_get,
+ .perm_config_set = bnxt_dl_perm_config_set,
};
int bnxt_dl_register(struct bnxt *bp)
@@ -26,12 +276,12 @@ int bnxt_dl_register(struct bnxt *bp)
struct devlink *dl;
int rc;
- if (!pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV))
- return 0;
-
- if (bp->hwrm_spec_code < 0x10800) {
+ if ((!pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV)) ||
+ bp->hwrm_spec_code < 0x10800) {
+ /* eswitch switchdev mode not supported */
+ bnxt_dl_ops.eswitch_mode_set = NULL;
+ bnxt_dl_ops.eswitch_mode_get = NULL;
netdev_warn(bp->dev, "Firmware does not support SR-IOV E-Switch SWITCHDEV mode.\n");
- return -ENOTSUPP;
}
dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
index e92a35d..d843a81 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
@@ -10,6 +10,23 @@
#ifndef BNXT_DEVLINK_H
#define BNXT_DEVLINK_H
+#define BNXT_DRV_PF 1
+#define BNXT_DRV_VF 2
+
+enum bnxt_drv_appl {
+ BNXT_DRV_APPL_SHARED,
+ BNXT_DRV_APPL_PORT,
+ BNXT_DRV_APPL_FUNCTION
+};
+
+struct bnxt_drv_cfgparam {
+ enum devlink_perm_config_param param;
+ u8 func; /* BNXT_DRV_PF | BNXT_DRV_VF */
+ enum bnxt_drv_appl appl; /* applicability (shared, func, port) */
+ u32 bitlength; /* length, in bits */
+ u32 nvm_param;
+};
+
/* Struct to hold housekeeping info needed by devlink interface */
struct bnxt_dl {
struct bnxt *bp; /* back ptr to the controlling dev */
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h
index cb04cc7..8c25731 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h
@@ -5676,6 +5676,106 @@ struct hwrm_nvm_install_update_cmd_err {
u8 unused_0[7];
};
+/* hwrm_nvm_get_variable */
+/* Input (40 bytes) */
+struct hwrm_nvm_get_variable_input {
+ __le16 req_type;
+ __le16 cmpl_ring;
+ __le16 seq_id;
+ __le16 target_id;
+ __le64 resp_addr;
+ __le64 dest_data_addr;
+ __le16 data_len;
+ __le16 option_num;
+ #define NVM_GET_VARIABLE_REQ_OPTION_NUM_RSVD_0 0x0UL
+ #define NVM_GET_VARIABLE_REQ_OPTION_NUM_RSVD_FFFF 0xffffUL
+ __le16 dimensions;
+ __le16 index_0;
+ __le16 index_1;
+ __le16 index_2;
+ __le16 index_3;
+ u8 flags;
+ #define NVM_GET_VARIABLE_REQ_FLAGS_FACTORY_DFLT 0x1UL
+ u8 unused_0;
+};
+
+/* Output (16 bytes) */
+struct hwrm_nvm_get_variable_output {
+ __le16 error_code;
+ __le16 req_type;
+ __le16 seq_id;
+ __le16 resp_len;
+ __le16 data_len;
+ __le16 option_num;
+ #define NVM_GET_VARIABLE_RESP_OPTION_NUM_RSVD_0 0x0UL
+ #define NVM_GET_VARIABLE_RESP_OPTION_NUM_RSVD_FFFF 0xffffUL
+ u8 unused_0;
+ u8 unused_1;
+ u8 unused_2;
+ u8 valid;
+};
+
+/* Command specific Error Codes (8 bytes) */
+struct hwrm_nvm_get_variable_cmd_err {
+ u8 code;
+ #define NVM_GET_VARIABLE_CMD_ERR_CODE_UNKNOWN 0x0UL
+ #define NVM_GET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST 0x1UL
+ #define NVM_GET_VARIABLE_CMD_ERR_CODE_CORRUPT_VAR 0x2UL
+ #define NVM_GET_VARIABLE_CMD_ERR_CODE_LEN_TOO_SHORT 0x3UL
+ u8 unused_0[7];
+};
+
+/* hwrm_nvm_set_variable */
+/* Input (40 bytes) */
+struct hwrm_nvm_set_variable_input {
+ __le16 req_type;
+ __le16 cmpl_ring;
+ __le16 seq_id;
+ __le16 target_id;
+ __le64 resp_addr;
+ __le64 src_data_addr;
+ __le16 data_len;
+ __le16 option_num;
+ #define NVM_SET_VARIABLE_REQ_OPTION_NUM_RSVD_0 0x0UL
+ #define NVM_SET_VARIABLE_REQ_OPTION_NUM_RSVD_FFFF 0xffffUL
+ __le16 dimensions;
+ __le16 index_0;
+ __le16 index_1;
+ __le16 index_2;
+ __le16 index_3;
+ u8 flags;
+ #define NVM_SET_VARIABLE_REQ_FLAGS_FORCE_FLUSH 0x1UL
+ #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_MASK 0xeUL
+ #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_SFT 1
+ #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_NONE (0x0UL << 1)
+ #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_HMAC_SHA1 (0x1UL << 1)
+ #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_LAST \
+ NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_HMAC_SHA1
+ u8 unused_0;
+};
+
+/* Output (16 bytes) */
+struct hwrm_nvm_set_variable_output {
+ __le16 error_code;
+ __le16 req_type;
+ __le16 seq_id;
+ __le16 resp_len;
+ __le32 unused_0;
+ u8 unused_1;
+ u8 unused_2;
+ u8 unused_3;
+ u8 valid;
+};
+
+/* Command specific Error Codes (8 bytes) */
+struct hwrm_nvm_set_variable_cmd_err {
+ u8 code;
+ #define NVM_SET_VARIABLE_CMD_ERR_CODE_UNKNOWN 0x0UL
+ #define NVM_SET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST 0x1UL
+ #define NVM_SET_VARIABLE_CMD_ERR_CODE_CORRUPT_VAR 0x2UL
+ u8 unused_0[7];
+};
+
/* hwrm_selftest_qlist */
/* Input (16 bytes) */
struct hwrm_selftest_qlist_input {
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 10/10] bnxt: Adding num MSI-X vectors per VF perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding permanent config parameter for number MSI-X vectors
per VF, using devlink API for get/set operation.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index c6e670c..620a207 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -22,6 +22,8 @@
* # of VFs per PF in SR-IOV mode
* DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT:
* Max # of MSI-X vectors per PF
+ * DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF:
+ * # of MSI-X vectors per VF
*/
struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
{DEVLINK_PERM_CONFIG_SRIOV_ENABLED, BNXT_DRV_PF,
@@ -30,6 +32,8 @@ struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
BNXT_DRV_APPL_FUNCTION, 8, 404},
{DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT, BNXT_DRV_PF,
BNXT_DRV_APPL_SHARED, 10, 108},
+ {DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF, BNXT_DRV_PF,
+ BNXT_DRV_APPL_FUNCTION, 10, 406},
};
#define BNXT_NUM_DRV_CFGPARAM ARRAY_SIZE(bnxt_drv_cfgparam_list)
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 07/10] bnxt: Adding SR-IOV enablement permanent cfg param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding permanent config parameter for SR-IOV enablement, using
devlink API for get/set operation.
0 = SR-IOV disabled
1 = SR-IOV enabled
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index 81ab77e..6eb80c1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -14,7 +14,14 @@
#include "bnxt_vfr.h"
#include "bnxt_devlink.h"
+/* Permanent config parameters from devlink.h:
+ * DEVLINK_PERM_CONFIG_SRIOV_ENABLED:
+ * 0 = disable SR-IOV
+ * 1 = enable SR-IOV
+ */
struct bnxt_drv_cfgparam bnxt_drv_cfgparam_list[] = {
+ {DEVLINK_PERM_CONFIG_SRIOV_ENABLED, BNXT_DRV_PF,
+ BNXT_DRV_APPL_SHARED, 1, 401},
};
#define BNXT_NUM_DRV_CFGPARAM ARRAY_SIZE(bnxt_drv_cfgparam_list)
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 05/10] devlink: Adding num MSI-X vectors per VF perm config param
From: Steve Lin @ 2017-10-24 20:12 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, michael.chan, linville, gospo, steven.lin1, yuvalm
In-Reply-To: <1508875962-39233-1-git-send-email-steven.lin1@broadcom.com>
Adding DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF permanent config
parameter. Value is permanent, so becomes the new default value
for this device.
Value defines number of MSI-X vectors allocated per VF.
Signed-off-by: Steve Lin <steven.lin1@broadcom.com>
Acked-by: Andy Gospodarek <gospo@broadcom.com>
---
include/uapi/linux/devlink.h | 3 +++
net/core/devlink.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 5877ff9..1b76e8f 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -264,11 +264,14 @@ enum devlink_dpipe_header_id {
* # of VFs per PF in SR-IOV mode
* DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT:
* Max # of MSI-X vectors per PF
+ * DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF:
+ * # of MSI-X vectors per VF
*/
enum devlink_perm_config_param {
DEVLINK_PERM_CONFIG_SRIOV_ENABLED,
DEVLINK_PERM_CONFIG_NUM_VF_PER_PF,
DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT,
+ DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF,
__DEVLINK_PERM_CONFIG_MAX,
DEVLINK_PERM_CONFIG_MAX = __DEVLINK_PERM_CONFIG_MAX - 1
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 284e167..07d64da 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1572,6 +1572,7 @@ static const u8 devlink_perm_cfg_param_types[DEVLINK_PERM_CONFIG_MAX + 1] = {
[DEVLINK_PERM_CONFIG_SRIOV_ENABLED] = NLA_U8,
[DEVLINK_PERM_CONFIG_NUM_VF_PER_PF] = NLA_U32,
[DEVLINK_PERM_CONFIG_MAX_NUM_PF_MSIX_VECT] = NLA_U32,
+ [DEVLINK_PERM_CONFIG_MSIX_VECTORS_PER_VF] = NLA_U32,
};
static int devlink_nl_single_param_get(struct sk_buff *msg,
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v14 5/5] PCI: Remove PCI pool macro functions
From: Bjorn Helgaas @ 2017-10-24 20:18 UTC (permalink / raw)
To: Romain Perier
Cc: Jens Axboe, Andrew Morton, Dan Williams, Vinod Koul, Jeff Kirsher,
Aviad Krawczyk, Bjorn Helgaas, linux-pci, dmaengine, netdev,
linux-kernel, Romain Perier
In-Reply-To: <20171023175958.8327-6-romain.perier@gmail.com>
On Mon, Oct 23, 2017 at 07:59:58PM +0200, Romain Perier wrote:
> From: Romain Perier <romain.perier@collabora.com>
>
> Now that all the drivers use dma pool API, we can remove the macro
> functions for PCI pool.
>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Since this barely touches drivers/pci and linux-pci wasn't copied
until v14, I assume you're planning to merge this via some other tree.
Let me know if you need anything else from me.
> ---
> include/linux/pci.h | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 80eaa2dbe3e9..a827f6eb54db 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1325,15 +1325,6 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
> #include <linux/pci-dma.h>
> #include <linux/dmapool.h>
>
> -#define pci_pool dma_pool
> -#define pci_pool_create(name, pdev, size, align, allocation) \
> - dma_pool_create(name, &pdev->dev, size, align, allocation)
> -#define pci_pool_destroy(pool) dma_pool_destroy(pool)
> -#define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
> -#define pci_pool_zalloc(pool, flags, handle) \
> - dma_pool_zalloc(pool, flags, handle)
> -#define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
> -
> struct msix_entry {
> u32 vector; /* kernel uses to write allocated vector */
> u16 entry; /* driver uses to specify entry, OS writes */
> --
> 2.14.1
>
^ permalink raw reply
* Re: [RFC PATCH 3/5] sctp: Add LSM hooks
From: Richard Haines @ 2017-10-24 20:27 UTC (permalink / raw)
To: Xin Long
Cc: Neil Horman, selinux, network dev, linux-sctp,
linux-security-module
In-Reply-To: <CADvbK_cLGA4PH_c4FB0eSUAMoV0XgtyA++cTFsGDkb=nvtR68g@mail.gmail.com>
On Fri, 2017-10-20 at 21:14 +0800, Xin Long wrote:
> On Fri, Oct 20, 2017 at 8:04 PM, Richard Haines
> <richard_c_haines@btinternet.com> wrote:
> > On Fri, 2017-10-20 at 07:16 -0400, Neil Horman wrote:
> > > On Wed, Oct 18, 2017 at 11:05:09PM +0800, Xin Long wrote:
> > > > On Tue, Oct 17, 2017 at 9:58 PM, Richard Haines
> > > > <richard_c_haines@btinternet.com> wrote:
> > > > > Add security hooks to allow security modules to exercise
> > > > > access
> > > > > control
> > > > > over SCTP.
> > > > >
> > > > > Signed-off-by: Richard Haines <richard_c_haines@btinternet.co
> > > > > m>
> > > > > ---
> > > > > include/net/sctp/structs.h | 10 ++++++++
> > > > > include/uapi/linux/sctp.h | 1 +
> > > > > net/sctp/sm_make_chunk.c | 12 +++++++++
> > > > > net/sctp/sm_statefuns.c | 14 ++++++++++-
> > > > > net/sctp/socket.c | 61
> > > > > +++++++++++++++++++++++++++++++++++++++++++++-
> > > > > 5 files changed, 96 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/include/net/sctp/structs.h
> > > > > b/include/net/sctp/structs.h
> > > > > index 7767577..6e72e3e 100644
> > > > > --- a/include/net/sctp/structs.h
> > > > > +++ b/include/net/sctp/structs.h
> > > > > @@ -1270,6 +1270,16 @@ struct sctp_endpoint {
> > > > > reconf_enable:1;
> > > > >
> > > > > __u8 strreset_enable;
> > > > > +
> > > > > + /* Security identifiers from incoming (INIT). These
> > > > > are
> > > > > set by
> > > > > + * security_sctp_assoc_request(). These will only be
> > > > > used
> > > > > by
> > > > > + * SCTP TCP type sockets and peeled off connections
> > > > > as
> > > > > they
> > > > > + * cause a new socket to be generated.
> > > > > security_sctp_sk_clone()
> > > > > + * will then plug these into the new socket.
> > > > > + */
> > > > > +
> > > > > + u32 secid;
> > > > > + u32 peer_secid;
> > > > > };
> > > > >
> > > > > /* Recover the outter endpoint structure. */
> > > > > diff --git a/include/uapi/linux/sctp.h
> > > > > b/include/uapi/linux/sctp.h
> > > > > index 6217ff8..c04812f 100644
> > > > > --- a/include/uapi/linux/sctp.h
> > > > > +++ b/include/uapi/linux/sctp.h
> > > > > @@ -122,6 +122,7 @@ typedef __s32 sctp_assoc_t;
> > > > > #define SCTP_RESET_ASSOC 120
> > > > > #define SCTP_ADD_STREAMS 121
> > > > > #define SCTP_SOCKOPT_PEELOFF_FLAGS 122
> > > > > +#define SCTP_SENDMSG_CONNECT 123
> > > > >
> > > > > /* PR-SCTP policies */
> > > > > #define SCTP_PR_SCTP_NONE 0x0000
> > > > > diff --git a/net/sctp/sm_make_chunk.c
> > > > > b/net/sctp/sm_make_chunk.c
> > > > > index 6110447..ca4705b 100644
> > > > > --- a/net/sctp/sm_make_chunk.c
> > > > > +++ b/net/sctp/sm_make_chunk.c
> > > > > @@ -3059,6 +3059,12 @@ static __be16
> > > > > sctp_process_asconf_param(struct sctp_association *asoc,
> > > > > if (af->is_any(&addr))
> > > > > memcpy(&addr, &asconf->source,
> > > > > sizeof(addr));
> > > > >
> > > > > + if (security_sctp_bind_connect(asoc->ep-
> > > > > >base.sk,
> > > > > + SCTP_PARAM_ADD
> > > > > _IP,
> > > > > + (struct
> > > > > sockaddr
> > > > > *)&addr,
> > > > > + af-
> > > > > >sockaddr_len))
> > > > > + return SCTP_ERROR_REQ_REFUSED;
> > > > > +
> > > > > /* ADDIP 4.3 D9) If an endpoint receives an
> > > > > ADD
> > > > > IP address
> > > > > * request and does not have the local
> > > > > resources
> > > > > to add this
> > > > > * new address to the association, it MUST
> > > > > return
> > > > > an Error
> > > > > @@ -3125,6 +3131,12 @@ static __be16
> > > > > sctp_process_asconf_param(struct sctp_association *asoc,
> > > > > if (af->is_any(&addr))
> > > > > memcpy(&addr.v4, sctp_source(asconf),
> > > > > sizeof(addr));
> > > > >
> > > > > + if (security_sctp_bind_connect(asoc->ep-
> > > > > >base.sk,
> > > > > + SCTP_PARAM_SET
> > > > > _PRI
> > > > > MARY,
> > > > > + (struct
> > > > > sockaddr
> > > > > *)&addr,
> > > > > + af-
> > > > > >sockaddr_len))
> > > > > + return SCTP_ERROR_REQ_REFUSED;
> > > > > +
> > > > > peer = sctp_assoc_lookup_paddr(asoc, &addr);
> > > > > if (!peer)
> > > > > return SCTP_ERROR_DNS_FAILED;
> > > > > diff --git a/net/sctp/sm_statefuns.c
> > > > > b/net/sctp/sm_statefuns.c
> > > > > index b2a74c3..4ba5805 100644
> > > > > --- a/net/sctp/sm_statefuns.c
> > > > > +++ b/net/sctp/sm_statefuns.c
> > > > > @@ -314,6 +314,11 @@ sctp_disposition_t
> > > > > sctp_sf_do_5_1B_init(struct net *net,
> > > > > sctp_unrecognized_param_t *unk_param;
> > > > > int len;
> > > > >
> > > > > + /* Update socket peer label if first association. */
> > > > > + if (security_sctp_assoc_request((struct sctp_endpoint
> > > > > *)ep,
> > > > > + chunk->skb,
> > > > > SCTP_CID_INIT))
> > > > > + return sctp_sf_pdiscard(net, ep, asoc, type,
> > > > > arg,
> > > > > commands);
> > > > > +
> > > > > /* 6.10 Bundling
> > > > > * An endpoint MUST NOT bundle INIT, INIT ACK or
> > > > > * SHUTDOWN COMPLETE with any other chunks.
> > > > > @@ -446,7 +451,6 @@ sctp_disposition_t
> > > > > sctp_sf_do_5_1B_init(struct net *net,
> > > > > }
> > > > >
> > > > > sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC,
> > > > > SCTP_ASOC(new_asoc));
> > > > > -
> > > > > sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
> > > > > SCTP_CHUNK(repl));
> > > > >
> > > > > /*
> > > > > @@ -507,6 +511,11 @@ sctp_disposition_t
> > > > > sctp_sf_do_5_1C_ack(struct net *net,
> > > > > struct sctp_chunk *err_chunk;
> > > > > struct sctp_packet *packet;
> > > > >
> > > > > + /* Update socket peer label if first association. */
> > > > > + if (security_sctp_assoc_request((struct sctp_endpoint
> > > > > *)ep,
> > > > > + chunk->skb,
> > > > > SCTP_CID_INIT_ACK))
> > > > > + return sctp_sf_pdiscard(net, ep, asoc, type,
> > > > > arg,
> > > > > commands);
> > > > > +
> > > >
> > > > Just thinking security_sctp_assoc_request hook should also be
> > > > in
> > > > sctp_sf_do_unexpected_init() and sctp_sf_do_5_2_4_dupcook() ?
> > >
> > > I agree, i think if this hook is gating on the creation of a new
> > > association,
> > > they should be in all the locations where that happens
> > > Neil
> >
> > Thanks for the comments. I've just added the hook as requested for
> > my
> > next update, however I have not managed to trigger these areas
> > using
> > the lksctp-tools tests. Can you suggest any suitable tools for
> > testing
> > these scenarios.
>
> It's all a matter of timing:
>
> sctp_sf_do_5_2_2_dupinit():
> Case A:
>
> Endpoint A Endpoint B ULP
> (CLOSED) (CLOSED)
>
> INIT ----------------->
>
> <----------------- INIT-ACK
>
> COOKIE-ECHO ----------------->
>
> <----------------- COOKIE-ACK
> Communication Up ---------->
> INIT ----------------->
> (Different INIT-TAG)
> <----------------- INIT-ACK
>
> COOKIE-ECHO ----------------->
>
> <----------------- COOKIE-ACK
>
> DATA ----------------->
>
> <----------------- SACK
>
>
> sctp_sf_do_5_2_1_siminit():
> Case B:
>
> Endpoint A Endpoint B ULP
> (CLOSED) (CLOSED)
>
> <--
> --- Associate
> <----------------- INIT
>
> INIT ----------------->
>
> <----------------- INIT-ACK
>
> COOKIE-ECHO ----------------->
>
> <----------------- COOKIE-ACK
> Communication Up ---------->
>
>
> sctp_sf_do_5_2_4_dupcook():
> Case D:
>
> Endpoint A Endpoint B ULP
> (CLOSED) (CLOSED)
>
> <--
> --- Associate
> INIT ----------------->
>
> <----------------- INIT-ACK
>
> COOKIE-ECHO ----------------->
>
> <----------------- COOKIE-ACK
> Communication Up ---------->
> COOKIE-ECHO ----------------->
>
> <----------------- COOKIE-ACK
>
> I think scapy could help with 4-shake stuff:
> # iptables -A OUTPUT -p sctp -d 192.0.0.2 --chunk-type only abort -o
> eth1 -j DROP
> and
> something like:
> def start_assoc(self, target, local):
> target_host, target_port = target
> local_host, local_port = local
>
> # init snd
> self._tsn = 2017
> self._cnt = 15
>
> SCTP_HEADER = (IP(dst=target_host, flags="DF") /
> SCTP(sport=local_port, dport=target_port, tag=0))
> INIT = (SCTP_HEADER / SCTPChunkInit(init_tag=1,
> a_rwnd=106496, n_out_streams=self._cnt, n_in_streams=self._cnt,
> init_tsn=self._tsn,
>
> params=[SCTPParamSupport(types=[64])]))
> INIT_ACK = sr1(INIT, timeout=3, verbose=0)
> if INIT_ACK == None or not
> INIT_ACK.haslayer(SCTPChunkInitAck):
> return False
>
> # cookie echo snd
> SCTP_HEADER[SCTP].tag =
> INIT_ACK[SCTPChunkInitAck].init_tag
> COOKIE_ECHO = (SCTP_HEADER /
> SCTPChunkCookieEcho(cookie=INIT_ACK[SCTPChunkParamStateCookie].cookie
> ))
> COOKIE_ACK = sr1(COOKIE_ECHO, timeout=3, verbose=0)
> if COOKIE_ACK == None or not
> COOKIE_ACK.haslayer(SCTPChunkCookieAck):
> return False
That looks a bit complicated for me so I found some SCTP Conformance
Test Tools at: https://github.com/nplab
I added the required hooks as suggested above and then built and ran
"ETSI-SCTP-Conformance-Testsuite" and "sctp-tests" with the following
specific tests for the above scenarios according to RFC2960 sections
5.2.2 and 5.2.4:
sctp-dm-o-4-8
sctp-as-o-1-9-1
sctp-as-o-1-9-2
sctp-dm-o-4-2-1
They all passed except when running:
"sctp-tests" runsctptest sctp-as-o-1-9-2 - TIMEOUT
This is because the SUT needs to reply with a new IP address that
required a modified test server (I just used a simple sctp server),
however the ETSI-SCTP-Conformance-Testsuite did pass as I guess that
provided the required IP address.
Are these tests okay ??
Does anyone on the list use these conformance tools ???
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox