* Re: [PATCH v2 1/2] fixup! net/macb: Adding comments to various #defs to make interpretation easier
From: Nicolas Ferre @ 2015-01-15 10:05 UTC (permalink / raw)
To: Xander Huff, davem
Cc: netdev, jaeden.amero, rich.tollerton, ben.shelton, brad.mouring,
linux-kernel, cyrille.pitchen
In-Reply-To: <1421274051-21588-1-git-send-email-xander.huff@ni.com>
Le 14/01/2015 23:20, Xander Huff a écrit :
> Put #define comments into a single line.
It seems that correction is not done for all the entries modified:
@ 0x0100 to 0x01b0
Can you please consider correcting this?
Thanks, bye.
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> ---
> drivers/net/ethernet/cadence/macb.h | 107 +++++++++---------------------------
> 1 file changed, 26 insertions(+), 81 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 378b218..d7b93d0 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -275,9 +275,7 @@
> #define MACB_THALT_SIZE 1
> #define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */
> #define MACB_NCR_TPF_SIZE 1
> -#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum
> - * pause frame
> - */
> +#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */
> #define MACB_TZQ_SIZE 1
>
> /* Bitfields in NCFGR */
> @@ -299,9 +297,7 @@
> #define MACB_UNI_SIZE 1
> #define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */
> #define MACB_BIG_SIZE 1
> -#define MACB_EAE_OFFSET 9 /* External address match
> - * enable
> - */
> +#define MACB_EAE_OFFSET 9 /* External address match enable */
> #define MACB_EAE_SIZE 1
> #define MACB_CLK_OFFSET 10
> #define MACB_CLK_SIZE 2
> @@ -313,9 +309,7 @@
> #define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
> #define MACB_RBOF_OFFSET 14 /* Receive buffer offset */
> #define MACB_RBOF_SIZE 2
> -#define MACB_RLCE_OFFSET 16 /* Length field error frame
> - * discard
> - */
> +#define MACB_RLCE_OFFSET 16 /* Length field error frame discard */
> #define MACB_RLCE_SIZE 1
> #define MACB_DRFCS_OFFSET 17 /* FCS remove */
> #define MACB_DRFCS_SIZE 1
> @@ -335,41 +329,22 @@
> #define GEM_RXCOEN_SIZE 1
>
> /* Constants for data bus width. */
> -#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus
> - * width
> - */
> -#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus
> - * width
> - */
> -#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus
> - * width
> - */
> +#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus width */
> +#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus width */
> +#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus width */
>
> /* Bitfields in DMACFG. */
> -#define GEM_FBLDO_OFFSET 0 /* AHB fixed burst length for
> - * DMA data operations
> - */
> +#define GEM_FBLDO_OFFSET 0 /* AHB fixed burst length for DMA data operations */
> #define GEM_FBLDO_SIZE 5
> -#define GEM_ENDIA_OFFSET 7 /* AHB endian swap mode enable
> - * for packet data accesses
> - */
> +#define GEM_ENDIA_OFFSET 7 /* AHB endian swap mode enable for packet data accesses */
> #define GEM_ENDIA_SIZE 1
> -#define GEM_RXBMS_OFFSET 8 /* Receiver packet buffer
> - * memory size select
> - */
> +#define GEM_RXBMS_OFFSET 8 /* Receiver packet buffer memory size select */
> #define GEM_RXBMS_SIZE 2
> -#define GEM_TXPBMS_OFFSET 10 /* Transmitter packet buffer
> - * memory size select
> - */
> +#define GEM_TXPBMS_OFFSET 10 /* Transmitter packet buffer memory size select */
> #define GEM_TXPBMS_SIZE 1
> -#define GEM_TXCOEN_OFFSET 11 /* Transmitter IP, TCP and
> - * UDP checksum generation
> - * offload enable
> - */
> +#define GEM_TXCOEN_OFFSET 11 /* Transmitter IP, TCP and UDP checksum generation offload enable */
> #define GEM_TXCOEN_SIZE 1
> -#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size in
> - * AHB system memory
> - */
> +#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size in AHB system memory */
> #define GEM_RXBS_SIZE 8
> #define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */
> #define GEM_DDRP_SIZE 1
> @@ -378,13 +353,9 @@
> /* Bitfields in NSR */
> #define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */
> #define MACB_NSR_LINK_SIZE 1
> -#define MACB_MDIO_OFFSET 1 /* status of the mdio_in
> - * pin
> - */
> +#define MACB_MDIO_OFFSET 1 /* status of the mdio_in pin */
> #define MACB_MDIO_SIZE 1
> -#define MACB_IDLE_OFFSET 2 /* The PHY management logic is
> - * idle (i.e. has completed)
> - */
> +#define MACB_IDLE_OFFSET 2 /* The PHY management logic is idle (i.e. has completed) */
> #define MACB_IDLE_SIZE 1
>
> /* Bitfields in TSR */
> @@ -396,9 +367,7 @@
> #define MACB_TSR_RLE_SIZE 1
> #define MACB_TGO_OFFSET 3 /* Transmit go */
> #define MACB_TGO_SIZE 1
> -#define MACB_BEX_OFFSET 4 /* Transmit frame corruption
> - * due to AHB error
> - */
> +#define MACB_BEX_OFFSET 4 /* Transmit frame corruption due to AHB error */
> #define MACB_BEX_SIZE 1
> #define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
> #define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
> @@ -424,43 +393,23 @@
> #define MACB_RXUBR_SIZE 1
> #define MACB_TXUBR_OFFSET 3 /* TX used bit read */
> #define MACB_TXUBR_SIZE 1
> -#define MACB_ISR_TUND_OFFSET 4 /* Enable trnasmit buffer
> - * under run interrupt
> - */
> +#define MACB_ISR_TUND_OFFSET 4 /* Enable trnasmit buffer under run interrupt */
> #define MACB_ISR_TUND_SIZE 1
> -#define MACB_ISR_RLE_OFFSET 5 /* Enable retry limit exceeded
> - * or late collision interrupt
> - */
> +#define MACB_ISR_RLE_OFFSET 5 /* Enable retry limit exceeded or late collision interrupt */
> #define MACB_ISR_RLE_SIZE 1
> -#define MACB_TXERR_OFFSET 6 /* Enable transmit frame
> - * corruption due to AHB error
> - * interrupt
> - */
> +#define MACB_TXERR_OFFSET 6 /* Enable transmit frame corruption due to AHB error interrupt */
> #define MACB_TXERR_SIZE 1
> -#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete
> - * interrupt
> - */
> +#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete interrupt */
> #define MACB_TCOMP_SIZE 1
> -#define MACB_ISR_LINK_OFFSET 9 /* Enable link change
> - * interrupt
> - */
> +#define MACB_ISR_LINK_OFFSET 9 /* Enable link change interrupt */
> #define MACB_ISR_LINK_SIZE 1
> -#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun
> - * interrupt
> - */
> +#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun interrupt */
> #define MACB_ISR_ROVR_SIZE 1
> -#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK
> - * interrupt
> - */
> +#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK interrupt */
> #define MACB_HRESP_SIZE 1
> -#define MACB_PFR_OFFSET 12 /* Enable pause frame with
> - * non-zero pause quantum
> - * interrupt
> - */
> +#define MACB_PFR_OFFSET 12 /* Enable pause frame with non-zero pause quantum interrupt */
> #define MACB_PFR_SIZE 1
> -#define MACB_PTZ_OFFSET 13 /* Enable pause time zero
> - * interrupt
> - */
> +#define MACB_PTZ_OFFSET 13 /* Enable pause time zero interrupt */
> #define MACB_PTZ_SIZE 1
>
> /* Bitfields in MAN */
> @@ -472,13 +421,9 @@
> #define MACB_REGA_SIZE 5
> #define MACB_PHYA_OFFSET 23 /* PHY address */
> #define MACB_PHYA_SIZE 5
> -#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01
> - * is write.
> - */
> +#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01 is write. */
> #define MACB_RW_SIZE 2
> -#define MACB_SOF_OFFSET 30 /* Must be written to 1 for
> - * Clause 22 operation
> - */
> +#define MACB_SOF_OFFSET 30 /* Must be written to 1 for Clause 22 operation */
> #define MACB_SOF_SIZE 2
>
> /* Bitfields in USRIO (AVR32) */
>
--
Nicolas Ferre
^ permalink raw reply
* [PATCH] mac80211: Fix typo in mac80211.h
From: Masanari Iida @ 2015-01-15 10:05 UTC (permalink / raw)
To: linux-kernel, netdev, davem; +Cc: Masanari Iida
This patch fix spelling typo found in Documentation/DocBook/80211.xml.
It is because this file was generated from comments in source,
I had to fix in include/net/mac80211.h
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
include/net/mac80211.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 29c7be8..a9a6213 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1292,7 +1292,7 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
* %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
* @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
* driver for a CCMP key to indicate that is requires IV generation
- * only for managment frames (MFP).
+ * only for management frames (MFP).
*/
enum ieee80211_key_flags {
IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
@@ -4894,7 +4894,7 @@ static inline int rate_supported(struct ieee80211_sta *sta,
* @sta: &struct ieee80211_sta pointer to the target destination. Note
* that this may be null.
* @priv_sta: private rate control structure. This may be null.
- * @txrc: rate control information we sholud populate for mac80211.
+ * @txrc: rate control information we should populate for mac80211.
*/
bool rate_control_send_low(struct ieee80211_sta *sta,
void *priv_sta,
--
2.3.0.rc0
^ permalink raw reply related
* Re: [bisected regression] e1000e: "Detected Hardware Unit Hang"
From: Thomas Jarosch @ 2015-01-15 10:11 UTC (permalink / raw)
To: Eric Dumazet
Cc: 'Linux Netdev List', Eric Dumazet, Jeff Kirsher,
e1000-devel
In-Reply-To: <1421256052.11734.22.camel@edumazet-glaptop2.roam.corp.google.com>
On Wednesday, 14. January 2015 09:20:52 Eric Dumazet wrote:
> I would try to use lower data per txd. I am not sure 24KB is really
> supported.
>
> ( check commit d821a4c4d11ad160925dab2bb009b8444beff484 for details)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
> b/drivers/net/ethernet/intel/e1000e/netdev.c index
> e14fd85f64eb..8d973f7edfbd 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -3897,7 +3897,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
> * limit of 24KB due to receive synchronization limitations.
> */
> adapter->tx_fifo_limit = min_t(u32, ((er32(PBA) >> 16) << 10) - 96,
> - 24 << 10);
> + 8 << 10);
>
> /* Disable Adaptive Interrupt Moderation if 2 full packets cannot
> * fit in receive buffer.
Thanks for checking!
I just tried that change on top of git f800c25 (git HEAD), same problem.
Let's see what the Intel wizards come up with.
What "works" is to decrease the page size in git HEAD, too:
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 85ab7d7..9f0ef97 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2108,7 +2108,7 @@ static inline void __skb_queue_purge(struct
sk_buff_head *list)
kfree_skb(skb);
}
-#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768)
+#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(4096)
#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE
When I try a page size of 8192, it starts failing again. I'll now run
a stress test with 4096 to see if the problem is really gone
or just happens more rarely.
Cheers,
Thomas
^ permalink raw reply related
* [PATCH_V5] dm9000: Add regulator and reset support to dm9000
From: Zubair Lutfullah Kakakhel @ 2015-01-15 10:12 UTC (permalink / raw)
To: davem
Cc: Zubair.Kakakhel, devicetree, linux-kernel, netdev, s.hauer,
sergei.shtylyov
In boards, the dm9000 chip's power and reset can be controlled by gpio.
It makes sense to add them to the dm9000 driver and let dt be used to
enable power and reset the phy.
Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
V4 Reordered an error check. PTR_ERR inside IS_ERR.
V3 Fixed an indentation and removed a call to gpio_direction_output as
devm_gpio_request_one can handle it.
V2 A few fixes and more error checks. Nothing major
V1 Minor blooper
---
.../devicetree/bindings/net/davicom-dm9000.txt | 4 +++
drivers/net/ethernet/davicom/dm9000.c | 40 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/davicom-dm9000.txt b/Documentation/devicetree/bindings/net/davicom-dm9000.txt
index 28767ed..5224bf0 100644
--- a/Documentation/devicetree/bindings/net/davicom-dm9000.txt
+++ b/Documentation/devicetree/bindings/net/davicom-dm9000.txt
@@ -11,6 +11,8 @@ Required properties:
Optional properties:
- davicom,no-eeprom : Configuration EEPROM is not available
- davicom,ext-phy : Use external PHY
+- reset-gpios : phandle of gpio that will be used to reset chip during probe
+- vcc-supply : phandle of regulator that will be used to enable power to chip
Example:
@@ -21,4 +23,6 @@ Example:
interrupts = <7 4>;
local-mac-address = [00 00 de ad be ef];
davicom,no-eeprom;
+ reset-gpios = <&gpf 12 GPIO_ACTIVE_LOW>;
+ vcc-supply = <ð0_power>;
};
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index ef0bb58..c0a7813 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -36,6 +36,9 @@
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
#include <asm/delay.h>
#include <asm/irq.h>
@@ -1426,11 +1429,48 @@ dm9000_probe(struct platform_device *pdev)
struct dm9000_plat_data *pdata = dev_get_platdata(&pdev->dev);
struct board_info *db; /* Point a board information structure */
struct net_device *ndev;
+ struct device *dev = &pdev->dev;
const unsigned char *mac_src;
int ret = 0;
int iosize;
int i;
u32 id_val;
+ int reset_gpios;
+ enum of_gpio_flags flags;
+ struct regulator *power;
+
+ power = devm_regulator_get(dev, "vcc");
+ if (IS_ERR(power)) {
+ if (PTR_ERR(power) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ dev_dbg(dev, "no regulator provided\n");
+ } else {
+ ret = regulator_enable(power);
+ if (ret != 0) {
+ dev_err(dev,
+ "Failed to enable power regulator: %d\n", ret);
+ return ret;
+ }
+ dev_dbg(dev, "regulator enabled\n");
+ }
+
+ reset_gpios = of_get_named_gpio_flags(dev->of_node, "reset-gpios", 0,
+ &flags);
+ if (gpio_is_valid(reset_gpios)) {
+ ret = devm_gpio_request_one(dev, reset_gpios, flags,
+ "dm9000_reset");
+ if (ret) {
+ dev_err(dev, "failed to request reset gpio %d: %d\n",
+ reset_gpios, ret);
+ return -ENODEV;
+ }
+
+ /* According to manual PWRST# Low Period Min 1ms */
+ msleep(2);
+ gpio_set_value(reset_gpios, 1);
+ /* Needs 3ms to read eeprom when PWRST is deasserted */
+ msleep(4);
+ }
if (!pdata) {
pdata = dm9000_parse_dt(&pdev->dev);
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next v13 3/3] net: hisilicon: new hip04 ethernet driver
From: Ding Tianhong @ 2015-01-15 10:28 UTC (permalink / raw)
To: Joe Perches
Cc: arnd-r2nGTMty4D4, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, grant.likely-QSEj5FYQhm4dnm+yROfE0A,
agraf-l3A5Bk7waGM,
sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
xuwei5-C8/M+/jPZTeaMJb+Lgu22Q,
zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A,
netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-lFZ/pmaqli7XmaaqVzeoHQ
In-Reply-To: <1421296742.25598.3.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
On 2015/1/15 12:39, Joe Perches wrote:
> On Wed, 2015-01-14 at 14:34 +0800, Ding Tianhong wrote:
>> Support Hisilicon hip04 ethernet driver, including 100M / 1000M controller.
>> The controller has no tx done interrupt, reclaim xmitted buffer in the poll.
>
> Mostly trivial comments:
>
>> +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
>
> []
>
>> +#define GMAC_MAX_PKT_LEN 1516
>
> []
>
>> +static int hip04_rx_poll(struct napi_struct *napi, int budget)
>> +{
> []
>> + while (cnt && !last) {
> []
>> + desc = (struct rx_desc *)skb->data;
>> + len = be16_to_cpu(desc->pkt_len);
>> + err = be32_to_cpu(desc->pkt_err);
>> +
>> + if (0 == len) {
>> + dev_kfree_skb_any(skb);
>> + last = true;
>> + } else if ((err & RX_PKT_ERR) || (len >= GMAC_MAX_PKT_LEN)) {
>
> Is this ">=" correct? Maybe it should be ">" ?
>
> []
>
>> +static irqreturn_t hip04_mac_interrupt(int irq, void *dev_id)
>> +{
>> + struct net_device *ndev = (struct net_device *)dev_id;
>
> Unnecessary cast of void *
>
> []
>
>> +static int hip04_set_coalesce(struct net_device *netdev,
>> + struct ethtool_coalesce *ec)
>> +{
>> + struct hip04_priv *priv = netdev_priv(netdev);
>> +
>> + /* Check not supported parameters */
>> + if ((ec->rx_max_coalesced_frames) || (ec->rx_coalesce_usecs_irq) ||
>> + (ec->rx_max_coalesced_frames_irq) || (ec->tx_coalesce_usecs_irq) ||
>> + (ec->use_adaptive_rx_coalesce) || (ec->use_adaptive_tx_coalesce) ||
>> + (ec->pkt_rate_low) || (ec->rx_coalesce_usecs_low) ||
>> + (ec->rx_max_coalesced_frames_low) || (ec->tx_coalesce_usecs_high) ||
>> + (ec->tx_max_coalesced_frames_low) || (ec->pkt_rate_high) ||
>> + (ec->tx_coalesce_usecs_low) || (ec->rx_coalesce_usecs_high) ||
>> + (ec->rx_max_coalesced_frames_high) || (ec->rx_coalesce_usecs) ||
>> + (ec->tx_max_coalesced_frames_irq) ||
>> + (ec->stats_block_coalesce_usecs) ||
>> + (ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval))
>> + return -EOPNOTSUPP;
>
> Rather than a somewhat haphazard mix of these values,
> this might be simpler to read as something like:
>
> /* Check not supported parameters */
> if (ec->pkt_rate_low ||
> ec->pkt_rate_high ||
>
> ec->use_adaptive_rx_coalesce ||
> ec->rx_coalesce_usecs ||
> ec->rx_coalesce_usecs_low ||
> ec->rx_coalesce_usecs_high ||
> ec->rx_coalesce_usecs_irq ||
> ec->rx_max_coalesced_frames ||
> ec->rx_max_coalesced_frames_low ||
> ec->rx_max_coalesced_frames_high ||
> ec->rx_max_coalesced_frames_irq ||
>
> ec->use_adaptive_tx_coalesce ||
> ec->tx_coalesce_usecs_low ||
> ec->tx_coalesce_usecs_high ||
> ec->tx_max_coalesced_frames_low ||
> ec->tx_max_coalesced_frames_high ||
> ec->tx_max_coalesced_frames_irq ||
>
> ec->stats_block_coalesce_usecs ||
> ec->rate_sample_interval)
> return -EOPNOTSUPP;
>
>
>> +static void hip04_free_ring(struct net_device *ndev, struct device *d)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + int i;
>> +
>> + for (i = 0; i < RX_DESC_NUM; i++)
>> + if (priv->rx_buf[i])
>> + put_page(virt_to_head_page(priv->rx_buf[i]));
>
> It's generally nicer to use braces around
> for loops with single ifs.
>
>> +
>> + for (i = 0; i < TX_DESC_NUM; i++)
>> + if (priv->tx_skb[i])
>> + dev_kfree_skb_any(priv->tx_skb[i]);
>
>
>
OK, fix them later, thanks.
Ding
> .
>
--
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
* Re: [PATCH net-next v13 3/3] net: hisilicon: new hip04 ethernet driver
From: Ding Tianhong @ 2015-01-15 10:29 UTC (permalink / raw)
To: Eric Dumazet
Cc: arnd-r2nGTMty4D4, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, grant.likely-QSEj5FYQhm4dnm+yROfE0A,
agraf-l3A5Bk7waGM,
sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
xuwei5-C8/M+/jPZTeaMJb+Lgu22Q,
zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A,
netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-lFZ/pmaqli7XmaaqVzeoHQ
In-Reply-To: <1421253246.11734.17.camel-XN9IlZ5yJG9HTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
On 2015/1/15 0:34, Eric Dumazet wrote:
> On Wed, 2015-01-14 at 14:34 +0800, Ding Tianhong wrote:
>> Support Hisilicon hip04 ethernet driver, including 100M / 1000M controller.
>> The controller has no tx done interrupt, reclaim xmitted buffer in the poll.
>>
>> v13: Fix the problem of alignment parameters for function and checkpatch warming.
>>
>> v12: According Alex's suggestion, modify the changelog and add MODULE_DEVICE_TABLE
>> for hip04 ethernet.
>>
>> v11: Add ethtool support for tx coalecse getting and setting, the xmit_more
>> is not supported for this patch, but I think it could work for hip04,
>> will support it later after some tests for performance better.
>>
>> Here are some performance test results by ping and iperf(add tx_coalesce_frames/users),
>> it looks that the performance and latency is more better by tx_coalesce_frames/usecs.
>>
>> - Before:
>> $ ping 192.168.1.1 ...
>> === 192.168.1.1 ping statistics ===
>> 24 packets transmitted, 24 received, 0% packet loss, time 22999ms
>> rtt min/avg/max/mdev = 0.180/0.202/0.403/0.043 ms
>>
>> $ iperf -c 192.168.1.1 ...
>> [ ID] Interval Transfer Bandwidth
>> [ 3] 0.0- 1.0 sec 115 MBytes 945 Mbits/sec
>>
>> - After:
>> $ ping 192.168.1.1 ...
>> === 192.168.1.1 ping statistics ===
>> 24 packets transmitted, 24 received, 0% packet loss, time 22999ms
>> rtt min/avg/max/mdev = 0.178/0.190/0.380/0.041 ms
>>
>> $ iperf -c 192.168.1.1 ...
>> [ ID] Interval Transfer Bandwidth
>> [ 3] 0.0- 1.0 sec 115 MBytes 965 Mbits/sec
>>
>> v10: According David Miller and Arnd Bergmann's suggestion, add some modification
>> for v9 version
>> - drop the workqueue
>> - batch cleanup based on tx_coalesce_frames/usecs for better throughput
>> - use a reasonable default tx timeout (200us, could be shorted
>> based on measurements) with a range timer
>> - fix napi poll function return value
>> - use a lockless queue for cleanup
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
>> Signed-off-by: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>> drivers/net/ethernet/hisilicon/Makefile | 2 +-
>> drivers/net/ethernet/hisilicon/hip04_eth.c | 969 +++++++++++++++++++++++++++++
>> 2 files changed, 970 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/net/ethernet/hisilicon/hip04_eth.c
>>
>> diff --git a/drivers/net/ethernet/hisilicon/Makefile b/drivers/net/ethernet/hisilicon/Makefile
>> index 40115a7..6c14540 100644
>> --- a/drivers/net/ethernet/hisilicon/Makefile
>> +++ b/drivers/net/ethernet/hisilicon/Makefile
>> @@ -3,4 +3,4 @@
>> #
>>
>> obj-$(CONFIG_HIX5HD2_GMAC) += hix5hd2_gmac.o
>> -obj-$(CONFIG_HIP04_ETH) += hip04_mdio.o
>> +obj-$(CONFIG_HIP04_ETH) += hip04_mdio.o hip04_eth.o
>> diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
>> new file mode 100644
>> index 0000000..525214e
>> --- /dev/null
>> +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
>> @@ -0,0 +1,969 @@
>> +
>> +/* Copyright (c) 2014 Linaro Ltd.
>> + * Copyright (c) 2014 Hisilicon Limited.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + */
>> +
>> +#include <linux/module.h>
>> +#include <linux/etherdevice.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/ktime.h>
>> +#include <linux/of_address.h>
>> +#include <linux/phy.h>
>> +#include <linux/of_mdio.h>
>> +#include <linux/of_net.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/regmap.h>
>> +
>> +#define PPE_CFG_RX_ADDR 0x100
>> +#define PPE_CFG_POOL_GRP 0x300
>> +#define PPE_CFG_RX_BUF_SIZE 0x400
>> +#define PPE_CFG_RX_FIFO_SIZE 0x500
>> +#define PPE_CURR_BUF_CNT 0xa200
>> +
>> +#define GE_DUPLEX_TYPE 0x08
>> +#define GE_MAX_FRM_SIZE_REG 0x3c
>> +#define GE_PORT_MODE 0x40
>> +#define GE_PORT_EN 0x44
>> +#define GE_SHORT_RUNTS_THR_REG 0x50
>> +#define GE_TX_LOCAL_PAGE_REG 0x5c
>> +#define GE_TRANSMIT_CONTROL_REG 0x60
>> +#define GE_CF_CRC_STRIP_REG 0x1b0
>> +#define GE_MODE_CHANGE_REG 0x1b4
>> +#define GE_RECV_CONTROL_REG 0x1e0
>> +#define GE_STATION_MAC_ADDRESS 0x210
>> +#define PPE_CFG_CPU_ADD_ADDR 0x580
>> +#define PPE_CFG_MAX_FRAME_LEN_REG 0x408
>> +#define PPE_CFG_BUS_CTRL_REG 0x424
>> +#define PPE_CFG_RX_CTRL_REG 0x428
>> +#define PPE_CFG_RX_PKT_MODE_REG 0x438
>> +#define PPE_CFG_QOS_VMID_GEN 0x500
>> +#define PPE_CFG_RX_PKT_INT 0x538
>> +#define PPE_INTEN 0x600
>> +#define PPE_INTSTS 0x608
>> +#define PPE_RINT 0x604
>> +#define PPE_CFG_STS_MODE 0x700
>> +#define PPE_HIS_RX_PKT_CNT 0x804
>> +
>> +/* REG_INTERRUPT */
>> +#define RCV_INT BIT(10)
>> +#define RCV_NOBUF BIT(8)
>> +#define RCV_DROP BIT(7)
>> +#define TX_DROP BIT(6)
>> +#define DEF_INT_ERR (RCV_NOBUF | RCV_DROP | TX_DROP)
>> +#define DEF_INT_MASK (RCV_INT | DEF_INT_ERR)
>> +
>> +/* TX descriptor config */
>> +#define TX_FREE_MEM BIT(0)
>> +#define TX_READ_ALLOC_L3 BIT(1)
>> +#define TX_FINISH_CACHE_INV BIT(2)
>> +#define TX_CLEAR_WB BIT(4)
>> +#define TX_L3_CHECKSUM BIT(5)
>> +#define TX_LOOP_BACK BIT(11)
>> +
>> +/* RX error */
>> +#define RX_PKT_DROP BIT(0)
>> +#define RX_L2_ERR BIT(1)
>> +#define RX_PKT_ERR (RX_PKT_DROP | RX_L2_ERR)
>> +
>> +#define SGMII_SPEED_1000 0x08
>> +#define SGMII_SPEED_100 0x07
>> +#define SGMII_SPEED_10 0x06
>> +#define MII_SPEED_100 0x01
>> +#define MII_SPEED_10 0x00
>> +
>> +#define GE_DUPLEX_FULL BIT(0)
>> +#define GE_DUPLEX_HALF 0x00
>> +#define GE_MODE_CHANGE_EN BIT(0)
>> +
>> +#define GE_TX_AUTO_NEG BIT(5)
>> +#define GE_TX_ADD_CRC BIT(6)
>> +#define GE_TX_SHORT_PAD_THROUGH BIT(7)
>> +
>> +#define GE_RX_STRIP_CRC BIT(0)
>> +#define GE_RX_STRIP_PAD BIT(3)
>> +#define GE_RX_PAD_EN BIT(4)
>> +
>> +#define GE_AUTO_NEG_CTL BIT(0)
>> +
>> +#define GE_RX_INT_THRESHOLD BIT(6)
>> +#define GE_RX_TIMEOUT 0x04
>> +
>> +#define GE_RX_PORT_EN BIT(1)
>> +#define GE_TX_PORT_EN BIT(2)
>> +
>> +#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(12)
>> +
>> +#define PPE_CFG_RX_PKT_ALIGN BIT(18)
>> +#define PPE_CFG_QOS_VMID_MODE BIT(14)
>> +#define PPE_CFG_QOS_VMID_GRP_SHIFT 8
>> +
>> +#define PPE_CFG_RX_FIFO_FSFU BIT(11)
>> +#define PPE_CFG_RX_DEPTH_SHIFT 16
>> +#define PPE_CFG_RX_START_SHIFT 0
>> +#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11
>> +
>> +#define PPE_CFG_BUS_LOCAL_REL BIT(14)
>> +#define PPE_CFG_BUS_BIG_ENDIEN BIT(0)
>> +
>> +#define RX_DESC_NUM 128
>> +#define TX_DESC_NUM 256
>> +#define TX_NEXT(N) (((N) + 1) & (TX_DESC_NUM-1))
>> +#define RX_NEXT(N) (((N) + 1) & (RX_DESC_NUM-1))
>> +
>> +#define GMAC_PPE_RX_PKT_MAX_LEN 379
>> +#define GMAC_MAX_PKT_LEN 1516
>> +#define GMAC_MIN_PKT_LEN 31
>> +#define RX_BUF_SIZE 1600
>> +#define RESET_TIMEOUT 1000
>> +#define TX_TIMEOUT (6 * HZ)
>> +
>> +#define DRV_NAME "hip04-ether"
>> +#define DRV_VERSION "v1.0"
>> +
>> +#define HIP04_MAX_TX_COALESCE_USECS 200
>> +#define HIP04_MIN_TX_COALESCE_USECS 100
>> +#define HIP04_MAX_TX_COALESCE_FRAMES 200
>> +#define HIP04_MIN_TX_COALESCE_FRAMES 100
>> +
>> +struct tx_desc {
>> + u32 send_addr;
>
> __be32 send_adddr; ?
>
>> + u32 send_size;
>
> __be32
>
>> + u32 next_addr;
> __be32
>
>> + u32 cfg;
> __be32
>
>> + u32 wb_addr;
> __be32 wb_addr ?
>
>> +} __aligned(64);
>> +
>> +struct rx_desc {
>> + u16 reserved_16;
>> + u16 pkt_len;
>> + u32 reserve1[3];
>> + u32 pkt_err;
>> + u32 reserve2[4];
>> +};
>> +
>> +struct hip04_priv {
>> + void __iomem *base;
>> + int phy_mode;
>> + int chan;
>> + unsigned int port;
>> + unsigned int speed;
>> + unsigned int duplex;
>> + unsigned int reg_inten;
>> +
>> + struct napi_struct napi;
>> + struct net_device *ndev;
>> +
>> + struct tx_desc *tx_desc;
>> + dma_addr_t tx_desc_dma;
>> + struct sk_buff *tx_skb[TX_DESC_NUM];
>> + dma_addr_t tx_phys[TX_DESC_NUM];
>
> This is not an efficient way to store skb/phys, as for each skb, info
> will be store in 2 separate cache lines.
>
> It would be better to use a
>
> struct hip04_tx_desc {
> struct sk_buff *skb;
> dma_addr_t phys;
> }
>
>> + unsigned int tx_head;
>> +
>> + int tx_coalesce_frames;
>> + int tx_coalesce_usecs;
>> + struct hrtimer tx_coalesce_timer;
>> +
>> + unsigned char *rx_buf[RX_DESC_NUM];
>> + dma_addr_t rx_phys[RX_DESC_NUM];
>
> Same thing here : Use a struct to get better data locality.
>
>> + unsigned int rx_head;
>> + unsigned int rx_buf_size;
>> +
>> + struct device_node *phy_node;
>> + struct phy_device *phy;
>> + struct regmap *map;
>> + struct work_struct tx_timeout_task;
>> +
>> + /* written only by tx cleanup */
>> + unsigned int tx_tail ____cacheline_aligned_in_smp;
>> +};
>> +
>> +static inline unsigned int tx_count(unsigned int head, unsigned int tail)
>> +{
>> + return (head - tail) % (TX_DESC_NUM - 1);
>> +}
>> +
>> +static void hip04_config_port(struct net_device *ndev, u32 speed, u32 duplex)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + u32 val;
>> +
>> + priv->speed = speed;
>> + priv->duplex = duplex;
>> +
>> + switch (priv->phy_mode) {
>> + case PHY_INTERFACE_MODE_SGMII:
>> + if (speed == SPEED_1000)
>> + val = SGMII_SPEED_1000;
>> + else if (speed == SPEED_100)
>> + val = SGMII_SPEED_100;
>> + else
>> + val = SGMII_SPEED_10;
>> + break;
>> + case PHY_INTERFACE_MODE_MII:
>> + if (speed == SPEED_100)
>> + val = MII_SPEED_100;
>> + else
>> + val = MII_SPEED_10;
>> + break;
>> + default:
>> + netdev_warn(ndev, "not supported mode\n");
>> + val = MII_SPEED_10;
>> + break;
>> + }
>> + writel_relaxed(val, priv->base + GE_PORT_MODE);
>> +
>> + val = duplex ? GE_DUPLEX_FULL : GE_DUPLEX_HALF;
>> + writel_relaxed(val, priv->base + GE_DUPLEX_TYPE);
>> +
>> + val = GE_MODE_CHANGE_EN;
>> + writel_relaxed(val, priv->base + GE_MODE_CHANGE_REG);
>> +}
>> +
>> +static void hip04_reset_ppe(struct hip04_priv *priv)
>> +{
>> + u32 val, tmp, timeout = 0;
>> +
>> + do {
>> + regmap_read(priv->map, priv->port * 4 + PPE_CURR_BUF_CNT, &val);
>> + regmap_read(priv->map, priv->port * 4 + PPE_CFG_RX_ADDR, &tmp);
>> + if (timeout++ > RESET_TIMEOUT)
>> + break;
>> + } while (val & 0xfff);
>> +}
>> +
>> +static void hip04_config_fifo(struct hip04_priv *priv)
>> +{
>> + u32 val;
>> +
>> + val = readl_relaxed(priv->base + PPE_CFG_STS_MODE);
>> + val |= PPE_CFG_STS_RX_PKT_CNT_RC;
>> + writel_relaxed(val, priv->base + PPE_CFG_STS_MODE);
>> +
>> + val = BIT(priv->port);
>> + regmap_write(priv->map, priv->port * 4 + PPE_CFG_POOL_GRP, val);
>> +
>> + val = priv->port << PPE_CFG_QOS_VMID_GRP_SHIFT;
>> + val |= PPE_CFG_QOS_VMID_MODE;
>> + writel_relaxed(val, priv->base + PPE_CFG_QOS_VMID_GEN);
>> +
>> + val = RX_BUF_SIZE;
>> + regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_BUF_SIZE, val);
>> +
>> + val = RX_DESC_NUM << PPE_CFG_RX_DEPTH_SHIFT;
>> + val |= PPE_CFG_RX_FIFO_FSFU;
>> + val |= priv->chan << PPE_CFG_RX_START_SHIFT;
>> + regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_FIFO_SIZE, val);
>> +
>> + val = NET_IP_ALIGN << PPE_CFG_RX_CTRL_ALIGN_SHIFT;
>> + writel_relaxed(val, priv->base + PPE_CFG_RX_CTRL_REG);
>> +
>> + val = PPE_CFG_RX_PKT_ALIGN;
>> + writel_relaxed(val, priv->base + PPE_CFG_RX_PKT_MODE_REG);
>> +
>> + val = PPE_CFG_BUS_LOCAL_REL | PPE_CFG_BUS_BIG_ENDIEN;
>> + writel_relaxed(val, priv->base + PPE_CFG_BUS_CTRL_REG);
>> +
>> + val = GMAC_PPE_RX_PKT_MAX_LEN;
>> + writel_relaxed(val, priv->base + PPE_CFG_MAX_FRAME_LEN_REG);
>> +
>> + val = GMAC_MAX_PKT_LEN;
>> + writel_relaxed(val, priv->base + GE_MAX_FRM_SIZE_REG);
>> +
>> + val = GMAC_MIN_PKT_LEN;
>> + writel_relaxed(val, priv->base + GE_SHORT_RUNTS_THR_REG);
>> +
>> + val = readl_relaxed(priv->base + GE_TRANSMIT_CONTROL_REG);
>> + val |= GE_TX_AUTO_NEG | GE_TX_ADD_CRC | GE_TX_SHORT_PAD_THROUGH;
>> + writel_relaxed(val, priv->base + GE_TRANSMIT_CONTROL_REG);
>> +
>> + val = GE_RX_STRIP_CRC;
>> + writel_relaxed(val, priv->base + GE_CF_CRC_STRIP_REG);
>> +
>> + val = readl_relaxed(priv->base + GE_RECV_CONTROL_REG);
>> + val |= GE_RX_STRIP_PAD | GE_RX_PAD_EN;
>> + writel_relaxed(val, priv->base + GE_RECV_CONTROL_REG);
>> +
>> + val = GE_AUTO_NEG_CTL;
>> + writel_relaxed(val, priv->base + GE_TX_LOCAL_PAGE_REG);
>> +}
>> +
>> +static void hip04_mac_enable(struct net_device *ndev)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + u32 val;
>> +
>> + /* enable tx & rx */
>> + val = readl_relaxed(priv->base + GE_PORT_EN);
>> + val |= GE_RX_PORT_EN | GE_TX_PORT_EN;
>> + writel_relaxed(val, priv->base + GE_PORT_EN);
>> +
>> + /* clear rx int */
>> + val = RCV_INT;
>> + writel_relaxed(val, priv->base + PPE_RINT);
>> +
>> + /* config recv int */
>> + val = GE_RX_INT_THRESHOLD | GE_RX_TIMEOUT;
>> + writel_relaxed(val, priv->base + PPE_CFG_RX_PKT_INT);
>> +
>> + /* enable interrupt */
>> + priv->reg_inten = DEF_INT_MASK;
>> + writel_relaxed(priv->reg_inten, priv->base + PPE_INTEN);
>> +}
>> +
>> +static void hip04_mac_disable(struct net_device *ndev)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + u32 val;
>> +
>> + /* disable int */
>> + priv->reg_inten &= ~(DEF_INT_MASK);
>> + writel_relaxed(priv->reg_inten, priv->base + PPE_INTEN);
>> +
>> + /* disable tx & rx */
>> + val = readl_relaxed(priv->base + GE_PORT_EN);
>> + val &= ~(GE_RX_PORT_EN | GE_TX_PORT_EN);
>> + writel_relaxed(val, priv->base + GE_PORT_EN);
>> +}
>> +
>> +static void hip04_set_xmit_desc(struct hip04_priv *priv, dma_addr_t phys)
>> +{
>> + writel(phys, priv->base + PPE_CFG_CPU_ADD_ADDR);
>> +}
>> +
>> +static void hip04_set_recv_desc(struct hip04_priv *priv, dma_addr_t phys)
>> +{
>> + regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_ADDR, phys);
>> +}
>> +
>> +static u32 hip04_recv_cnt(struct hip04_priv *priv)
>> +{
>> + return readl(priv->base + PPE_HIS_RX_PKT_CNT);
>> +}
>> +
>> +static void hip04_update_mac_address(struct net_device *ndev)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> +
>> + writel_relaxed(((ndev->dev_addr[0] << 8) | (ndev->dev_addr[1])),
>> + priv->base + GE_STATION_MAC_ADDRESS);
>> + writel_relaxed(((ndev->dev_addr[2] << 24) | (ndev->dev_addr[3] << 16) |
>> + (ndev->dev_addr[4] << 8) | (ndev->dev_addr[5])),
>> + priv->base + GE_STATION_MAC_ADDRESS + 4);
>> +}
>> +
>> +static int hip04_set_mac_address(struct net_device *ndev, void *addr)
>> +{
>> + eth_mac_addr(ndev, addr);
>> + hip04_update_mac_address(ndev);
>> + return 0;
>> +}
>> +
>> +static int hip04_tx_reclaim(struct net_device *ndev, bool force)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + unsigned tx_tail = priv->tx_tail;
>> + struct tx_desc *desc;
>> + unsigned int bytes_compl = 0, pkts_compl = 0;
>> + unsigned int count;
>> +
>> + smp_rmb();
>> + count = tx_count(ACCESS_ONCE(priv->tx_head), tx_tail);
>> + if (count == 0)
>> + goto out;
>> +
>> + while (count) {
>> + desc = &priv->tx_desc[tx_tail];
>> + if (desc->send_addr != 0) {
>> + if (force)
>> + desc->send_addr = 0;
>> + else
>> + break;
>> + }
>> +
>> + if (priv->tx_phys[tx_tail]) {
>> + dma_unmap_single(&ndev->dev, priv->tx_phys[tx_tail],
>> + priv->tx_skb[tx_tail]->len,
>> + DMA_TO_DEVICE);
>> + priv->tx_phys[tx_tail] = 0;
>> + }
>> + pkts_compl++;
>> + bytes_compl += priv->tx_skb[tx_tail]->len;
>> + dev_kfree_skb(priv->tx_skb[tx_tail]);
>> + priv->tx_skb[tx_tail] = NULL;
>> + tx_tail = TX_NEXT(tx_tail);
>> + count--;
>> + }
>> +
>> + priv->tx_tail = tx_tail;
>> + smp_wmb(); /* Ensure tx_tail visible to xmit */
>> +
>> +out:
>> + if (pkts_compl || bytes_compl)
>
> Testing bytes_compl should be enough : There is no way pkt_compl could
> be 0 if bytes_compl is not 0.
>
>> + netdev_completed_queue(ndev, pkts_compl, bytes_compl);
>> +
>> + if (unlikely(netif_queue_stopped(ndev)) && (count < (TX_DESC_NUM - 1)))
>> + netif_wake_queue(ndev);
>> +
>> + return count;
>> +}
>> +
>> +static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>> +{
>> + struct hip04_priv *priv = netdev_priv(ndev);
>> + struct net_device_stats *stats = &ndev->stats;
>> + unsigned int tx_head = priv->tx_head, count;
>> + struct tx_desc *desc = &priv->tx_desc[tx_head];
>> + dma_addr_t phys;
>> +
>> + smp_rmb();
>> + count = tx_count(tx_head, ACCESS_ONCE(priv->tx_tail));
>> + if (count == (TX_DESC_NUM - 1)) {
>> + netif_stop_queue(ndev);
>> + return NETDEV_TX_BUSY;
>> + }
>> +
>> + phys = dma_map_single(&ndev->dev, skb->data, skb->len, DMA_TO_DEVICE);
>> + if (dma_mapping_error(&ndev->dev, phys)) {
>> + dev_kfree_skb(skb);
>> + return NETDEV_TX_OK;
>> + }
>> +
>> + priv->tx_skb[tx_head] = skb;
>> + priv->tx_phys[tx_head] = phys;
>> + desc->send_addr = cpu_to_be32(phys);
>> + desc->send_size = cpu_to_be32(skb->len);
>> + desc->cfg = cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV);
>> + phys = priv->tx_desc_dma + tx_head * sizeof(struct tx_desc);
>> + desc->wb_addr = cpu_to_be32(phys);
>> + skb_tx_timestamp(skb);
>> +
>> + hip04_set_xmit_desc(priv, phys);
>> + priv->tx_head = TX_NEXT(tx_head);
>> + count++;
>
> Starting from this point, skb might already have been freed by TX
> completion.
>
> Its racy to access skb->len
>
>> + netdev_sent_queue(ndev, skb->len);
>> +
>> + stats->tx_bytes += skb->len;
>> + stats->tx_packets++;
>> +
>> + /* Ensure tx_head update visible to tx reclaim */
>> + smp_wmb();
>> +
>> + /* queue is getting full, better start cleaning up now */
>> + if (count >= priv->tx_coalesce_frames) {
>> + if (napi_schedule_prep(&priv->napi)) {
>> + /* disable rx interrupt and timer */
>> + priv->reg_inten &= ~(RCV_INT);
>> + writel_relaxed(DEF_INT_MASK & ~RCV_INT,
>> + priv->base + PPE_INTEN);
>> + hrtimer_cancel(&priv->tx_coalesce_timer);
>> + __napi_schedule(&priv->napi);
>> + }
>> + } else if (!hrtimer_is_queued(&priv->tx_coalesce_timer)) {
>> + /* cleanup not pending yet, start a new timer */
>> + hrtimer_start_expires(&priv->tx_coalesce_timer,
>> + HRTIMER_MODE_REL);
>> + }
>> +
>> + return NETDEV_TX_OK;
>> +}
>> +
>> +static int hip04_rx_poll(struct napi_struct *napi, int budget)
>> +{
>> + struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);
>> + struct net_device *ndev = priv->ndev;
>> + struct net_device_stats *stats = &ndev->stats;
>> + unsigned int cnt = hip04_recv_cnt(priv);
>> + struct rx_desc *desc;
>> + struct sk_buff *skb;
>> + unsigned char *buf;
>> + bool last = false;
>> + dma_addr_t phys;
>> + int rx = 0;
>> + int tx_remaining;
>> + u16 len;
>> + u32 err;
>> +
>> + while (cnt && !last) {
>> + buf = priv->rx_buf[priv->rx_head];
>> + skb = build_skb(buf, priv->rx_buf_size);
>> + if (unlikely(!skb))
>> + net_dbg_ratelimited("build_skb failed\n");
>
> Well, is skb is NULL, you're crashing later...
> You really have to address a memory allocation error much better than
> that !
>
>> +
>> + dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
>> + RX_BUF_SIZE, DMA_FROM_DEVICE);
>> + priv->rx_phys[priv->rx_head] = 0;
>> +
>> + desc = (struct rx_desc *)skb->data;
>> + len = be16_to_cpu(desc->pkt_len);
>> + err = be32_to_cpu(desc->pkt_err);
>> +
>> + if (0 == len) {
>> + dev_kfree_skb_any(skb);
>> + last = true;
>> + } else if ((err & RX_PKT_ERR) || (len >= GMAC_MAX_PKT_LEN)) {
>> + dev_kfree_skb_any(skb);
>> + stats->rx_dropped++;
>> + stats->rx_errors++;
>> + } else {
>> + skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
>> + skb_put(skb, len);
>> + skb->protocol = eth_type_trans(skb, ndev);
>> + napi_gro_receive(&priv->napi, skb);
>> + stats->rx_packets++;
>> + stats->rx_bytes += len;
>> + rx++;
>> + }
>> +
>> + buf = netdev_alloc_frag(priv->rx_buf_size);
>> + if (!buf)
>> + goto done;
>
> Same problem here : In case of memory allocation error, your driver is
> totally screwed.
>
>> + phys = dma_map_single(&ndev->dev, buf,
>> + RX_BUF_SIZE, DMA_FROM_DEVICE);
>> + if (dma_mapping_error(&ndev->dev, phys))
>> + goto done;
>
> Same problem here : You really have to recover properly.
>
>> + priv->rx_buf[priv->rx_head] = buf;
>> + priv->rx_phys[priv->rx_head] = phys;
>> + hip04_set_recv_desc(priv, phys);
>> +
>> + priv->rx_head = RX_NEXT(priv->rx_head);
>> + if (rx >= budget)
>> + goto done;
>> +
>> + if (--cnt == 0)
>> + cnt = hip04_recv_cnt(priv);
>> + }
>> +
>> + if (!(priv->reg_inten & RCV_INT)) {
>> + /* enable rx interrupt */
>> + priv->reg_inten |= RCV_INT;
>> + writel_relaxed(priv->reg_inten, priv->base + PPE_INTEN);
>> + }
>> + napi_complete(napi);
>> +done:
>> + /* clean up tx descriptors and start a new timer if necessary */
>> + tx_remaining = hip04_tx_reclaim(ndev, false);
>> + if (rx < budget && tx_remaining)
>> + hrtimer_start_expires(&priv->tx_coalesce_timer, HRTIMER_MODE_REL);
>> +
>> + return rx;
>> +}
>> +
Yes, thanks, fix them later.
Ding
>
>
> .
>
--
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
* Re: [PATCH v2 2/2] fixup! net/macb: improved ethtool statistics support
From: Nicolas Ferre @ 2015-01-15 10:35 UTC (permalink / raw)
To: Xander Huff, davem
Cc: netdev, jaeden.amero, rich.tollerton, ben.shelton, brad.mouring,
linux-kernel, cyrille.pitchen
In-Reply-To: <1421274051-21588-2-git-send-email-xander.huff@ni.com>
Le 14/01/2015 23:20, Xander Huff a écrit :
> Add spaces around arithmetic operators.
> Make a separate gem_ethtool_ops for the new statistics functions.
> Adjust new block comments to match the existing comments in macb.h.
I wouldn't have mixed the 3 modification in one patch.
More comments below...
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> ---
> drivers/net/ethernet/cadence/macb.c | 25 +++--
> drivers/net/ethernet/cadence/macb.h | 203 +++++++++---------------------------
> 2 files changed, 68 insertions(+), 160 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index dd8c202..f60f8f8 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -1832,15 +1832,15 @@ static void gem_update_stats(struct macb *bp)
>
> for (i = 0; i < GEM_STATS_LEN; ++i, ++p) {
> u32 offset = gem_statistics[i].offset;
> - u64 val = __raw_readl(bp->regs+offset);
> + u64 val = __raw_readl(bp->regs + offset);
>
> bp->ethtool_stats[i] += val;
> *p += val;
>
> if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) {
> /* Add GEM_OCTTXH, GEM_OCTRXH */
> - val = __raw_readl(bp->regs+offset+4);
> - bp->ethtool_stats[i] += ((u64)val)<<32;
> + val = __raw_readl(bp->regs+offset + 4);
> + bp->ethtool_stats[i] += ((u64)val) << 32;
> *(++p) += val;
> }
> }
> @@ -1891,7 +1891,7 @@ static void gem_get_ethtool_stats(struct net_device *dev,
>
> bp = netdev_priv(dev);
> gem_update_stats(bp);
> - memcpy(data, &bp->ethtool_stats, sizeof(u64)*GEM_STATS_LEN);
> + memcpy(data, &bp->ethtool_stats, sizeof(u64) * GEM_STATS_LEN);
> }
>
> static int gem_get_sset_count(struct net_device *dev, int sset)
> @@ -2032,11 +2032,21 @@ const struct ethtool_ops macb_ethtool_ops = {
> .get_regs = macb_get_regs,
> .get_link = ethtool_op_get_link,
> .get_ts_info = ethtool_op_get_ts_info,
> +};
> +EXPORT_SYMBOL_GPL(macb_ethtool_ops);
> +
> +const struct ethtool_ops gem_ethtool_ops = {
> + .get_settings = macb_get_settings,
> + .set_settings = macb_set_settings,
> + .get_regs_len = macb_get_regs_len,
> + .get_regs = macb_get_regs,
> + .get_link = ethtool_op_get_link,
> + .get_ts_info = ethtool_op_get_ts_info,
> .get_ethtool_stats = gem_get_ethtool_stats,
> .get_strings = gem_get_ethtool_strings,
> .get_sset_count = gem_get_sset_count,
> };
> -EXPORT_SYMBOL_GPL(macb_ethtool_ops);
> +EXPORT_SYMBOL_GPL(gem_ethtool_ops);
>
> int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> {
> @@ -2325,7 +2335,10 @@ static int __init macb_probe(struct platform_device *pdev)
>
> dev->netdev_ops = &macb_netdev_ops;
> netif_napi_add(dev, &bp->napi, macb_poll, 64);
> - dev->ethtool_ops = &macb_ethtool_ops;
> + if (macb_is_gem(bp))
There is such a test 3 lines after: why not insert these setup there? It
seems to me that ethtool_ops is not used in the gap.
> + dev->ethtool_ops = &gem_ethtool_ops;
> + else
> + dev->ethtool_ops = &macb_ethtool_ops;
>
> dev->base_addr = regs->start;
>
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index d7b93d0..2ea5355 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -82,159 +82,52 @@
> #define GEM_SA4B 0x00A0 /* Specific4 Bottom */
> #define GEM_SA4T 0x00A4 /* Specific4 Top */
> #define GEM_OTX 0x0100 /* Octets transmitted */
I see, it's modified hereafter! Why not integrate this part in previous
patch?
> -#define GEM_OCTTXL 0x0100 /* Octets transmitted
> - * [31:0]
> - */
> -#define GEM_OCTTXH 0x0104 /* Octets transmitted
> - * [47:32]
> - */
> -#define GEM_TXCNT 0x0108 /* Error-free Frames
> - * Transmitted counter
> - */
> -#define GEM_TXBCCNT 0x010c /* Error-free Broadcast
> - * Frames counter
> - */
> -#define GEM_TXMCCNT 0x0110 /* Error-free Multicast
> - * Frames counter
> - */
> -#define GEM_TXPAUSECNT 0x0114 /* Pause Frames
> - * Transmitted Counter
> - */
> -#define GEM_TX64CNT 0x0118 /* Error-free 64 byte
> - * Frames Transmitted
> - * counter
> - */
> -#define GEM_TX65CNT 0x011c /* Error-free 65-127 byte
> - * Frames Transmitted
> - * counter
> - */
> -#define GEM_TX128CNT 0x0120 /* Error-free 128-255
> - * byte Frames
> - * Transmitted counter
> - */
> -#define GEM_TX256CNT 0x0124 /* Error-free 256-511
> - * byte Frames
> - * transmitted counter
> - */
> -#define GEM_TX512CNT 0x0128 /* Error-free 512-1023
> - * byte Frames
> - * transmitted counter
> - */
> -#define GEM_TX1024CNT 0x012c /* Error-free 1024-1518
> - * byte Frames
> - * transmitted counter
> - */
> -#define GEM_TX1519CNT 0x0130 /* Error-free larger than
> - * 1519 byte Frames
> - * tranmitted counter
> - */
> -#define GEM_TXURUNCNT 0x0134 /* TX under run error
> - * counter
> - */
> -#define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame
> - * Counter
> - */
> -#define GEM_MULTICOLLCNT 0x013c /* Multiple Collision
> - * Frame Counter
> - */
> -#define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision
> - * Frame Counter
> - */
> -#define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame
> - * Counter
> - */
> -#define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission
> - * Frame Counter
> - */
> -#define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error
> - * Counter
> - */
> +#define GEM_OCTTXL 0x0100 /* Octets transmitted [31:0] */
> +#define GEM_OCTTXH 0x0104 /* Octets transmitted [47:32] */
> +#define GEM_TXCNT 0x0108 /* Error-free Frames Transmitted counter */
> +#define GEM_TXBCCNT 0x010c /* Error-free Broadcast Frames counter */
> +#define GEM_TXMCCNT 0x0110 /* Error-free Multicast Frames counter */
> +#define GEM_TXPAUSECNT 0x0114 /* Pause Frames Transmitted Counter */
> +#define GEM_TX64CNT 0x0118 /* Error-free 64 byte Frames Transmitted counter */
> +#define GEM_TX65CNT 0x011c /* Error-free 65-127 byte Frames Transmitted counter */
> +#define GEM_TX128CNT 0x0120 /* Error-free 128-255 byte Frames Transmitted counter */
> +#define GEM_TX256CNT 0x0124 /* Error-free 256-511 byte Frames transmitted counter */
> +#define GEM_TX512CNT 0x0128 /* Error-free 512-1023 byte Frames transmitted counter */
> +#define GEM_TX1024CNT 0x012c /* Error-free 1024-1518 byte Frames transmitted counter */
> +#define GEM_TX1519CNT 0x0130 /* Error-free larger than 1519 byte Frames tranmitted counter */
> +#define GEM_TXURUNCNT 0x0134 /* TX under run error counter */
> +#define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame Counter */
> +#define GEM_MULTICOLLCNT 0x013c /* Multiple Collision Frame Counter */
> +#define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision Frame Counter */
> +#define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame Counter */
> +#define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission Frame Counter */
> +#define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error Counter */
> #define GEM_ORX 0x0150 /* Octets received */
> -#define GEM_OCTRXL 0x0150 /* Octets received
> - * [31:0]
> - */
> -#define GEM_OCTRXH 0x0154 /* Octets received
> - * [47:32]
> - */
> -#define GEM_RXCNT 0x0158 /* Error-free Frames
> - * Received Counter
> - */
> -#define GEM_RXBROADCNT 0x015c /* Error-free Broadcast
> - * Frames Received
> - * Counter
> - */
> -#define GEM_RXMULTICNT 0x0160 /* Error-free Multicast
> - * Frames Received
> - * Counter
> - */
> -#define GEM_RXPAUSECNT 0x0164 /* Error-free Pause
> - * Frames Received
> - * Counter
> - */
> -#define GEM_RX64CNT 0x0168 /* Error-free 64 byte
> - * Frames Received
> - * Counter
> - */
> -#define GEM_RX65CNT 0x016c /* Error-free 65-127 byte
> - * Frames Received
> - * Counter
> - */
> -#define GEM_RX128CNT 0x0170 /* Error-free 128-255
> - * byte Frames Received
> - * Counter
> - */
> -#define GEM_RX256CNT 0x0174 /* Error-free 256-511
> - * byte Frames Received
> - * Counter
> - */
> -#define GEM_RX512CNT 0x0178 /* Error-free 512-1023
> - * byte Frames Received
> - * Counter
> - */
> -#define GEM_RX1024CNT 0x017c /* Error-free 1024-1518
> - * byte Frames Received
> - * Counter
> - */
> -#define GEM_RX1519CNT 0x0180 /* Error-free larger than
> - * 1519 Frames Received
> - * Counter
> - */
> -#define GEM_RXUNDRCNT 0x0184 /* Undersize Frames
> - * Received Counter
> - */
> -#define GEM_RXOVRCNT 0x0188 /* Oversize Frames
> - * Received Counter
> - */
> -#define GEM_RXJABCNT 0x018c /* Jabbers Received
> - * Counter
> - */
> -#define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence
> - * Error Counter
> - */
> -#define GEM_RXLENGTHCNT 0x0194 /* Length Field Error
> - * Counter
> - */
> -#define GEM_RXSYMBCNT 0x0198 /* Symbol Error
> - * Counter
> - */
> -#define GEM_RXALIGNCNT 0x019c /* Alignment Error
> - * Counter
> - */
> -#define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error
> - * Counter
> - */
> -#define GEM_RXORCNT 0x01a4 /* Receive Overrun
> - * Counter
> - */
> -#define GEM_RXIPCCNT 0x01a8 /* IP header Checksum
> - * Error Counter
> - */
> -#define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error
> - * Counter
> - */
> -#define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error
> - * Counter
> - */
> +#define GEM_OCTRXL 0x0150 /* Octets received [31:0] */
> +#define GEM_OCTRXH 0x0154 /* Octets received [47:32] */
> +#define GEM_RXCNT 0x0158 /* Error-free Frames Received Counter */
> +#define GEM_RXBROADCNT 0x015c /* Error-free Broadcast Frames Received Counter */
> +#define GEM_RXMULTICNT 0x0160 /* Error-free Multicast Frames Received Counter */
> +#define GEM_RXPAUSECNT 0x0164 /* Error-free Pause Frames Received Counter */
> +#define GEM_RX64CNT 0x0168 /* Error-free 64 byte Frames Received Counter */
> +#define GEM_RX65CNT 0x016c /* Error-free 65-127 byte Frames Received Counter */
> +#define GEM_RX128CNT 0x0170 /* Error-free 128-255 byte Frames Received Counter */
> +#define GEM_RX256CNT 0x0174 /* Error-free 256-511 byte Frames Received Counter */
> +#define GEM_RX512CNT 0x0178 /* Error-free 512-1023 byte Frames Received Counter */
> +#define GEM_RX1024CNT 0x017c /* Error-free 1024-1518 byte Frames Received Counter */
> +#define GEM_RX1519CNT 0x0180 /* Error-free larger than 1519 Frames Received Counter */
> +#define GEM_RXUNDRCNT 0x0184 /* Undersize Frames Received Counter */
> +#define GEM_RXOVRCNT 0x0188 /* Oversize Frames Received Counter */
> +#define GEM_RXJABCNT 0x018c /* Jabbers Received Counter */
> +#define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence Error Counter */
> +#define GEM_RXLENGTHCNT 0x0194 /* Length Field Error Counter */
> +#define GEM_RXSYMBCNT 0x0198 /* Symbol Error Counter */
> +#define GEM_RXALIGNCNT 0x019c /* Alignment Error Counter */
> +#define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error Counter */
> +#define GEM_RXORCNT 0x01a4 /* Receive Overrun Counter */
> +#define GEM_RXIPCCNT 0x01a8 /* IP header Checksum Error Counter */
> +#define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error Counter */
> +#define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error Counter */
> #define GEM_DCFG1 0x0280 /* Design Config 1 */
> #define GEM_DCFG2 0x0284 /* Design Config 2 */
> #define GEM_DCFG3 0x0288 /* Design Config 3 */
> @@ -748,7 +641,8 @@ struct gem_stats {
> u32 rx_udp_checksum_errors;
> };
>
> -/* Describes the name and offset of an individual statistic register, as
> +/*
> + * Describes the name and offset of an individual statistic register, as
> * returned by `ethtool -S`. Also describes which net_device_stats statistics
> * this register should contribute to.
> */
> @@ -778,7 +672,8 @@ struct gem_statistic {
> .stat_bits = bits \
> }
>
> -/* list of gem statistic registers. The names MUST match the
> +/*
> + * list of gem statistic registers. The names MUST match the
> * corresponding GEM_* definitions.
> */
> static const struct gem_statistic gem_statistics[] = {
Anyway, thanks for having posted a new revision. Can you prepare another
series?
Bye,
--
Nicolas Ferre
^ permalink raw reply
* [PATCH iproute2 2/2] lib: fix setns() function when !HAVE_SETNS
From: Nicolas Dichtel @ 2015-01-15 10:36 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Vadim Kochan
In-Reply-To: <1421318185-10858-1-git-send-email-nicolas.dichtel@6wind.com>
When HAVE_SETNS is not set, iproute2 provides a local implementation of this
function based on __NR_setns.
This macro is defined in sys/syscall.h, which was not included, thus the local
implementation always returned -1.
CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
include/namespace.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/namespace.h b/include/namespace.h
index 28a4223b3eb2..52f7fbd7bb8c 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -3,6 +3,7 @@
#include <sched.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
#include <errno.h>
#define NETNS_RUN_DIR "/var/run/netns"
--
2.1.0
^ permalink raw reply related
* [PATCH iproute2 1/2] lib: fix warning in namespace.h
From: Nicolas Dichtel @ 2015-01-15 10:36 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Vadim Kochan
Warning was:
In file included from bridge.c:16:0:
../include/namespace.h:33:12: warning: ‘setns’ defined but not used [-Wunused-function]
CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
include/namespace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/namespace.h b/include/namespace.h
index b8c5cad6aaa2..28a4223b3eb2 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -30,7 +30,7 @@
#endif
#ifndef HAVE_SETNS
-static int setns(int fd, int nstype)
+static inline int setns(int fd, int nstype)
{
#ifdef __NR_setns
return syscall(__NR_setns, fd, nstype);
--
2.1.0
^ permalink raw reply related
* [PATCH] sh_eth: Fix addition of .trscer_err_mask to wrong SoC data
From: Geert Uytterhoeven @ 2015-01-15 10:52 UTC (permalink / raw)
To: David S. Miller
Cc: Nobuhiro Iwamatsu, Yoshihiro Shimoda, netdev, linux-sh,
Geert Uytterhoeven
commit b284fbe3b3ef9cf8 ("sh_eth: Fix access to TRSCER register") wanted
to add a .trscer_err_mask value to the R-Car Gen2 family-specific data
structure (r8a779x_data), but it was accidentally added to the
SH7724-specific data structure (sh7724_data).
Presumably this happened due to a patch conflict with commit
d407bc0203539031 ("sh-eth: Set fdr_value of R-Car SoCs"), which added
another field at the same position.
Move the field setting to fix this.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: b284fbe3b3ef9cf8 ("sh_eth: Fix access to TRSCER register")
---
Commit b284fbe3b3ef9cf8 is in Linus' tree.
drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 37583a9d88534346..8d227d919e194847 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -498,6 +498,8 @@ static struct sh_eth_cpu_data r8a779x_data = {
EESR_ECI,
.fdr_value = 0x00000f0f,
+ .trscer_err_mask = DESC_I_RINT8,
+
.apr = 1,
.mpr = 1,
.tpauser = 1,
@@ -538,8 +540,6 @@ static struct sh_eth_cpu_data sh7724_data = {
EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
EESR_ECI,
- .trscer_err_mask = DESC_I_RINT8,
-
.apr = 1,
.mpr = 1,
.tpauser = 1,
--
1.9.1
^ permalink raw reply related
* [PATCH] net: sh_eth: Use u32 for 32-bit register data
From: Geert Uytterhoeven @ 2015-01-15 10:54 UTC (permalink / raw)
To: David S. Miller
Cc: Nobuhiro Iwamatsu, Yoshihiro Shimoda, netdev, linux-sh,
Geert Uytterhoeven
Replace "unsigned long" by "u32" when handling 32-bit register data.
A.o., this saves 11 * 36 bytes in the static sh_eth_cpu_data structures
when compiling for 64-bit.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is against net-next
drivers/net/ethernet/renesas/sh_eth.c | 14 +++++++-------
drivers/net/ethernet/renesas/sh_eth.h | 30 ++++++++++++++----------------
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 8d227d919e194847..67103b012b8eef5e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -594,7 +594,7 @@ static struct sh_eth_cpu_data sh7757_data = {
static void sh_eth_chip_reset_giga(struct net_device *ndev)
{
int i;
- unsigned long mahr[2], malr[2];
+ u32 mahr[2], malr[2];
/* save MAHR and MALR */
for (i = 0; i < 2; i++) {
@@ -988,7 +988,7 @@ static void read_mac_address(struct net_device *ndev, unsigned char *mac)
}
}
-static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
+static u32 sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
{
if (sh_eth_is_gether(mdp) || sh_eth_is_rz_fast_ether(mdp))
return EDTRR_TRNS_GETHER;
@@ -1521,7 +1521,7 @@ static void sh_eth_rcv_snd_enable(struct net_device *ndev)
}
/* error control function */
-static void sh_eth_error(struct net_device *ndev, int intr_status)
+static void sh_eth_error(struct net_device *ndev, u32 intr_status)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
u32 felic_stat;
@@ -1637,7 +1637,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
struct sh_eth_private *mdp = netdev_priv(ndev);
struct sh_eth_cpu_data *cd = mdp->cd;
irqreturn_t ret = IRQ_NONE;
- unsigned long intr_status, intr_enable;
+ u32 intr_status, intr_enable;
spin_lock(&mdp->lock);
@@ -1663,7 +1663,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
__napi_schedule(&mdp->napi);
} else {
netdev_warn(ndev,
- "ignoring interrupt, status 0x%08lx, mask 0x%08lx.\n",
+ "ignoring interrupt, status 0x%08x, mask 0x%08x.\n",
intr_status, intr_enable);
}
}
@@ -1696,7 +1696,7 @@ static int sh_eth_poll(struct napi_struct *napi, int budget)
napi);
struct net_device *ndev = napi->dev;
int quota = budget;
- unsigned long intr_status;
+ u32 intr_status;
for (;;) {
intr_status = sh_eth_read(ndev, EESR);
@@ -2067,7 +2067,7 @@ static void sh_eth_tx_timeout(struct net_device *ndev)
netif_err(mdp, timer, ndev,
"transmit timed out, status %8.8x, resetting...\n",
- (int)sh_eth_read(ndev, EESR));
+ sh_eth_read(ndev, EESR));
/* tx_errors count up */
ndev->stats.tx_errors++;
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 71f5de1171bd93d0..7bfaf1c81ea2c210 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -459,21 +459,21 @@ struct sh_eth_cpu_data {
/* mandatory initialize value */
int register_type;
- unsigned long eesipr_value;
+ u32 eesipr_value;
/* optional initialize value */
- unsigned long ecsr_value;
- unsigned long ecsipr_value;
- unsigned long fdr_value;
- unsigned long fcftr_value;
- unsigned long rpadir_value;
+ u32 ecsr_value;
+ u32 ecsipr_value;
+ u32 fdr_value;
+ u32 fcftr_value;
+ u32 rpadir_value;
/* interrupt checking mask */
- unsigned long tx_check;
- unsigned long eesr_err_check;
+ u32 tx_check;
+ u32 eesr_err_check;
/* Error mask */
- unsigned long trscer_err_mask;
+ u32 trscer_err_mask;
/* hardware features */
unsigned long irq_flags; /* IRQ configuration flags */
@@ -542,7 +542,7 @@ static inline void sh_eth_soft_swap(char *src, int len)
#endif
}
-static inline void sh_eth_write(struct net_device *ndev, unsigned long data,
+static inline void sh_eth_write(struct net_device *ndev, u32 data,
int enum_index)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -550,8 +550,7 @@ static inline void sh_eth_write(struct net_device *ndev, unsigned long data,
iowrite32(data, mdp->addr + mdp->reg_offset[enum_index]);
}
-static inline unsigned long sh_eth_read(struct net_device *ndev,
- int enum_index)
+static inline u32 sh_eth_read(struct net_device *ndev, int enum_index)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -564,14 +563,13 @@ static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp,
return mdp->tsu_addr + mdp->reg_offset[enum_index];
}
-static inline void sh_eth_tsu_write(struct sh_eth_private *mdp,
- unsigned long data, int enum_index)
+static inline void sh_eth_tsu_write(struct sh_eth_private *mdp, u32 data,
+ int enum_index)
{
iowrite32(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
}
-static inline unsigned long sh_eth_tsu_read(struct sh_eth_private *mdp,
- int enum_index)
+static inline u32 sh_eth_tsu_read(struct sh_eth_private *mdp, int enum_index)
{
return ioread32(mdp->tsu_addr + mdp->reg_offset[enum_index]);
}
--
1.9.1
^ permalink raw reply related
* [PATCH 1/3] genetlink: document parallel_ops
From: Johannes Berg @ 2015-01-15 11:04 UTC (permalink / raw)
To: netdev; +Cc: Jeff Layton, Sedat Dilek, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
The kernel-doc for the parallel_ops family struct member is
missing, add it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/genetlink.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 84125088c309..2ea2c55bdc87 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -27,6 +27,8 @@ struct genl_info;
* @maxattr: maximum number of attributes supported
* @netnsok: set to true if the family can handle network
* namespaces and should be presented in all of them
+ * @parallel_ops: operations can be called in parallel and aren't
+ * synchronized by the core genetlink code
* @pre_doit: called before an operation's doit callback, it may
* do additional, common, filtering and return an error
* @post_doit: called after an operation's doit callback, it may
--
2.1.4
^ permalink raw reply related
* [PATCH 2/3] genetlink: disallow subscribing to unknown mcast groups
From: Johannes Berg @ 2015-01-15 11:04 UTC (permalink / raw)
To: netdev; +Cc: Jeff Layton, Sedat Dilek, Johannes Berg
In-Reply-To: <1421319885-31779-1-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
Jeff Layton reported that he could trigger the multicast unbind warning
in generic netlink using trinity. I originally thought it was a race
condition between unregistering the generic netlink family and closing
the socket, but there's a far simpler explanation: genetlink currently
allows subscribing to groups that don't (yet) exist, and the warning is
triggered when unsubscribing again while the group still doesn't exist.
Originally, I had a warning in the subscribe case and accepted it out of
userspace API concerns, but the warning was of course wrong and removed
later.
However, I now think that allowing userspace to subscribe to groups that
don't exist is wrong and could possibly become a security problem:
Consider a (new) genetlink family implementing a permission check in
the mcast_bind() function similar to the like the audit code does today;
it would be possible to bypass the permission check by guessing the ID
and subscribing to the group it exists. This is only possible in case a
family like that would be dynamically loaded, but it doesn't seem like a
huge stretch, for example wireless may be loaded when you plug in a USB
device.
To avoid this reject such subscription attempts.
If this ends up causing userspace issues we may need to add a workaround
in af_netlink to deny such requests but not return an error.
Reported-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/netlink/genetlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 2e11061ef885..c18d3f5624b2 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -985,7 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {
static int genl_bind(struct net *net, int group)
{
- int i, err = 0;
+ int i, err = -ENOENT;
down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
--
2.1.4
^ permalink raw reply related
* [PATCH 3/3] genetlink: synchronize socket closing and family removal
From: Johannes Berg @ 2015-01-15 11:04 UTC (permalink / raw)
To: netdev; +Cc: Jeff Layton, Sedat Dilek, Johannes Berg
In-Reply-To: <1421319885-31779-1-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
In addition to the problem Jeff Layton reported, I looked at the code
and reproduced the same warning by subscribing and removing the genl
family with a socket still open. This is a fairly tricky race which
originates in the fact that generic netlink allows the family to go
away while sockets are still open - unlike regular netlink which has
a module refcount for every open socket so in general this cannot be
triggered.
Trying to resolve this issue by the obvious locking isn't possible as
it will result in deadlocks between unregistration and group unbind
notification (which incidentally lockdep doesn't find due to the home
grown locking in the netlink table.)
To really resolve this, introduce a "closing socket" reference counter
(for generic netlink only, as it's the only affected family) in the
core netlink code and use that in generic netlink to wait for all the
sockets that are being closed at the same time as a generic netlink
family is removed.
This fixes the race that when a socket is closed, it will should call
the unbind, but if the family is removed at the same time the unbind
will not find it, leading to the warning. The real problem though is
that in this case the unbind could actually find a new family that is
registered to have a multicast group with the same ID, and call its
mcast_unbind() leading to confusing.
Also remove the warning since it would still trigger, but is now no
longer a problem.
This also moves the code in af_netlink.c to before unreferencing the
module to avoid having the same problem in the normal non-genl case.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/linux/genetlink.h | 4 ++++
include/net/genetlink.h | 5 ++++-
net/netlink/af_netlink.c | 28 +++++++++++++++++++++-------
net/netlink/af_netlink.h | 1 +
net/netlink/genetlink.c | 16 +++++++++-------
5 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 55b685719d52..09460d6d6682 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -11,6 +11,10 @@ extern void genl_unlock(void);
extern int lockdep_genl_is_held(void);
#endif
+/* for synchronisation between af_netlink and genetlink */
+extern atomic_t genl_sk_destructing_cnt;
+extern wait_queue_head_t genl_sk_destructing_waitq;
+
/**
* rcu_dereference_genl - rcu_dereference with debug checking
* @p: The pointer to read, prior to dereferencing
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 2ea2c55bdc87..6c92415311ca 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -35,7 +35,10 @@ struct genl_info;
* undo operations done by pre_doit, for example release locks
* @mcast_bind: a socket bound to the given multicast group (which
* is given as the offset into the groups array)
- * @mcast_unbind: a socket was unbound from the given multicast group
+ * @mcast_unbind: a socket was unbound from the given multicast group.
+ * Note that unbind() will not be called symmetrically if the
+ * generic netlink family is removed while there are still open
+ * sockets.
* @attrbuf: buffer to store parsed attributes
* @family_list: family list
* @mcgrps: multicast groups used by this family (private)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 01b702d63457..bccafeac7460 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -61,6 +61,7 @@
#include <linux/rhashtable.h>
#include <asm/cacheflush.h>
#include <linux/hash.h>
+#include <linux/genetlink.h>
#include <net/net_namespace.h>
#include <net/sock.h>
@@ -1089,6 +1090,10 @@ static void netlink_remove(struct sock *sk)
__sk_del_bind_node(sk);
netlink_update_listeners(sk);
}
+ if (sk->sk_protocol == NETLINK_GENERIC) {
+ atomic_inc(&genl_sk_destructing_cnt);
+ printk(KERN_DEBUG "inc destructing\n");
+ }
netlink_table_ungrab();
}
@@ -1212,6 +1217,22 @@ static int netlink_release(struct socket *sock)
* will be purged.
*/
+ /* must not acquire netlink_table_lock in any way again before unbind
+ * and notifying genetlink is done as otherwise it might deadlock
+ */
+ if (nlk->netlink_unbind) {
+ int i;
+
+ for (i = 0; i < nlk->ngroups; i++)
+ if (test_bit(i, nlk->groups))
+ nlk->netlink_unbind(sock_net(sk), i + 1);
+ }
+ if (sk->sk_protocol == NETLINK_GENERIC) {
+ atomic_dec(&genl_sk_destructing_cnt);
+ printk(KERN_DEBUG "dec destructing\n");
+ wake_up(&genl_sk_destructing_waitq);
+ }
+
sock->sk = NULL;
wake_up_interruptible_all(&nlk->wait);
@@ -1247,13 +1268,6 @@ static int netlink_release(struct socket *sock)
netlink_table_ungrab();
}
- if (nlk->netlink_unbind) {
- int i;
-
- for (i = 0; i < nlk->ngroups; i++)
- if (test_bit(i, nlk->groups))
- nlk->netlink_unbind(sock_net(sk), i + 1);
- }
kfree(nlk->groups);
nlk->groups = NULL;
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index 7518375782f5..89008405d6b4 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -2,6 +2,7 @@
#define _AF_NETLINK_H
#include <linux/rhashtable.h>
+#include <linux/atomic.h>
#include <net/sock.h>
#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index c18d3f5624b2..ee57459fc258 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -23,6 +23,9 @@
static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */
static DECLARE_RWSEM(cb_lock);
+atomic_t genl_sk_destructing_cnt = ATOMIC_INIT(0);
+DECLARE_WAIT_QUEUE_HEAD(genl_sk_destructing_waitq);
+
void genl_lock(void)
{
mutex_lock(&genl_mutex);
@@ -435,15 +438,18 @@ int genl_unregister_family(struct genl_family *family)
genl_lock_all();
- genl_unregister_mc_groups(family);
-
list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
if (family->id != rc->id || strcmp(rc->name, family->name))
continue;
+ genl_unregister_mc_groups(family);
+
list_del(&rc->family_list);
family->n_ops = 0;
- genl_unlock_all();
+ up_write(&cb_lock);
+ wait_event(genl_sk_destructing_waitq,
+ atomic_read(&genl_sk_destructing_cnt) == 0);
+ genl_unlock();
kfree(family->attrbuf);
genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0);
@@ -1014,7 +1020,6 @@ static int genl_bind(struct net *net, int group)
static void genl_unbind(struct net *net, int group)
{
int i;
- bool found = false;
down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
@@ -1027,14 +1032,11 @@ static void genl_unbind(struct net *net, int group)
if (f->mcast_unbind)
f->mcast_unbind(net, fam_grp);
- found = true;
break;
}
}
}
up_read(&cb_lock);
-
- WARN_ON(!found);
}
static int __net_init genl_pernet_init(struct net *net)
--
2.1.4
^ permalink raw reply related
* Re: [PATCH v4 20/20] kbuild: add a new kselftest_install make target to install selftests
From: Michal Marek @ 2015-01-15 11:39 UTC (permalink / raw)
To: Shuah Khan, masami.hiramatsu.pt-FCd8Q96Dh0JBDgjK7y7TUQ
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
rostedt-nx8X9YLhiw1AfugRpC6u6w, mingo-H+wXaHxf7aLQT0dZR+AlfA,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, keescook-F7+t8E8rja9g9hUCZPvPmw,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w, mpe-Gsx/Oe8HsFggBc27wqDAHg,
cov-sgV2jX0FEOL9JmXXK+q4OQ, dh.herrmann-Re5JQEeQqe8AvxtiuMwx3w,
hughd-hpIqsD4AKlfQT0dZR+AlfA, bobby.prani-Re5JQEeQqe8AvxtiuMwx3w,
serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA,
ebiederm-aS9lmoZGLiVWk0Htik3J/w, tim.bird-/MT0OVThwyLZJqsBc5GL+g,
josh-iaAMLnmF4UmaiuxdJuQwMA, koct9i-Re5JQEeQqe8AvxtiuMwx3w,
linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <54B69A1B.80006-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
On 2015-01-14 17:32, Shuah Khan wrote:
> On 01/06/2015 12:43 PM, Shuah Khan wrote:
>> Add a new make target to install to install kernel selftests.
>> This new target will build and install selftests. kselftest
>> target now depends on kselftest_install and runs the generated
>> kselftest script to reduce duplicate work and for common look
>> and feel when running tests.
>>
>> make kselftest_target:
>> -- exports kselftest INSTALL_KSFT_PATH
>> default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
>> -- exports INSTALL_KSFT_PATH
>> -- runs selftests make install target
>>
>> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
>> ---
>> Makefile | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> Hi Marek,
>
> Could you please Ack this patch, if this version looks good,
> so I can take this through ksefltest tree.
Sorry, I thought I had acked v3.
Acked-by: Michal Marek <mmarek-AlSwsSmVLrQ@public.gmane.org>
Michal
^ permalink raw reply
* Re: [PATCH for 3.19 3/3] rtlwifi: rtl8192ee: Fix several bugs
From: Kalle Valo @ 2015-01-15 11:42 UTC (permalink / raw)
To: Larry Finger; +Cc: linux-wireless, Troy Tan, netdev
In-Reply-To: <1421257036-5382-4-git-send-email-Larry.Finger@lwfinger.net>
Larry Finger <Larry.Finger@lwfinger.net> writes:
> From: Troy Tan <troy_tan@realsil.com.cn>
>
> The following bugs are fixed in this driver:
> 1. Problems parsing C2H CMD
> 2. An ad-hoc connection can cause a TX freeze.
> 3. There are additional conditions that cause a TX freeze.
> 4. The previous code failed to handle situations where an RX
> descriptor was unavailable.
>
> Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Is this really so important that it should go to 3.19? A patch titled
"Fix several bugs" immediately makes me cautious and then I look at the
patch itself I see rewriting functions instead of simple bug fixes. From
a quick look this looks more -next material than 3.19.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH iproute2 1/2] lib: fix warning in namespace.h
From: Vadim Kochan @ 2015-01-15 11:33 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: shemminger, netdev, Vadim Kochan
In-Reply-To: <1421318185-10858-1-git-send-email-nicolas.dichtel@6wind.com>
On Thu, Jan 15, 2015 at 11:36:24AM +0100, Nicolas Dichtel wrote:
> Warning was:
> In file included from bridge.c:16:0:
> ../include/namespace.h:33:12: warning: ‘setns’ defined but not used [-Wunused-function]
>
> CC: Vadim Kochan <vadim4j@gmail.com>
> Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> include/namespace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/namespace.h b/include/namespace.h
> index b8c5cad6aaa2..28a4223b3eb2 100644
> --- a/include/namespace.h
> +++ b/include/namespace.h
> @@ -30,7 +30,7 @@
> #endif
>
> #ifndef HAVE_SETNS
> -static int setns(int fd, int nstype)
> +static inline int setns(int fd, int nstype)
> {
> #ifdef __NR_setns
> return syscall(__NR_setns, fd, nstype);
> --
> 2.1.0
>
Thank You Nicolas!
I have to do more testing before send a patches.
Thanks,
^ permalink raw reply
* Re: [PATCH for 3.19 2/3] rtlwifi: Fix handling of new style descriptors
From: Kalle Valo @ 2015-01-15 11:44 UTC (permalink / raw)
To: Larry Finger
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Troy Tan,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1421257036-5382-3-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org> writes:
> From: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
>
> The hardware and firmware for the RTL8192EE utilize a FIFO list of
> descriptors. There were some problems with the initial implementation.
> The worst of these failed to detect that the FIFO was becoming full,
> which led to the device needing to be power cycled. As this condition
> is not relevant to most of the devices supported by rtlwifi, a callback
> routine was added to detect this situation. This patch implements the
> necessary changes in the pci handler.
>
> Signed-off-by: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
> Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
[...]
> --- a/drivers/net/wireless/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/rtlwifi/wifi.h
> @@ -2172,6 +2172,7 @@ struct rtl_hal_ops {
> void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
> struct rtl_wow_pattern *rtl_pattern,
> u8 index);
> + u16 (*get_available_desc)(struct ieee80211_hw *hw, u8 q_idx);
I don't see this op set anywhere within the patch. Is that correct or
did I miss something?
--
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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
* RE: [PATCH v2 1/2] fixup! net/macb: Adding comments to various #defs to make interpretation easier
From: David Laight @ 2015-01-15 11:46 UTC (permalink / raw)
To: 'Xander Huff', davem@davemloft.net,
nicolas.ferre@atmel.com
Cc: netdev@vger.kernel.org, jaeden.amero@ni.com,
rich.tollerton@ni.com, ben.shelton@ni.com, brad.mouring@ni.com,
linux-kernel@vger.kernel.org, cyrille.pitchen@atmel.com
In-Reply-To: <1421274051-21588-1-git-send-email-xander.huff@ni.com>
From: Xander Huff
> Put #define comments into a single line.
Breaks the 80 char limit.
I suspect the definitions could be made to fit by judicial editing.
But that probably requires knowing exactly what the comments mean.
David
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> ---
> drivers/net/ethernet/cadence/macb.h | 107 +++++++++---------------------------
> 1 file changed, 26 insertions(+), 81 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 378b218..d7b93d0 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -275,9 +275,7 @@
> #define MACB_THALT_SIZE 1
> #define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */
> #define MACB_NCR_TPF_SIZE 1
> -#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum
> - * pause frame
> - */
> +#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */
> #define MACB_TZQ_SIZE 1
>
> /* Bitfields in NCFGR */
> @@ -299,9 +297,7 @@
> #define MACB_UNI_SIZE 1
> #define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */
> #define MACB_BIG_SIZE 1
> -#define MACB_EAE_OFFSET 9 /* External address match
> - * enable
> - */
> +#define MACB_EAE_OFFSET 9 /* External address match enable */
> #define MACB_EAE_SIZE 1
> #define MACB_CLK_OFFSET 10
> #define MACB_CLK_SIZE 2
> @@ -313,9 +309,7 @@
> #define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
> #define MACB_RBOF_OFFSET 14 /* Receive buffer offset */
> #define MACB_RBOF_SIZE 2
> -#define MACB_RLCE_OFFSET 16 /* Length field error frame
> - * discard
> - */
> +#define MACB_RLCE_OFFSET 16 /* Length field error frame discard */
> #define MACB_RLCE_SIZE 1
> #define MACB_DRFCS_OFFSET 17 /* FCS remove */
> #define MACB_DRFCS_SIZE 1
> @@ -335,41 +329,22 @@
> #define GEM_RXCOEN_SIZE 1
>
> /* Constants for data bus width. */
> -#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus
> - * width
> - */
> -#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus
> - * width
> - */
> -#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus
> - * width
> - */
> +#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus width */
> +#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus width */
> +#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus width */
>
> /* Bitfields in DMACFG. */
> -#define GEM_FBLDO_OFFSET 0 /* AHB fixed burst length for
> - * DMA data operations
> - */
> +#define GEM_FBLDO_OFFSET 0 /* AHB fixed burst length for DMA data operations */
> #define GEM_FBLDO_SIZE 5
> -#define GEM_ENDIA_OFFSET 7 /* AHB endian swap mode enable
> - * for packet data accesses
> - */
> +#define GEM_ENDIA_OFFSET 7 /* AHB endian swap mode enable for packet data accesses */
> #define GEM_ENDIA_SIZE 1
> -#define GEM_RXBMS_OFFSET 8 /* Receiver packet buffer
> - * memory size select
> - */
> +#define GEM_RXBMS_OFFSET 8 /* Receiver packet buffer memory size select */
> #define GEM_RXBMS_SIZE 2
> -#define GEM_TXPBMS_OFFSET 10 /* Transmitter packet buffer
> - * memory size select
> - */
> +#define GEM_TXPBMS_OFFSET 10 /* Transmitter packet buffer memory size select */
> #define GEM_TXPBMS_SIZE 1
> -#define GEM_TXCOEN_OFFSET 11 /* Transmitter IP, TCP and
> - * UDP checksum generation
> - * offload enable
> - */
> +#define GEM_TXCOEN_OFFSET 11 /* Transmitter IP, TCP and UDP checksum generation
> offload enable */
> #define GEM_TXCOEN_SIZE 1
> -#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size in
> - * AHB system memory
> - */
> +#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size in AHB system memory */
> #define GEM_RXBS_SIZE 8
> #define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */
> #define GEM_DDRP_SIZE 1
> @@ -378,13 +353,9 @@
> /* Bitfields in NSR */
> #define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */
> #define MACB_NSR_LINK_SIZE 1
> -#define MACB_MDIO_OFFSET 1 /* status of the mdio_in
> - * pin
> - */
> +#define MACB_MDIO_OFFSET 1 /* status of the mdio_in pin */
> #define MACB_MDIO_SIZE 1
> -#define MACB_IDLE_OFFSET 2 /* The PHY management logic is
> - * idle (i.e. has completed)
> - */
> +#define MACB_IDLE_OFFSET 2 /* The PHY management logic is idle (i.e. has completed)
> */
> #define MACB_IDLE_SIZE 1
>
> /* Bitfields in TSR */
> @@ -396,9 +367,7 @@
> #define MACB_TSR_RLE_SIZE 1
> #define MACB_TGO_OFFSET 3 /* Transmit go */
> #define MACB_TGO_SIZE 1
> -#define MACB_BEX_OFFSET 4 /* Transmit frame corruption
> - * due to AHB error
> - */
> +#define MACB_BEX_OFFSET 4 /* Transmit frame corruption due to AHB error */
> #define MACB_BEX_SIZE 1
> #define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
> #define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
> @@ -424,43 +393,23 @@
> #define MACB_RXUBR_SIZE 1
> #define MACB_TXUBR_OFFSET 3 /* TX used bit read */
> #define MACB_TXUBR_SIZE 1
> -#define MACB_ISR_TUND_OFFSET 4 /* Enable trnasmit buffer
> - * under run interrupt
> - */
> +#define MACB_ISR_TUND_OFFSET 4 /* Enable trnasmit buffer under run interrupt */
> #define MACB_ISR_TUND_SIZE 1
> -#define MACB_ISR_RLE_OFFSET 5 /* Enable retry limit exceeded
> - * or late collision interrupt
> - */
> +#define MACB_ISR_RLE_OFFSET 5 /* Enable retry limit exceeded or late collision interrupt
> */
> #define MACB_ISR_RLE_SIZE 1
> -#define MACB_TXERR_OFFSET 6 /* Enable transmit frame
> - * corruption due to AHB error
> - * interrupt
> - */
> +#define MACB_TXERR_OFFSET 6 /* Enable transmit frame corruption due to AHB error
> interrupt */
> #define MACB_TXERR_SIZE 1
> -#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete
> - * interrupt
> - */
> +#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete interrupt */
> #define MACB_TCOMP_SIZE 1
> -#define MACB_ISR_LINK_OFFSET 9 /* Enable link change
> - * interrupt
> - */
> +#define MACB_ISR_LINK_OFFSET 9 /* Enable link change interrupt */
> #define MACB_ISR_LINK_SIZE 1
> -#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun
> - * interrupt
> - */
> +#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun interrupt */
> #define MACB_ISR_ROVR_SIZE 1
> -#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK
> - * interrupt
> - */
> +#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK interrupt */
> #define MACB_HRESP_SIZE 1
> -#define MACB_PFR_OFFSET 12 /* Enable pause frame with
> - * non-zero pause quantum
> - * interrupt
> - */
> +#define MACB_PFR_OFFSET 12 /* Enable pause frame with non-zero pause quantum
> interrupt */
> #define MACB_PFR_SIZE 1
> -#define MACB_PTZ_OFFSET 13 /* Enable pause time zero
> - * interrupt
> - */
> +#define MACB_PTZ_OFFSET 13 /* Enable pause time zero interrupt */
> #define MACB_PTZ_SIZE 1
>
> /* Bitfields in MAN */
> @@ -472,13 +421,9 @@
> #define MACB_REGA_SIZE 5
> #define MACB_PHYA_OFFSET 23 /* PHY address */
> #define MACB_PHYA_SIZE 5
> -#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01
> - * is write.
> - */
> +#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01 is write. */
> #define MACB_RW_SIZE 2
> -#define MACB_SOF_OFFSET 30 /* Must be written to 1 for
> - * Clause 22 operation
> - */
> +#define MACB_SOF_OFFSET 30 /* Must be written to 1 for Clause 22 operation */
> #define MACB_SOF_SIZE 2
>
> /* Bitfields in USRIO (AVR32) */
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" 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: [PATCH for 3.19 2/3] rtlwifi: Fix handling of new style descriptors
From: Kalle Valo @ 2015-01-15 12:00 UTC (permalink / raw)
To: 谭杭波
Cc: larry.finger, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <C11178B3EB8EC446A461ADCC3E27182146C9A9F8@rsex2.realsil.com.cn>
Hi Troy,
please avoid top-posting.
谭杭波 <troy_tan@realsil.com.cn> writes:
> You can find get_available_desc here:
>
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/
> pci.c
> index e25faac..a62170e 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -578,6 +578,13 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int
> prio)
> else
> entry = (u8 *)(&ring->desc[ring->idx]);
>
> + if (rtlpriv->cfg->ops->get_available_desc &&
> + rtlpriv->cfg->ops->get_available_desc(hw, prio) <= 1) {
> + RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_DMESG,
> + "no available desc!\n");
> + return;
> + }
I don't see rtlpriv->cfg->ops->get_available_desc set here, only being
called?
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH for 3.19 3/3] rtlwifi: rtl8192ee: Fix several bugs
From: Kalle Valo @ 2015-01-15 12:03 UTC (permalink / raw)
To: 谭杭波
Cc: larry.finger, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <C11178B3EB8EC446A461ADCC3E27182146C9AA38@rsex2.realsil.com.cn>
谭杭波 <troy_tan@realsil.com.cn> writes:
> I think a have located the bug reported, but the code
> seems so unclean, so after the bug fix I modified the code
> and tried to make it more easy to understand.
That's good, but I cannot send cleanup patches to 3.19. Even if the
cleanup fixes something. It's better to do bug fixes and cleanup in
separate patches.
--
Kalle Valo
^ permalink raw reply
* [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2015-01-15
From: Jeff Kirsher @ 2015-01-15 12:19 UTC (permalink / raw)
To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene
This series contains updates to i40e and i40evf.
This series is a little bit larger than normal because two of the patches are
version bumps.
Shannon provides tweaks to i40e and i40evf to keep the firmware, software
and silicon validation in line together by removing unused and
deprecated code, adding define for iSCSI and fix queue mask size. Fix
i40e so we do not give up in the reset/rebuild process if DCB setup
fails, just handle it the same as in the probe setup. Cleans up PTP
log messages by removing the use of __func__ as we are not using that
any longer and removes the netdev name, since that can change and can
be misleading. Adds struct size checks to indirect and command
structs that were left out previously. Added admin queue API updates
(LLDP control, OEM OCSD and OCBB commands).
Kevin increases ASQ timeout for scenarios with multi-function devices.
Carolyn fixes a problem where the interrupts descriptions from the MSIx
configuration were truncating the needed bus info, which makes it hard
to distinguish configurations from port to port. Increased the string
buffer size in order to allow the full data to be displayed.
Sravanthi cleans up the dump stats string from debugfs.
Jacob updates i40e to only enable the PTP interrupt in PFs which have PTP
enabled, instead of blindly enabling the PTP interrupt flags for all PFs.
Also updated i40e so that we do not do Tx or Rx timestamps if we do not
have PTP enabled. Added the same check against pf->ptp_rx as we have
in Rx timestamp code path because it is possible that the user can
configure only Tx hardware timestamping so we do not want to check for
Rx timestamp hang since the software won't be handling them.
Neerav updates the driver to disable firmware LLDP agent for NICs with
a firmware version lower than v4.3 and added a message when this happens.
Adds parsing and reporting of iSCSI capability for a given device or
function, as well as adding support for iSCSI partition type with DCB
in NPAR mode.
The following are changes since commit 4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Carolyn Wyborny (2):
i40e: fix proc/int descriptions
i40e: Add define for interrupt name string len
Catherine Sullivan (1):
i40e/i40evf: Bump i40e/i40evf versions
Jacob Keller (4):
i40e: only enable PTP interrupt cause if PTP is enabled
i40e: check I40E_FLAG_PTP before handling Tx or Rx timestamps
i40e: use same check for Rx hang as for Rx timestamps
i40e: when Rx timestamps disabled set specific mode
Kevin Scott (1):
i40e/i40evf: Increase ASQ timeout
Neerav Parikh (2):
i40e: Issue "Stop LLDP" command for firmware older than v4.3
i40e: Support for NPAR iSCSI partition with DCB
Shannon Nelson (5):
i40e/i40evf: AdminQ updates ww36
i40e: don't give up on DCB error after reset
i40e: clean up PTP log messages
i40e: add more struct size checks
i40e: AQ API updates for new commands
Sravanthi Tangeda (2):
i40e: Dump Stats string removed from debugfs help command
i40e/i40evf: Bump i40e and i40evf versions
drivers/net/ethernet/intel/i40e/i40e.h | 5 +-
drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +-
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 152 +++++++++++++++++++--
drivers/net/ethernet/intel/i40e/i40e_common.c | 5 +
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 1 -
drivers/net/ethernet/intel/i40e/i40e_main.c | 120 +++++++++++-----
drivers/net/ethernet/intel/i40e/i40e_ptp.c | 61 +++++----
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +
drivers/net/ethernet/intel/i40e/i40e_type.h | 1 +
drivers/net/ethernet/intel/i40evf/i40e_adminq.h | 2 +-
.../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 108 +++++++++++++--
drivers/net/ethernet/intel/i40evf/i40e_type.h | 1 +
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
13 files changed, 371 insertions(+), 92 deletions(-)
--
1.9.3
^ permalink raw reply
* [net-next 01/17] i40e/i40evf: AdminQ updates ww36
From: Jeff Kirsher @ 2015-01-15 12:19 UTC (permalink / raw)
To: davem
Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene,
Kamil Kacperski, Jeff Kirsher
In-Reply-To: <1421324368-6860-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Shannon Nelson <shannon.nelson@intel.com>
Several little tweaks to keep FW, SV, and SW in line together
- Remove the unused and deprecated
i40e_aqc_opc_debug_modify_internals
- Add define for iSCSI capability
- Fix queue mask size
- Adjust i40e_aqc_oem_param_change for ease-of-use
Change-ID: I51f250b367912968a7cec61b3a68110d9796e914
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Kamil Kacperski <kamil.kacperski@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 9 +++++----
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index 8835aee..490dfcf 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -276,7 +276,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_debug_write_reg = 0xFF04,
i40e_aqc_opc_debug_modify_reg = 0xFF07,
i40e_aqc_opc_debug_dump_internals = 0xFF08,
- i40e_aqc_opc_debug_modify_internals = 0xFF09,
};
/* command structures and indirect data structures */
@@ -410,6 +409,7 @@ struct i40e_aqc_list_capabilities_element_resp {
#define I40E_AQ_CAP_ID_VSI 0x0017
#define I40E_AQ_CAP_ID_DCB 0x0018
#define I40E_AQ_CAP_ID_FCOE 0x0021
+#define I40E_AQ_CAP_ID_ISCSI 0x0022
#define I40E_AQ_CAP_ID_RSS 0x0040
#define I40E_AQ_CAP_ID_RXQ 0x0041
#define I40E_AQ_CAP_ID_TXQ 0x0042
@@ -1207,7 +1207,7 @@ struct i40e_aqc_add_remove_cloud_filters_element_data {
} ipaddr;
__le16 flags;
#define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0
-#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
+#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
/* 0x0000 reserved */
#define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001
@@ -1240,7 +1240,7 @@ struct i40e_aqc_add_remove_cloud_filters_element_data {
u8 reserved[4];
__le16 queue_number;
#define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0
-#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x3F << \
+#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x7FF << \
I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
u8 reserved2[14];
/* response section */
@@ -2106,7 +2106,8 @@ struct i40e_aqc_oem_param_change {
#define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1
#define I40E_AQ_OEM_PARAM_MAC 2
__le32 param_value1;
- u8 param_value2[8];
+ __le16 param_value2;
+ u8 reserved[6];
};
I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
index ff1b163..a20b2b0 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
@@ -276,7 +276,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_debug_write_reg = 0xFF04,
i40e_aqc_opc_debug_modify_reg = 0xFF07,
i40e_aqc_opc_debug_dump_internals = 0xFF08,
- i40e_aqc_opc_debug_modify_internals = 0xFF09,
};
/* command structures and indirect data structures */
@@ -410,6 +409,7 @@ struct i40e_aqc_list_capabilities_element_resp {
#define I40E_AQ_CAP_ID_VSI 0x0017
#define I40E_AQ_CAP_ID_DCB 0x0018
#define I40E_AQ_CAP_ID_FCOE 0x0021
+#define I40E_AQ_CAP_ID_ISCSI 0x0022
#define I40E_AQ_CAP_ID_RSS 0x0040
#define I40E_AQ_CAP_ID_RXQ 0x0041
#define I40E_AQ_CAP_ID_TXQ 0x0042
@@ -1207,7 +1207,7 @@ struct i40e_aqc_add_remove_cloud_filters_element_data {
} ipaddr;
__le16 flags;
#define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0
-#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
+#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
/* 0x0000 reserved */
#define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001
@@ -1240,7 +1240,7 @@ struct i40e_aqc_add_remove_cloud_filters_element_data {
u8 reserved[4];
__le16 queue_number;
#define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0
-#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x3F << \
+#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x7FF << \
I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
u8 reserved2[14];
/* response section */
@@ -2082,7 +2082,8 @@ struct i40e_aqc_oem_param_change {
#define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1
#define I40E_AQ_OEM_PARAM_MAC 2
__le32 param_value1;
- u8 param_value2[8];
+ __le16 param_value2;
+ u8 reserved[6];
};
I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
--
1.9.3
^ permalink raw reply related
* [net-next 03/17] i40e: fix proc/int descriptions
From: Jeff Kirsher @ 2015-01-15 12:19 UTC (permalink / raw)
To: davem; +Cc: Carolyn Wyborny, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <1421324368-6860-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Carolyn Wyborny <carolyn.wyborny@intel.com>
This patch fixes a problem where the /proc/interrupts descriptions
from the msix configuration were truncating the needed bus info,
making it hard to distinguish configuration from port to port.
This patch increases the string buffer size in order to allow the
full data to be displayed and sync's the text formatting of the misc
and fdir interrupt names
Change-ID: Ib01d6c61fb3f4ac70fbdf5bcc520b22638ea54b7
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index f3b036d..cd34d9b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4845,7 +4845,7 @@ static int i40e_open(struct net_device *netdev)
int i40e_vsi_open(struct i40e_vsi *vsi)
{
struct i40e_pf *pf = vsi->back;
- char int_name[IFNAMSIZ];
+ char int_name[IFNAMSIZ + 9];
int err;
/* allocate descriptors */
@@ -4879,7 +4879,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
goto err_set_queues;
} else if (vsi->type == I40E_VSI_FDIR) {
- snprintf(int_name, sizeof(int_name) - 1, "%s-%s-fdir",
+ snprintf(int_name, sizeof(int_name) - 1, "%s-%s:fdir",
dev_driver_string(&pf->pdev->dev),
dev_name(&pf->pdev->dev));
err = i40e_vsi_request_irq(vsi, int_name);
--
1.9.3
^ permalink raw reply related
* [net-next 02/17] i40e/i40evf: Increase ASQ timeout
From: Jeff Kirsher @ 2015-01-15 12:19 UTC (permalink / raw)
To: davem; +Cc: Kevin Scott, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <1421324368-6860-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Kevin Scott <kevin.c.scott@intel.com>
Increase ASQ timeout for some scenarios with multi-function devices
Change-ID: I2d7655b19e6c6f9a7ad04deacb106ca8d53886db
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +-
drivers/net/ethernet/intel/i40evf/i40e_adminq.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
index 564d0b0..de17b6f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
@@ -148,7 +148,7 @@ static inline int i40e_aq_rc_to_posix(u32 aq_ret, u16 aq_rc)
/* general information */
#define I40E_AQ_LARGE_BUF 512
-#define I40E_ASQ_CMD_TIMEOUT 100 /* msecs */
+#define I40E_ASQ_CMD_TIMEOUT 250 /* msecs */
void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
u16 opcode);
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
index 6c31bf2..60f04e9 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
@@ -148,7 +148,7 @@ static inline int i40e_aq_rc_to_posix(u32 aq_ret, u16 aq_rc)
/* general information */
#define I40E_AQ_LARGE_BUF 512
-#define I40E_ASQ_CMD_TIMEOUT 100 /* msecs */
+#define I40E_ASQ_CMD_TIMEOUT 250 /* msecs */
void i40evf_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
u16 opcode);
--
1.9.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox