* [PATCH net-next] net: stmmac: Add support for CBS QDISC
@ 2018-06-27 12:43 Jose Abreu
2018-06-27 14:15 ` kbuild test robot
2018-06-30 9:39 ` David Miller
0 siblings, 2 replies; 8+ messages in thread
From: Jose Abreu @ 2018-06-27 12:43 UTC (permalink / raw)
To: netdev
Cc: Jose Abreu, David S. Miller, Joao Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
This adds support for CBS reconfiguration using the TC application.
A new callback was added to TC ops struct and another one to DMA ops to
reconfigure the channel mode.
Tested in GMAC5.10.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Vitor Soares <soares@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 15 ++++++
drivers/net/ethernet/stmicro/stmmac/hwif.h | 8 +++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 62 +++++++++++++++++++++++
4 files changed, 87 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index d37f17ca62fe..6e32f8a3710b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -407,6 +407,19 @@ static void dwmac4_enable_tso(void __iomem *ioaddr, bool en, u32 chan)
}
}
+static void dwmac4_qmode(void __iomem *ioaddr, u32 channel, u8 qmode)
+{
+ u32 mtl_tx_op = readl(ioaddr + MTL_CHAN_TX_OP_MODE(channel));
+
+ mtl_tx_op &= ~MTL_OP_MODE_TXQEN_MASK;
+ if (qmode != MTL_QUEUE_AVB)
+ mtl_tx_op |= MTL_OP_MODE_TXQEN;
+ else
+ mtl_tx_op |= MTL_OP_MODE_TXQEN_AV;
+
+ writel(mtl_tx_op, ioaddr + MTL_CHAN_TX_OP_MODE(channel));
+}
+
const struct stmmac_dma_ops dwmac4_dma_ops = {
.reset = dwmac4_dma_reset,
.init = dwmac4_dma_init,
@@ -431,6 +444,7 @@ const struct stmmac_dma_ops dwmac4_dma_ops = {
.set_rx_tail_ptr = dwmac4_set_rx_tail_ptr,
.set_tx_tail_ptr = dwmac4_set_tx_tail_ptr,
.enable_tso = dwmac4_enable_tso,
+ .qmode = dwmac4_qmode,
};
const struct stmmac_dma_ops dwmac410_dma_ops = {
@@ -457,4 +471,5 @@ const struct stmmac_dma_ops dwmac410_dma_ops = {
.set_rx_tail_ptr = dwmac4_set_rx_tail_ptr,
.set_tx_tail_ptr = dwmac4_set_tx_tail_ptr,
.enable_tso = dwmac4_enable_tso,
+ .qmode = dwmac4_qmode,
};
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index e44e7b26ce82..e2a965790648 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -183,6 +183,7 @@ struct stmmac_dma_ops {
void (*set_rx_tail_ptr)(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
void (*set_tx_tail_ptr)(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
void (*enable_tso)(void __iomem *ioaddr, bool en, u32 chan);
+ void (*qmode)(void __iomem *ioaddr, u32 channel, u8 qmode);
};
#define stmmac_reset(__priv, __args...) \
@@ -235,6 +236,8 @@ struct stmmac_dma_ops {
stmmac_do_void_callback(__priv, dma, set_tx_tail_ptr, __args)
#define stmmac_enable_tso(__priv, __args...) \
stmmac_do_void_callback(__priv, dma, enable_tso, __args)
+#define stmmac_dma_qmode(__priv, __args...) \
+ stmmac_do_void_callback(__priv, dma, qmode, __args)
struct mac_device_info;
struct net_device;
@@ -441,17 +444,22 @@ struct stmmac_mode_ops {
struct stmmac_priv;
struct tc_cls_u32_offload;
+struct tc_cbs_qopt_offload;
struct stmmac_tc_ops {
int (*init)(struct stmmac_priv *priv);
int (*setup_cls_u32)(struct stmmac_priv *priv,
struct tc_cls_u32_offload *cls);
+ int (*setup_cbs)(struct stmmac_priv *priv,
+ struct tc_cbs_qopt_offload *qopt);
};
#define stmmac_tc_init(__priv, __args...) \
stmmac_do_callback(__priv, tc, init, __args)
#define stmmac_tc_setup_cls_u32(__priv, __args...) \
stmmac_do_callback(__priv, tc, setup_cls_u32, __args)
+#define stmmac_tc_setup_cbs(__priv, __args...) \
+ stmmac_do_callback(__priv, tc, setup_cbs, __args)
struct stmmac_regs_off {
u32 ptp_off;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ccf3e2e161ca..a6be3b59a728 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3778,6 +3778,8 @@ static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
switch (type) {
case TC_SETUP_BLOCK:
return stmmac_setup_tc_block(priv, type_data);
+ case TC_SETUP_QDISC_CBS:
+ return stmmac_tc_setup_cbs(priv, priv, type_data);
default:
return -EOPNOTSUPP;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 881c94b73e2f..67542bd21010 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -289,7 +289,69 @@ static int tc_init(struct stmmac_priv *priv)
return 0;
}
+static int tc_setup_cbs(struct stmmac_priv *priv,
+ struct tc_cbs_qopt_offload *qopt)
+{
+ u32 tx_queues_count = priv->plat->tx_queues_to_use;
+ u32 queue = qopt->queue;
+ u32 ptr, speed_div;
+ u32 mode_to_use;
+ s64 value;
+ int ret;
+
+ /* Queue 0 is not AVB capable */
+ if (queue <= 0 || queue >= tx_queues_count)
+ return -EINVAL;
+ if (priv->speed != SPEED_100 && priv->speed != SPEED_1000)
+ return -EOPNOTSUPP;
+
+ mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
+ if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {
+ ret = stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_AVB);
+ if (ret)
+ return ret;
+
+ priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
+ } else if (!qopt->enable) {
+ return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
+ }
+
+ /* Port Transmit Rate and Speed Divider */
+ ptr = (priv->speed == SPEED_100) ? 4 : 8;
+ speed_div = (priv->speed == SPEED_100) ? 100000 : 1000000;
+
+ /* Final adjustments for HW */
+ value = qopt->idleslope * 1024 * ptr;
+ do_div(value, speed_div);
+ priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
+
+ value = -qopt->sendslope * 1024UL * ptr;
+ do_div(value, speed_div);
+ priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
+
+ value = qopt->hicredit * 1024 * 8;
+ priv->plat->tx_queues_cfg[queue].high_credit = value & GENMASK(31, 0);
+
+ value = qopt->locredit * 1024 * 8;
+ priv->plat->tx_queues_cfg[queue].low_credit = value & GENMASK(31, 0);
+
+ ret = stmmac_config_cbs(priv, priv->hw,
+ priv->plat->tx_queues_cfg[queue].send_slope,
+ priv->plat->tx_queues_cfg[queue].idle_slope,
+ priv->plat->tx_queues_cfg[queue].high_credit,
+ priv->plat->tx_queues_cfg[queue].low_credit,
+ queue);
+ if (ret)
+ return ret;
+
+ dev_info(priv->device, "CBS queue %d: send %d, idle %d, hi %d, lo %d\n",
+ queue, qopt->sendslope, qopt->idleslope,
+ qopt->hicredit, qopt->locredit);
+ return 0;
+}
+
const struct stmmac_tc_ops dwmac510_tc_ops = {
.init = tc_init,
.setup_cls_u32 = tc_setup_cls_u32,
+ .setup_cbs = tc_setup_cbs,
};
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 12:43 [PATCH net-next] net: stmmac: Add support for CBS QDISC Jose Abreu
@ 2018-06-27 14:15 ` kbuild test robot
2018-06-27 14:32 ` Jose Abreu
2018-06-30 9:39 ` David Miller
1 sibling, 1 reply; 8+ messages in thread
From: kbuild test robot @ 2018-06-27 14:15 UTC (permalink / raw)
To: Jose Abreu
Cc: kbuild-all, netdev, Jose Abreu, David S. Miller, Joao Pinto,
Vitor Soares, Giuseppe Cavallaro, Alexandre Torgue
[-- Attachment #1: Type: text/plain, Size: 4313 bytes --]
Hi Jose,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jose-Abreu/net-stmmac-Add-support-for-CBS-QDISC/20180627-214704
config: sh-allyesconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=sh
All warnings (new ones prefixed by >>):
In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
from include/linux/kernel.h:174,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/net/pkt_cls.h:6,
from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
do_div(value, speed_div);
^~~~~~
include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:329:2: note: in expansion of macro 'do_div'
do_div(value, speed_div);
^~~~~~
vim +/do_div +325 drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c
291
292 static int tc_setup_cbs(struct stmmac_priv *priv,
293 struct tc_cbs_qopt_offload *qopt)
294 {
295 u32 tx_queues_count = priv->plat->tx_queues_to_use;
296 u32 queue = qopt->queue;
297 u32 ptr, speed_div;
298 u32 mode_to_use;
299 s64 value;
300 int ret;
301
302 /* Queue 0 is not AVB capable */
303 if (queue <= 0 || queue >= tx_queues_count)
304 return -EINVAL;
305 if (priv->speed != SPEED_100 && priv->speed != SPEED_1000)
306 return -EOPNOTSUPP;
307
308 mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
309 if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {
310 ret = stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_AVB);
311 if (ret)
312 return ret;
313
314 priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
315 } else if (!qopt->enable) {
316 return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
317 }
318
319 /* Port Transmit Rate and Speed Divider */
320 ptr = (priv->speed == SPEED_100) ? 4 : 8;
321 speed_div = (priv->speed == SPEED_100) ? 100000 : 1000000;
322
323 /* Final adjustments for HW */
324 value = qopt->idleslope * 1024 * ptr;
> 325 do_div(value, speed_div);
326 priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
327
328 value = -qopt->sendslope * 1024UL * ptr;
329 do_div(value, speed_div);
330 priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
331
332 value = qopt->hicredit * 1024 * 8;
333 priv->plat->tx_queues_cfg[queue].high_credit = value & GENMASK(31, 0);
334
335 value = qopt->locredit * 1024 * 8;
336 priv->plat->tx_queues_cfg[queue].low_credit = value & GENMASK(31, 0);
337
338 ret = stmmac_config_cbs(priv, priv->hw,
339 priv->plat->tx_queues_cfg[queue].send_slope,
340 priv->plat->tx_queues_cfg[queue].idle_slope,
341 priv->plat->tx_queues_cfg[queue].high_credit,
342 priv->plat->tx_queues_cfg[queue].low_credit,
343 queue);
344 if (ret)
345 return ret;
346
347 dev_info(priv->device, "CBS queue %d: send %d, idle %d, hi %d, lo %d\n",
348 queue, qopt->sendslope, qopt->idleslope,
349 qopt->hicredit, qopt->locredit);
350 return 0;
351 }
352
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48915 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 14:15 ` kbuild test robot
@ 2018-06-27 14:32 ` Jose Abreu
2018-06-27 14:36 ` Jose Abreu
2018-06-27 14:36 ` Geert Uytterhoeven
0 siblings, 2 replies; 8+ messages in thread
From: Jose Abreu @ 2018-06-27 14:32 UTC (permalink / raw)
To: kbuild test robot, Jose Abreu, linux-sh, Rich Felker,
Yoshinori Sato
Cc: kbuild-all, netdev, David S. Miller, Joao Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
++ SH Maintainers
++ SH ML
Hi SH Maintainers,
On 27-06-2018 15:15, kbuild test robot wrote:
> Hi Jose,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on net-next/master]
>
> url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jose-2DAbreu_net-2Dstmmac-2DAdd-2Dsupport-2Dfor-2DCBS-2DQDISC_20180627-2D214704&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=qW5_vbinGt0OnyDfQ2wtKdb2ZGzCcLwq6Fmlaki61xw&e=
> config: sh-allyesconfig (attached as .config)
> compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=4nNar4fgVZq0LjrPKIZP30nxVUY4yeu5QeyKbmlsu8A&e= -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.2.0 make.cross ARCH=sh
>
> All warnings (new ones prefixed by >>):
>
> In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
> from include/linux/kernel.h:174,
> from include/linux/list.h:9,
> from include/linux/timer.h:5,
> from include/linux/workqueue.h:9,
> from include/net/pkt_cls.h:6,
> from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> ^
>>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
> do_div(value, speed_div);
> ^~~~~~
> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
I'm not seeing the reason for this warning as I'm using a 64 bit
var. I guess the warning is appearing only because its signed
[see source bellow]. Is this not supported?
Thanks and Best Regards,
Jose Miguel Abreu
> ^
> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:329:2: note: in expansion of macro 'do_div'
> do_div(value, speed_div);
> ^~~~~~
>
> vim +/do_div +325 drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c
>
> 291
> 292 static int tc_setup_cbs(struct stmmac_priv *priv,
> 293 struct tc_cbs_qopt_offload *qopt)
> 294 {
> 295 u32 tx_queues_count = priv->plat->tx_queues_to_use;
> 296 u32 queue = qopt->queue;
> 297 u32 ptr, speed_div;
> 298 u32 mode_to_use;
> 299 s64 value;
> 300 int ret;
> 301
> 302 /* Queue 0 is not AVB capable */
> 303 if (queue <= 0 || queue >= tx_queues_count)
> 304 return -EINVAL;
> 305 if (priv->speed != SPEED_100 && priv->speed != SPEED_1000)
> 306 return -EOPNOTSUPP;
> 307
> 308 mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
> 309 if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {
> 310 ret = stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_AVB);
> 311 if (ret)
> 312 return ret;
> 313
> 314 priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
> 315 } else if (!qopt->enable) {
> 316 return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
> 317 }
> 318
> 319 /* Port Transmit Rate and Speed Divider */
> 320 ptr = (priv->speed == SPEED_100) ? 4 : 8;
> 321 speed_div = (priv->speed == SPEED_100) ? 100000 : 1000000;
> 322
> 323 /* Final adjustments for HW */
> 324 value = qopt->idleslope * 1024 * ptr;
> > 325 do_div(value, speed_div);
> 326 priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
> 327
> 328 value = -qopt->sendslope * 1024UL * ptr;
> 329 do_div(value, speed_div);
> 330 priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
> 331
> 332 value = qopt->hicredit * 1024 * 8;
> 333 priv->plat->tx_queues_cfg[queue].high_credit = value & GENMASK(31, 0);
> 334
> 335 value = qopt->locredit * 1024 * 8;
> 336 priv->plat->tx_queues_cfg[queue].low_credit = value & GENMASK(31, 0);
> 337
> 338 ret = stmmac_config_cbs(priv, priv->hw,
> 339 priv->plat->tx_queues_cfg[queue].send_slope,
> 340 priv->plat->tx_queues_cfg[queue].idle_slope,
> 341 priv->plat->tx_queues_cfg[queue].high_credit,
> 342 priv->plat->tx_queues_cfg[queue].low_credit,
> 343 queue);
> 344 if (ret)
> 345 return ret;
> 346
> 347 dev_info(priv->device, "CBS queue %d: send %d, idle %d, hi %d, lo %d\n",
> 348 queue, qopt->sendslope, qopt->idleslope,
> 349 qopt->hicredit, qopt->locredit);
> 350 return 0;
> 351 }
> 352
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_pipermail_kbuild-2Dall&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=yMjbhyNoi6ZESIohHtaqFOTXipZVefU7mA4Tfc5QPms&e= Intel Corporation
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 14:32 ` Jose Abreu
@ 2018-06-27 14:36 ` Jose Abreu
2018-06-27 14:36 ` Geert Uytterhoeven
1 sibling, 0 replies; 8+ messages in thread
From: Jose Abreu @ 2018-06-27 14:36 UTC (permalink / raw)
To: kbuild test robot, Jose Abreu, linux-sh, Rich Felker,
Yoshinori Sato, linux-kernel@vger.kernel.org
Cc: kbuild-all, netdev, David S. Miller, Joao Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
++ LKML because I just noticed this is using generic headers.
On 27-06-2018 15:32, Jose Abreu wrote:
> ++ SH Maintainers
> ++ SH ML
>
> Hi SH Maintainers,
>
> On 27-06-2018 15:15, kbuild test robot wrote:
>> Hi Jose,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on net-next/master]
>>
>> url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jose-2DAbreu_net-2Dstmmac-2DAdd-2Dsupport-2Dfor-2DCBS-2DQDISC_20180627-2D214704&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=qW5_vbinGt0OnyDfQ2wtKdb2ZGzCcLwq6Fmlaki61xw&e=
>> config: sh-allyesconfig (attached as .config)
>> compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
>> reproduce:
>> wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=4nNar4fgVZq0LjrPKIZP30nxVUY4yeu5QeyKbmlsu8A&e= -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # save the attached .config to linux build tree
>> GCC_VERSION=7.2.0 make.cross ARCH=sh
>>
>> All warnings (new ones prefixed by >>):
>>
>> In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
>> from include/linux/kernel.h:174,
>> from include/linux/list.h:9,
>> from include/linux/timer.h:5,
>> from include/linux/workqueue.h:9,
>> from include/net/pkt_cls.h:6,
>> from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
>> ^
>>>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
>> do_div(value, speed_div);
>> ^~~~~~
>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> I'm not seeing the reason for this warning as I'm using a 64 bit
> var. I guess the warning is appearing only because its signed
> [see source bellow]. Is this not supported?
>
> Thanks and Best Regards,
> Jose Miguel Abreu
>
>> ^
>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:329:2: note: in expansion of macro 'do_div'
>> do_div(value, speed_div);
>> ^~~~~~
>>
>> vim +/do_div +325 drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c
>>
>> 291
>> 292 static int tc_setup_cbs(struct stmmac_priv *priv,
>> 293 struct tc_cbs_qopt_offload *qopt)
>> 294 {
>> 295 u32 tx_queues_count = priv->plat->tx_queues_to_use;
>> 296 u32 queue = qopt->queue;
>> 297 u32 ptr, speed_div;
>> 298 u32 mode_to_use;
>> 299 s64 value;
>> 300 int ret;
>> 301
>> 302 /* Queue 0 is not AVB capable */
>> 303 if (queue <= 0 || queue >= tx_queues_count)
>> 304 return -EINVAL;
>> 305 if (priv->speed != SPEED_100 && priv->speed != SPEED_1000)
>> 306 return -EOPNOTSUPP;
>> 307
>> 308 mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
>> 309 if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {
>> 310 ret = stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_AVB);
>> 311 if (ret)
>> 312 return ret;
>> 313
>> 314 priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
>> 315 } else if (!qopt->enable) {
>> 316 return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
>> 317 }
>> 318
>> 319 /* Port Transmit Rate and Speed Divider */
>> 320 ptr = (priv->speed == SPEED_100) ? 4 : 8;
>> 321 speed_div = (priv->speed == SPEED_100) ? 100000 : 1000000;
>> 322
>> 323 /* Final adjustments for HW */
>> 324 value = qopt->idleslope * 1024 * ptr;
>> > 325 do_div(value, speed_div);
>> 326 priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
>> 327
>> 328 value = -qopt->sendslope * 1024UL * ptr;
>> 329 do_div(value, speed_div);
>> 330 priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
>> 331
>> 332 value = qopt->hicredit * 1024 * 8;
>> 333 priv->plat->tx_queues_cfg[queue].high_credit = value & GENMASK(31, 0);
>> 334
>> 335 value = qopt->locredit * 1024 * 8;
>> 336 priv->plat->tx_queues_cfg[queue].low_credit = value & GENMASK(31, 0);
>> 337
>> 338 ret = stmmac_config_cbs(priv, priv->hw,
>> 339 priv->plat->tx_queues_cfg[queue].send_slope,
>> 340 priv->plat->tx_queues_cfg[queue].idle_slope,
>> 341 priv->plat->tx_queues_cfg[queue].high_credit,
>> 342 priv->plat->tx_queues_cfg[queue].low_credit,
>> 343 queue);
>> 344 if (ret)
>> 345 return ret;
>> 346
>> 347 dev_info(priv->device, "CBS queue %d: send %d, idle %d, hi %d, lo %d\n",
>> 348 queue, qopt->sendslope, qopt->idleslope,
>> 349 qopt->hicredit, qopt->locredit);
>> 350 return 0;
>> 351 }
>> 352
>>
>> ---
>> 0-DAY kernel test infrastructure Open Source Technology Center
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_pipermail_kbuild-2Dall&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=yMjbhyNoi6ZESIohHtaqFOTXipZVefU7mA4Tfc5QPms&e= Intel Corporation
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 14:32 ` Jose Abreu
2018-06-27 14:36 ` Jose Abreu
@ 2018-06-27 14:36 ` Geert Uytterhoeven
2018-06-27 14:44 ` Jose Abreu
1 sibling, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2018-06-27 14:36 UTC (permalink / raw)
To: Jose.Abreu
Cc: kbuild test robot, Linux-sh list, Rich Felker, Yoshinori Sato,
kbuild-all, netdev, David S. Miller, Joao.Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
Hi Jose,
On Wed, Jun 27, 2018 at 4:32 PM Jose Abreu <Jose.Abreu@synopsys.com> wrote:
> ++ SH Maintainers
> ++ SH ML
>
> Hi SH Maintainers,
>
> On 27-06-2018 15:15, kbuild test robot wrote:
> > Hi Jose,
> >
> > I love your patch! Perhaps something to improve:
> >
> > [auto build test WARNING on net-next/master]
> >
> > url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jose-2DAbreu_net-2Dstmmac-2DAdd-2Dsupport-2Dfor-2DCBS-2DQDISC_20180627-2D214704&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=qW5_vbinGt0OnyDfQ2wtKdb2ZGzCcLwq6Fmlaki61xw&e=
> > config: sh-allyesconfig (attached as .config)
> > compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> > reproduce:
> > wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=4nNar4fgVZq0LjrPKIZP30nxVUY4yeu5QeyKbmlsu8A&e= -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # save the attached .config to linux build tree
> > GCC_VERSION=7.2.0 make.cross ARCH=sh
> >
> > All warnings (new ones prefixed by >>):
> >
> > In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
> > from include/linux/kernel.h:174,
> > from include/linux/list.h:9,
> > from include/linux/timer.h:5,
> > from include/linux/workqueue.h:9,
> > from include/net/pkt_cls.h:6,
> > from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
> > drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
> > include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> > ^
> >>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
> > do_div(value, speed_div);
> > ^~~~~~
> > include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
>
> I'm not seeing the reason for this warning as I'm using a 64 bit
> var. I guess the warning is appearing only because its signed
> [see source bellow]. Is this not supported?
No, the first parameter of do_div() must be u64, hence the check to
enforce that.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 14:36 ` Geert Uytterhoeven
@ 2018-06-27 14:44 ` Jose Abreu
2018-06-27 14:51 ` Geert Uytterhoeven
0 siblings, 1 reply; 8+ messages in thread
From: Jose Abreu @ 2018-06-27 14:44 UTC (permalink / raw)
To: Geert Uytterhoeven, Jose.Abreu
Cc: kbuild test robot, Linux-sh list, Rich Felker, Yoshinori Sato,
kbuild-all, netdev, David S. Miller, Joao.Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
Hi Geert,
On 27-06-2018 15:36, Geert Uytterhoeven wrote:
> Hi Jose,
>
> On Wed, Jun 27, 2018 at 4:32 PM Jose Abreu <Jose.Abreu@synopsys.com> wrote:
>> ++ SH Maintainers
>> ++ SH ML
>>
>> Hi SH Maintainers,
>>
>> On 27-06-2018 15:15, kbuild test robot wrote:
>>> Hi Jose,
>>>
>>> I love your patch! Perhaps something to improve:
>>>
>>> [auto build test WARNING on net-next/master]
>>>
>>> url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jose-2DAbreu_net-2Dstmmac-2DAdd-2Dsupport-2Dfor-2DCBS-2DQDISC_20180627-2D214704&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=qW5_vbinGt0OnyDfQ2wtKdb2ZGzCcLwq6Fmlaki61xw&e=
>>> config: sh-allyesconfig (attached as .config)
>>> compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
>>> reproduce:
>>> wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=4nNar4fgVZq0LjrPKIZP30nxVUY4yeu5QeyKbmlsu8A&e= -O ~/bin/make.cross
>>> chmod +x ~/bin/make.cross
>>> # save the attached .config to linux build tree
>>> GCC_VERSION=7.2.0 make.cross ARCH=sh
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>> In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
>>> from include/linux/kernel.h:174,
>>> from include/linux/list.h:9,
>>> from include/linux/timer.h:5,
>>> from include/linux/workqueue.h:9,
>>> from include/net/pkt_cls.h:6,
>>> from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
>>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
>>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
>>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
>>> ^
>>>>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
>>> do_div(value, speed_div);
>>> ^~~~~~
>>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
>>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
>> I'm not seeing the reason for this warning as I'm using a 64 bit
>> var. I guess the warning is appearing only because its signed
>> [see source bellow]. Is this not supported?
> No, the first parameter of do_div() must be u64, hence the check to
> enforce that.
Hmm ok. I guess I can use two variables then because the only
case value will be negative is with locredit and this does not
need the do_div.
Thanks for the clarification.
Thanks and Best Regards,
Jose Miguel Abreu
>
> Gr{oetje,eeting}s,
>
> Geert
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 14:44 ` Jose Abreu
@ 2018-06-27 14:51 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2018-06-27 14:51 UTC (permalink / raw)
To: Jose.Abreu
Cc: kbuild test robot, Linux-sh list, Rich Felker, Yoshinori Sato,
kbuild-all, netdev, David S. Miller, Joao.Pinto, Vitor Soares,
Giuseppe Cavallaro, Alexandre Torgue
Hi Jose,
On Wed, Jun 27, 2018 at 4:44 PM Jose Abreu <Jose.Abreu@synopsys.com> wrote:
> On 27-06-2018 15:36, Geert Uytterhoeven wrote:
> > On Wed, Jun 27, 2018 at 4:32 PM Jose Abreu <Jose.Abreu@synopsys.com> wrote:
> >> ++ SH Maintainers
> >> ++ SH ML
> >>
> >> Hi SH Maintainers,
> >>
> >> On 27-06-2018 15:15, kbuild test robot wrote:
> >>> Hi Jose,
> >>>
> >>> I love your patch! Perhaps something to improve:
> >>>
> >>> [auto build test WARNING on net-next/master]
> >>>
> >>> url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jose-2DAbreu_net-2Dstmmac-2DAdd-2Dsupport-2Dfor-2DCBS-2DQDISC_20180627-2D214704&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=qW5_vbinGt0OnyDfQ2wtKdb2ZGzCcLwq6Fmlaki61xw&e=
> >>> config: sh-allyesconfig (attached as .config)
> >>> compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> >>> reproduce:
> >>> wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=YIae3rrFzqYg_5b4eVIAXuyvT_EV0vKACS25rJugux8&s=4nNar4fgVZq0LjrPKIZP30nxVUY4yeu5QeyKbmlsu8A&e= -O ~/bin/make.cross
> >>> chmod +x ~/bin/make.cross
> >>> # save the attached .config to linux build tree
> >>> GCC_VERSION=7.2.0 make.cross ARCH=sh
> >>>
> >>> All warnings (new ones prefixed by >>):
> >>>
> >>> In file included from ./arch/sh/include/generated/asm/div64.h:1:0,
> >>> from include/linux/kernel.h:174,
> >>> from include/linux/list.h:9,
> >>> from include/linux/timer.h:5,
> >>> from include/linux/workqueue.h:9,
> >>> from include/net/pkt_cls.h:6,
> >>> from drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:7:
> >>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c: In function 'tc_setup_cbs':
> >>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> >>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> >>> ^
> >>>>> drivers/net//ethernet/stmicro/stmmac/stmmac_tc.c:325:2: note: in expansion of macro 'do_div'
> >>> do_div(value, speed_div);
> >>> ^~~~~~
> >>> include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer types lacks a cast
> >>> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> >> I'm not seeing the reason for this warning as I'm using a 64 bit
> >> var. I guess the warning is appearing only because its signed
> >> [see source bellow]. Is this not supported?
> > No, the first parameter of do_div() must be u64, hence the check to
> > enforce that.
>
> Hmm ok. I guess I can use two variables then because the only
> case value will be negative is with locredit and this does not
> need the do_div.
You can use div_s64_rem() or div_s64() (in include/linux/math64.h).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] net: stmmac: Add support for CBS QDISC
2018-06-27 12:43 [PATCH net-next] net: stmmac: Add support for CBS QDISC Jose Abreu
2018-06-27 14:15 ` kbuild test robot
@ 2018-06-30 9:39 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2018-06-30 9:39 UTC (permalink / raw)
To: Jose.Abreu
Cc: netdev, Joao.Pinto, Vitor.Soares, peppe.cavallaro,
alexandre.torgue
From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Wed, 27 Jun 2018 13:43:20 +0100
> This adds support for CBS reconfiguration using the TC application.
>
> A new callback was added to TC ops struct and another one to DMA ops to
> reconfigure the channel mode.
>
> Tested in GMAC5.10.
>
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-06-30 9:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-27 12:43 [PATCH net-next] net: stmmac: Add support for CBS QDISC Jose Abreu
2018-06-27 14:15 ` kbuild test robot
2018-06-27 14:32 ` Jose Abreu
2018-06-27 14:36 ` Jose Abreu
2018-06-27 14:36 ` Geert Uytterhoeven
2018-06-27 14:44 ` Jose Abreu
2018-06-27 14:51 ` Geert Uytterhoeven
2018-06-30 9:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox