* [PATCH v2 net-next 2/2] net: hns: fixes a bug of RSS
From: Kejian Yan @ 2016-03-10 13:21 UTC (permalink / raw)
To: davem
Cc: yisen.zhuang, salil.mehta, liguozhu, huangdaode, arnd,
andriy.shevchenko, andrew, chenny.xu, ivecera, lisheng011,
fengguang.wu, haifeng.wei, netdev, linux-kernel, linux-arm-kernel,
linuxarm
In-Reply-To: <1457616110-225844-1-git-send-email-yankejian@huawei.com>
If trying to get receive flow hash indirection table by ethtool, it needs
to call .get_rxnfc to get ring number first. So this patch implements the
.get_rxnfc of ethtool. And the data type of rss_indir_table is u32, it has
to be multiply by the width of data type when using memcpy.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
---
change log:
PATCH v2:
- This patch fixes the comments provided by Andy Shevchenko <Andy Shevchenko>
PATCH v1:
- first submit
Link: https://lkml.org/lkml/2016/3/9/981
---
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 6 ++++--
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index d07db1f..7b06e9b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -787,7 +787,8 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key,
memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE);
/* update the current hash->queue mappings from the shadow RSS table */
- memcpy(indir, ppe_cb->rss_indir_table, HNS_PPEV2_RSS_IND_TBL_SIZE);
+ memcpy(indir, ppe_cb->rss_indir_table,
+ HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
return 0;
}
@@ -802,7 +803,8 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir,
hns_ppe_set_rss_key(ppe_cb, (u32 *)key);
/* update the shadow RSS table with user specified qids */
- memcpy(ppe_cb->rss_indir_table, indir, HNS_PPEV2_RSS_IND_TBL_SIZE);
+ memcpy(ppe_cb->rss_indir_table, indir,
+ HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
/* now update the hardware */
hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3b914ac..24b2b5f 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -1253,6 +1253,23 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
return ops->set_rss(priv->ae_handle, indir, key, hfunc);
}
+static int hns_get_rxnfc(struct net_device *netdev,
+ struct ethtool_rxnfc *cmd,
+ u32 *rule_locs)
+{
+ struct hns_nic_priv *priv = netdev_priv(netdev);
+
+ switch (cmd->cmd) {
+ case ETHTOOL_GRXRINGS:
+ cmd->data = priv->ae_handle->q_num;
+ break;
+ default:
+ return -ERRNO;
+ }
+
+ return 0;
+}
+
static struct ethtool_ops hns_ethtool_ops = {
.get_drvinfo = hns_nic_get_drvinfo,
.get_link = hns_nic_get_link,
@@ -1276,6 +1293,7 @@ static struct ethtool_ops hns_ethtool_ops = {
.get_rxfh_indir_size = hns_get_rss_indir_size,
.get_rxfh = hns_get_rss,
.set_rxfh = hns_set_rss,
+ .get_rxnfc = hns_get_rxnfc,
};
void hns_ethtool_set_ops(struct net_device *ndev)
--
1.9.1
^ permalink raw reply related
* Re: [PATCH v2 net-next 1/2] net: hns: fix return value of the function about rss
From: kbuild test robot @ 2016-03-10 13:26 UTC (permalink / raw)
To: Kejian Yan
Cc: kbuild-all, davem, yisen.zhuang, salil.mehta, liguozhu,
huangdaode, arnd, andriy.shevchenko, andrew, chenny.xu, ivecera,
lisheng011, fengguang.wu, haifeng.wei, netdev, linux-kernel,
linux-arm-kernel, linuxarm
In-Reply-To: <1457616110-225844-2-git-send-email-yankejian@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 2813 bytes --]
Hi Kejian,
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Kejian-Yan/net-hns-get-and-set-RSS-indirection-table-by-using-ethtool/20160310-210648
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c: In function 'hns_get_rss':
>> drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1214:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c: In function 'hns_set_rss':
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1236:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
vim +/ret +1214 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
6bc0ce7d Salil 2015-12-03 1198 netdev_err(netdev,
6bc0ce7d Salil 2015-12-03 1199 "RSS feature is not supported on this hardware\n");
73f4f566 Kejian Yan 2016-03-10 1200 return (u32)-EOPNOTSUPP;
6bc0ce7d Salil 2015-12-03 1201 }
6bc0ce7d Salil 2015-12-03 1202
6bc0ce7d Salil 2015-12-03 1203 ops = priv->ae_handle->dev->ops;
6bc0ce7d Salil 2015-12-03 1204 ret = ops->get_rss_indir_size(priv->ae_handle);
6bc0ce7d Salil 2015-12-03 1205
6bc0ce7d Salil 2015-12-03 1206 return ret;
6bc0ce7d Salil 2015-12-03 1207 }
6bc0ce7d Salil 2015-12-03 1208
6bc0ce7d Salil 2015-12-03 1209 static int
6bc0ce7d Salil 2015-12-03 1210 hns_get_rss(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
6bc0ce7d Salil 2015-12-03 1211 {
6bc0ce7d Salil 2015-12-03 1212 struct hns_nic_priv *priv = netdev_priv(netdev);
6bc0ce7d Salil 2015-12-03 1213 struct hnae_ae_ops *ops;
6bc0ce7d Salil 2015-12-03 @1214 int ret;
6bc0ce7d Salil 2015-12-03 1215
6bc0ce7d Salil 2015-12-03 1216 if (AE_IS_VER1(priv->enet_ver)) {
6bc0ce7d Salil 2015-12-03 1217 netdev_err(netdev,
6bc0ce7d Salil 2015-12-03 1218 "RSS feature is not supported on this hardware\n");
6bc0ce7d Salil 2015-12-03 1219 return -EOPNOTSUPP;
6bc0ce7d Salil 2015-12-03 1220 }
6bc0ce7d Salil 2015-12-03 1221
6bc0ce7d Salil 2015-12-03 1222 ops = priv->ae_handle->dev->ops;
:::::: The code at line 1214 was first introduced by commit
:::::: 6bc0ce7d9adabf332afc102f7f97bf121b990ece net:hns: Add Hip06 "RSS(Receive Side Scaling)" support to HNS Driver
:::::: TO: Salil <salil.mehta@huawei.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 52478 bytes --]
^ permalink raw reply
* Re: [PATCH v2 net-next 2/2] net: hns: fixes a bug of RSS
From: kbuild test robot @ 2016-03-10 13:27 UTC (permalink / raw)
To: Kejian Yan
Cc: kbuild-all, davem, yisen.zhuang, salil.mehta, liguozhu,
huangdaode, arnd, andriy.shevchenko, andrew, chenny.xu, ivecera,
lisheng011, fengguang.wu, haifeng.wei, netdev, linux-kernel,
linux-arm-kernel, linuxarm
In-Reply-To: <1457616110-225844-3-git-send-email-yankejian@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]
Hi Kejian,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Kejian-Yan/net-hns-get-and-set-RSS-indirection-table-by-using-ethtool/20160310-210648
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c: In function 'hns_get_rss':
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1214:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c: In function 'hns_set_rss':
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1236:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c: In function 'hns_get_rxnfc':
>> drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1267:11: error: 'ERRNO' undeclared (first use in this function)
return -ERRNO;
^
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c:1267:11: note: each undeclared identifier is reported only once for each function it appears in
vim +/ERRNO +1267 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
1208
1209 static int
1210 hns_get_rss(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
1211 {
1212 struct hns_nic_priv *priv = netdev_priv(netdev);
1213 struct hnae_ae_ops *ops;
> 1214 int ret;
1215
1216 if (AE_IS_VER1(priv->enet_ver)) {
1217 netdev_err(netdev,
1218 "RSS feature is not supported on this hardware\n");
1219 return -EOPNOTSUPP;
1220 }
1221
1222 ops = priv->ae_handle->dev->ops;
1223
1224 if (!indir)
1225 return 0;
1226
1227 return ops->get_rss(priv->ae_handle, indir, key, hfunc);
1228 }
1229
1230 static int
1231 hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
1232 const u8 hfunc)
1233 {
1234 struct hns_nic_priv *priv = netdev_priv(netdev);
1235 struct hnae_ae_ops *ops;
1236 int ret;
1237
1238 if (AE_IS_VER1(priv->enet_ver)) {
1239 netdev_err(netdev,
1240 "RSS feature is not supported on this hardware\n");
1241 return -EOPNOTSUPP;
1242 }
1243
1244 ops = priv->ae_handle->dev->ops;
1245
1246 /* currently hfunc can only be Toeplitz hash */
1247 if (key ||
1248 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
1249 return -EOPNOTSUPP;
1250 if (!indir)
1251 return 0;
1252
1253 return ops->set_rss(priv->ae_handle, indir, key, hfunc);
1254 }
1255
1256 static int hns_get_rxnfc(struct net_device *netdev,
1257 struct ethtool_rxnfc *cmd,
1258 u32 *rule_locs)
1259 {
1260 struct hns_nic_priv *priv = netdev_priv(netdev);
1261
1262 switch (cmd->cmd) {
1263 case ETHTOOL_GRXRINGS:
1264 cmd->data = priv->ae_handle->q_num;
1265 break;
1266 default:
> 1267 return -ERRNO;
1268 }
1269
1270 return 0;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44124 bytes --]
^ permalink raw reply
* RE: [PATCH 3/3] dm9601: add support ethtool style utility
From: Joseph Chang @ 2016-03-10 12:51 UTC (permalink / raw)
To: 'Ben Hutchings', 'Joseph CHANG',
'Peter Korsgaard', netdev, linux-usb, linux-kernel
Cc: 'Joseph Chang'
In-Reply-To: <1457610560.3001.34.camel@decadent.org.uk>
[-- Attachment #1: Type: text/plain, Size: 3829 bytes --]
I did verify to dump EEPROM data and also write EEPROM by per byte.
1.Plug dm9601/dm9621 adapter and has get dm9601.ko be 'insmod' to have 'eht0',
2.Run ethtool v3.7 (as attached executable file and it's help display.)
3. Commands:
./ethtool -e eth0 (dump EEPROM data for all the .get_eeprom_len )
./ethtool -E eth0 magic 0x9620 offset 0 value 0xf1 (write 0xf1 to eeprom byte0)
./ethtool -E eth0 magic 0x9620 offset 1 value 0xf2 (write 0xf2 to eeprom byte1)
./ethtool -E eth0 magic 0x9620 offset 2 value 0xf3 (write 0xf3 to eeprom byte2)
*I am not sure if it can cover all the huge purpose functions of ethtool, or
some leakage in such implementation. Thanks and need further advice~
Best Regards,
Joseph CHANG
System Application Engineering Division
Davicom Semiconductor, Inc.
No. 6 Li-Hsin 6th Rd., Science-Based Park,
Hsin-Chu, Taiwan.
Tel: 886-3-5798797 Ex 8534
Fax: 886-3-5646929
Web: http://www.davicom.com.tw
-----Original Message-----
From: Ben Hutchings [mailto:ben@decadent.org.uk]
Sent: Thursday, March 10, 2016 7:49 PM
To: Joseph CHANG; Peter Korsgaard; netdev@vger.kernel.org; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org
Cc: Joseph Chang
Subject: Re: [PATCH 3/3] dm9601: add support ethtool style utility
The subject line on this is very vague; it should say which ethtool
operation you're implementing.
On Thu, 2016-03-10 at 19:24 +0800, Joseph CHANG wrote:
> Add function dm9601_set_eeprom which tested good with ethtool
> utility, include the eeprom words dump and the eeprom byte write.
>
> Signed-off-by: Joseph CHANG <josright123@gmail.com>
> ---
> drivers/net/usb/dm9601.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
> index 50095df..a6904f4 100644
> --- a/drivers/net/usb/dm9601.c
> +++ b/drivers/net/usb/dm9601.c
> @@ -61,6 +61,7 @@
> #define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */
> #define DM_TIMEOUT 1000
> #define DM_EP3I_VAL 0x07
> +#define MD96XX_EEPROM_MAGIC 0x9620
The get_eeprom operation needs to be changed, to set eeprom->magic to
this value.
> static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
> {
> @@ -289,6 +290,43 @@ static int dm9601_get_eeprom(struct net_device *net,
> return 0;
> }
>
> +static int dm9601_set_eeprom(struct net_device *net,
> + struct ethtool_eeprom *eeprom, u8 *data)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + int offset = eeprom->offset;
> + int len = eeprom->len;
> + int done;
> +
> + if (eeprom->magic != MD96XX_EEPROM_MAGIC) {
> + netdev_dbg(dev->net, "EEPROM: magic value mismatch, magic = 0x%x",
> + eeprom->magic);
> + return -EINVAL;
> + }
> +
> + while (len > 0) {
> + if (len & 1 || offset & 1) {
Given that the get_eeprom operation only handles word-aligned reads, is
it really important to support misaligned writes in set_eeprom?
Also, this test should be 'if (len == 1 || offset & 1)'. Consider a
write with offset = 2, len = 3. You want to write a word on the first
iteration, then a byte on the second iteration.
> + int which = offset & 1;
> + u8 tmp[2];
> +
> + dm_read_eeprom_word(dev, offset / 2, tmp);
> + tmp[which] = *data;
> + dm_write_eeprom_word(dev, offset / 2,
> + tmp[0] | tmp[1] << 8);
> + mdelay(10);
Why is a delay required here, but not in the other case?
> + done = 1;
> + } else {
> + dm_write_eeprom_word(dev, offset / 2,
> + data[0] | data[1] << 8);
> + done = 2;
> + }
> + data += done;
> + offset += done;
> + len -= done;
> + }
> + return 0;
> +}
[...]
Ben.
--
Ben Hutchings
To err is human; to really foul things up requires a computer.
[-- Attachment #2: ethtool --]
[-- Type: application/octet-stream, Size: 1034422 bytes --]
[-- Attachment #3: ethtool.help.txt --]
[-- Type: text/plain, Size: 4790 bytes --]
ethtool version 3.7
Usage:
ethtool DEVNAME Display standard information about device
ethtool -s|--change DEVNAME Change generic options
[ speed %d ]
[ duplex half|full ]
[ port tp|aui|bnc|mii|fibre ]
[ mdix auto|on|off ]
[ autoneg on|off ]
[ advertise %x ]
[ phyad %d ]
[ xcvr internal|external ]
[ wol p|u|m|b|a|g|s|d... ]
[ sopass %x:%x:%x:%x:%x:%x ]
[ msglvl %d | msglvl type on|off ... ]
ethtool -a|--show-pause DEVNAME Show pause options
ethtool -A|--pause DEVNAME Set pause options
[ autoneg on|off ]
[ rx on|off ]
[ tx on|off ]
ethtool -c|--show-coalesce DEVNAME Show coalesce options
ethtool -C|--coalesce DEVNAME Set coalesce options
[adaptive-rx on|off]
[adaptive-tx on|off]
[rx-usecs N]
[rx-frames N]
[rx-usecs-irq N]
[rx-frames-irq N]
[tx-usecs N]
[tx-frames N]
[tx-usecs-irq N]
[tx-frames-irq N]
[stats-block-usecs N]
[pkt-rate-low N]
[rx-usecs-low N]
[rx-frames-low N]
[tx-usecs-low N]
[tx-frames-low N]
[pkt-rate-high N]
[rx-usecs-high N]
[rx-frames-high N]
[tx-usecs-high N]
[tx-frames-high N]
[sample-interval N]
ethtool -g|--show-ring DEVNAME Query RX/TX ring parameters
ethtool -G|--set-ring DEVNAME Set RX/TX ring parameters
[ rx N ]
[ rx-mini N ]
[ rx-jumbo N ]
[ tx N ]
ethtool -k|--show-features|--show-offload DEVNAME Get state of protocol offload and other features
ethtool -K|--features|--offload DEVNAME Set protocol offload and other features
FEATURE on|off ...
ethtool -i|--driver DEVNAME Show driver information
ethtool -d|--register-dump DEVNAME Do a register dump
[ raw on|off ]
[ file FILENAME ]
ethtool -e|--eeprom-dump DEVNAME Do a EEPROM dump
[ raw on|off ]
[ offset N ]
[ length N ]
ethtool -E|--change-eeprom DEVNAME Change bytes in device EEPROM
[ magic N ]
[ offset N ]
[ length N ]
[ value N ]
ethtool -r|--negotiate DEVNAME Restart N-WAY negotiation
ethtool -p|--identify DEVNAME Show visible port identification (e.g. blinking)
[ TIME-IN-SECONDS ]
ethtool -t|--test DEVNAME Execute adapter self test
[ online | offline | external_lb ]
ethtool -S|--statistics DEVNAME Show adapter statistics
ethtool -n|-u|--show-nfc|--show-ntuple DEVNAME Show Rx network flow classification options or rules
[ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 |
rule %d ]
ethtool -N|-U|--config-nfc|--config-ntuple DEVNAME Configure Rx network flow classification options or rules
rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... |
flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4
[ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
[ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
[ proto %d [m %x] ]
[ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
[ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
[ tos %d [m %x] ]
[ l4proto %d [m %x] ]
[ src-port %d [m %x] ]
[ dst-port %d [m %x] ]
[ spi %d [m %x] ]
[ vlan-etype %x [m %x] ]
[ vlan %x [m %x] ]
[ user-def %x [m %x] ]
[ action %d ]
[ loc %d]] |
delete %d
ethtool -T|--show-time-stamping DEVNAME Show time stamping capabilities
ethtool -x|--show-rxfh-indir DEVNAME Show Rx flow hash indirection
ethtool -X|--set-rxfh-indir DEVNAME Set Rx flow hash indirection
equal N | weight W0 W1 ...
ethtool -f|--flash DEVNAME Flash firmware image from the specified file to a region on the device
FILENAME [ REGION-NUMBER-TO-FLASH ]
ethtool -P|--show-permaddr DEVNAME Show permanent hardware address
ethtool -w|--get-dump DEVNAME Get dump flag, data
[ data FILENAME ]
ethtool -W|--set-dump DEVNAME Set dump flag of the device
N
ethtool -l|--show-channels DEVNAME Query Channels
ethtool -L|--set-channels DEVNAME Set Channels
[ rx N ]
[ tx N ]
[ other N ]
[ combined N ]
ethtool --show-priv-flags DEVNAME Query private flags
ethtool --set-priv-flags DEVNAME Set private flags
FLAG on|off ...
ethtool -m|--dump-module-eeprom|--module-info DEVNAME Query/Decode Module EEPROM information and optical diagnostics if available
[ raw on|off ]
[ hex on|off ]
[ offset N ]
[ length N ]
ethtool --show-eee DEVNAME Show EEE settings
ethtool --set-eee DEVNAME Set EEE settings
[ eee on|off ]
[ advertise %x ]
[ tx-lpi on|off ]
[ tx-timer %d ]
ethtool -h|--help Show this help
ethtool --version Show version number
^ permalink raw reply
* Re: [PATCH 4/5] vti6: Fix dst_entry leek on pmtu discovery
From: Sergei Shtylyov @ 2016-03-10 13:52 UTC (permalink / raw)
To: Steffen Klassert, David Miller; +Cc: Herbert Xu, netdev
In-Reply-To: <1457605469-17332-5-git-send-email-steffen.klassert@secunet.com>
Hello.
s/leek/leak/ in the subject.
On 3/10/2016 1:24 PM, Steffen Klassert wrote:
> We may exit without releasing the dst_entry on pmtu discovery,
> so don't return directly but goto the te error handling. This
Te?
> also makes sure that the statistic counter gets updated.
>
> Fixes: ccd740cbc6e0 ("vti6: Add pmtu handling to vti6_xmit.")
> Reported-by: Mark McKinstry <Mark.McKinstry@alliedtelesis.co.nz>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
[...]
MBR, Sergei
^ permalink raw reply
* Re: [PATCH 5/5] vti: Fix recource leeks on pmtu discovery
From: Sergei Shtylyov @ 2016-03-10 13:53 UTC (permalink / raw)
To: Steffen Klassert, David Miller; +Cc: Herbert Xu, netdev
In-Reply-To: <1457605469-17332-6-git-send-email-steffen.klassert@secunet.com>
s/leeks/leaks/.
^ permalink raw reply
* Re: [net-next PATCH V2 2/3] mlx4: use napi_consume_skb API to get bulk free operations
From: Sergei Shtylyov @ 2016-03-10 13:59 UTC (permalink / raw)
To: Jesper Dangaard Brouer, netdev, David S. Miller
Cc: eugenia, Alexander Duyck, alexei.starovoitov, saeedm, gerlitz.or
In-Reply-To: <20160310121542.3680.84170.stgit@firesoul>
Hello.
On 3/10/2016 3:15 PM, Jesper Dangaard Brouer wrote:
> Bulk free of SKBs happen transparently by the API call napi_consume_skb().
> The napi budget parameter is usually needed by napi_consume_skb()
> to detect if called from netpoll. In this patch it have an extra meaning.
It has.
> For mlx4 driver, the mlx4_en_stop_port() call is done outside
> NAPI/softirq context, and cleanup the entire TX ring via
> mlx4_en_free_tx_buf(). The code mlx4_en_free_tx_desc() for
> freeing SKBs are shared with NAPI calls.
>
> To handle this shared use the zero budget indication is reused,
> and handled appropiately in napi_consume_skb(). To reflect this,
Appropriately.
> variable is called napi_mode for the function call that needed
> this distinction.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_tx.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index e0946ab22010..1b41feafce9e 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
[...]
> @@ -371,7 +373,9 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
> while (ring->cons != ring->prod) {
> ring->last_nr_txbb = mlx4_en_free_tx_desc(priv, ring,
> ring->cons & ring->size_mask,
> - !!(ring->cons & ring->size), 0);
> + !!(ring->cons & ring->size), 0,
> + 0 /* none-NAPI caller */
Non-NAPI, perhaps?
[...]
MBR, Sergei
^ permalink raw reply
* Re: [PATCH v2] phy: remove documentation of removed members of phy_device structure
From: Andrew Lunn @ 2016-03-10 14:21 UTC (permalink / raw)
To: LABBE Corentin; +Cc: f.fainelli, netdev, linux-kernel
In-Reply-To: <1457614738-17337-1-git-send-email-clabbe.montjoie@gmail.com>
On Thu, Mar 10, 2016 at 01:58:58PM +0100, LABBE Corentin wrote:
> Commit e5a03bfd873c ("phy: Add an mdio_device structure") removed addr,
> bus and dev member of the phy_device structure.
> This patch remove the documentation about those members.
>
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Hi Corentin
Thanks for updating the patch with the extra removals.
Andrew
> ---
> include/linux/phy.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> Changes since v1
> - remove also documentation for dev and bus
>
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index d6f3641..2abd791 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -327,8 +327,6 @@ struct phy_c45_device_ids {
> /* phy_device: An instance of a PHY
> *
> * drv: Pointer to the driver for this PHY instance
> - * bus: Pointer to the bus this PHY is on
> - * dev: driver model device structure for this PHY
> * phy_id: UID for this device found during discovery
> * c45_ids: 802.3-c45 Device Identifers if is_c45.
> * is_c45: Set to true if this phy uses clause 45 addressing.
> @@ -338,7 +336,6 @@ struct phy_c45_device_ids {
> * suspended: Set to true if this phy has been suspended successfully.
> * state: state of the PHY for management purposes
> * dev_flags: Device-specific flags used by the PHY driver.
> - * addr: Bus address of PHY
> * link_timeout: The number of timer firings to wait before the
> * giving up on the current attempt at acquiring a link
> * irq: IRQ number of the PHY's interrupt (-1 if none)
> --
> 2.4.10
>
^ permalink raw reply
* [RFC -next 0/2] virtio-net: Advised MTU feature
From: Aaron Conole @ 2016-03-10 14:28 UTC (permalink / raw)
To: netdev, Michael S. Tsirkin, virtualization, linux-kernel
The following series adds the ability for a hypervisor to set an MTU on the
guest during feature negotiation phase. This is useful for VM orchestration
when, for instance, tunneling is involved and the MTU of the various systems
should be homogenous.
The first patch adds the feature bit as described in the proposed VFIO spec
addition found at
https://lists.oasis-open.org/archives/virtio-dev/201603/msg00001.html
The second patch adds a user of the bit, and a warning when the guest changes
the MTU from the hypervisor advised MTU. Future patches may add more thorough
error handling.
Aaron Conole (2):
virtio: Start the advised MTU feature support
virtio_net: Read and use the advised MTU
drivers/net/virtio_net.c | 15 ++++++++++++++-
include/uapi/linux/virtio_net.h | 3 +++
2 files changed, 17 insertions(+), 1 deletion(-)
--
2.5.0
^ permalink raw reply
* [RFC -next 1/2] virtio: Start the advised MTU feature support
From: Aaron Conole @ 2016-03-10 14:28 UTC (permalink / raw)
To: netdev, Michael S. Tsirkin, virtualization, linux-kernel
In-Reply-To: <1457620092-24170-1-git-send-email-aconole@redhat.com>
This commit adds the feature bit and associated mtu device entry for the
virtio network device. Future commits will make use of these bits to support
negotiated MTU.
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
include/uapi/linux/virtio_net.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index ec32293..41a6a01 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -55,6 +55,7 @@
#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
* Steering */
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
+#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
#ifndef VIRTIO_NET_NO_LEGACY
#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
@@ -73,6 +74,8 @@ struct virtio_net_config {
* Legal values are between 1 and 0x8000
*/
__u16 max_virtqueue_pairs;
+ /* Default maximum transmit unit advice */
+ __u16 mtu;
} __attribute__((packed));
/*
--
2.5.0
^ permalink raw reply related
* [RFC -next 2/2] virtio_net: Read and use the advised MTU
From: Aaron Conole @ 2016-03-10 14:28 UTC (permalink / raw)
To: netdev, Michael S. Tsirkin, virtualization, linux-kernel
In-Reply-To: <1457620092-24170-1-git-send-email-aconole@redhat.com>
This patch checks the feature bit for the VIRTIO_NET_F_MTU feature. If it
exists, read the advised MTU and use it.
No proper error handling is provided for the case where a user changes the
negotiated MTU. A future commit will add proper error handling. Instead, a
warning is emitted if the guest changes the device MTU after previously being
given advice.
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
drivers/net/virtio_net.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 767ab11..7175563 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -146,6 +146,7 @@ struct virtnet_info {
virtio_net_ctrl_ack ctrl_status;
u8 ctrl_promisc;
u8 ctrl_allmulti;
+ bool negotiated_mtu;
};
struct padded_vnet_hdr {
@@ -1390,8 +1391,12 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
{
+ struct virtnet_info *vi = netdev_priv(dev);
if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
return -EINVAL;
+ if (vi->negotiated_mtu == true) {
+ pr_warn("changing mtu from negotiated mtu.");
+ }
dev->mtu = new_mtu;
return 0;
}
@@ -1836,6 +1841,13 @@ static int virtnet_probe(struct virtio_device *vdev)
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
vi->has_cvq = true;
+ if (virtio_has_feature(vdev, VIRTIO_NET_F_MTU)) {
+ vi->negotiated_mtu = true;
+ dev->mtu = virtio_cread16(vdev,
+ offsetof(struct virtio_net_config,
+ mtu));
+ }
+
if (vi->any_header_sg)
dev->needed_headroom = vi->hdr_len;
@@ -2017,8 +2029,9 @@ static unsigned int features[] = {
VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ,
VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN,
VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
- VIRTIO_NET_F_CTRL_MAC_ADDR,
+ VIRTIO_NET_F_CTRL_MAC_ADDR,
VIRTIO_F_ANY_LAYOUT,
+ VIRTIO_NET_F_MTU,
};
static struct virtio_driver virtio_net_driver = {
--
2.5.0
^ permalink raw reply related
* Best userspace tool to set maxrate for an interface
From: Amir Vadai @ 2016-03-10 14:32 UTC (permalink / raw)
To: John Fastabend; +Cc: Or Gerlitz, netdev, Amir Vadai
Hi John,
I would like to have a standard userspace tool to set the max ratelimit
of an interface.
If you remember, we added [1] a dcb netlink attribute
(DCB_ATTR_IEEE_MAXRATE) under DCB_CMD_IEEE_SET.
The natural place for it is in lldpad/dcbtool. The maxrate setting is
not part of the 8021Qaz spec, therefore it is a bit different from the
other ieee attributes. So I'm not sure it is a good place.
Where do you think it should be added?
Thanks,
Amir
[1] - 08f10af ("net/dcb: Add an optional max rate attribute")
^ permalink raw reply
* Re: gretap default MTU question
From: Jonathan Thibault @ 2016-03-10 14:30 UTC (permalink / raw)
To: netdev@vger.kernel.org
In-Reply-To: <56E05C8F.1060901@navigue.com>
On 09/03/16 12:25 PM, Jonathan Thibault wrote:
> Hello good people of netdev,
>
> When setting up gretap devices like so:
>
> ip link add mydev type gretap remote 1.1.1.1 local 2.2.2.2 nopmtudisc
>
> I'm observing two different behavior:
>
> - On system A, the MTU of 'mydev' is set to the MTU of the 'parent'
> interface (currently 1600) minus 38. All other interfaces on that system
> have a default MTU of 1500, only the parent was forced to 1600 to avoid
> fragmentation. So 'mydev' accurately figures out that its MTU is 1562.
>
> - On system B, with the 'parent' interface MTU set to 1600 and all other
> defaulting to 1500 (same situation as A), the MTU of 'mydev' gets set to
> 1462.
>
> I'm trying to figure out which behavior is normal and what mechanism (if
> any) causes the MTU to be set differently. In both cases the 'parent'
> device has an MTU of 1600. The code in ip_gre.c does this:
>
> dev->mtu = ETH_DATA_LEN - t_hlen - 4;
>
> In this case, system B would have the expected behavior and I need some
> way to explain what goes on with system A.
>
> Of course I can force the MTU on system B but I was rather pleased with
> the 'magic' on system A.
>
> If anyone here familiar with this code can offer an explanation, it
> would greatly ease my curiosity.
>
> Jonathan
Replying to myself to leave a trace.
Turns out that the MTU of the gretap device is based on the MTU of the
interface that has a route to the 'remote' address. In my specific
case, it used the default route on system B and a static route on system
A. The cause of the discrepancy was a missing route.
Jonathan
^ permalink raw reply
* Re: [RFC -next 2/2] virtio_net: Read and use the advised MTU
From: Paolo Abeni @ 2016-03-10 14:57 UTC (permalink / raw)
To: Aaron Conole; +Cc: netdev, Michael S. Tsirkin, virtualization, linux-kernel
In-Reply-To: <1457620092-24170-3-git-send-email-aconole@redhat.com>
On Thu, 2016-03-10 at 09:28 -0500, Aaron Conole wrote:
> This patch checks the feature bit for the VIRTIO_NET_F_MTU feature. If it
> exists, read the advised MTU and use it.
>
> No proper error handling is provided for the case where a user changes the
> negotiated MTU. A future commit will add proper error handling. Instead, a
> warning is emitted if the guest changes the device MTU after previously being
> given advice.
>
> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---
> drivers/net/virtio_net.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 767ab11..7175563 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -146,6 +146,7 @@ struct virtnet_info {
> virtio_net_ctrl_ack ctrl_status;
> u8 ctrl_promisc;
> u8 ctrl_allmulti;
> + bool negotiated_mtu;
> };
>
> struct padded_vnet_hdr {
> @@ -1390,8 +1391,12 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
>
> static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> {
> + struct virtnet_info *vi = netdev_priv(dev);
> if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> return -EINVAL;
> + if (vi->negotiated_mtu == true) {
why don't:
if ((vi->negotiated_mtu == true) && (dev->mtu != new_mtu))
?
> + pr_warn("changing mtu from negotiated mtu.");
> + }
> dev->mtu = new_mtu;
> return 0;
> }
> @@ -1836,6 +1841,13 @@ static int virtnet_probe(struct virtio_device *vdev)
> if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
> vi->has_cvq = true;
>
> + if (virtio_has_feature(vdev, VIRTIO_NET_F_MTU)) {
> + vi->negotiated_mtu = true;
> + dev->mtu = virtio_cread16(vdev,
> + offsetof(struct virtio_net_config,
> + mtu));
> + }
> +
> if (vi->any_header_sg)
> dev->needed_headroom = vi->hdr_len;
>
> @@ -2017,8 +2029,9 @@ static unsigned int features[] = {
> VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ,
> VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN,
> VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
> - VIRTIO_NET_F_CTRL_MAC_ADDR,
> + VIRTIO_NET_F_CTRL_MAC_ADDR,
Here a trailing white space slipped-in.
Otherwise LGTM.
Paolo
> VIRTIO_F_ANY_LAYOUT,
> + VIRTIO_NET_F_MTU,
> };
>
> static struct virtio_driver virtio_net_driver = {
^ permalink raw reply
* [PATCH 0/2] drivers/net/forcedeth: add support for WAKE_PHY
From: Karol Herbst @ 2016-03-10 14:58 UTC (permalink / raw)
To: linux-kernel; +Cc: David S . Miller, netdev, Karol Herbst
From: Karol Herbst <nouveau@karolherbst.de>
I want to use my mac mini as a local server, but put it to sleep automatically
therefore wol p, and because wol g is a mess if you want to wakeup the target
machine automagically :)
Karol Herbst (2):
net/forcedeth: refactor wol support to make it easier adding more
modes
net/forcedeth: add wol p support
drivers/net/ethernet/nvidia/forcedeth.c | 37 ++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 14 deletions(-)
--
2.7.2
^ permalink raw reply
* [net-next PATCH V3 0/3] net: bulk free adjustment and two driver use-cases
From: Jesper Dangaard Brouer @ 2016-03-10 14:59 UTC (permalink / raw)
To: netdev, David S. Miller
Cc: sergei.shtylyov, eugenia, Alexander Duyck, alexei.starovoitov,
saeedm, Jesper Dangaard Brouer, gerlitz.or
In-Reply-To: <56E17DAC.2060305@cogentembedded.com>
I've split out the bulk free adjustments, from the bulk alloc patches,
as I want the adjustment to napi_consume_skb be in same kernel cycle
the API was introduced.
Adjustments based on discussion:
Subj: "mlx4: use napi_consume_skb API to get bulk free operations"
http://thread.gmane.org/gmane.linux.network/402503/focus=403386
Patchset based on net-next at commit 3ebeac1d0295
V3: spelling fixes from Sergei
---
Jesper Dangaard Brouer (3):
net: adjust napi_consume_skb to handle none-NAPI callers
mlx4: use napi_consume_skb API to get bulk free operations
mlx5: use napi_consume_skb API to get bulk free operations
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 16 ++++++++++------
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 4 ++--
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +-
net/core/skbuff.c | 4 ++--
5 files changed, 16 insertions(+), 12 deletions(-)
^ permalink raw reply
* [net-next PATCH V3 1/3] net: adjust napi_consume_skb to handle none-NAPI callers
From: Jesper Dangaard Brouer @ 2016-03-10 14:59 UTC (permalink / raw)
To: netdev, David S. Miller
Cc: sergei.shtylyov, eugenia, Alexander Duyck, alexei.starovoitov,
saeedm, Jesper Dangaard Brouer, gerlitz.or
In-Reply-To: <20160310145803.22901.24734.stgit@firesoul>
Some drivers reuse/share code paths that free SKBs between NAPI
and none-NAPI calls. Adjust napi_consume_skb to handle this
use-case.
Before, calls from netpoll (w/ IRQs disabled) was handled and
indicated with a budget zero indication. Use the same zero
indication to handle calls not originating from NAPI/softirq.
Simply handled by using dev_consume_skb_any().
This adds an extra branch+call for the netpoll case (checking
in_irq() + irqs_disabled()), but that is okay as this is a slowpath.
Suggested-by: Alexander Duyck <aduyck@mirantis.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
net/core/skbuff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7af7ec635d90..bc62baa54ceb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -801,9 +801,9 @@ void napi_consume_skb(struct sk_buff *skb, int budget)
if (unlikely(!skb))
return;
- /* if budget is 0 assume netpoll w/ IRQs disabled */
+ /* Zero budget indicate none-NAPI context called us, like netpoll */
if (unlikely(!budget)) {
- dev_consume_skb_irq(skb);
+ dev_consume_skb_any(skb);
return;
}
^ permalink raw reply related
* [net-next PATCH V3 2/3] mlx4: use napi_consume_skb API to get bulk free operations
From: Jesper Dangaard Brouer @ 2016-03-10 14:59 UTC (permalink / raw)
To: netdev, David S. Miller
Cc: sergei.shtylyov, eugenia, Alexander Duyck, alexei.starovoitov,
saeedm, Jesper Dangaard Brouer, gerlitz.or
In-Reply-To: <20160310145803.22901.24734.stgit@firesoul>
Bulk free of SKBs happen transparently by the API call napi_consume_skb().
The napi budget parameter is usually needed by napi_consume_skb()
to detect if called from netpoll. In this patch it has an extra meaning.
For mlx4 driver, the mlx4_en_stop_port() call is done outside
NAPI/softirq context, and cleanup the entire TX ring via
mlx4_en_free_tx_buf(). The code mlx4_en_free_tx_desc() for
freeing SKBs are shared with NAPI calls.
To handle this shared use the zero budget indication is reused,
and handled appropriately in napi_consume_skb(). To reflect this,
variable is called napi_mode for the function call that needed
this distinction.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index e0946ab22010..001a3d78168e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -276,7 +276,8 @@ static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv,
static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring,
- int index, u8 owner, u64 timestamp)
+ int index, u8 owner, u64 timestamp,
+ int napi_mode)
{
struct mlx4_en_tx_info *tx_info = &ring->tx_info[index];
struct mlx4_en_tx_desc *tx_desc = ring->buf + index * TXBB_SIZE;
@@ -347,7 +348,8 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
}
}
}
- dev_consume_skb_any(skb);
+ napi_consume_skb(skb, napi_mode);
+
return tx_info->nr_txbb;
}
@@ -371,7 +373,9 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
while (ring->cons != ring->prod) {
ring->last_nr_txbb = mlx4_en_free_tx_desc(priv, ring,
ring->cons & ring->size_mask,
- !!(ring->cons & ring->size), 0);
+ !!(ring->cons & ring->size), 0,
+ 0 /* Non-NAPI caller */
+ );
ring->cons += ring->last_nr_txbb;
cnt++;
}
@@ -385,7 +389,7 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
}
static bool mlx4_en_process_tx_cq(struct net_device *dev,
- struct mlx4_en_cq *cq)
+ struct mlx4_en_cq *cq, int napi_budget)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_cq *mcq = &cq->mcq;
@@ -451,7 +455,7 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev,
last_nr_txbb = mlx4_en_free_tx_desc(
priv, ring, ring_index,
!!((ring_cons + txbbs_skipped) &
- ring->size), timestamp);
+ ring->size), timestamp, napi_budget);
mlx4_en_stamp_wqe(priv, ring, stamp_index,
!!((ring_cons + txbbs_stamp) &
@@ -511,7 +515,7 @@ int mlx4_en_poll_tx_cq(struct napi_struct *napi, int budget)
struct mlx4_en_priv *priv = netdev_priv(dev);
int clean_complete;
- clean_complete = mlx4_en_process_tx_cq(dev, cq);
+ clean_complete = mlx4_en_process_tx_cq(dev, cq, budget);
if (!clean_complete)
return budget;
^ permalink raw reply related
* [net-next PATCH V3 3/3] mlx5: use napi_consume_skb API to get bulk free operations
From: Jesper Dangaard Brouer @ 2016-03-10 14:59 UTC (permalink / raw)
To: netdev, David S. Miller
Cc: sergei.shtylyov, eugenia, Alexander Duyck, alexei.starovoitov,
saeedm, Jesper Dangaard Brouer, gerlitz.or
In-Reply-To: <20160310145803.22901.24734.stgit@firesoul>
Bulk free of SKBs happen transparently by the API call napi_consume_skb().
The napi budget parameter is needed by napi_consume_skb() to detect
if called from netpoll.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 4 ++--
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 9c0e80e64b43..a0708782eb78 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -619,7 +619,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);
void mlx5e_completion_event(struct mlx5_core_cq *mcq);
void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
int mlx5e_napi_poll(struct napi_struct *napi, int budget);
-bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq);
+bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget);
bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index c34f4f3e9537..996b13a5042f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -336,7 +336,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
return mlx5e_sq_xmit(sq, skb);
}
-bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq)
+bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
{
struct mlx5e_sq *sq;
u32 dma_fifo_cc;
@@ -412,7 +412,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq)
npkts++;
nbytes += wi->num_bytes;
sqcc += wi->num_wqebbs;
- dev_kfree_skb(skb);
+ napi_consume_skb(skb, napi_budget);
} while (!last_wqe);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index 4ac8d716dbdd..d244acee63a5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -60,7 +60,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
clear_bit(MLX5E_CHANNEL_NAPI_SCHED, &c->flags);
for (i = 0; i < c->num_tc; i++)
- busy |= mlx5e_poll_tx_cq(&c->sq[i].cq);
+ busy |= mlx5e_poll_tx_cq(&c->sq[i].cq, budget);
work_done = mlx5e_poll_rx_cq(&c->rq.cq, budget);
busy |= work_done == budget;
^ permalink raw reply related
* Re: [PATCH net] sctp: fix the transports round robin issue when init is retransmitted
From: Marcelo Ricardo Leitner @ 2016-03-10 15:01 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Vlad Yasevich, daniel
In-Reply-To: <8d3cd163c84b30797f1123a7fc8a56f768801a87.1457595117.git.lucien.xin@gmail.com>
On Thu, Mar 10, 2016 at 03:31:57PM +0800, Xin Long wrote:
> prior to this patch, at the beginning if we have two paths in one assoc,
> they may have the same params other than the last_time_heard, it will try
> the paths like this:
>
> 1st cycle
> try trans1 fail.
> then trans2 is selected.(cause it's last_time_heard is after trans1).
>
> 2nd cycle:
> try trans2 fail
> then trans2 is selected.(cause it's last_time_heard is after trans1).
>
> 3rd cycle:
> try trans2 fail
> then trans2 is selected.(cause it's last_time_heard is after trans1).
>
> ....
>
> trans1 will never have change to be selected, which is not what we expect.
> we should keeping round robin all the paths if they are just added at the
> beginning.
>
> So at first every tranport's last_time_heard should be initialized 0, so
> that we ensure they have the same value at the beginning, only by this,
> all the transports could get equal chance to be selected.
>
> Then for sctp_trans_elect_best, it should return the trans_next one when
> *trans == *trans_next, so that we can try next if it fails, but now it
> always return trans. so we can fix it by exchanging these two params when
> we calls sctp_trans_elect_tie().
>
> Fixes: 4c47af4d5eb2 ('net: sctp: rework multihoming retransmission path selection to rfc4960')
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
> net/sctp/associola.c | 2 +-
> net/sctp/transport.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 2bf8ec9..cd87344 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -1263,7 +1263,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,
> if (score_curr > score_best)
> return curr;
> else if (score_curr == score_best)
> - return sctp_trans_elect_tie(curr, best);
> + return sctp_trans_elect_tie(best, curr);
> else
> return best;
> }
> diff --git a/net/sctp/transport.c b/net/sctp/transport.c
> index a431c14..d517153 100644
> --- a/net/sctp/transport.c
> +++ b/net/sctp/transport.c
> @@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net,
> */
> peer->rto = msecs_to_jiffies(net->sctp.rto_initial);
>
> - peer->last_time_heard = ktime_get();
> + peer->last_time_heard = ktime_set(0, 0);
> peer->last_time_ecne_reduced = jiffies;
>
> peer->param_flags = SPP_HB_DISABLE |
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" 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
* Re: Question on switchdev
From: Murali Karicheri @ 2016-03-10 15:03 UTC (permalink / raw)
To: Andrew Lunn; +Cc: jiri, sfeldma, netdev
In-Reply-To: <20160309003919.GA31963@lunn.ch>
On 03/08/2016 07:39 PM, Andrew Lunn wrote:
>> Andrew,
>>
>> >From the high level, it looks like netcp switch meets the specifications
>> of a DSA hardware. Can you point me to a specific implementation that
>> I can use as an example to implement this for netcp?
>
> You need two parts:
>
> A tagging implementation, in net/dsa/tag_*.c. They are all pretty
> similar, and all pretty simple.
>
> A switch driver. driver/net/dsa/mv88e6060.c is the simplest. I would
> suggest your first submission implements similar features as to what
> this driver does. This is very minimalistic, but a good start. Once
> that is accepted, you can incrementally add more features.
>
> Andrew
>
Thanks Andrew!
--
Murali Karicheri
Linux Kernel, Keystone
^ permalink raw reply
* [PATCH 2/2] net/forcedeth: add wol p support
From: Karol Herbst @ 2016-03-10 14:58 UTC (permalink / raw)
To: linux-kernel; +Cc: David S . Miller, netdev, Karol Herbst
In-Reply-To: <1457621884-2479-1-git-send-email-git@karolherbst.de>
REd on my mac mini. No idea if that also works on other ethernet cards
supported by forcedeth, but I doubt anybody cares at all, otherwise somebody
else would have REd it already.
Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
---
drivers/net/ethernet/nvidia/forcedeth.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index bdce33b..8e4e894 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -291,6 +291,7 @@ enum {
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04
#define NVREG_WAKEUPFLAGS_ENABLE_G 0x01111
+#define NVREG_WAKEUPFLAGS_ENABLE_P 0x12000
NvRegMgmtUnitGetVersion = 0x204,
#define NVREG_MGMTUNITGETVERSION 0x01
@@ -4216,12 +4217,14 @@ static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
{
struct fe_priv *np = netdev_priv(dev);
- wolinfo->supported = WAKE_MAGIC;
+ wolinfo->supported = WAKE_MAGIC | WAKE_PHY;
spin_lock_irq(&np->lock);
wolinfo->wolopts = 0;
if (np->wolenabled & WAKE_MAGIC)
wolinfo->wolopts |= WAKE_MAGIC;
+ if (np->wolenabled & WAKE_PHY)
+ wolinfo->wolopts |= WAKE_PHY;
spin_unlock_irq(&np->lock);
}
@@ -4236,6 +4239,10 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
np->wolenabled |= WAKE_MAGIC;
np->wol_flags |= NVREG_WAKEUPFLAGS_ENABLE_G;
}
+ if (wolinfo->wolopts & WAKE_PHY) {
+ np->wolenabled |= WAKE_PHY;
+ np->wol_flags |= NVREG_WAKEUPFLAGS_ENABLE_P;
+ }
if (netif_running(dev)) {
spin_lock_irq(&np->lock);
writel(np->wol_flags, base + NvRegWakeUpFlags);
--
2.7.2
^ permalink raw reply related
* [PATCH 1/2] net/forcedeth: refactor wol support to make it easier to add more wol modes
From: Karol Herbst @ 2016-03-10 14:58 UTC (permalink / raw)
To: linux-kernel; +Cc: David S . Miller, netdev
In-Reply-To: <1457621884-2479-1-git-send-email-git@karolherbst.de>
Signed-off-by: Karol Herbst <git@karolherbst.de>
---
drivers/net/ethernet/nvidia/forcedeth.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 75e88f4..bdce33b 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -290,7 +290,7 @@ enum {
#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04
-#define NVREG_WAKEUPFLAGS_ENABLE 0x1111
+#define NVREG_WAKEUPFLAGS_ENABLE_G 0x01111
NvRegMgmtUnitGetVersion = 0x204,
#define NVREG_MGMTUNITGETVERSION 0x01
@@ -764,6 +764,7 @@ struct fe_priv {
int fixed_mode;
int phyaddr;
int wolenabled;
+ u32 wol_flags;
unsigned int phy_oui;
unsigned int phy_model;
unsigned int phy_rev;
@@ -4218,8 +4219,9 @@ static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
wolinfo->supported = WAKE_MAGIC;
spin_lock_irq(&np->lock);
- if (np->wolenabled)
- wolinfo->wolopts = WAKE_MAGIC;
+ wolinfo->wolopts = 0;
+ if (np->wolenabled & WAKE_MAGIC)
+ wolinfo->wolopts |= WAKE_MAGIC;
spin_unlock_irq(&np->lock);
}
@@ -4227,20 +4229,19 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
{
struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
- u32 flags = 0;
- if (wolinfo->wolopts == 0) {
- np->wolenabled = 0;
- } else if (wolinfo->wolopts & WAKE_MAGIC) {
- np->wolenabled = 1;
- flags = NVREG_WAKEUPFLAGS_ENABLE;
+ np->wolenabled = 0;
+ np->wol_flags = 0;
+ if (wolinfo->wolopts & WAKE_MAGIC) {
+ np->wolenabled |= WAKE_MAGIC;
+ np->wol_flags |= NVREG_WAKEUPFLAGS_ENABLE_G;
}
if (netif_running(dev)) {
spin_lock_irq(&np->lock);
- writel(flags, base + NvRegWakeUpFlags);
+ writel(np->wol_flags, base + NvRegWakeUpFlags);
spin_unlock_irq(&np->lock);
}
- device_set_wakeup_enable(&np->pci_dev->dev, np->wolenabled);
+ device_set_wakeup_enable(&np->pci_dev->dev, np->wolenabled != 0);
return 0;
}
@@ -5445,7 +5446,7 @@ static int nv_open(struct net_device *dev)
writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed);
writel(NVREG_MII_LINKCHANGE, base + NvRegMIIMask);
if (np->wolenabled)
- writel(NVREG_WAKEUPFLAGS_ENABLE , base + NvRegWakeUpFlags);
+ writel(np->wol_flags, base + NvRegWakeUpFlags);
i = readl(base + NvRegPowerState);
if ((i & NVREG_POWERSTATE_POWEREDUP) == 0)
@@ -5833,6 +5834,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
/* disable WOL */
writel(0, base + NvRegWakeUpFlags);
np->wolenabled = 0;
+ np->wol_flags = 0;
device_set_wakeup_enable(&pci_dev->dev, false);
if (id->driver_data & DEV_HAS_POWER_CNTRL) {
@@ -6175,7 +6177,7 @@ static void nv_shutdown(struct pci_dev *pdev)
* only put the device into D3 if we really go for poweroff.
*/
if (system_state == SYSTEM_POWER_OFF) {
- pci_wake_from_d3(pdev, np->wolenabled);
+ pci_wake_from_d3(pdev, np->wolenabled != 0);
pci_set_power_state(pdev, PCI_D3hot);
}
}
--
2.7.2
^ permalink raw reply related
* Re: Micrel Phy - Is there a way to configure the Phy not to do 802.3x flow control?
From: Murali Karicheri @ 2016-03-10 15:07 UTC (permalink / raw)
To: Andrew Lunn; +Cc: johan, open list:TI NETCP ETHERNET DRIVER, Kwok, WingMan
In-Reply-To: <20160303222654.GS15541@lunn.ch>
Andrew,
Thanks for your response!
On 03/03/2016 05:26 PM, Andrew Lunn wrote:
> On Thu, Mar 03, 2016 at 05:18:38PM -0500, Murali Karicheri wrote:
>> Hi,
>>
>> We are using Micrel Phy in one of our board and wondering if we can force the
>> Phy to disable flow control at start. I have a 1G ethernet switch connected
>> to Phy and the phy always enable flow control. I would like to configure the
>> phy not to flow control. Is that possible and if yes, what should I do in the
>> my Ethernet driver to tell the Phy not to enable flow control?
>
> Hi Murali
>
> Have you played with:
>
> ethtool -a|--show-pause devname
>
> ethtool -A|--pause devname [autoneg on|off] [rx on|off] [tx on|off]
>
> Andrew
>
I will try, but my question is for disabling flow control by default in the
phy when Ethernet driver is initialized. How does the driver tells the phy
to disable tx/rx flow control. Even if phy advertise flow control capability
the Ethernet h/w MAC layer should be capable of doing a Pause. So the driver
needs to have a way to disable tx/rx FC when it starts. How this can be
achieved? We would like to disable this by default. User will be able to
enable it through ethtool command if it desire to have FC for a specific
use case. Isn't reasonable?
--
Murali Karicheri
Linux Kernel, Keystone
^ permalink raw reply
* Re: [RFC] net: ipv4 -- Introduce ifa limit per net
From: Cyrill Gorcunov @ 2016-03-10 15:09 UTC (permalink / raw)
To: David Miller, alexei.starovoitov, eric.dumazet
Cc: netdev, solar, vvs, avagin, xemul, vdavydov, khorenko, pablo,
netfilter-devel
In-Reply-To: <20160310110324.GB21154@uranus.lan>
On Thu, Mar 10, 2016 at 02:03:24PM +0300, Cyrill Gorcunov wrote:
> On Thu, Mar 10, 2016 at 01:20:18PM +0300, Cyrill Gorcunov wrote:
> > On Thu, Mar 10, 2016 at 12:16:29AM +0300, Cyrill Gorcunov wrote:
> > >
> > > Thanks for explanation, Dave! I'll continue on this task tomorrow
> > > tryin to implement optimization you proposed.
> >
> > OK, here are the results for the preliminary patch with conntrack running
> ...
> > net/ipv4/devinet.c | 13 ++++++++++++-
> > 1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > Index: linux-ml.git/net/ipv4/devinet.c
> > ===================================================================
> > --- linux-ml.git.orig/net/ipv4/devinet.c
> > +++ linux-ml.git/net/ipv4/devinet.c
> > @@ -403,7 +403,18 @@ no_promotions:
> > So that, this order is correct.
> > */
>
> This patch is wrong, so drop it please. I'll do another.
Here I think is a better variant. The resulst are good
enough -- 1 sec for cleanup. Does the patch look sane?
---
net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
Index: linux-ml.git/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
===================================================================
--- linux-ml.git.orig/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
+++ linux-ml.git/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
@@ -108,9 +108,22 @@ static int masq_inet_event(struct notifi
unsigned long event,
void *ptr)
{
- struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+ struct in_ifaddr *ifa = ptr;
+ struct net_device *dev = ifa->ifa_dev->dev;
struct netdev_notifier_info info;
+ if (event == NETDEV_DOWN) {
+ /*
+ * When we meet dead device which is
+ * being released with dozeon of addresses
+ * assigned -- we can optimize calls
+ * to conntrack cleanups and do it only
+ * once.
+ */
+ if (ifa->ifa_dev->dead && ifa->ifa_next)
+ return NOTIFY_DONE;
+ }
+
netdev_notifier_info_init(&info, dev);
return masq_device_event(this, event, &info);
}
^ 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