Re: [PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
On 06/10/2015 10:29 PM, Joe Perches wrote: On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: Signed-off-by: Ivan Vecera ivec...@redhat.com There should be some indication a few messages have been deleted in the commit log and a reason why too. diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c [] @@ -965,10 +964,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, /* * Force an immediate * Transmit Schedule */ - printk(KERN_INFO bna: %s %d - TXQ_STARTED\n, - bnad-netdev-name, - txq_id); [] @@ -1057,8 +1051,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) txq_id = tcb-id; clear_bit(BNAD_TXQ_TX_STARTED, tcb-flags); netif_stop_subqueue(bnad-netdev, txq_id); - printk(KERN_INFO bna: %s %d TXQ_STOPPED\n, - bnad-netdev-name, txq_id); etc... I'm sorry I have removed them as logging noise. IMHO it is not necessary to log when .probe() and .remove() are called or when TxQ is started or stopped. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: isdn: pcbit: another off-by-one issue?
On Thu, 2015-06-11 at 11:28 +0200, Rasmus Villemoes wrote: Since nobody seems to have been hit by this ever, I wonder whether it's stable@ material. It probably doesn't make sense to fix this without also backporting 7bcc6738eef. I'm guessing nobody is using this anymore. I would be really surprised if anyone is. Let's test my idea. Hands up anyone that has: - a PCBIT ISDN-card (manufactured in Portugal by Octal, according to its Kconfig entry); - a working X86 machine with ISA; - a working ISDN line; - and, say, an ISP picking up the stuff you send down that ISDN line at the other end; - and cares how 2.6.32 (and higher) runs that setup. [Crickets.] Besides, it is, apparently, an I4L driver. (Though there's a CAPI part too. I need to check how that fits into the picture.) I4L is deprecated for ten years now (or is it even longer?). Perhaps pcbit, and the other I4L drivers, should be (finally) tossed out? That was discussed last year too, but nothing really was decided. Paul Bolle -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 1/7] net/mlx5e: Fix HW MTU settings
From: Saeed Mahameed sae...@mellanox.com Previously we configured HW MTU to be netdev-mtu, actually we need to configure netdev-mtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN). Also, query MTU can not fail, hence make the relevant helper a void functionm, add mlx5e_set_dev_port_mtu, helper function to handle MTU setting. Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/infiniband/hw/mlx5/main.c |8 +-- drivers/net/ethernet/mellanox/mlx5/core/en.h |1 - drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 61 +++-- drivers/net/ethernet/mellanox/mlx5/core/port.c| 36 +--- include/linux/mlx5/driver.h | 10 ++-- 5 files changed, 55 insertions(+), 61 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index d4dea86..79dadd6 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -446,15 +446,11 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port, if (err) goto out; - err = mlx5_query_port_max_mtu(mdev, max_mtu, port); - if (err) - goto out; + mlx5_query_port_max_mtu(mdev, max_mtu, port); props-max_mtu = mlx5_mtu_to_ib_mtu(max_mtu); - err = mlx5_query_port_oper_mtu(mdev, oper_mtu, port); - if (err) - goto out; + mlx5_query_port_oper_mtu(mdev, oper_mtu, port); props-active_mtu = mlx5_mtu_to_ib_mtu(oper_mtu); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index e9edb72..71f38bb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -57,7 +57,6 @@ #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS 0x20 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES0x80 #define MLX5E_PARAMS_DEFAULT_RX_HASH_LOG_TBL_SZ 0x7 -#define MLX5E_PARAMS_MIN_MTU46 #define MLX5E_TX_CQ_POLL_BUDGET128 #define MLX5E_UPDATE_STATS_INTERVAL200 /* msecs */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 7348c51..f9fdeac 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -277,6 +277,9 @@ static void mlx5e_send_nop(struct mlx5e_sq *sq) mlx5e_tx_notify_hw(sq, wqe); } +#define MLX5E_HW2SW_MTU(hwmtu) (hwmtu - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)) +#define MLX5E_SW2HW_MTU(swmtu) (swmtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)) + static int mlx5e_create_rq(struct mlx5e_channel *c, struct mlx5e_rq_param *param, struct mlx5e_rq *rq) @@ -305,7 +308,7 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, } rq-wqe_sz = (priv-params.lro_en) ? priv-params.lro_wqe_sz : - priv-netdev-mtu + ETH_HLEN + VLAN_HLEN; +MLX5E_SW2HW_MTU(priv-netdev-mtu); for (i = 0; i wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(rq-wq, i); @@ -1366,11 +1369,30 @@ static void mlx5e_close_tirs(struct mlx5e_priv *priv) mlx5e_close_tir(priv, i); } -int mlx5e_open_locked(struct net_device *netdev) +static int mlx5e_set_dev_port_mtu(struct net_device *netdev) { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv-mdev; - int actual_mtu; + int hw_mtu; + int err; + + err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(netdev-mtu), 1); + if (err) + return err; + + mlx5_query_port_oper_mtu(mdev, hw_mtu, 1); + + if (MLX5E_HW2SW_MTU(hw_mtu) != netdev-mtu) + netdev_warn(netdev, %s: Port MTU %d is different than netdev mtu %d\n, + __func__, MLX5E_HW2SW_MTU(hw_mtu), netdev-mtu); + + netdev-mtu = MLX5E_HW2SW_MTU(hw_mtu); + return 0; +} + +int mlx5e_open_locked(struct net_device *netdev) +{ + struct mlx5e_priv *priv = netdev_priv(netdev); int num_txqs; int err; @@ -1379,25 +1401,9 @@ int mlx5e_open_locked(struct net_device *netdev) netif_set_real_num_tx_queues(netdev, num_txqs); netif_set_real_num_rx_queues(netdev, priv-params.num_channels); - err = mlx5_set_port_mtu(mdev, netdev-mtu); - if (err) { - netdev_err(netdev, %s: mlx5_set_port_mtu failed %d\n, - __func__, err); + err = mlx5e_set_dev_port_mtu(netdev); + if (err) return err; - } - - err = mlx5_query_port_oper_mtu(mdev, actual_mtu, 1); - if (err) { - netdev_err(netdev, %s: mlx5_query_port_oper_mtu failed %d\n, - __func__, err); -
[PATCH net-next 2/7] net/mlx5e: Add HW cacheline start padding
From: Saeed Mahameed sae...@mellanox.com Enable HW cacheline start padding and align RX WQE size to cacheline while considering HW start padding. Also, fix dma_unmap call to use the correct SKB data buffer size. Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c |5 - drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 10 +- include/linux/mlx5/device.h |4 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index f9fdeac..95772dc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -309,12 +309,15 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, rq-wqe_sz = (priv-params.lro_en) ? priv-params.lro_wqe_sz : MLX5E_SW2HW_MTU(priv-netdev-mtu); + rq-wqe_sz = SKB_DATA_ALIGN(rq-wqe_sz + MLX5E_NET_IP_ALIGN); for (i = 0; i wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(rq-wq, i); + u32 byte_count = rq-wqe_sz - MLX5E_NET_IP_ALIGN; wqe-data.lkey = c-mkey_be; - wqe-data.byte_count = cpu_to_be32(rq-wqe_sz); + wqe-data.byte_count = + cpu_to_be32(byte_count | MLX5_HW_START_PADDING); } rq-pdev= c-pdev; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index ce1317c..06e7c74 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -45,18 +45,18 @@ static inline int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, if (unlikely(!skb)) return -ENOMEM; - skb_reserve(skb, MLX5E_NET_IP_ALIGN); - dma_addr = dma_map_single(rq-pdev, /* hw start padding */ - skb-data - MLX5E_NET_IP_ALIGN, - /* hw end padding */ + skb-data, + /* hw end padding */ rq-wqe_sz, DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(rq-pdev, dma_addr))) goto err_free_skb; + skb_reserve(skb, MLX5E_NET_IP_ALIGN); + *((dma_addr_t *)skb-cb) = dma_addr; wqe-data.addr = cpu_to_be64(dma_addr + MLX5E_NET_IP_ALIGN); @@ -217,7 +217,7 @@ bool mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) dma_unmap_single(rq-pdev, *((dma_addr_t *)skb-cb), -skb_end_offset(skb), +rq-wqe_sz, DMA_FROM_DEVICE); if (unlikely((cqe-op_own 4) != MLX5_CQE_RESP_SEND)) { diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index b2c4350..b943cd9 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -132,6 +132,10 @@ enum { }; enum { + MLX5_HW_START_PADDING = MLX5_INLINE_SEG, +}; + +enum { MLX5_MIN_PKEY_TABLE_SIZE = 128, MLX5_MAX_LOG_PKEY_TABLE = 5, }; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/12] fsl/fman: Add Frame Manager support
So I couldn't help having yet another look at the code, just to drive home my point. On Thu, 2015-06-11 at 10:55 +0200, Paul Bolle wrote: +void *fm_drv_init(void) static. +{ + memset(fm_drvs, 0, sizeof(fm_drvs)); fm_drvs is an external variable. It is guaranteed to be zero, isn't it? + mutex_init(fm_drv_mutex); + + /* Register to the DTB for basic FM API */ + platform_driver_register(fm_driver); + + return fm_drvs; You're returning a pointer to external variable. How's that useful? And note this is the last time we'll ever see fm_drvs. So I think that all this variable does for the code is getting initialized to zero, twice. +} + +int fm_drv_free(void *p_fm_drv) static. +{ + platform_driver_unregister(fm_driver); + mutex_destroy(fm_drv_mutex); + + return 0; This function has one caller, which doesn't check the return value. So this should be a function returning void. Of course, a wrapper of two lines called only once means you should actually not put this into a separate function. +} +static void *p_fm_drv; +static int __init __cold fm_load(void) +{ + p_fm_drv = fm_drv_init(); + if (!p_fm_drv) { fm_drv_init() returns a pointer to an external variable. So how can this happen? + pr_err(Failed to init FM wrapper!\n); + return -ENODEV; + } + + pr_info(Freescale FM module\n); + return 0; +} This is all rather basic. It must be, otherwise I wouldn't spot it. So I keep spotting these basic oddities, with every cup of coffee I treat myself to while reading through this, wherever I look. By now I'm sure there's no need for the netdev people to look at this, not yet. Paul Bolle -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/12] fsl/fman: Add Frame Manager support
You should note that I started with scanning this patch for basic, say, build system issues. Which I did find. But then I kept spotting all kind of oddities. After a while I stopped looking closely. So, to note something, I haven't yet looked into the 24 symbols this series exports. There might be a reason for all 24 of them, but I just thought it a bit suspect. But, anyhow, my guess is this series needs a close look or two before the people understanding ethernet drivers (I'm not one of them) will consider reviewing it for more substantial issues. On Wed, 2015-06-10 at 18:21 +0300, Madalin Bucur wrote: --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig +if FSL_FMAN + +config FSL_FM_MAX_FRAME_SIZE + int Maximum L2 frame size + depends on FSL_FMAN This dependency is already provided through if FSL_MAN above. + range 64 9600 + default 1522 + help + Configure this in relation to the maximum possible MTU of your + network configuration. In particular, one would need to + increase this value in order to use jumbo frames. + FSL_FM_MAX_FRAME_SIZE must accommodate the Ethernet FCS + (4 bytes) and one ETH+VLAN header (18 bytes), to a total of + 22 bytes in excess of the desired L3 MTU. + + Note that having too large a FSL_FM_MAX_FRAME_SIZE (much larger + than the actual MTU) may lead to buffer exhaustion, especially + in the case of badly fragmented datagrams on the Rx path. + Conversely, having a FSL_FM_MAX_FRAME_SIZE smaller than the + actual MTU will lead to frames being dropped. + +config FSL_FM_RX_EXTRA_HEADROOM + int Add extra headroom at beginning of data buffers + depends on FSL_FMAN Ditto. + range 16 384 + default 64 + help + Configure this to tell the Frame Manager to reserve some extra + space at the beginning of a data buffer on the receive path, + before Internal Context fields are copied. This is in addition + to the private data area already reserved for driver internal + use. The provided value must be a multiple of 16. + + This option does not affect in any way the layout of + transmitted buffers. + +endif# FSL_FMAN --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile obj-y+= fsl_fman.o -fsl_fman-objs:= fman.o fm_muram.o +fsl_fman-objs:= fman.o fm_muram.o fm.o fm_drv.o --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm.c +/* static functions */ There's no need to tell us that. +static int check_fm_parameters(struct fm_t *p_fm) +{ +#ifdef FM_AID_MODE_NO_TNUM_SW005 I think this is always defined (I already deleted that part of the patch, so perhaps I'm missing some subtle issue). + if (p_fm-p_fm_state_struct-rev_info.major_rev = 6 + p_fm-p_fm_drv_param-dma_aid_mode != + E_FMAN_DMA_AID_OUT_PORT_ID) { + pr_err(dma_aid_mode not supported by this integration.\n); + return -EDOM; + } +#endif /* FM_AID_MODE_NO_TNUM_SW005 */ +#ifdef FM_HAS_TOTAL_DMAS Ditto. + if ((p_fm-p_fm_state_struct-rev_info.major_rev 6) + (!p_fm-p_fm_state_struct-max_num_of_open_dmas || + (p_fm-p_fm_state_struct-max_num_of_open_dmas + p_fm-intg-bmi_max_num_of_dmas))) { + pr_err(max_num_of_open_dmas number has to be in the range 1 - %d\n, +p_fm-intg-bmi_max_num_of_dmas); + return -EDOM; + } +#endif /* FM_HAS_TOTAL_DMAS */ +#ifdef FM_NO_WATCHDOG Ditto. I'll stop checking for this stuff now. Please clean them up (or show me that I'm wrong). + if ((p_fm-p_fm_state_struct-rev_info.major_rev == 2) + (p_fm-p_fm_drv_param-dma_watchdog)) { + pr_err(watchdog!\n); + return -EINVAL; + } +#endif /* FM_NO_WATCHDOG */ +/* fm_init + * + * Initializes the FM module + * + * @Param[in] p_fm - FM module descriptor + * + * @Return0 on success; Error code otherwise. + */ I know little about kerneldoc, but this is not kerneldoc, right? +/* fm_free + * Frees all resources that were assigned to FM module. + * Calling this routine invalidates the descriptor. + * p_fm - FM module descriptor + *Return0 on success; Error code otherwise. + */ Ditto. +void fm_event_isr(struct fm_t *p_fm) +{ +#define FM_M_CALL_MAC_ISR(_id)\ + (p_fm-intr_mng[(enum fm_inter_module_event)(FM_EV_MAC0 + _id)]. \ + f_isr(p_fm-intr_mng[(enum fm_inter_module_event)(FM_EV_MAC0 + _id)] \ + .h_src_handle)) + uint32_t pending; + int ret; + struct fman_fpm_regs __iomem *fpm_rg; There must be a
Re: isdn: pcbit: another off-by-one issue?
[adding some emails I should Cc'ed in the first place] On Thu, Jun 11 2015, Dan Carpenter dan.carpen...@oracle.com wrote: On Wed, Jun 10, 2015 at 09:50:53PM +0200, Rasmus Villemoes wrote: Hi Dan You were last to touch drivers/isdn/pcbit/drv.c (7bcc6738eef), but I think there may still be an off-by-one in pcbit_set_msn: At the end of the loop, sp is incremented by len, but if the string contained a comma, sp will now point at that. At that point, we seem to be stuck in an infinite loop where we'll always get cp==sp and len==0, until we run out of memory. Am I reading this completely wrong? Nope. You're right. That bug has been there since before the start of git. We could fix it by doing: diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 4172e22..b156d5b 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c @@ -1053,7 +1053,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list) else back-next = ptr; back = ptr; - sp += len; + sp += len + 1; } while (cp); } Yep, that's also what I would do. Since nobody seems to have been hit by this ever, I wonder whether it's stable@ material. It probably doesn't make sense to fix this without also backporting 7bcc6738eef. Rasmus -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH] net: Add sock_common_listen for TCP and DCCP
Code refactoring: 1. Move the common code of inet_listen() and inet_dccp_listen() to sock_common_listen(). Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen(). 2. Modify and rename inet_listen() to tcp_listen(). 3. Modify and rename inet_dccp_listen() to dccp_listen(). 4. Add new callback pointer listen in struct proto for tcp_listen() and dccp_listen(). This patch makes codes more modularized and removes redudant codes. Signed-off-by: Firo Yang fir...@gmail.com --- I test it on my x86 pc. include/net/sock.h | 18 include/net/tcp.h | 1 + net/core/sock.c | 36 +++ net/dccp/dccp.h | 2 +- net/dccp/ipv4.c | 4 ++-- net/dccp/ipv6.c | 3 ++- net/dccp/proto.c| 62 - net/ipv4/af_inet.c | 58 + net/ipv4/tcp.c | 35 ++ net/ipv4/tcp_ipv4.c | 1 + net/ipv6/af_inet6.c | 2 +- net/ipv6/tcp_ipv6.c | 1 + 12 files changed, 118 insertions(+), 105 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 26c1c31..5adc7f4 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -934,6 +934,7 @@ struct proto { int (*connect)(struct sock *sk, struct sockaddr *uaddr, int addr_len); + int (*listen)(struct sock *sk, int backlog); int (*disconnect)(struct sock *sk, int flags); struct sock * (*accept)(struct sock *sk, int flags, int *err); @@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); #define SOCK_BINDADDR_LOCK 4 #define SOCK_BINDPORT_LOCK 8 +/* + * Sock common state + * These values must be enqual to correspondent TCP state + * and DCCP state. + */ +enum { + SOCK_CLOSE = TCP_CLOSE, + SOCK_LISTEN = TCP_LISTEN +}; + +enum { + SOCKF_CLOSE = TCPF_CLOSE, + SOCKF_LISTEN= TCPF_LISTEN, +}; + struct socket_alloc { struct socket socket; struct inode vfs_inode; @@ -1587,6 +1603,8 @@ int compat_sock_common_setsockopt(struct socket *sock, int level, void sk_common_release(struct sock *sk); +int sock_common_listen(struct socket *sock, int backlog); + /* * Default socket callbacks and setup code */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 978cebe..70d3f64 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -434,6 +434,7 @@ int compat_tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); void tcp_set_keepalive(struct sock *sk, int val); void tcp_syn_ack_timeout(const struct request_sock *req); +int tcp_listen(struct sock *sk, int backlog); int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); void tcp_parse_options(const struct sk_buff *skb, diff --git a/net/core/sock.c b/net/core/sock.c index e72633c..8016a1e 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2559,6 +2559,42 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, EXPORT_SYMBOL(sock_common_recvmsg); /* + * Move a socket into listening state. + */ +int sock_common_listen(struct socket *sock, int backlog) +{ + struct sock *sk = sock-sk; + unsigned char old_state; + int err; + + lock_sock(sk); + + err = -EINVAL; + if (sock-state != SS_UNCONNECTED) + goto out; + + old_state = sk-sk_state; + if (!((1 old_state) (SOCKF_CLOSE | SOCKF_LISTEN))) + goto out; + + /* Really, if the socket is already in listen state +* we can only allow the backlog to be adjusted. +*/ + if (old_state != SOCK_LISTEN) { + err = sk-sk_prot-listen(sk, backlog); + if (err) + goto out; + } + sk-sk_max_ack_backlog = backlog; + err = 0; + +out: + release_sock(sk); + return err; +} +EXPORT_SYMBOL(sock_common_listen); + +/* * Set socket options on an inet socket. */ int sock_common_setsockopt(struct socket *sock, int level, int optname, diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index bebc735..5a5acbb 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -313,7 +313,7 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); void dccp_shutdown(struct sock *sk, int how); -int inet_dccp_listen(struct socket *sock, int backlog); +int dccp_listen(struct sock *sk, int backlog); unsigned int dccp_poll(struct file *file, struct socket *sock, poll_table *wait); int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
[PATCH net-next 5/7] net/mlx5e: Support NETIF_F_SG
From: Saeed Mahameed sae...@mellanox.com When NETIF_F_SG is set, each send WQE may have a different size since each skb can have different number of fragments as of LSO header etc. This implies that a given WQE may wrap around the send queue, i.e begin at its end and continue at its start. While it is legal by the device spec, we preferred a solution that avoids it - when building of current WQE is done, if the next WQE may wrap around the send queue, fill the send queue with NOPs WQEs till its end, so that the next WQE will begin at send queue start. NOP WQE for itself cannot wrap around the send queue since it is of minimal size - 64 bytes, and all send WQEs are a multiple of that size. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h |3 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 26 ++- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 35 +++- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 71f38bb..23cc3bf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -283,6 +283,8 @@ struct mlx5e_sq { struct netdev_queue *txq; u32sqn; u32bf_buf_size; + u16max_inline; + u16edge; struct device *pdev; __be32 mkey_be; unsigned long state; @@ -453,6 +455,7 @@ enum mlx5e_link_mode { #define MLX5E_PROT_MASK(link_mode) (1 link_mode) +void mlx5e_send_nop(struct mlx5e_sq *sq, bool notify_hw); u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, void *accel_priv, select_queue_fallback_t fallback); netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 1a655fd..5458cc6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -257,26 +257,6 @@ static void mlx5e_disable_async_events(struct mlx5e_priv *priv) spin_unlock_irq(priv-async_events_spinlock); } -static void mlx5e_send_nop(struct mlx5e_sq *sq) -{ - struct mlx5_wq_cyc*wq = sq-wq; - - u16 pi = sq-pc wq-sz_m1; - struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(wq, pi); - - struct mlx5_wqe_ctrl_seg *cseg = wqe-ctrl; - - memset(cseg, 0, sizeof(*cseg)); - - cseg-opmod_idx_opcode = cpu_to_be32((sq-pc 8) | MLX5_OPCODE_NOP); - cseg-qpn_ds = cpu_to_be32((sq-sqn 8) | 0x01); - cseg-fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; - - sq-skb[pi] = NULL; - sq-pc++; - mlx5e_tx_notify_hw(sq, wqe); -} - #define MLX5E_HW2SW_MTU(hwmtu) (hwmtu - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)) #define MLX5E_SW2HW_MTU(swmtu) (swmtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)) @@ -453,7 +433,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, goto err_disable_rq; set_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, rq-state); - mlx5e_send_nop(c-sq[0]); /* trigger mlx5e_post_rx_wqes() */ + mlx5e_send_nop(c-sq[0], true); /* trigger mlx5e_post_rx_wqes() */ return 0; @@ -541,6 +521,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, sq-mkey_be = c-mkey_be; sq-channel = c; sq-tc = tc; + sq-edge= (sq-wq.sz_m1 + 1) - MLX5_SEND_WQE_MAX_WQEBBS; return 0; @@ -694,7 +675,7 @@ static void mlx5e_close_sq(struct mlx5e_sq *sq) /* ensure hw is notified of all pending wqes */ if (mlx5e_sq_has_room_for(sq, 1)) - mlx5e_send_nop(sq); + mlx5e_send_nop(sq, true); mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); while (sq-cc != sq-pc) /* wait till sq is empty */ @@ -1746,6 +1727,7 @@ static void mlx5e_build_netdev(struct net_device *netdev) netdev-ethtool_ops = mlx5e_ethtool_ops; + netdev-vlan_features|= NETIF_F_SG; netdev-vlan_features|= NETIF_F_IP_CSUM; netdev-vlan_features|= NETIF_F_IPV6_CSUM; netdev-vlan_features|= NETIF_F_GRO; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 3cfd2bc..bac268a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -34,6 +34,33 @@ #include linux/if_vlan.h #include en.h +#define MLX5E_SQ_NOPS_ROOM MLX5_SEND_WQE_MAX_WQEBBS +#define MLX5E_SQ_STOP_ROOM (MLX5_SEND_WQE_MAX_WQEBBS +\
[PATCH net-next 7/7] net/mlx5e: Add transport domain to the ethernet TIRs/TISs
From: Achiad Shochat ach...@mellanox.com Allocate and use transport domain by the Ethernet driver code. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h |1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 16 +++- 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 23cc3bf..e14120e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -389,6 +389,7 @@ struct mlx5e_priv { struct mutex state_lock; /* Protects Interface state */ struct mlx5_uarcq_uar; u32pdn; + u32tdn; struct mlx5_core_mrmr; struct mlx5e_channel **channel; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 5458cc6..4e8b0c2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1101,6 +1101,7 @@ static int mlx5e_open_tis(struct mlx5e_priv *priv, int tc) memset(in, 0, sizeof(in)); MLX5_SET(tisc, tisc, prio, tc); + MLX5_SET(tisc, tisc, transport_domain, priv-tdn); return mlx5_core_create_tis(mdev, in, sizeof(in), priv-tisn[tc]); } @@ -1199,6 +1200,8 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) { void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); + MLX5_SET(tirc, tirc, transport_domain, priv-tdn); + #define ROUGH_MAX_L2_L3_HDR_SZ 256 #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\ @@ -1818,11 +1821,18 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) goto err_unmap_free_uar; } + err = mlx5_alloc_transport_domain(mdev, priv-tdn); + if (err) { + netdev_err(netdev, %s: mlx5_alloc_transport_domain failed, %d\n, + __func__, err); + goto err_dealloc_pd; + } + err = mlx5e_create_mkey(priv, priv-pdn, priv-mr); if (err) { netdev_err(netdev, %s: mlx5e_create_mkey failed, %d\n, __func__, err); - goto err_dealloc_pd; + goto err_dealloc_transport_domain; } err = register_netdev(netdev); @@ -1839,6 +1849,9 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) err_destroy_mkey: mlx5_core_destroy_mkey(mdev, priv-mr); +err_dealloc_transport_domain: + mlx5_dealloc_transport_domain(mdev, priv-tdn); + err_dealloc_pd: mlx5_core_dealloc_pd(mdev, priv-pdn); @@ -1858,6 +1871,7 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) unregister_netdev(netdev); mlx5_core_destroy_mkey(priv-mdev, priv-mr); + mlx5_dealloc_transport_domain(priv-mdev, priv-tdn); mlx5_core_dealloc_pd(priv-mdev, priv-pdn); mlx5_unmap_free_uar(priv-mdev, priv-cq_uar); mlx5e_disable_async_events(priv); -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 0/7] mlx5 Ethernet driver update - Jun 11 2015
Hi Dave, This series from Saeed, Achiad and Gal contains few fixes to the recently introduced mlx5 Ethernet functionality. Or. Achiad Shochat (2): net/mlx5_core: Add transport domain alloc/dealloc support net/mlx5e: Add transport domain to the ethernet TIRs/TISs Gal Pressman (1): net/mlx5e: Enforce max flow-tables level = 3 Saeed Mahameed (4): net/mlx5e: Fix HW MTU settings net/mlx5e: Add HW cacheline start padding net/mlx5e: Disable client vlan TX acceleration net/mlx5e: Support NETIF_F_SG drivers/infiniband/hw/mlx5/main.c |8 +- drivers/net/ethernet/mellanox/mlx5/core/en.h |5 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 112 ++- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c| 10 +- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c| 58 ++ drivers/net/ethernet/mellanox/mlx5/core/port.c | 36 +++ drivers/net/ethernet/mellanox/mlx5/core/transobj.c | 35 ++ drivers/net/ethernet/mellanox/mlx5/core/transobj.h |2 + include/linux/mlx5/device.h|4 + include/linux/mlx5/driver.h| 10 +- 10 files changed, 166 insertions(+), 114 deletions(-) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 6/7] net/mlx5_core: Add transport domain alloc/dealloc support
From: Achiad Shochat ach...@mellanox.com Each transport object, namely TIR and TIS, must have a transport domain number (TDN) identifier. The driver wrongly assumed that it is OK to use TDN=0 without explicit TDN allocation from the device. The TDN will also be used for isolating different processes once user mode Ethernet will be supported. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/transobj.c | 35 drivers/net/ethernet/mellanox/mlx5/core/transobj.h |2 + 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c index 7a12028..8d98b03 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c @@ -34,6 +34,41 @@ #include mlx5_core.h #include transobj.h +int mlx5_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn) +{ + u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)]; + u32 out[MLX5_ST_SZ_DW(alloc_transport_domain_out)]; + int err; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(alloc_transport_domain_in, in, opcode, +MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN); + + err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); + if (!err) + *tdn = MLX5_GET(alloc_transport_domain_out, out, + transport_domain); + + return err; +} + +void mlx5_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn) +{ + u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)]; + u32 out[MLX5_ST_SZ_DW(dealloc_transport_domain_out)]; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(dealloc_transport_domain_in, in, opcode, +MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN); + MLX5_SET(dealloc_transport_domain_in, in, transport_domain, tdn); + + mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rqn) { u32 out[MLX5_ST_SZ_DW(create_rq_out)]; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.h b/drivers/net/ethernet/mellanox/mlx5/core/transobj.h index 90322c1..f9ef244 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.h @@ -33,6 +33,8 @@ #ifndef __TRANSOBJ_H__ #define __TRANSOBJ_H__ +int mlx5_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn); +void mlx5_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn); int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rqn); int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in, int inlen); -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 3/7] net/mlx5e: Disable client vlan TX acceleration
From: Saeed Mahameed sae...@mellanox.com We need to resolve a HW configuration issue for enabling HW CVLAN insertion. Meanwhile, no need to implement the VLAN insertion in the driver, rather use the generic kernel VLAN insertion method. Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c |1 - drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 23 +--- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 95772dc..3cba6a6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1755,7 +1755,6 @@ static void mlx5e_build_netdev(struct net_device *netdev) netdev-vlan_features|= NETIF_F_LRO; netdev-hw_features = netdev-vlan_features; - netdev-hw_features |= NETIF_F_HW_VLAN_CTAG_TX; netdev-hw_features |= NETIF_F_HW_VLAN_CTAG_RX; netdev-hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 8020986..3cfd2bc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -89,21 +89,6 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, return MLX5E_MIN_INLINE; } -static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs) -{ - struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start; - int cpy1_sz = 2 * ETH_ALEN; - int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN; - - skb_copy_from_linear_data(skb, vhdr, cpy1_sz); - skb_pull_inline(skb, cpy1_sz); - vhdr-h_vlan_proto = skb-vlan_proto; - vhdr-h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb)); - skb_copy_from_linear_data(skb, vhdr-h_vlan_encapsulated_proto, - cpy2_sz); - skb_pull_inline(skb, cpy2_sz); -} - static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) { struct mlx5_wq_cyc *wq = sq-wq; @@ -149,12 +134,8 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ETH_ZLEN); } - if (skb_vlan_tag_present(skb)) { - mlx5e_insert_vlan(eseg-inline_hdr_start, skb, ihs); - } else { - skb_copy_from_linear_data(skb, eseg-inline_hdr_start, ihs); - skb_pull_inline(skb, ihs); - } + skb_copy_from_linear_data(skb, eseg-inline_hdr_start, ihs); + skb_pull_inline(skb, ihs); eseg-inline_hdr_sz = cpu_to_be16(ihs); -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 4/7] net/mlx5e: Enforce max flow-tables level = 3
From: Gal Pressman g...@mellanox.com The Ethernet driver requires at least 3 flow table levels to operate, enforce that. Signed-off-by: Gal Pressman g...@mellanox.com Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Or Gerlitz ogerl...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 3cba6a6..1a655fd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1662,7 +1662,10 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) !MLX5_CAP_ETH(mdev, csum_cap) || !MLX5_CAP_ETH(mdev, max_lso_cap) || !MLX5_CAP_ETH(mdev, vlan_cap) || - !MLX5_CAP_ETH(mdev, rss_ind_tbl_cap)) { + !MLX5_CAP_ETH(mdev, rss_ind_tbl_cap) || + MLX5_CAP_FLOWTABLE(mdev, + flow_table_properties_nic_receive.max_ft_level) + 3) { mlx5_core_warn(mdev, Not creating net device, some required device capabilities are missing\n); return -ENOTSUPP; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 00/10] NFS: add AF_VSOCK support to NFS client
On Wed, Jun 10, 2015 at 02:09:26PM -0400, J. Bruce Fields wrote: On Wed, Jun 10, 2015 at 05:43:15PM +0100, Stefan Hajnoczi wrote: These are all at the SUNRPC level rather than at the NFS protocol level. Any idea who I need to talk to? Anyay, if there is anything to be worked out, nf...@ietf.org is the place to go. Thanks, I can write a summary and send it there. Stefan pgpFWaqBobsIi.pgp Description: PGP signature
Re: [patch -next] net/mlx5_core: fix an error code
On Thu, Jun 11, 2015 at 11:50 AM, Dan Carpenter dan.carpen...@oracle.com wrote: We return success if mlx5e_alloc_sq_db() fails but we should return an error code. Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 7348c51..075e517 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -525,7 +525,8 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, sq-uar_map = sq-uar.map; sq-bf_buf_size = (1 MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; - if (mlx5e_alloc_sq_db(sq, cpu_to_node(c-cpu))) + err = mlx5e_alloc_sq_db(sq, cpu_to_node(c-cpu)); + if (err) goto err_sq_wq_destroy; sq-txq = netdev_get_tx_queue(priv-netdev, Dan, nice catch, the team here just handed me the same fix, but you submitted 1st... Acked-by: Or Gerlitz ogerl...@mellanox.com -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote: On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek go...@cumulusnetworks.com wrote: Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are reachable via an interface where carrier is off. No action is taken, but additional flags are passed to userspace to indicate carrier status. Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar and I'm wondering if this could be done without introducing a new flag and just use RTNH_F_DEAD. The link change event would set RTNH_F_DEAD on nh on dev link down, and clear on link up. The sysctl knob would be something like nexthop_dead_on_linkdown, default off. So basically expanding the ways RTNH_F_DEAD can be set. That would simplify the patch set quite a bit and require no changes to iproute2. You are absolutely correct that what you describe would be less churn to userspace. From a functionality standpoint that is close to what was originally proposed, but Alex specifically did not like the behavioral change to what having RTNH_F_DEAD set (at least that was what I understood). That was what made me make the move to add this additional flag that was exported to userspace, so it was possible to differentiate the old dead routes/nexthop functionality from those that were not going to be dead due to link being down. At this point I think I prefer the additional data provided by the new flag exported to userspace. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch -next] net/mlx5_core: fix an error code
We return success if mlx5e_alloc_sq_db() fails but we should return an error code. Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 7348c51..075e517 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -525,7 +525,8 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, sq-uar_map = sq-uar.map; sq-bf_buf_size = (1 MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; - if (mlx5e_alloc_sq_db(sq, cpu_to_node(c-cpu))) + err = mlx5e_alloc_sq_db(sq, cpu_to_node(c-cpu)); + if (err) goto err_sq_wq_destroy; sq-txq = netdev_get_tx_queue(priv-netdev, -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
On Thu, Jun 11, 2015 at 4:23 AM, Andy Gospodarek go...@cumulusnetworks.com wrote: On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote: On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek go...@cumulusnetworks.com wrote: Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are reachable via an interface where carrier is off. No action is taken, but additional flags are passed to userspace to indicate carrier status. Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar and I'm wondering if this could be done without introducing a new flag and just use RTNH_F_DEAD. The link change event would set RTNH_F_DEAD on nh on dev link down, and clear on link up. The sysctl knob would be something like nexthop_dead_on_linkdown, default off. So basically expanding the ways RTNH_F_DEAD can be set. That would simplify the patch set quite a bit and require no changes to iproute2. You are absolutely correct that what you describe would be less churn to userspace. From a functionality standpoint that is close to what was originally proposed, but Alex specifically did not like the behavioral change to what having RTNH_F_DEAD set (at least that was what I understood). That was what made me make the move to add this additional flag that was exported to userspace, so it was possible to differentiate the old dead routes/nexthop functionality from those that were not going to be dead due to link being down. Why does user space need to know _why_ a nh is dead? User space already knows the state (admin/link) of the nh dev. I not seeing why user space needs to differentiate why nh is dead. The kernel only needs to know if nh is dead to exclude nh from ecmp selection. Same for an offload device. Can you explain how this new flag provides user space more information than what's already available from RTM_NEWLINK notifications? At this point I think I prefer the additional data provided by the new flag exported to userspace. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] switchdev: fix BUG when port driver doesn't support set attr op
On Wed, Jun 10, 2015 at 11:16 PM, Jiri Pirko j...@resnulli.us wrote: Thu, Jun 11, 2015 at 12:00:47AM CEST, sfel...@gmail.com wrote: On Wed, Jun 10, 2015 at 2:47 PM, Scott Feldman sfel...@gmail.com wrote: On Wed, Jun 10, 2015 at 2:25 PM, David Ahern dsah...@gmail.com wrote: On 6/10/15 2:56 PM, sfel...@gmail.com wrote: From: Scott Feldman sfel...@gmail.com Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged port does not support switchdec_port_attr_set op. Don't BUG() if -EOPNOTSUPP is returned. Signed-off-by: Scott Feldman sfel...@gmail.com Reported-by: Brenden Blanco bbla...@plumgrid.com --- net/switchdev/switchdev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index e008057..99bced4 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct work_struct *work) rtnl_lock(); err = switchdev_port_attr_set(asw-dev, asw-attr); - BUG_ON(err); + BUG_ON(err err != -EOPNOTSUPP); rtnl_unlock(); dev_put(asw-dev); Should that be WARN_ON instead of BUG_ON? I think I had it as WARN when we were working on the initial patches, but we changed it to BUG_ON because we should only get an error here if the driver screwed something up between PREPARE phase and COMMIT phase, so it should be considered a driver bug which needs fixing. Actually, ignore what I said above. I was confusing this BUG_ON with the one in switchdev_port_attr_set(). Perhaps this BUG_ON() you're commenting on should be WARN(). A driver could return an err in PREPARE phase and that shouldn't be a BUG_ON situation; seems WARN would be better. It the case where the driver returns an err in COMMIT phase but didn't return an err in PREPARE phase we want to BUG_ON(). Maybe that case doesn't justify BUG_ON either, based on the link you posted. Jiri, IIRC, you suggested the BUG_ON(). Does it still sound right based on the point David is raising? Hmm, looking at code of switchdev_port_attr_set. In case that fails in prepare state (which can easily happen for example due to -ENOMEM) this BUG_ON is hit as well. That is not right. I think we should change it just to warning. Also I think that prink (or a flavour) is more suitable here than WARN. Thanks, I'll change it to netdev_err. Btw, why switchdev_port_obj_add has WARN and not BUG ? Not sure. We should be consistent. WARN seems better for both obj_add/attr_set than BUG, given the link David Ahern posted. Do you agree? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
On 06/11/2015 04:23 AM, Andy Gospodarek wrote: On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote: On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek go...@cumulusnetworks.com wrote: Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are reachable via an interface where carrier is off. No action is taken, but additional flags are passed to userspace to indicate carrier status. Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar and I'm wondering if this could be done without introducing a new flag and just use RTNH_F_DEAD. The link change event would set RTNH_F_DEAD on nh on dev link down, and clear on link up. The sysctl knob would be something like nexthop_dead_on_linkdown, default off. So basically expanding the ways RTNH_F_DEAD can be set. That would simplify the patch set quite a bit and require no changes to iproute2. You are absolutely correct that what you describe would be less churn to userspace. From a functionality standpoint that is close to what was originally proposed, but Alex specifically did not like the behavioral change to what having RTNH_F_DEAD set (at least that was what I understood). That was what made me make the move to add this additional flag that was exported to userspace, so it was possible to differentiate the old dead routes/nexthop functionality from those that were not going to be dead due to link being down. this point I think I prefer the additional data provided by the new flag exported to userspace. I preferred the 2 flag solution as the original solution still required 2 flags, it just only exposed 1 to user-space. As a result it was much more error prone since it was fairly easy to get into a confused state about why the link was dead. With the 2 flag solution it becomes much easier to sort out why the route is not functional and it is much easier to isolate for things like the sysctl which only disables the use of LINKDOWN and not DEAD. - Alex -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: /net/mpls/conf/ethX//input duplicate entry
On 6/11/15, 5:55 AM, Robert Shearman wrote: On 11/06/15 00:23, Scott Feldman wrote: On Wed, Jun 10, 2015 at 2:58 PM, roopa ro...@cumulusnetworks.com wrote: On 6/10/15, 1:43 PM, Scott Feldman wrote: I'm getting this dump_stack when reloading rocker driver. Did some sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER? Steps to repro: load rocker (on system) with rocker device, rmmod rocker, and then modprobe rocker. I doubt this is specific to rocker: and re-registration of a netdev should hit it. I am using UDEV rules to rename kernel's ethX to a different name. Maybe that's what tripped it up? On a quick look, wondering if this is because mpls driver does not seem to do a unregister and re-register sysctl on device name change. Mea culpa. Thanks for looking at this. diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 7b3f732..ec21a5d 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event, case NETDEV_UNREGISTER: mpls_ifdown(dev); break; + case NETDEV_CHANGENAME: + mpls_ifdown(dev); + if ((dev-type == ARPHRD_ETHER) || + (dev-type == ARPHRD_LOOPBACK)) { + mdev = mpls_add_dev(dev); + if (IS_ERR(mdev)) + return notifier_from_errno(PTR_ERR(mdev)); + } } return NOTIFY_OK; } Roopa, I tested this patch and problem goes away. (It's missing a break statement, BTW). I didn't look into the correctness of the patch, but at first glance it seems liek the right thing to do. Maybe breaking out the renaming portions into sub-functions could keep the work done in NETDEV_CHANGENAME to a minimum. I agree that breaking out the sysctl registration/unregistration is a good idea to not have to do more work than is necessary, and to avoid unintended consequences (like routes using the interface being made unusable). Are you sending official fix? Roopa, let me know if you'd like me to carry this forward. sorry for the delay in getting back. Its going to be a busy day for me. And i don't know the side-effects of my changes yet. you probably have a better handle on this. So if you can, yes please carry this forward. thanks!. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Amministratore di sistema
Cassetta postale ha superato il limite diarchiviazione, che di 20 GB come stabilitodall'amministratore, si sta attualmenteeseguendo su 20,9 GB, non sarai in grado diinviare o ricevere messaggi di nuovi finch non siri-convalida la tua casella di posta. Perriconvalidare la tua casella di posta, Inserisci einviare a noi tuoi dettagli qui sotto per verificaree aggiornare il tuo account: (1) Posta elettronica: (2) Nome: (3) Password: (4) Email alternativo: Grazie Amministratore di sistema -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH] net: Add sock_common_listen for TCP and DCCP
On Thu, 2015-06-11 at 19:05 +0800, Firo Yang wrote: Code refactoring: 1. Move the common code of inet_listen() and inet_dccp_listen() to sock_common_listen(). Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen(). 2. Modify and rename inet_listen() to tcp_listen(). 3. Modify and rename inet_dccp_listen() to dccp_listen(). 4. Add new callback pointer listen in struct proto for tcp_listen() and dccp_listen(). This patch makes codes more modularized and removes redudant codes. Signed-off-by: Firo Yang fir...@gmail.com --- I test it on my x86 pc. include/net/sock.h | 18 include/net/tcp.h | 1 + net/core/sock.c | 36 +++ net/dccp/dccp.h | 2 +- net/dccp/ipv4.c | 4 ++-- net/dccp/ipv6.c | 3 ++- net/dccp/proto.c| 62 - net/ipv4/af_inet.c | 58 + net/ipv4/tcp.c | 35 ++ net/ipv4/tcp_ipv4.c | 1 + net/ipv6/af_inet6.c | 2 +- net/ipv6/tcp_ipv6.c | 1 + 12 files changed, 118 insertions(+), 105 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 26c1c31..5adc7f4 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -934,6 +934,7 @@ struct proto { int (*connect)(struct sock *sk, struct sockaddr *uaddr, int addr_len); + int (*listen)(struct sock *sk, int backlog); int (*disconnect)(struct sock *sk, int flags); struct sock * (*accept)(struct sock *sk, int flags, int *err); @@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); #define SOCK_BINDADDR_LOCK 4 #define SOCK_BINDPORT_LOCK 8 +/* + * Sock common state + * These values must be enqual to correspondent TCP state + * and DCCP state. + */ +enum { + SOCK_CLOSE = TCP_CLOSE, + SOCK_LISTEN = TCP_LISTEN +}; + +enum { + SOCKF_CLOSE = TCPF_CLOSE, + SOCKF_LISTEN= TCPF_LISTEN, +}; + You know, TCP_CLOSE and TCP_LISTEN are really legacy states for sk_state, this is not going to change anytime soon. I prefer to keep using TCP_ names and not adding aliases. Otherwise your patch looks fine to me, thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 01/19] bna: use ether_addr_copy instead of memcpy
On 06/10/2015 07:57 PM, Joe Perches wrote: On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: Signed-off-by: Ivan Vecera ivec...@redhat.com Have you verified that all of these are __aligned(2)? I haven't, but you should verify that you have in the commit log. I have checked an alignment of all instances and they are all aligned properly... An exception is global variable bnad_bcast_addr, its alignment is 1 according __alignof__ but according generated assembly it is aligned to 2. Anyway I'm going to put __aligned directive for sure. btw: this use looks odd to me: static int bnad_set_mac_address(struct net_device *netdev, void *mac_addr) { int err; struct bnad *bnad = netdev_priv(netdev); struct sockaddr *sa = (struct sockaddr *)mac_addr; unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); err = bnad_mac_addr_set_locked(bnad, sa-sa_data); as it casts what seems to be a mac address to a sockaddr and uses a different offset for sa-sa_data than the mac_addr passed. and the mac_addr as it's void doesn't need a cast. No, bnad_set_mac_address() is an implementation of .ndo_set_mac_address() and this is called with pointer to struct sockaddr. The mac_addr name is a little bit confusing. Will post v2. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 02/19] bna: get rid of mac_t
The patch converts mac_t type to widely used 'u8 [ETH_ALEN]'. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h | 4 ++-- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 2 +- drivers/net/ethernet/brocade/bna/bfi.h | 6 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h | 6 +++--- drivers/net/ethernet/brocade/bna/bna.h | 4 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c | 4 ++-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 4 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 10 +- drivers/net/ethernet/brocade/bna/bnad.h | 2 +- drivers/net/ethernet/brocade/bna/cna.h | 6 -- 12 files changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 3bfd9da..f55887b 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -55,7 +55,7 @@ struct bfa_adapter_attr { charoptrom_ver[BFA_VERSION_LEN]; charos_type[BFA_ADAPTER_OS_TYPE_LEN]; struct bfa_mfg_vpd vpd; - struct mac mac; + u8 mac[ETH_ALEN]; u8 nports; u8 max_speed; @@ -211,7 +211,7 @@ struct bfa_mfg_block { charsupplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)]; charsupplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)]; charsupplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)]; - mac_t mfg_mac;/* base mac address */ + u8 mfg_mac[ETH_ALEN]; /* base mac address */ u8 num_mac;/* number of mac addresses */ u8 rsv2; u32 card_type; /* card type */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index a37326d..ce0b228 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -188,7 +188,7 @@ struct bfa_cee_attr { u8 error_reason; struct bfa_cee_lldp_cfg lldp_remote; struct bfa_cee_dcbx_cfg dcbx_remote; - mac_t src_mac; + u8 src_mac[ETH_ALEN]; u8 link_speed; u8 nw_priority; u8 filler[2]; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 68f3c13..82c95f8 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2796,7 +2796,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc *ioc, ad_attr-prototype = 0; ad_attr-pwwn = bfa_ioc_get_pwwn(ioc); - ad_attr-mac = bfa_nw_ioc_get_mac(ioc); + bfa_nw_ioc_get_mac(ioc, ad_attr-mac); ad_attr-pcie_gen = ioc_attr-pcie_gen; ad_attr-pcie_lanes = ioc_attr-pcie_lanes; @@ -2942,10 +2942,10 @@ bfa_ioc_get_pwwn(struct bfa_ioc *ioc) return ioc-attr-pwwn; } -mac_t -bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) +void +bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac) { - return ioc-attr-mac; + ether_addr_copy(mac, ioc-attr-mac); } /* Firmware failure detected. Start recovery actions. */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index effb715..b37bc16 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -309,7 +309,7 @@ void bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); bool bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); -mac_t bfa_nw_ioc_get_mac(struct bfa_ioc *ioc); +void bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac); void bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave); int bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen); int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 2bcde40..63645ac 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -189,14 +189,14 @@ struct bfi_ioc_getattr_req { struct bfi_ioc_attr { u64 mfg_pwwn; /*! Mfg port wwn */ u64 mfg_nwwn; /*! Mfg node wwn */ - mac_t mfg_mac;/*! Mfg mac */ + u8 mfg_mac[ETH_ALEN]; /*! Mfg mac*/ u8 port_mode; /* enum bfi_port_mode */ u8 rsvd_a; u64 pwwn; u64 nwwn; - mac_t mac;/*! PBC or Mfg mac*/ +
[PATCH ethtool V3 2/2] ethtool.8.in: Add man page for tunable copybreak
From: Govindarajulu Varadarajan _gov...@gmx.com Signed-off-by: Govindarajulu Varadarajan _gov...@gmx.com Signed-off-by: Hadar Hen Zion had...@mellanox.com --- ethtool.8.in | 20 1 file changed, 20 insertions(+) diff --git a/ethtool.8.in b/ethtool.8.in index ae56293..eae630e 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -176,6 +176,14 @@ ethtool \- query or control network driver and hardware settings .BN rx\-jumbo .BN tx .HP +.B ethtool \-b|\-\-show\-tunable +.I devname +.HP +.B ethtool \-B|\-\-set\-tunable +.I devname +.BN rx-copybreak +.BN tx-copybreak +.HP .B ethtool \-i|\-\-driver .I devname .HP @@ -399,6 +407,18 @@ Changes the number of ring entries for the Rx Jumbo ring. .BI tx \ N Changes the number of ring entries for the Tx ring. .TP +.B \-b|\-\-show\-tunable +Get device tunable values +.TP +.B \-B|\-\-set\-tunable +Set device tunable values +.TP +.BI rx-copybreak \ N +Change rx_copybreak +.TP +.BI tx-copybreak \ N +Change tx_copybreak +.TP .B \-i \-\-driver Queries the specified network device for associated driver information. .TP -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver
Hello. On 6/11/2015 10:24 AM, David Miller wrote: Ethernet AVB device includes the gPTP timer, so we can implement a PTP clock driver. We're doing that in a separate file, with the main Ethernet driver calling the PTP driver's [de]initialization and interrupt handler functions. Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when that one leaves the operation mode, we have to unregister the PTP clock... :-( Based on the original patches by Masaru Nagai. Signed-off-by: Masaru Nagai masaru.nagai...@renesas.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Applied. Thank you! I had to fix up this patch because: obj-$(CONFIG_RAVB) += ravb_main.o ravb_ptp.o Doesn't do what you want it to for the modular case. Oh, crap, I forgot to test the modular build after splitting the driver again into separate files. Sorry about that... :- You instead need to say something like: ravb-objs := ravb_main.o ravb_ptp.o obj-$(CONFIG_RAVB) += ravb.o and that's how I fixed up this commit before pushing it out. And the code base I was using as a reference had this issue fixed quite similarly... WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 5/5] rocker: remove support for legacy VLAN ndo ops
Full quote below. So what is the consensus on this topic? I read the emails but i dont see a resolution. cheers, jamal On 06/03/15 08:08, Jamal Hadi Salim wrote: On 06/02/15 10:30, Scott Feldman wrote: On Tue, Jun 2, 2015 at 4:43 AM, Jamal Hadi Salim j...@mojatatu.com wrote: On 06/02/15 03:10, Scott Feldman wrote: Question to ask when looking at something of this nature: Will it work with no suprises if you used today's unmodified app? The default behavior shouldnt change and unfortunately it does here. The default behavior does change, yes, but there shouldn't be any surprises even if using today's unmodified app. [..] [] Ha, you're giving the behavior for bridge fdb command, where self is the default. Yes, sorry ;- For bridge link and bridge vlan, the default is master. The user must explicitly specify self to act on the device side of the port. Not sure what device side of the port is intended to mean. But: iproute2, user can specify device is either the bridge or bridge port. I think that is the key. This is used in combination with the self/master flags to decide behavior in the kernel. Summary, assuming flag bits master:self user setting: 00 (none set - which is default iproute2 behavior). Kernel behavior: if (bridge port targeted) sets the vlan bitmap on the bridge port. else sets the vlan bitmap on the bridge. *** Above is what we want to maintain unchanged. If you are saying it doesnt change, then we are fine. user setting: 01 (self on) kernel behavior: no difference from default user setting: 1x (master on, self doesnt matter) kernel behavior: if (bridge port targeted) sets the bitmap on the bridge port. sets the bitmap on the bridge as well. else sets the bitmap on the bridge. BTW: given the vlan change are reflected from the bowels of br_vlan_info() - is it redundant there is a call in br_afset afterwards which says something like if master is set and target is bridge port then call hardware setting thing? dont have much time - so i may be confusing something. It's unfortunate the iproute2 defaults aren't consistent between commands. Maybe someone knows the history here and can explain. Not sure. Too many cooks with specific use cases? There are many thing in bridge that i wish were different. Unfortunately when things get to this level Dave's famous a horse has left the barn principle applies. Despite my whining, over time, even shit doesnt smell anymore. I almost feel we need an ABI police force (refer to Jiri's talk at netconf). It is much easier to fix kernel changes. cheers, jamal -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 04/19] bna: get rid of duplicate and unused macros
replaced macros: BNA_MAC_IS_EQUAL - ether_addr_equal BNA_POWER_OF_2 - is_power_of_2 BNA_TO_POWER_OF_2_HIGH - roundup_pow_of_two removed unused macros: bfa_fsm_get_state bfa_ioc_clr_stats bfa_ioc_fetch_stats bfa_ioc_get_alt_ioc_fwstate bfa_ioc_isr_mode_set bfa_ioc_maxfrsize bfa_ioc_mbox_cmd_pending bfa_ioc_ownership_reset bfa_ioc_rx_bbcredit bfa_ioc_state_disabled bfa_sm_cmp_state bfa_sm_get_state bfa_sm_send_event bfa_sm_set_state bfa_sm_state_decl BFA_STRING_32 BFI_ADAPTER_IS_{PROTO,TTV,UNSUPP) BFI_IOC_ENDIAN_SIG BNA_{C,RX,TX}Q_PAGE_INDEX_MAX BNA_{C,RX,TX}Q_PAGE_INDEX_MAX_SHIFT BNA_{C,RX,TX}Q_QPGE_PTR_GET BNA_IOC_TIMER_FREQ BNA_MESSAGE_SIZE BNA_QE_INDX_2_PTR BNA_QE_INDX_RANGE BNA_Q_GET_{C,P}I BNA_Q_{C,P}I_ADD BNA_Q_FREE_COUNT BNA_Q_IN_USE_COUNT BNA_TO_POWER_OF_2 containing_rec Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 drivers/net/ethernet/brocade/bna/bfa_defs.h | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 14 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 13 --- drivers/net/ethernet/brocade/bna/bfi.h | 8 -- drivers/net/ethernet/brocade/bna/bna.h | 105 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 13 ++- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 4 +- 8 files changed, 9 insertions(+), 163 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cs.h b/drivers/net/ethernet/brocade/bna/bfa_cs.h index af25d8e..1d11d66 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_cs.h @@ -28,19 +28,6 @@ typedef void (*bfa_sm_t)(void *sm, int event); -/* oc - object class eg. bfa_ioc - * st - state, eg. reset - * otype - object type, eg. struct bfa_ioc - * etype - object type, eg. enum ioc_event - */ -#define bfa_sm_state_decl(oc, st, otype, etype)\ - static void oc ## _sm_ ## st(otype * fsm, etype event) - -#define bfa_sm_set_state(_sm, _state) ((_sm)-sm = (bfa_sm_t)(_state)) -#define bfa_sm_send_event(_sm, _event) ((_sm)-sm((_sm), (_event))) -#define bfa_sm_get_state(_sm) ((_sm)-sm) -#define bfa_sm_cmp_state(_sm, _state) ((_sm)-sm == (bfa_sm_t)(_state)) - /* For converting from state machine function to state encoding. */ struct bfa_sm_table { bfa_sm_tsm; /*! state machine function */ @@ -67,7 +54,6 @@ typedef void (*bfa_fsm_t)(void *fsm, int event); } while (0) #define bfa_fsm_send_event(_fsm, _event) ((_fsm)-fsm((_fsm), (_event))) -#define bfa_fsm_get_state(_fsm)((_fsm)-fsm) #define bfa_fsm_cmp_state(_fsm, _state) \ ((_fsm)-fsm == (bfa_fsm_t)(_state)) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 6827d91..d152b3f 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -24,7 +24,6 @@ #include bfa_defs_status.h #include bfa_defs_mfg_comm.h -#define BFA_STRING_32 32 #define BFA_VERSION_LEN 64 /* -- adapter definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 82c95f8..29e0428 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -23,14 +23,6 @@ /* IOC local definitions */ -#define bfa_ioc_state_disabled(__sm) \ - (((__sm) == BFI_IOC_UNINIT) || \ -((__sm) == BFI_IOC_INITING) || \ -((__sm) == BFI_IOC_HWINIT) || \ -((__sm) == BFI_IOC_DISABLED) ||\ -((__sm) == BFI_IOC_FAIL) ||\ -((__sm) == BFI_IOC_CFG_DISABLED)) - /* Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details. */ #define bfa_ioc_firmware_lock(__ioc) \ @@ -57,12 +49,6 @@ ((__ioc)-ioc_hwif-ioc_get_fwstate(__ioc)) #define bfa_ioc_set_alt_ioc_fwstate(__ioc, __fwstate) \ ((__ioc)-ioc_hwif-ioc_set_alt_fwstate(__ioc, __fwstate)) -#define bfa_ioc_get_alt_ioc_fwstate(__ioc) \ - ((__ioc)-ioc_hwif-ioc_get_alt_fwstate(__ioc)) - -#define bfa_ioc_mbox_cmd_pending(__ioc)\ - (!list_empty(((__ioc)-mbox_mod.cmd_q)) || \ - readl((__ioc)-ioc_regs.hfn_mbox_cmd)) static bool bfa_nw_auto_recover = true; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b37bc16..b6ad2c5 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -232,12 +232,6 @@ struct bfa_ioc_hwif { #define bfa_ioc_asic_gen(__ioc)((__ioc)-asic_gen) #define bfa_ioc_is_default(__ioc) \ (bfa_ioc_pcifn(__ioc)
[PATCH net-next v2 09/19] bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 13 - drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 16 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 27f75d7..471e74d 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -3000,16 +3000,6 @@ do { \ } \ } while (0) -#define call_tx_prio_change_cbfn(tx) \ -do { \ - if ((tx)-prio_change_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_tx *); \ - cbfn = (tx)-prio_change_cbfn; \ - (tx)-prio_change_cbfn = NULL; \ - cbfn((tx)-bna-bnad, (tx));\ - } \ -} while (0) - static void bna_tx_mod_cb_tx_stopped(void *tx_mod, struct bna_tx *tx); static void bna_bfi_tx_enet_start(struct bna_tx *tx); static void bna_tx_enet_stop(struct bna_tx *tx); @@ -3062,7 +3052,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) break; case TX_E_PRIO_CHANGE: - call_tx_prio_change_cbfn(tx); break; case TX_E_BW_UPDATE: @@ -3232,7 +3221,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) case TX_E_FAIL: bfa_fsm_set_state(tx, bna_tx_sm_failed); - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; @@ -3253,7 +3241,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) static void bna_tx_sm_prio_cleanup_wait_entry(struct bna_tx *tx) { - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 96a02f2..095bd63 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -495,9 +495,6 @@ struct bna_tx { void (*stop_cbfn)(void *arg, struct bna_tx *tx); void*stop_cbarg; - /* callback for bna_tx_prio_set() */ - void (*prio_change_cbfn)(struct bnad *bnad, struct bna_tx *tx); - struct bfa_msgq_cmd_entry msgq_cmd; union { struct bfi_enet_tx_cfg_req cfg_req; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 11/19] bna: remove paused from bna_rx_config and flags from bna_rxf
The bna_rx_config struct member paused can be removed as it is never written and as it cannot have non-zero value the bna_rxf struct member flags also cannot have BNA_RXF_F_PAUSED value and is always zero. So the flags member can be removed as well as bna_rxf_flags enum and the code-paths that needs to have non-zero bna_rxf-flags. This clean-up makes bna_rxf_sm_paused state unsed and can be also removed. --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 36 +--- drivers/net/ethernet/brocade/bna/bna_types.h | 6 - 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index ccf48a1..896aa82 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -59,8 +59,6 @@ static int bna_rxf_allmulti_cfg_reset(struct bna_rxf *rxf, bfa_fsm_state_decl(bna_rxf, stopped, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, paused, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, @@ -79,11 +77,7 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) { switch (event) { case RXF_E_START: - if (rxf-flags BNA_RXF_F_PAUSED) { - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - call_rxf_start_cbfn(rxf); - } else - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); + bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; case RXF_E_STOP: @@ -104,29 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) } static void -bna_rxf_sm_paused_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_STOP: - case RXF_E_FAIL: - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_CONFIG: - call_rxf_cam_fltr_cbfn(rxf); - break; - - default: - bfa_sm_fault(event); - } -} - -static void bna_rxf_sm_cfg_wait_entry(struct bna_rxf *rxf) { if (!bna_rxf_cfg_apply(rxf)) { @@ -679,9 +650,6 @@ bna_rxf_init(struct bna_rxf *rxf, INIT_LIST_HEAD(rxf-mcast_active_q); INIT_LIST_HEAD(rxf-mcast_handle_q); - if (q_config-paused) - rxf-flags |= BNA_RXF_F_PAUSED; - rxf-rit = (u8 *) res_info[BNA_RX_RES_MEM_T_RIT].res_u.mem_info.mdl[0].kva; bna_rit_init(rxf, q_config-num_paths); @@ -742,8 +710,6 @@ bna_rxf_uninit(struct bna_rxf *rxf) rxf-rss_pending = 0; rxf-vlan_strip_pending = false; - rxf-flags = 0; - rxf-rx = NULL; } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index e56f650..134abf7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -182,10 +182,6 @@ enum bna_rx_mod_flags { BNA_RX_MOD_F_ENET_LOOPBACK = 2, }; -enum bna_rxf_flags { - BNA_RXF_F_PAUSED= 1, -}; - enum bna_rxf_event { RXF_E_START = 1, RXF_E_STOP = 2, @@ -668,7 +664,6 @@ struct bna_rx_config { enum bna_rx_type rx_type; int num_paths; enum bna_rxp_type rxp_type; - int paused; int coalescing_timeo; /* * Small/Large (or Header/Data) buffer size to be configured @@ -713,7 +708,6 @@ struct bna_rxp { /* RxF structure (hardware Rx Function) */ struct bna_rxf { bfa_fsm_t fsm; - enum bna_rxf_flags flags; struct bfa_msgq_cmd_entry msgq_cmd; union { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 13/19] bna: correct comparisons/assignments to bool
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 29e0428..52fc439 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1373,7 +1373,7 @@ static enum bfi_ioc_img_ver_cmp bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, struct bfi_ioc_image_hdr *fwhdr_to_cmp) { - if (bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp) == false) + if (!bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp)) return BFI_IOC_IMG_VER_INCOMP; if (fwhdr_to_cmp-fwver.patch base_fwhdr-fwver.patch) @@ -1384,7 +1384,7 @@ bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, /* GA takes priority over internal builds of the same patch stream. * At this point major minor maint and patch numbers are same. */ - if (fwhdr_is_ga(base_fwhdr) == true) + if (fwhdr_is_ga(base_fwhdr)) if (fwhdr_is_ga(fwhdr_to_cmp)) return BFI_IOC_IMG_VER_SAME; else @@ -2209,7 +2209,7 @@ bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 soff, u32 sz) /* * Hold semaphore to serialize pll init and fwtrc. */ - if (bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg) == 0) + if (!bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg)) return 1; writel(pgnum, ioc-ioc_regs.host_page_num_fn); @@ -2264,7 +2264,7 @@ bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc) int tlen; if (ioc-dbg_fwsave_once) { - ioc-dbg_fwsave_once = 0; + ioc-dbg_fwsave_once = false; if (ioc-dbg_fwsave_len) { tlen = ioc-dbg_fwsave_len; bfa_nw_ioc_debug_fwtrc(ioc, ioc-dbg_fwsave, tlen); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 07/19] bna: remove pause_cbfn from struct bna_enet
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_enet.c | 15 --- drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 18 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index b8de17b..dc9f73b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -884,16 +884,6 @@ do { \ } \ } while (0) -#define call_enet_pause_cbfn(enet) \ -do { \ - if ((enet)-pause_cbfn) { \ - void (*cbfn)(struct bnad *);\ - cbfn = (enet)-pause_cbfn; \ - (enet)-pause_cbfn = NULL; \ - cbfn((enet)-bna-bnad);\ - } \ -} while (0) - #define call_enet_mtu_cbfn(enet) \ do { \ if ((enet)-mtu_cbfn) { \ @@ -925,7 +915,6 @@ bfa_fsm_state_decl(bna_enet, chld_stop_wait, struct bna_enet, static void bna_enet_sm_stopped_entry(struct bna_enet *enet) { - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); call_enet_stop_cbfn(enet); } @@ -947,7 +936,6 @@ bna_enet_sm_stopped(struct bna_enet *enet, enum bna_enet_event event) break; case ENET_E_PAUSE_CFG: - call_enet_pause_cbfn(enet); break; case ENET_E_MTU_CFG: @@ -1039,7 +1027,6 @@ bna_enet_sm_started_entry(struct bna_enet *enet) * NOTE: Do not call bna_enet_chld_start() here, since it will be * inadvertently called during cfg_wait-started transition as well */ - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); } @@ -1211,8 +1198,6 @@ bna_enet_init(struct bna_enet *enet, struct bna *bna) enet-stop_cbfn = NULL; enet-stop_cbarg = NULL; - enet-pause_cbfn = NULL; - enet-mtu_cbfn = NULL; bfa_fsm_set_state(enet, bna_enet_sm_stopped); diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index d0a7a56..a50ee99 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -362,9 +362,6 @@ struct bna_enet { void (*stop_cbfn)(void *); void*stop_cbarg; - /* Callback for bna_enet_pause_config() */ - void (*pause_cbfn)(struct bnad *); - /* Callback for bna_enet_mtu_set() */ void (*mtu_cbfn)(struct bnad *); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 10/19] bna: remove RXF_E_PAUSE and RXF_E_RESUME events
RXF_E_PAUSE RXF_E_RESUME events are never sent for bna_rxf object so they needn't to be handled. The bna_rxf's state bna_rxf_sm_fltr_clr_wait and function bna_rxf_fltr_clear are unused after this so remove them also. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 75 drivers/net/ethernet/brocade/bna/bna_types.h | 2 - 2 files changed, 77 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 471e74d..ccf48a1 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -46,7 +46,6 @@ do { \ static int bna_rxf_cfg_apply(struct bna_rxf *rxf); static void bna_rxf_cfg_reset(struct bna_rxf *rxf); -static int bna_rxf_fltr_clear(struct bna_rxf *rxf); static int bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_promisc_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_allmulti_cfg_apply(struct bna_rxf *rxf); @@ -66,8 +65,6 @@ bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, fltr_clr_wait, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, last_resp_wait, struct bna_rxf, enum bna_rxf_event); @@ -101,14 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - break; - - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - break; - default: bfa_sm_fault(event); } @@ -132,11 +121,6 @@ bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); - break; - default: bfa_sm_fault(event); } @@ -170,12 +154,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) /* No-op */ break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_start_cbfn(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - case RXF_E_FW_RESP: if (!bna_rxf_cfg_apply(rxf)) { /* No more pending config updates */ @@ -209,40 +187,6 @@ bna_rxf_sm_started(struct bna_rxf *rxf, enum bna_rxf_event event) bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - if (!bna_rxf_fltr_clear(rxf)) - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - else - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - - default: - bfa_sm_fault(event); - } -} - -static void -bna_rxf_sm_fltr_clr_wait_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_FAIL: - bna_rxf_cfg_reset(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_FW_RESP: - if (!bna_rxf_fltr_clear(rxf)) { - /* No more pending CAM entries to clear */ - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - } - break; - default: bfa_sm_fault(event); } @@ -652,25 +596,6 @@ bna_rxf_cfg_apply(struct bna_rxf *rxf) return 0; } -/* Only software reset */ -static int -bna_rxf_fltr_clear(struct bna_rxf *rxf) -{ - if (bna_rxf_ucast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_mcast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_promisc_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_allmulti_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - return 0; -} - static void bna_rxf_cfg_reset(struct bna_rxf *rxf) { diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 095bd63..e56f650 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -191,8 +191,6 @@ enum bna_rxf_event { RXF_E_STOP = 2, RXF_E_FAIL = 3,
[PATCH net] net: igb: fix the start time for periodic output signals
When programming the start of a periodic output, the code wrongly places the seconds value into the low register and the nanoseconds into the high register. Even though this is backwards, it slipped through my testing, because the re-arming code in the interrupt service routine is correct, and the signal does appear starting with the second edge. This patch fixes the issue by programming the registers correctly. Signed-off-by: Richard Cochran richardcoch...@gmail.com --- drivers/net/ethernet/intel/igb/igb_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index e3b9b63..c3a9392c 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -538,8 +538,8 @@ static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp, igb-perout[i].start.tv_nsec = rq-perout.start.nsec; igb-perout[i].period.tv_sec = ts.tv_sec; igb-perout[i].period.tv_nsec = ts.tv_nsec; - wr32(trgttiml, rq-perout.start.sec); - wr32(trgttimh, rq-perout.start.nsec); + wr32(trgttimh, rq-perout.start.sec); + wr32(trgttiml, rq-perout.start.nsec); tsauxc |= tsauxc_mask; tsim |= tsim_mask; } else { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 03/19] bna: replace pragma(pack) with attribute __packed
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h| 6 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 14 +-- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 6 +- drivers/net/ethernet/brocade/bna/bfi.h | 70 +++--- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h| 104 ++--- 6 files changed, 103 insertions(+), 127 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index f55887b..6827d91 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -187,8 +187,6 @@ enum { #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE20 #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 -#pragma pack(1) - /* BFA adapter manufacturing block definition. * * All numerical fields are in big-endian format. @@ -227,9 +225,7 @@ struct bfa_mfg_block { charinitial_mode[8]; /* initial mode: hba/cna/nic */ u8 rsv4[84]; u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /* md5 checksum */ -}; - -#pragma pack() +} __packed; /* -- pci definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index ce0b228..f048887 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -109,8 +109,6 @@ union bfa_port_stats_u { struct bfa_port_eth_stats eth; }; -#pragma pack(1) - #define BFA_CEE_LLDP_MAX_STRING_LEN (128) #define BFA_CEE_DCBX_MAX_PRIORITY (8) #define BFA_CEE_DCBX_MAX_PGID (8) @@ -133,7 +131,7 @@ struct bfa_cee_lldp_str { u8 len; u8 rsvd[2]; u8 value[BFA_CEE_LLDP_MAX_STRING_LEN]; -}; +} __packed; /* LLDP parameters */ struct bfa_cee_lldp_cfg { @@ -145,7 +143,7 @@ struct bfa_cee_lldp_cfg { struct bfa_cee_lldp_str mgmt_addr; u16 time_to_live; u16 enabled_system_cap; -}; +} __packed; enum bfa_cee_dcbx_version { DCBX_PROTOCOL_PRECEE= 1, @@ -171,7 +169,7 @@ struct bfa_cee_dcbx_cfg { u8 lls_fcoe; /* FCoE Logical Link Status */ u8 lls_lan; /* LAN Logical Link Status */ u8 rsvd[2]; -}; +} __packed; /* CEE status */ /* Making this to tri-state for the benefit of port list command */ @@ -192,7 +190,7 @@ struct bfa_cee_attr { u8 link_speed; u8 nw_priority; u8 filler[2]; -}; +} __packed; /* LLDP/DCBX/CEE Statistics */ struct bfa_cee_stats { @@ -214,8 +212,6 @@ struct bfa_cee_stats { u32 cee_status_up; /*! CEE status up */ u32 cee_hw_cfg_changed; /*! CEE hw cfg changed */ u32 cee_rx_invalid_cfg; /*! CEE invalid cfg */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_CNA_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 7a45cd0..679a503 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -59,8 +59,6 @@ enum { BFA_MFG_TYPE_INVALID = 0,/*! Invalid card type */ }; -#pragma pack(1) - /* Check if Mezz card */ #define bfa_mfg_is_mezz(type) (( \ (type) == BFA_MFG_TYPE_JAYHAWK || \ @@ -148,8 +146,6 @@ struct bfa_mfg_vpd { u8 len;/*! vpd data length excluding header */ u8 rsv; u8 data[BFA_MFG_VPD_LEN]; /*! vpd data */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_MFG_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 63645ac..3e97077 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -21,8 +21,6 @@ #include bfa_defs.h -#pragma pack(1) - /* BFI FW image type */ #defineBFI_FLASH_CHUNK_SZ 256 /*! Flash chunk size */ #defineBFI_FLASH_CHUNK_SZ_WORDS(BFI_FLASH_CHUNK_SZ/sizeof(u32)) @@ -36,10 +34,10 @@ struct bfi_mhdr { struct { u8 qid; u8 fn_lpu; /*! msg destination*/ - } h2i; + } __packed h2i; u16 i2htok; /*! token in msgs to host */ - } mtag; -}; + } __packed mtag; +} __packed; #define bfi_fn_lpu(__fn, __lpu)((__fn) 1 | (__lpu)) #define bfi_mhdr_2_fn(_mh) ((_mh)-mtag.h2i.fn_lpu 1) @@ -75,14 +73,14 @@ union bfi_addr_u { struct { u32 addr_lo; u32 addr_hi; - } a32; -}; + } __packed a32; +} __packed; /* Generic DMA addr-len pair. */ struct bfi_alen { union bfi_addr_ual_addr;/* DMA
[PATCH net-next v2 16/19] bna: get rid of private macros for manipulation with lists
Remove macros for manipulation with struct list_head and replace them with standard ones. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c | 10 +- drivers/net/ethernet/brocade/bna/bna.h | 1 - drivers/net/ethernet/brocade/bna/bna_enet.c | 50 ++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 310 +-- drivers/net/ethernet/brocade/bna/cna.h | 56 - 7 files changed, 130 insertions(+), 308 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cee.c b/drivers/net/ethernet/brocade/bna/bfa_cee.c index cf9f395..95bc8b6 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cee.c +++ b/drivers/net/ethernet/brocade/bna/bfa_cee.c @@ -282,7 +282,6 @@ bfa_nw_cee_attach(struct bfa_cee *cee, struct bfa_ioc *ioc, cee-ioc = ioc; bfa_nw_ioc_mbox_regisr(cee-ioc, BFI_MC_CEE, bfa_cee_isr, cee); - bfa_q_qe_init(cee-ioc_notify); bfa_ioc_notify_init(cee-ioc_notify, bfa_cee_notify, cee); bfa_nw_ioc_notify_register(cee-ioc, cee-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 52fc439..dabbb30 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2163,7 +2163,8 @@ bfa_ioc_mbox_poll(struct bfa_ioc *ioc) /** * Enqueue command to firmware. */ - bfa_q_deq(mod-cmd_q, cmd); + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); bfa_ioc_mbox_send(ioc, cmd-msg, sizeof(cmd-msg)); /** @@ -2184,8 +2185,10 @@ bfa_ioc_mbox_flush(struct bfa_ioc *ioc) struct bfa_ioc_mbox_mod *mod = ioc-mbox_mod; struct bfa_mbox_cmd *cmd; - while (!list_empty(mod-cmd_q)) - bfa_q_deq(mod-cmd_q, cmd); + while (!list_empty(mod-cmd_q)) { + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); + } } /** @@ -3231,7 +3234,6 @@ bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) flash-op_busy = 0; bfa_nw_ioc_mbox_regisr(flash-ioc, BFI_MC_FLASH, bfa_flash_intr, flash); - bfa_q_qe_init(flash-ioc_notify); bfa_ioc_notify_init(flash-ioc_notify, bfa_flash_notify, flash); list_add_tail(flash-ioc_notify.qe, flash-ioc-notify_q); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c b/drivers/net/ethernet/brocade/bna/bfa_msgq.c index c07d5b9..9c5bb24 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_msgq.c +++ b/drivers/net/ethernet/brocade/bna/bfa_msgq.c @@ -66,8 +66,9 @@ cmdq_sm_stopped_entry(struct bfa_msgq_cmdq *cmdq) cmdq-offset = 0; cmdq-bytes_to_copy = 0; while (!list_empty(cmdq-pending_q)) { - bfa_q_deq(cmdq-pending_q, cmdq_ent); - bfa_q_qe_init(cmdq_ent-qe); + cmdq_ent = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); + list_del(cmdq_ent-qe); call_cmdq_ent_cbfn(cmdq_ent, BFA_STATUS_FAILED); } } @@ -242,8 +243,8 @@ bfa_msgq_cmdq_ci_update(struct bfa_msgq_cmdq *cmdq, struct bfi_mbmsg *mb) /* Walk through pending list to see if the command can be posted */ while (!list_empty(cmdq-pending_q)) { - cmd = - (struct bfa_msgq_cmd_entry *)bfa_q_first(cmdq-pending_q); + cmd = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); if (ntohs(cmd-msg_hdr-num_entries) = BFA_MSGQ_FREE_CNT(cmdq)) { list_del(cmd-qe); @@ -615,7 +616,6 @@ bfa_msgq_attach(struct bfa_msgq *msgq, struct bfa_ioc *ioc) bfa_msgq_rspq_attach(msgq-rspq, msgq); bfa_nw_ioc_mbox_regisr(msgq-ioc, BFI_MC_MSGQ, bfa_msgq_isr, msgq); - bfa_q_qe_init(msgq-ioc_notify); bfa_ioc_notify_init(msgq-ioc_notify, bfa_msgq_notify, msgq); bfa_nw_ioc_notify_register(msgq-ioc, msgq-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 4f16ee2..66e6e09 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -283,7 +283,6 @@ void bna_hw_stats_get(struct bna *bna); /* APIs for RxF */ struct bna_mac *bna_cam_mod_mac_get(struct list_head *head); -void bna_cam_mod_mac_put(struct list_head *tail, struct bna_mac *mac); struct bna_mcam_handle *bna_mcam_mod_handle_get(struct bna_mcam_mod *mod); void bna_mcam_mod_handle_put(struct bna_mcam_mod *mcam_mod, struct bna_mcam_handle *handle); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index
[PATCH net-next v2 14/19] bna: use memdup_user to copy userspace buffers
Patch converts kzalloc-copy_from_user sequence to memdup_user. There is also one useless assignment of NULL to bnad-regdata as it is followed by assignment of kzalloc output. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 27 - 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 72c8955..ad7af5c 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c @@ -321,15 +321,10 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, len); if (rc 2) { @@ -341,7 +336,6 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, kfree(kern_buf); kfree(bnad-regdata); - bnad-regdata = NULL; bnad-reglen = 0; bnad-regdata = kzalloc(len 2, GFP_KERNEL); @@ -388,15 +382,10 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, val); if (rc 2) { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 08/19] bna: remove oper_state_cbfn from struct bna_rxf
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 15 --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 6 -- drivers/net/ethernet/brocade/bna/bna_types.h | 4 3 files changed, 25 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 0962e54..4f16ee2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -119,21 +119,6 @@ do { \ } \ } while (0) -#definecall_rxf_pause_cbfn(rxf) \ -do { \ - if ((rxf)-oper_state_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_rx *); \ - struct bnad *cbarg; \ - cbfn = (rxf)-oper_state_cbfn; \ - cbarg = (rxf)-oper_state_cbarg;\ - (rxf)-oper_state_cbfn = NULL; \ - (rxf)-oper_state_cbarg = NULL; \ - cbfn(cbarg, rxf-rx); \ - } \ -} while (0) - -#definecall_rxf_resume_cbfn(rxf) call_rxf_pause_cbfn(rxf) - #define is_xxx_enable(mode, bitmask, xxx) ((bitmask xxx) (mode xxx)) #define is_xxx_disable(mode, bitmask, xxx) ((bitmask xxx) !(mode xxx)) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 16d36df..27f75d7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -103,12 +103,10 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) case RXF_E_PAUSE: rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_pause_cbfn(rxf); break; case RXF_E_RESUME: rxf-flags = ~BNA_RXF_F_PAUSED; - call_rxf_resume_cbfn(rxf); break; default: @@ -119,7 +117,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) static void bna_rxf_sm_paused_entry(struct bna_rxf *rxf) { - call_rxf_pause_cbfn(rxf); } static void @@ -166,7 +163,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) bna_rxf_cfg_reset(rxf); call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; @@ -197,7 +193,6 @@ bna_rxf_sm_started_entry(struct bna_rxf *rxf) { call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); } static void @@ -238,7 +233,6 @@ bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) switch (event) { case RXF_E_FAIL: bna_rxf_cfg_reset(rxf); - call_rxf_pause_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index a50ee99..96a02f2 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -739,10 +739,6 @@ struct bna_rxf { void (*stop_cbfn) (struct bna_rx *rx); struct bna_rx *stop_cbarg; - /* callback for bna_rx_receive_pause() / bna_rx_receive_resume() */ - void (*oper_state_cbfn) (struct bnad *bnad, struct bna_rx *rx); - struct bnad *oper_state_cbarg; - /** * callback for: * bna_rxf_ucast_set() -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 17/19] bna: use list_for_each_entry where appropriate
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 5 +- drivers/net/ethernet/brocade/bna/bna.h | 41 -- drivers/net/ethernet/brocade/bna/bna_enet.c | 23 -- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 117 +-- 4 files changed, 37 insertions(+), 149 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index dabbb30..2c74beb 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1091,12 +1091,9 @@ static void bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event) { struct bfa_ioc_notify *notify; - struct list_head*qe; - list_for_each(qe, ioc-notify_q) { - notify = (struct bfa_ioc_notify *)qe; + list_for_each_entry(notify, ioc-notify_q, qe) notify-cbfn(notify-cbarg, event); - } } static void diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 66e6e09..dc845b2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -208,28 +208,24 @@ do { \ #define bna_rx_rid_mask(_bna) ((_bna)-rx_mod.rid_mask) #define bna_tx_from_rid(_bna, _rid, _tx) \ -do { \ - struct bna_tx_mod *__tx_mod = (_bna)-tx_mod;\ - struct bna_tx *__tx;\ - struct list_head *qe; \ - _tx = NULL; \ - list_for_each(qe, __tx_mod-tx_active_q) { \ - __tx = (struct bna_tx *)qe; \ - if (__tx-rid == (_rid)) {\ - (_tx) = __tx; \ - break;\ - } \ - } \ +do { \ + struct bna_tx_mod *__tx_mod = (_bna)-tx_mod; \ + struct bna_tx *__tx;\ + _tx = NULL; \ + list_for_each_entry(__tx, __tx_mod-tx_active_q, qe) { \ + if (__tx-rid == (_rid)) { \ + (_tx) = __tx; \ + break; \ + } \ + } \ } while (0) #define bna_rx_from_rid(_bna, _rid, _rx) \ do { \ struct bna_rx_mod *__rx_mod = (_bna)-rx_mod; \ struct bna_rx *__rx;\ - struct list_head *qe; \ _rx = NULL; \ - list_for_each(qe, __rx_mod-rx_active_q) { \ - __rx = (struct bna_rx *)qe; \ + list_for_each_entry(__rx, __rx_mod-rx_active_q, qe) { \ if (__rx-rid == (_rid)) { \ (_rx) = __rx; \ break; \ @@ -249,15 +245,12 @@ do { \ static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr) { - struct bna_mac *mac = NULL; - struct list_head *qe; - list_for_each(qe, q) { - if (ether_addr_equal(((struct bna_mac *)qe)-addr, addr)) { - mac = (struct bna_mac *)qe; - break; - } - } - return mac; + struct bna_mac *mac; + + list_for_each_entry(mac, q, qe) + if (ether_addr_equal(mac-addr, addr)) + return mac; + return NULL; } #define bna_attr(_bna) ((_bna)-ioceth.attr) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index bd8f2c2..05680e0 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1806,17 +1806,6 @@ bna_ucam_mod_init(struct bna_ucam_mod *ucam_mod, struct bna *bna, static void
[PATCH net-next v2 01/19] bna: use ether_addr_copy instead of memcpy
Parameters of all ether_addr_copy instances were checked for proper alignment. Alignment of bnad_bcast_addr is forced to 2 as the implicit alignment is 1. I have also renamed address parameter of bnad_set_mac_address() to addr. The name mac_addr was a little bit confusing as the real parameter is struct sockaddr *. v2: added __aligned directive to bnad_bcast_addr, renamed parameter of bnad_set_mac_address() (thx j...@perches.com) Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 12 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 22 ++ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 8ab3a5f..30d5e7f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -876,7 +876,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, bfa_q_qe_init(rxf-ucast_pending_mac-qe); } - memcpy(rxf-ucast_pending_mac-addr, ucmac, ETH_ALEN); + ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; rxf-cam_fltr_cbfn = cbfn; rxf-cam_fltr_cbarg = rx-bna-bnad; @@ -905,7 +905,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, if (mac == NULL) return BNA_CB_MCAST_LIST_FULL; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, addr, ETH_ALEN); + ether_addr_copy(mac-addr, addr); list_add_tail(mac-qe, rxf-mcast_pending_add_q); rxf-cam_fltr_cbfn = cbfn; @@ -955,7 +955,7 @@ bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; } @@ -1026,7 +1026,7 @@ bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; @@ -1149,8 +1149,8 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf) /* Set default unicast MAC */ if (rxf-ucast_pending_set) { rxf-ucast_pending_set = 0; - memcpy(rxf-ucast_active_mac.addr, - rxf-ucast_pending_mac-addr, ETH_ALEN); + ether_addr_copy(rxf-ucast_active_mac.addr, + rxf-ucast_pending_mac-addr); rxf-ucast_active_set = 1; bna_bfi_ucast_req(rxf, rxf-ucast_active_mac, BFI_ENET_H2I_MAC_UCAST_SET_REQ); diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index caae6cb..3e7c092 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -57,7 +57,8 @@ static u32 bnad_rxqs_per_cq = 2; static u32 bna_id; static struct mutex bnad_list_mutex; static LIST_HEAD(bnad_list); -static const u8 bnad_bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +static const u8 bnad_bcast_addr[] __aligned(2) = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* * Local MACROS @@ -875,9 +876,9 @@ bnad_set_netdev_perm_addr(struct bnad *bnad) { struct net_device *netdev = bnad-netdev; - memcpy(netdev-perm_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-perm_addr, bnad-perm_addr.mac); if (is_zero_ether_addr(netdev-dev_addr)) - memcpy(netdev-dev_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-dev_addr, bnad-perm_addr.mac); } /* Control Path Handlers */ @@ -1862,8 +1863,7 @@ bnad_netdev_mc_list_get(struct net_device *netdev, u8 *mc_list) struct netdev_hw_addr *mc_addr; netdev_for_each_mc_addr(mc_addr, netdev) { - memcpy(mc_list[i * ETH_ALEN], mc_addr-addr[0], - ETH_ALEN); + ether_addr_copy(mc_list[i * ETH_ALEN], mc_addr-addr[0]); i++; } } @@ -3141,8 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad) entry = 0; netdev_for_each_uc_addr(ha, netdev) { - memcpy(mac_list[entry * ETH_ALEN], - ha-addr[0], ETH_ALEN); + ether_addr_copy(mac_list[entry * ETH_ALEN], ha-addr[0]); entry++; } @@ -3183,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad) if (mac_list == NULL) goto mode_allmulti; - memcpy(mac_list[0], bnad_bcast_addr[0], ETH_ALEN); +
[PATCH net-next v2 12/19] bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag
TX_E_PRIO_CHANGE event is never sent for bna_tx so it doesn't need to be handled. After this change bna_tx-flags cannot contain BNA_TX_F_PRIO_CHANGED flag and it can be also eliminated. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 -- drivers/net/ethernet/brocade/bna/bna_types.h | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 896aa82..54ad169 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -2901,7 +2901,6 @@ enum bna_tx_event { TX_E_FAIL = 3, TX_E_STARTED= 4, TX_E_STOPPED= 5, - TX_E_PRIO_CHANGE= 6, TX_E_CLEANUP_DONE = 7, TX_E_BW_UPDATE = 8, }; @@ -2942,9 +2941,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) /* No-op */ break; - case TX_E_PRIO_CHANGE: - break; - case TX_E_BW_UPDATE: /* No-op */ break; @@ -2965,28 +2961,23 @@ bna_tx_sm_start_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_STOP: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stop_wait); break; case TX_E_FAIL: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stopped); break; case TX_E_STARTED: - if (tx-flags (BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED)) { - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | - BNA_TX_F_BW_UPDATED); + if (tx-flags BNA_TX_F_BW_UPDATED) { + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); } else bfa_fsm_set_state(tx, bna_tx_sm_started); break; - case TX_E_PRIO_CHANGE: - tx-flags |= BNA_TX_F_PRIO_CHANGED; - break; - case TX_E_BW_UPDATE: tx-flags |= BNA_TX_F_BW_UPDATED; break; @@ -3028,7 +3019,6 @@ bna_tx_sm_started(struct bna_tx *tx, enum bna_tx_event event) tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); break; @@ -3061,7 +3051,6 @@ bna_tx_sm_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bna_tx_enet_stop(tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3081,7 +3070,6 @@ bna_tx_sm_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_FAIL: - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3119,7 +3107,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_prio_cleanup_wait); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3147,7 +3134,6 @@ bna_tx_sm_prio_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_failed); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 134abf7..e0e797f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -135,7 +135,6 @@ enum bna_tx_type { enum bna_tx_flags { BNA_TX_F_ENET_STARTED = 1, BNA_TX_F_ENABLED= 2, - BNA_TX_F_PRIO_CHANGED = 4, BNA_TX_F_BW_UPDATED = 8, }; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 15/19] bna: remove useless pointer assignment
Pointer cmpl used to iterate through completion entries is updated at the beginning of while loop as well as at the end. The update at the end of the loop is useless. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 0f833e4..fc97428 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -725,7 +725,6 @@ next: cmpl-valid = 0; BNA_QE_INDX_INC(ccb-producer_index, ccb-q_depth); } - cmpl = cq[ccb-producer_index]; } napi_gro_flush(rx_ctrl-napi, false); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
...and remove some of them. It is not necessary to log when .probe() and .remove() are called or when TxQ is started or stopped. Also log level of some of them was changed to more appropriate one (link up/down, firmware loading failure. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 46 + drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 34 -- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 9 ++--- drivers/net/ethernet/brocade/bna/cna_fwimg.c| 2 +- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 4542eb2..6be31ae 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -946,8 +946,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, if (link_up) { if (!netif_carrier_ok(bnad-netdev)) { uint tx_id, tcb_id; - printk(KERN_WARNING bna: %s link up\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link up\n); netif_carrier_on(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); for (tx_id = 0; tx_id bnad-num_tx; tx_id++) { @@ -966,10 +965,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, /* * Force an immediate * Transmit Schedule */ - printk(KERN_INFO bna: %s %d - TXQ_STARTED\n, - bnad-netdev-name, - txq_id); netif_wake_subqueue( bnad-netdev, txq_id); @@ -987,8 +982,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, } } else { if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_WARNING bna: %s link down\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link down\n); netif_carrier_off(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); } @@ -1058,8 +1052,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) txq_id = tcb-id; clear_bit(BNAD_TXQ_TX_STARTED, tcb-flags); netif_stop_subqueue(bnad-netdev, txq_id); - printk(KERN_INFO bna: %s %d TXQ_STOPPED\n, - bnad-netdev-name, txq_id); } } @@ -1082,8 +1074,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) BUG_ON(*(tcb-hw_consumer_index) != 0); if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_INFO bna: %s %d TXQ_STARTED\n, - bnad-netdev-name, txq_id); netif_wake_subqueue(bnad-netdev, txq_id); BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); } @@ -2136,7 +2126,7 @@ bnad_reinit_rx(struct bnad *bnad) current_err = bnad_setup_rx(bnad, rx_id); if (current_err !err) { err = current_err; - pr_err(RXQ:%u setup failed\n, rx_id); + netdev_err(netdev, RXQ:%u setup failed\n, rx_id); } } @@ -2672,8 +2662,9 @@ bnad_enable_msix(struct bnad *bnad) if (ret 0) { goto intx_mode; } else if (ret bnad-msix_num) { - pr_warn(BNA: %d MSI-X vectors allocated %d requested\n, - ret, bnad-msix_num); + dev_warn(bnad-pcidev-dev, +%d MSI-X vectors allocated %d requested\n, +ret, bnad-msix_num); spin_lock_irqsave(bnad-bna_lock, flags); /* ret = #of vectors that we got */ @@ -2695,7 +2686,8 @@ bnad_enable_msix(struct bnad *bnad) return; intx_mode: - pr_warn(BNA: MSI-X enable failed - operating in INTx mode\n); + dev_warn(bnad-pcidev-dev, +MSI-X enable failed - operating in INTx mode\n); kfree(bnad-msix_table); bnad-msix_table = NULL; @@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad, dev_err(pdev-dev, ioremap for bar0 failed\n); return -ENOMEM; } - pr_info(bar0 mapped to %p, len %llu\n, bnad-bar0, - (unsigned long long) bnad-mmio_len); + dev_info(pdev-dev, bar0 mapped to %p, len %llu\n, bnad-bar0, +
[PATCH net-next v2 18/19] bna: fix timeout API argument type
Timeout functions are defined with 'void *' ptr argument. They should be defined directly with 'struct bfa_ioc *' type to avoid type conversions. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 16 +--- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 8 drivers/net/ethernet/brocade/bna/bnad.c| 8 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 2c74beb..b009fd7 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1895,10 +1895,8 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) } void -bfa_nw_ioc_timeout(void *ioc_arg) +bfa_nw_ioc_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_fsm_send_event(ioc, IOC_E_TIMEOUT); } @@ -1963,10 +1961,9 @@ bfa_ioc_send_getattr(struct bfa_ioc *ioc) } void -bfa_nw_ioc_hb_check(void *cbarg) +bfa_nw_ioc_hb_check(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = cbarg; - u32 hb_count; + u32 hb_count; hb_count = readl(ioc-ioc_regs.heartbeat); if (ioc-hb_count == hb_count) { @@ -2983,9 +2980,8 @@ bfa_iocpf_stop(struct bfa_ioc *ioc) } void -bfa_nw_iocpf_timeout(void *ioc_arg) +bfa_nw_iocpf_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; enum bfa_iocpf_state iocpf_st; iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc-iocpf.fsm); @@ -2997,10 +2993,8 @@ bfa_nw_iocpf_timeout(void *ioc_arg) } void -bfa_nw_iocpf_sem_timeout(void *ioc_arg) +bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_ioc_hw_sem_get(ioc); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b6ad2c5..2c0b4c0 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -304,10 +304,10 @@ int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); /* * Timeout APIs */ -void bfa_nw_ioc_timeout(void *ioc); -void bfa_nw_ioc_hb_check(void *ioc); -void bfa_nw_iocpf_timeout(void *ioc); -void bfa_nw_iocpf_sem_timeout(void *ioc); +void bfa_nw_ioc_timeout(struct bfa_ioc *ioc); +void bfa_nw_ioc_hb_check(struct bfa_ioc *ioc); +void bfa_nw_iocpf_timeout(struct bfa_ioc *ioc); +void bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc); /* * F/W Image Size Chunk diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index fc97428..4542eb2 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -1703,7 +1703,7 @@ bnad_ioc_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1714,7 +1714,7 @@ bnad_ioc_hb_check(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_hb_check((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_hb_check(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1725,7 +1725,7 @@ bnad_iocpf_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1736,7 +1736,7 @@ bnad_iocpf_sem_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_sem_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_sem_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: /net/mpls/conf/ethX//input duplicate entry
On 11/06/15 00:23, Scott Feldman wrote: On Wed, Jun 10, 2015 at 2:58 PM, roopa ro...@cumulusnetworks.com wrote: On 6/10/15, 1:43 PM, Scott Feldman wrote: I'm getting this dump_stack when reloading rocker driver. Did some sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER? Steps to repro: load rocker (on system) with rocker device, rmmod rocker, and then modprobe rocker. I doubt this is specific to rocker: and re-registration of a netdev should hit it. I am using UDEV rules to rename kernel's ethX to a different name. Maybe that's what tripped it up? On a quick look, wondering if this is because mpls driver does not seem to do a unregister and re-register sysctl on device name change. Mea culpa. Thanks for looking at this. diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 7b3f732..ec21a5d 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event, case NETDEV_UNREGISTER: mpls_ifdown(dev); break; + case NETDEV_CHANGENAME: + mpls_ifdown(dev); + if ((dev-type == ARPHRD_ETHER) || + (dev-type == ARPHRD_LOOPBACK)) { + mdev = mpls_add_dev(dev); + if (IS_ERR(mdev)) + return notifier_from_errno(PTR_ERR(mdev)); + } } return NOTIFY_OK; } Roopa, I tested this patch and problem goes away. (It's missing a break statement, BTW). I didn't look into the correctness of the patch, but at first glance it seems liek the right thing to do. Maybe breaking out the renaming portions into sub-functions could keep the work done in NETDEV_CHANGENAME to a minimum. I agree that breaking out the sysctl registration/unregistration is a good idea to not have to do more work than is necessary, and to avoid unintended consequences (like routes using the interface being made unusable). Are you sending official fix? Roopa, let me know if you'd like me to carry this forward. Thanks, Rob -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH ethtool V3 0/2] Add copybreak support
Hi Ben, This series add support for setting/getting driver's tx/rx_copybreak value. Copybreak is handled through a new ethtool tunable interface. The kernel support will be avilable from kernel 4.2, commit net/ethtool: Add current supported tunable options. The series was originally sent by Govindarajulu Varadarajan, I fixed the comments and resend the series. Thanks, Hadar Changes form V2: - Change -B/-b to generic tunable option. - Remove tunable names from user space, defined tunable strings names in the kernel. - Remove the third patch - ethtool-copy.h: Sync with net-next 3.17.0-rc7 Govindarajulu Varadarajan (2): ethtool: Add copybreak support ethtool.8.in: Add man page for tunable copybreak ethtool-copy.h | 1 + ethtool.8.in | 20 + ethtool.c | 227 + 3 files changed, 248 insertions(+) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH ethtool V3 1/2] ethtool: Add copybreak support
From: Govindarajulu Varadarajan _gov...@gmx.com Add support for setting/getting driver's tx/rx_copybreak value. Copybreak is handled through a new ethtool tunable interface. The kernel support was added in 3.18, commit f0db9b07341 ethtool: Add generic options for tunables Signed-off-by: Govindarajulu Varadarajan _gov...@gmx.com Signed-off-by: Hadar Hen Zion had...@mellanox.com --- ethtool-copy.h | 1 + ethtool.c | 227 + 2 files changed, 228 insertions(+) diff --git a/ethtool-copy.h b/ethtool-copy.h index d23ffc4..f92743b 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -545,6 +545,7 @@ enum ethtool_stringset { ETH_SS_NTUPLE_FILTERS, ETH_SS_FEATURES, ETH_SS_RSS_HASH_FUNCS, + ETH_SS_TUNABLES, }; /** diff --git a/ethtool.c b/ethtool.c index 01b13a6..16b5c41 100644 --- a/ethtool.c +++ b/ethtool.c @@ -145,6 +145,12 @@ struct cmdline_info { void *seen_val; }; +struct ethtool_stunable { + cmdline_type_t type; + __u32 u32_val; + int seen_val; +}; + struct flag_info { const char *name; u32 value; @@ -1800,6 +1806,223 @@ static int do_gring(struct cmd_context *ctx) return 0; } +static int get_u32tunable(struct cmd_context *ctx, enum tunable_id id, + __u32 *value) +{ + struct ethtool_tunable *etuna; + int ret; + + etuna = calloc(sizeof(*etuna) + sizeof(__u32), 1); + if (!etuna) + return 1; + etuna-cmd = ETHTOOL_GTUNABLE; + etuna-id = id; + etuna-type_id = ETHTOOL_TUNABLE_U32; + etuna-len = sizeof(__u32); + ret = send_ioctl(ctx, etuna); + *value = *(__u32 *)((void *)etuna + sizeof(*etuna)); + free(etuna); + + return ret; +} + +static int print_u32tunable(int err, struct ethtool_gstrings *tunables, + enum tunable_id id, const __u32 value) +{ + char *tunable_name = (char *)tunables-data + id * ETH_GSTRING_LEN; + + if (err) { + switch (errno) { + /* Driver does not support this particular tunable +* Usually displays 0 +*/ + case EINVAL: + goto print; + /* Driver does not support get tunables ops or no such device +* No point in proceeding further +*/ + case EOPNOTSUPP: + case ENODEV: + perror(Cannot get device settings); + exit(err); + default: + perror(tunable_name); + return err; + } + } +print: + fprintf(stdout, %s: %u\n, tunable_name, value); + + return 0; +} + +static int do_gtunables(struct cmd_context *ctx) +{ + int err, anyerror = 0; + __u32 u32value = 0; + struct ethtool_gstrings *tunables; + int idx; + __u32 n_tunables; + + if (ctx-argc != 0) + exit_bad_args(); + + tunables = get_stringset(ctx, ETH_SS_TUNABLES, 0, 1); + if (!tunables) { + perror(Cannot get tunables names); + return 1; + } + if (tunables-len == 0) { + fprintf(stderr, No tunables defined\n); + return 1; + } + n_tunables = tunables-len; + + fprintf(stdout, Tunables settings for device %s\n, ctx-devname); + + for (idx = 0; idx n_tunables; idx++) { + switch(idx) { + case ETHTOOL_ID_UNSPEC: + break; + case ETHTOOL_RX_COPYBREAK: + case ETHTOOL_TX_COPYBREAK: + err = get_u32tunable(ctx, idx, u32value); + err = print_u32tunable(err, tunables, idx, u32value); + if (err) + anyerror = err; + break; + default: + anyerror = EINVAL; + } + } + if (anyerror) + fprintf(stderr, Failed to get all settings. displayed partial settings\n); + + free(tunables); + return anyerror; +} + +static int set_u32tunable(struct cmd_context *ctx, enum tunable_id id, + const __u32 value) +{ + struct ethtool_tunable *etuna; + int ret; + __u32 *data; + + etuna = malloc(sizeof(*etuna) + sizeof(__u32)); + if (!etuna) { + perror(Set tunable:); + return 1; + } + data = (void *)etuna + sizeof(*etuna); + *data = value; + etuna-cmd = ETHTOOL_STUNABLE; + etuna-id = id; + etuna-type_id = ETHTOOL_TUNABLE_U32; + etuna-len = sizeof(__u32); + ret = send_ioctl(ctx, etuna); + free(etuna); + + return ret; +} + +static int check_set_u32tunable(int err, enum tunable_id id) +{ + if (err) { + switch (errno)
Re: [PATCH v3] ipv6: Fix protocol resubmission
At Wed, 10 Jun 2015 16:57:25 -0500, Josh Hunt wrote: Dave Can you please revert this change? commit 0243508edd317ff1fa63b495643a7c192fbfcd92 Author: Josh Hunt joh...@akamai.com Date: Mon Jun 8 12:00:59 2015 -0400 ipv6: Fix protocol resubmission Let me know if you need a patch to do this and I will submit something. I will fix the original issue in the UDP code in another patch. feel free to Cc me if you would like me to test the new patch. thanks. -- Hajime -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 06/19] bna: remove unused cbfn parameter
removed: bna_rx_ucast_add bna_rx_ucast_del simplified: bna_enet_pause_config bna_rx_mcast_delall bna_rx_mcast_listset bna_rx_mode_set bna_rx_ucast_listset bna_rx_ucast_set Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 24 + drivers/net/ethernet/brocade/bna/bna_enet.c | 5 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 35 +++-- drivers/net/ethernet/brocade/bna/bnad.c | 18 ++--- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 2 +- 5 files changed, 25 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 130010d..0962e54 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -386,30 +386,19 @@ void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo); void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]); void bna_rx_dim_update(struct bna_ccb *ccb); enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac); enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist); enum bna_cb_status bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac, void (*cbfn)(struct bnad *, struct bna_rx *)); enum bna_cb_status -bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac); void -bna_rx_mcast_delall(struct bna_rx *rx, - void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_delall(struct bna_rx *rx); enum bna_cb_status bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode, - enum bna_rxmode bitmask, - void (*cbfn)(struct bnad *, struct bna_rx *)); + enum bna_rxmode bitmask); void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id); void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id); void bna_rx_vlanfilter_enable(struct bna_rx *rx); @@ -429,8 +418,7 @@ void bna_enet_enable(struct bna_enet *enet); void bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void (*cbfn)(void *)); void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)); + struct bna_pause_config *pause_config); void bna_enet_mtu_set(struct bna_enet *enet, int mtu, void (*cbfn)(struct bnad *)); void bna_enet_perm_mac_get(struct bna_enet *enet, u8 *mac); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index 54902ce..b8de17b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1308,13 +1308,10 @@ bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)) + struct bna_pause_config *pause_config) { enet-pause_config = *pause_config; - enet-pause_cbfn = cbfn; - bfa_fsm_send_event(enet, ENET_E_PAUSE_CFG); } diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 2c85f72..16d36df 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -863,8 +863,7 @@ bna_rxf_fail(struct bna_rxf *rxf) } enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac) { struct bna_rxf *rxf = rx-rxf; @@ -878,7 +877,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; - rxf-cam_fltr_cbfn = cbfn; + rxf-cam_fltr_cbfn = NULL; rxf-cam_fltr_cbarg = rx-bna-bnad; bfa_fsm_send_event(rxf, RXF_E_CONFIG); @@ -917,8 +916,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, } enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_listset(struct bna_rx *rx, int
[PATCH net-next v2 05/19] bna: use BIT(x) instead of (1 x)
Signed-off-by: Ivan Vecera ivec...@redhat.com --- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 66 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c| 4 +- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 +++ 6 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 679a503..16090fd 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -75,7 +75,7 @@ enum { CB_GPIO_FC4P2 = (4), /*! 4G 2port FC card */ CB_GPIO_FC4P1 = (5), /*! 4G 1port FC card */ CB_GPIO_DFLY= (6), /*! 8G 2port FC mezzanine card */ - CB_GPIO_PROTO = (1 7) /*! 8G 2port FC prototypes */ + CB_GPIO_PROTO = BIT(7)/*! 8G 2port FC prototypes */ }; #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index 2e72445..4247d8a 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c @@ -24,7 +24,7 @@ #include bfa_defs.h #define bfa_ioc_ct_sync_pos(__ioc) \ - ((u32) (1 bfa_ioc_pcifn(__ioc))) + ((u32)BIT(bfa_ioc_pcifn(__ioc))) #define BFA_IOC_SYNC_REQD_SH 16 #define bfa_ioc_ct_get_sync_ackd(__val) (__val 0x) #define bfa_ioc_ct_clear_sync_ackd(__val) (__val 0x) diff --git a/drivers/net/ethernet/brocade/bna/bfi_enet.h b/drivers/net/ethernet/brocade/bna/bfi_enet.h index fad3a12..d7be7ea8 100644 --- a/drivers/net/ethernet/brocade/bna/bfi_enet.h +++ b/drivers/net/ethernet/brocade/bna/bfi_enet.h @@ -68,13 +68,13 @@ union bfi_addr_be_u { #define BFI_ENET_TXQ_WI_EXTENSION (0x104) /* Extension WI */ /* TxQ Entry Control Flags */ -#define BFI_ENET_TXQ_WI_CF_FCOE_CRC(1 8) -#define BFI_ENET_TXQ_WI_CF_IPID_MODE (1 5) -#define BFI_ENET_TXQ_WI_CF_INS_PRIO(1 4) -#define BFI_ENET_TXQ_WI_CF_INS_VLAN(1 3) -#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM (1 2) -#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM (1 1) -#define BFI_ENET_TXQ_WI_CF_IP_CKSUM(1 0) +#define BFI_ENET_TXQ_WI_CF_FCOE_CRCBIT(8) +#define BFI_ENET_TXQ_WI_CF_IPID_MODE BIT(5) +#define BFI_ENET_TXQ_WI_CF_INS_PRIOBIT(4) +#define BFI_ENET_TXQ_WI_CF_INS_VLANBIT(3) +#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM BIT(2) +#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM BIT(1) +#define BFI_ENET_TXQ_WI_CF_IP_CKSUMBIT(0) struct bfi_enet_txq_wi_base { u8 reserved; @@ -122,32 +122,32 @@ struct bfi_enet_rxq_entry { /* R X C O M P L E T I O N Q U E U E D E F I N E S */ /* CQ Entry Flags */ -#defineBFI_ENET_CQ_EF_MAC_ERROR(1 0) -#defineBFI_ENET_CQ_EF_FCS_ERROR(1 1) -#defineBFI_ENET_CQ_EF_TOO_LONG (1 2) -#defineBFI_ENET_CQ_EF_FC_CRC_OK(1 3) +#define BFI_ENET_CQ_EF_MAC_ERROR BIT(0) +#define BFI_ENET_CQ_EF_FCS_ERROR BIT(1) +#define BFI_ENET_CQ_EF_TOO_LONGBIT(2) +#define BFI_ENET_CQ_EF_FC_CRC_OK BIT(3) -#defineBFI_ENET_CQ_EF_RSVD1(1 4) -#defineBFI_ENET_CQ_EF_L4_CKSUM_OK (1 5) -#defineBFI_ENET_CQ_EF_L3_CKSUM_OK (1 6) -#defineBFI_ENET_CQ_EF_HDS_HEADER (1 7) +#define BFI_ENET_CQ_EF_RSVD1 BIT(4) +#define BFI_ENET_CQ_EF_L4_CKSUM_OK BIT(5) +#define BFI_ENET_CQ_EF_L3_CKSUM_OK BIT(6) +#define BFI_ENET_CQ_EF_HDS_HEADER BIT(7) -#defineBFI_ENET_CQ_EF_UDP (1 8) -#defineBFI_ENET_CQ_EF_TCP (1 9) -#defineBFI_ENET_CQ_EF_IP_OPTIONS (1 10) -#defineBFI_ENET_CQ_EF_IPV6 (1 11) +#define BFI_ENET_CQ_EF_UDP BIT(8) +#define BFI_ENET_CQ_EF_TCP BIT(9) +#define BFI_ENET_CQ_EF_IP_OPTIONS BIT(10) +#define BFI_ENET_CQ_EF_IPV6BIT(11) -#defineBFI_ENET_CQ_EF_IPV4 (1 12) -#defineBFI_ENET_CQ_EF_VLAN (1 13) -#defineBFI_ENET_CQ_EF_RSS (1 14) -#defineBFI_ENET_CQ_EF_RSVD2(1 15) +#define BFI_ENET_CQ_EF_IPV4BIT(12) +#define BFI_ENET_CQ_EF_VLANBIT(13) +#define BFI_ENET_CQ_EF_RSS BIT(14) +#define BFI_ENET_CQ_EF_RSVD2 BIT(15) -#defineBFI_ENET_CQ_EF_MCAST_MATCH (1 16) -#defineBFI_ENET_CQ_EF_MCAST(1 17) -#define BFI_ENET_CQ_EF_BCAST (1 18) -#defineBFI_ENET_CQ_EF_REMOTE (1 19) +#define
[PATCH net-next v2 00/19] bna: clean-up
The patches clean the bna driver. v2: changes comments requested by Joe Ivan Vecera (19): bna: use ether_addr_copy instead of memcpy bna: get rid of mac_t bna: replace pragma(pack) with attribute __packed bna: get rid of duplicate and unused macros bna: use BIT(x) instead of (1 x) bna: remove unused cbfn parameter bna: remove pause_cbfn from struct bna_enet bna: remove oper_state_cbfn from struct bna_rxf bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx bna: remove RXF_E_PAUSE and RXF_E_RESUME events bna: remove paused from bna_rx_config and flags from bna_rxf bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag bna: correct comparisons/assignments to bool bna: use memdup_user to copy userspace buffers bna: remove useless pointer assignment bna: get rid of private macros for manipulation with lists bna: use list_for_each_entry where appropriate bna: fix timeout API argument type bna: use netdev_* and dev_* instead of printk and pr_* drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 - drivers/net/ethernet/brocade/bna/bfa_defs.h| 11 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 16 +- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 8 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 61 +- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 23 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c| 10 +- drivers/net/ethernet/brocade/bna/bfi.h | 84 ++- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 176 +++--- drivers/net/ethernet/brocade/bna/bna.h | 186 +- drivers/net/ethernet/brocade/bna/bna_enet.c| 101 +--- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 665 + drivers/net/ethernet/brocade/bna/bna_types.h | 19 - drivers/net/ethernet/brocade/bna/bnad.c| 101 ++-- drivers/net/ethernet/brocade/bna/bnad.h| 2 +- drivers/net/ethernet/brocade/bna/bnad_debugfs.c| 61 +- drivers/net/ethernet/brocade/bna/bnad_ethtool.c| 15 +- drivers/net/ethernet/brocade/bna/cna.h | 62 -- drivers/net/ethernet/brocade/bna/cna_fwimg.c | 2 +- 23 files changed, 491 insertions(+), 1229 deletions(-) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] net: igb: fix the start time for periodic output signals
On Thu, Jun 11, 2015 at 02:51:30PM +0200, Richard Cochran wrote: This patch fixes the issue by programming the registers correctly. Please also consider this for stable. Thanks, Richard -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
There is no background it doesn't matter if this activity happens synchronously or asynchronously, unless you're sensitive to the latency on that single operation. If you're driving all your cpu's and memory hard then this is work that still takes resources. If there's a kernel thread with compaction running, then obviously your process is not. Your patch should help in that not every atomic allocation failure should mean yet another run at compaction/reclaim. -Deb On Thu, Jun 11, 2015 at 5:16 PM, Chris Mason c...@fb.com wrote: networking is asking for 32KB, and the MM layer is doing what it can to provide it. Are the gains from getting 32KB contig bigger than the cost of moving pages around if the MM has to actually go into compaction? Should we start disk IO to give back 32KB contig? I think we want to tell the MM to compact in the background and give networking 32KB if it happens to have it available. If not, fall back to smaller allocations without doing anything expensive. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH next v0] bonding: Display LACP info only to CAP_SYS_ADMIN capable user
On Wed, 10 Jun 2015 17:19:56 -0700 Mahesh Bandewar mahe...@google.com wrote: Actor and Partner details can be accessed via proc-fs and sys-fs entries. These interfaces are world readable at this moment. The earlier patch-series made the LACP communication secure to avoid nuisance attack from within the same L2 domain but it did not prevent someone unprivileged looking at that information on host and perform the same act. This patch essentially avoids spitting those entries if the user in question does not have enough privileges. Signed-off-by: Mahesh Bandewar mahe...@google.com I would think you want CAP_NET_ADMIN for this? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 17:16 -0400, Chris Mason wrote: On 06/11/2015 04:48 PM, Eric Dumazet wrote: On Thu, 2015-06-11 at 13:24 -0700, Shaohua Li wrote: We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { This is not a specific networking issue, but mm one. You really need to start a discussion with mm experts. Your changelog does not exactly explains what _is_ the problem. If the problem lies in mm layer, it might be time to fix it, instead of work around the bug by never triggering it from this particular point, which is a safe point where a process is willing to wait a bit. Memory compaction is either working as intending, or not. If we enabled it but never run it because it hurts, what is the point enabling it ? networking is asking for 32KB, and the MM layer is doing what it can to provide it. Are the gains from getting 32KB contig bigger than the cost of moving pages around if the MM has to actually go into compaction? Should we start disk IO to give back 32KB contig? I think we want to tell the MM to compact in the background and give networking 32KB if it happens to have it available. If not, fall back to smaller allocations without doing anything expensive. Exactly my point. (And I mentioned this about 4 months ago) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
Resend in plaintext, thanks gmail: It's somewhat an intractable problem to know if compaction will succeed without trying it, and you can certainly end up in a state where memory is heavily fragmented, even with compaction running. You can't compact kernel pages for example, so you can end up in a state where compaction does nothing through no fault of it's own. In this case you waste time in compaction routines, then end up reclaiming precious page cache pages or swapping out for whatever it is your machine was doing trying to do to satisfy these order-3 allocations, after which all those pages need to be restored from disk almost immediately. This is not a happy server. Any mm fix may be years away. The only simple solution I can think of is specifically caching these allocations, in any other case under memory pressure they will be split by other smaller allocations. We've been forcing these allocations to order-0 internally until we can think of something else. -Deb On Thu, Jun 11, 2015 at 4:48 PM, Eric Dumazet eric.duma...@gmail.com wrote: On Thu, 2015-06-11 at 13:24 -0700, Shaohua Li wrote: We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { This is not a specific networking issue, but mm one. You really need to start a discussion with mm experts. Your changelog does not exactly explains what _is_ the problem. If the problem lies in mm layer, it might be time to fix it, instead of work around the bug by never triggering it from this particular point, which is a safe point where a process is willing to wait a bit. Memory compaction is either working as intending, or not. If we enabled it but never run it because it hurts, what is the point enabling it ? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majord...@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, Jun 11, 2015 at 02:22:13PM -0700, Eric Dumazet wrote: On Thu, 2015-06-11 at 17:16 -0400, Chris Mason wrote: On 06/11/2015 04:48 PM, Eric Dumazet wrote: On Thu, 2015-06-11 at 13:24 -0700, Shaohua Li wrote: We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { -pfrag-page = alloc_pages(gfp | __GFP_COMP | +pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { This is not a specific networking issue, but mm one. You really need to start a discussion with mm experts. Your changelog does not exactly explains what _is_ the problem. If the problem lies in mm layer, it might be time to fix it, instead of work around the bug by never triggering it from this particular point, which is a safe point where a process is willing to wait a bit. Memory compaction is either working as intending, or not. If we enabled it but never run it because it hurts, what is the point enabling it ? networking is asking for 32KB, and the MM layer is doing what it can to provide it. Are the gains from getting 32KB contig bigger than the cost of moving pages around if the MM has to actually go into compaction? Should we start disk IO to give back 32KB contig? I think we want to tell the MM to compact in the background and give networking 32KB if it happens to have it available. If not, fall back to smaller allocations without doing anything expensive. Exactly my point. (And I mentioned this about 4 months ago) This is exactly what the patch try to do. Atomic 32k allocation will fail with memory pressure, kswapd is waken up to do compaction and we fallback to 4k. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 13:24 -0700, Shaohua Li wrote: We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { This is not a specific networking issue, but mm one. You really need to start a discussion with mm experts. Your changelog does not exactly explains what _is_ the problem. If the problem lies in mm layer, it might be time to fix it, instead of work around the bug by never triggering it from this particular point, which is a safe point where a process is willing to wait a bit. Memory compaction is either working as intending, or not. If we enabled it but never run it because it hurts, what is the point enabling it ? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] net: tcp: dctcp_update_alpha() fixes.
On 06/11/2015 07:11 AM, Eric Dumazet wrote: From: Eric Dumazet eduma...@google.com dctcp_alpha can be read by from dctcp_get_info() without synchro, so use WRITE_ONCE() to prevent compiler from using dctcp_alpha as a temporary variable. Also, playing with small dctcp_shift_g (like 1), can expose an overflow with 32bit values shifted 9 times before divide. Use an u64 field to avoid this problem, and perform the divide only if acked_bytes_ecn is not zero. Signed-off-by: Eric Dumazet eduma...@google.com Change looks correct to me, thanks Eric! Acked-by: Daniel Borkmann dan...@iogearbox.net -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] net: use atomic allocation for order-3 page allocation
We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { -- 1.8.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On 06/11/2015 04:48 PM, Eric Dumazet wrote: On Thu, 2015-06-11 at 13:24 -0700, Shaohua Li wrote: We saw excessive memory compaction triggered by skb_page_frag_refill. This causes performance issues. Commit 5640f7685831e0 introduces the order-3 allocation to improve performance. But memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, compaction will not be triggered and we will fallback to order-0 immediately. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { -pfrag-page = alloc_pages(gfp | __GFP_COMP | +pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { This is not a specific networking issue, but mm one. You really need to start a discussion with mm experts. Your changelog does not exactly explains what _is_ the problem. If the problem lies in mm layer, it might be time to fix it, instead of work around the bug by never triggering it from this particular point, which is a safe point where a process is willing to wait a bit. Memory compaction is either working as intending, or not. If we enabled it but never run it because it hurts, what is the point enabling it ? networking is asking for 32KB, and the MM layer is doing what it can to provide it. Are the gains from getting 32KB contig bigger than the cost of moving pages around if the MM has to actually go into compaction? Should we start disk IO to give back 32KB contig? I think we want to tell the MM to compact in the background and give networking 32KB if it happens to have it available. If not, fall back to smaller allocations without doing anything expensive. -chris -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, Jun 11, 2015 at 02:56:26PM -0700, Eric Dumazet wrote: On Thu, 2015-06-11 at 14:45 -0700, Shaohua Li wrote: This is exactly what the patch try to do. Atomic 32k allocation will fail with memory pressure, kswapd is waken up to do compaction and we fallback to 4k. Read your changelog, then read what you just wrote. Your changelog said : 'compaction will not be triggered and we will fallback to order-0 immediately.' Now you tell me that compaction is started. What is the truth ? Please make sure changelog is precise, this would avoid many mails. Ah, ok. I mean direct compaction isn't triggered, kswapd is still waken up to do compaction. I'll update the changelog. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On 06/11/2015 05:22 PM, Eric Dumazet wrote: On Thu, 2015-06-11 at 17:16 -0400, Chris Mason wrote: On 06/11/2015 04:48 PM, Eric Dumazet wrote: networking is asking for 32KB, and the MM layer is doing what it can to provide it. Are the gains from getting 32KB contig bigger than the cost of moving pages around if the MM has to actually go into compaction? Should we start disk IO to give back 32KB contig? I think we want to tell the MM to compact in the background and give networking 32KB if it happens to have it available. If not, fall back to smaller allocations without doing anything expensive. Exactly my point. (And I mentioned this about 4 months ago) Sorry, reading this again I wasn't very clear. I agree with Shaohua's patch because it is telling the allocator that we don't want to wait for reclaim or compaction to find contiguous pages. But, is there any fallback to a single page allocation somewhere else? If this is the only way to get memory, we might want to add a single alloc_page path that won't trigger compaction but is at least able to wait for kswapd to make progress. -chris -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
Please stop top-posting. Quote the relevant material you are replying to first, the add your response commentary afterwards rather than beforehand. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1 linux-next] net/mlx4_core: use swap() in mlx4_make_profile()
From: Fabian Frederick f...@skynet.be Date: Wed, 10 Jun 2015 18:33:13 +0200 Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be Applied. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1 linux-next] net: fs_enet: use swap() in fs_enet_rx_napi()
From: Fabian Frederick f...@skynet.be Date: Wed, 10 Jun 2015 18:33:19 +0200 Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be Applied. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1 linux-next] net/ibm/emac: use swap() in emac_make_bootlist()
From: Fabian Frederick f...@skynet.be Date: Wed, 10 Jun 2015 18:33:16 +0200 Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be Applied. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1 linux-next] vxge: use swap() in vxge_hw_channel_dtr_alloc()
From: Fabian Frederick f...@skynet.be Date: Wed, 10 Jun 2015 18:33:26 +0200 Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be Applied. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1 linux-next] net/mlx4: use swap() in mlx4_init_qp_table()
From: Fabian Frederick f...@skynet.be Date: Wed, 10 Jun 2015 18:33:06 +0200 Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be Applied. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2 00/19] bna: clean-up
From: Ivan Vecera ivec...@redhat.com Date: Thu, 11 Jun 2015 15:52:12 +0200 The patches clean the bna driver. v2: changes comments requested by Joe Series applied, thanks Ivan. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 0/5] tcp: defer shinfo-gso_size|type settings
From: Eric Dumazet eduma...@google.com Date: Thu, 11 Jun 2015 09:15:14 -0700 We put shinfo-gso_segs in TCP_SKB_CB(skb) a while back for performance reasons. This was in commit cd7d8498c9a5 (tcp: change tcp_skb_pcount() location) This patch series complete the job for gso_size and gso_type, so that we do not bring 2 extra cache lines in tcp write xmit fast path, and making tcp_init_tso_segs() simpler and faster. Series applied, however long term I worry that using a u16 will not work with TSO'd ipv6 jumbograms. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 14:45 -0700, Shaohua Li wrote: This is exactly what the patch try to do. Atomic 32k allocation will fail with memory pressure, kswapd is waken up to do compaction and we fallback to 4k. Read your changelog, then read what you just wrote. Your changelog said : 'compaction will not be triggered and we will fallback to order-0 immediately.' Now you tell me that compaction is started. What is the truth ? Please make sure changelog is precise, this would avoid many mails. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH next v0] bonding: Display LACP info only to CAP_SYS_ADMIN capable user
From: Mahesh Bandewar mahe...@google.com Date: Wed, 10 Jun 2015 17:19:56 -0700 Actor and Partner details can be accessed via proc-fs and sys-fs entries. These interfaces are world readable at this moment. The earlier patch-series made the LACP communication secure to avoid nuisance attack from within the same L2 domain but it did not prevent someone unprivileged looking at that information on host and perform the same act. This patch essentially avoids spitting those entries if the user in question does not have enough privileges. Signed-off-by: Mahesh Bandewar mahe...@google.com I agree with Stephen Hemminger in that you should probably be using CAP_NET_ADMIN here. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] net: igb: fix the start time for periodic output signals
On Thu, 2015-06-11 at 14:51 +0200, Richard Cochran wrote: When programming the start of a periodic output, the code wrongly places the seconds value into the low register and the nanoseconds into the high register. Even though this is backwards, it slipped through my testing, because the re-arming code in the interrupt service routine is correct, and the signal does appear starting with the second edge. This patch fixes the issue by programming the registers correctly. Signed-off-by: Richard Cochran richardcoch...@gmail.com Acked-by: Jeff Kirsher jeffrey.t.kirs...@intel.com signature.asc Description: This is a digitally signed message part
Re: [PATCH net] net: igb: fix the start time for periodic output signals
On Thu, 2015-06-11 at 15:56 -0700, David Miller wrote: From: Richard Cochran richardcoch...@gmail.com Date: Thu, 11 Jun 2015 14:53:10 +0200 On Thu, Jun 11, 2015 at 02:51:30PM +0200, Richard Cochran wrote: This patch fixes the issue by programming the registers correctly. Please also consider this for stable. Jeff, do you want me to integrate this directly? Yes please. I was just about to send email asking that. signature.asc Description: This is a digitally signed message part
Re: [PATCH net] net: igb: fix the start time for periodic output signals
From: Jeff Kirsher jeffrey.t.kirs...@intel.com Date: Thu, 11 Jun 2015 15:59:05 -0700 On Thu, 2015-06-11 at 14:51 +0200, Richard Cochran wrote: When programming the start of a periodic output, the code wrongly places the seconds value into the low register and the nanoseconds into the high register. Even though this is backwards, it slipped through my testing, because the re-arming code in the interrupt service routine is correct, and the signal does appear starting with the second edge. This patch fixes the issue by programming the registers correctly. Signed-off-by: Richard Cochran richardcoch...@gmail.com Acked-by: Jeff Kirsher jeffrey.t.kirs...@intel.com Applied and queued up for -stable, thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4] sctp: fix ASCONF list handling
From: mleit...@redhat.com Date: Thu, 11 Jun 2015 11:30:46 -0300 Attempts to circumvent this lock invertion with RCU and/or list splicing were unsuccessful, as they led to more and more code to handle it properly. Back when Hannes started reviewing the patches, he had asked if I couldn't take the lock earlier during the socket destruction. I had said no because sctp_destroy_sock() is called with socket lock already held on sctp_close_sock() and such would not be possible to handle on error handling situations like when sctp_init_sock() fails and sctp_destroy_sock() is called right after that. But if we take care that nothing fails after initializing asconf on sctp_init_sock(), this is possible, and less complicated than my RCU and list splicing attempts. This is definitely a cleaner/simpler fix, but: @@ -1528,7 +1528,10 @@ static void sctp_close(struct sock *sk, long timeout) /* Supposedly, no process has access to the socket, but * the net layers still may. + * Also, sctp_destroy_sock() needs to be called with addr_wq_lock + * held and that should be grabbed before socket lock. */ + spin_lock_bh(net-sctp.addr_wq_lock); local_bh_disable(); bh_lock_sock(sk); @@ -1540,6 +1543,7 @@ static void sctp_close(struct sock *sk, long timeout) bh_unlock_sock(sk); local_bh_enable(); + spin_unlock_bh(net-sctp.addr_wq_lock); sock_put(sk); The local_bh_{enable,disable}() now appear to be superfluous and thus can be removed. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v2] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 16:32 -0700, Shaohua Li wrote: Ok, looks similar, added. Didn't trigger this one though. Probably because you do not use af_unix with big enough messages. diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3cfff2a..9856c7a 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4398,7 +4398,9 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, while (order) { if (npages = 1 order) { - page = alloc_pages(gfp_mask | Here, order is 0 (Look at while (order) right above) + gfp_t gfp = order 0 ? + gfp_mask ~__GFP_WAIT : gfp_mask; + page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN | -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] mpls: handle device renames for per-device sysctls
From: Robert Shearman rshea...@brocade.com Date: Thu, 11 Jun 2015 19:58:26 +0100 If a device is renamed and the original name is subsequently reused for a new device, the following warning is generated: ... Fix this by unregistering the previous sysctl table (registered for the path containing the original device name) and re-registering the table for the path containing the new device name. Fixes: 37bde79979c3 (mpls: Per-device enabling of packet input) Reported-by: Scott Feldman sfel...@gmail.com Signed-off-by: Robert Shearman rshea...@brocade.com Applied, thanks Robert. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Problem with patch make nlmsg_end() and genlmsg_end() void
On Thu, 2015-06-11 at 01:31 +0100, David Woodhouse wrote: On Tue, 2015-06-09 at 17:49 -0700, Eric Dumazet wrote: I've added some debugging, and it seems that when it deadlocks, glibc doesn't get *any* response to its RTM_GETADDR request. I know we'd get ENOBUFS is a *response* was dropped... but what about when the request itself is dropped? ... Please check that this patch fixes your issue : http://patchwork.ozlabs.org/patch/473041/ Looks likely; thanks. I'm running with that patch now. I haven't been able to quickly reproduce the problem on demand, but it usually happens within a day or two. So it'll be a few days at least before I call it a success. I just saw the same deadlock happen again; glibc's __check_pf() stuck in recvmsg() waiting for a response that never comes. This is the Fedora 22 4.0.5 kernel with the above patch applied. -- dwmw2 smime.p7s Description: S/MIME cryptographic signature
Re: [PATCH v2] NET: Add ezchip ethernet driver
From: Noam Camus no...@ezchip.com Date: Thu, 11 Jun 2015 11:33:49 +0300 +#define NPS_ENET_INT_MASK(sizeof(u32) - 1) +#define NPS_ENET_INT_OFFSET 2 +#define NPS_ENET_WORDS_NUM(length) ((length + NPS_ENET_INT_MASK) 2) This is a bit obfuscating in my opinion. First of all NPS_ENET_INT_OFFSET is not an offset, which you would add or subtract from a value, but rather it is a shift. All of the uses would look clearer as X / sizeof(u32) rather than the X NPS_ENET_INET_OFFSET. Same for NPS_ENET_WORDS_NUM(), this is simply DIV_ROUND_UP(x, sizeof_u32)) which is much more easy to understand. And I would just say sizeof(u32) - 1 outright for the mask as well. So basically what I'm saying is that these macros make the code harder to read and understand rather than making it easier. + + /* to accommodate word-unaligned address of reg + * we have to do memcpy() instead of simple = + */ + memcpy(reg, buf, sizeof(buf)); This is not guaranteed to work. 'ret' is a u32 * type therefore the compiler is allowed to assume the pointer is properly aligned and therefore emit a 32-bit load/store sequence inline for the memcpy() call. Which means all of this unaligned handling code is going to accomplish nothing at all. The code will still make unaligned accesses. + netif_rx(skb); Please implement proper NAPI support for your driver so that receive packets are processed via the -poll() handler in software interrupt context rather than via netif_rx() in hardware interrupt context. +static void nps_enet_tx_irq_handler(struct net_device *netdev, + struct nps_enet_tx_ctl tx_ctrl) +{ Likewise for TX completion handling. +static struct net_device_stats *nps_enet_get_stats(struct net_device *ndev) +{ + return ndev-stats; +} If this is all that your get_stats() method does, you can leave it unspecified in nps_netdev_ops, and the core code will do the right thing by default. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 0/7] mlx5 Ethernet driver update - Jun 11 2015
From: Or Gerlitz ogerl...@mellanox.com Date: Thu, 11 Jun 2015 14:47:26 +0300 This series from Saeed, Achiad and Gal contains few fixes to the recently introduced mlx5 Ethernet functionality. Series applied, thank you. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v2] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 15:27 -0700, Shaohua Li wrote: We saw excessive direct memory compaction triggered by skb_page_frag_refill. This causes performance issues and add latency. Commit 5640f7685831e0 introduces the order-3 allocation. According to the changelog, the order-3 allocation isn't a must-have but to improve performance. But direct memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of direct memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, direct memory compaction will not be triggered, skb_page_frag_refill will fallback to order-0 immediately, hence the direct memory compaction overhead is avoided. In the allocation failure case, kswapd is waken up and doing compaction, so chances are allocation could success next time. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. V2: make the changelog clearer Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { OK, now what about alloc_skb_with_frags() ? This should have same problem right ? Thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] net: igb: fix the start time for periodic output signals
From: Richard Cochran richardcoch...@gmail.com Date: Thu, 11 Jun 2015 14:53:10 +0200 On Thu, Jun 11, 2015 at 02:51:30PM +0200, Richard Cochran wrote: This patch fixes the issue by programming the registers correctly. Please also consider this for stable. Jeff, do you want me to integrate this directly? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] net: use atomic allocation for order-3 page allocation
On Thu, 2015-06-11 at 18:18 -0400, Chris Mason wrote: But, is there any fallback to a single page allocation somewhere else? If this is the only way to get memory, we might want to add a single alloc_page path that won't trigger compaction but is at least able to wait for kswapd to make progress. Sure, there is a fallback to order-0 in both skb_page_frag_refill() and alloc_skb_with_frags() They also use __GFP_NOWARN | __GFP_NORETRY -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case
From: sfel...@gmail.com Date: Thu, 11 Jun 2015 11:20:42 -0700 From: Scott Feldman sfel...@gmail.com This particular BUG_ON condition was checking for attr set err in the COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is OK but COMMIT fails). But BUG_ON() is too strong for this case, so change to WARN(). BUG_ON() would be warranted if the system was corrupted beyond repair, but this is not the case here. Signed-off-by: Scott Feldman sfel...@gmail.com Applied, thanks Scott. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v2] net: use atomic allocation for order-3 page allocation
On Thu, Jun 11, 2015 at 03:53:04PM -0700, Eric Dumazet wrote: On Thu, 2015-06-11 at 15:27 -0700, Shaohua Li wrote: We saw excessive direct memory compaction triggered by skb_page_frag_refill. This causes performance issues and add latency. Commit 5640f7685831e0 introduces the order-3 allocation. According to the changelog, the order-3 allocation isn't a must-have but to improve performance. But direct memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of direct memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, direct memory compaction will not be triggered, skb_page_frag_refill will fallback to order-0 immediately, hence the direct memory compaction overhead is avoided. In the allocation failure case, kswapd is waken up and doing compaction, so chances are allocation could success next time. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. V2: make the changelog clearer Cc: Eric Dumazet eduma...@google.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { OK, now what about alloc_skb_with_frags() ? This should have same problem right ? Ok, looks similar, added. Didn't trigger this one though. From 940dde18f7f655377a4c30d5de54c9eff15ab5a5 Mon Sep 17 00:00:00 2001 Message-Id: 940dde18f7f655377a4c30d5de54c9eff15ab5a5.1434065353.git.s...@fb.com From: Shaohua Li s...@fb.com Date: Thu, 11 Jun 2015 16:16:21 -0700 Subject: [RFC] net: use atomic allocation for order-3 page allocation We saw excessive direct memory compaction triggered by skb_page_frag_refill. This causes performance issues and add latency. Commit 5640f7685831e0 introduces the order-3 allocation. According to the changelog, the order-3 allocation isn't a must-have but to improve performance. But direct memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of direct memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, direct memory compaction will not be triggered, skb_page_frag_refill will fallback to order-0 immediately, hence the direct memory compaction overhead is avoided. In the allocation failure case, kswapd is waken up and doing compaction, so chances are allocation could success next time. alloc_skb_with_frags is the same. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. V3: fix the same issue in alloc_skb_with_frags as pointed out by Eric V2: make the changelog clearer Cc: Eric Dumazet eduma...@google.com Cc: Chris Mason c...@fb.com Cc: Debabrata Banerjee dbava...@gmail.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/skbuff.c | 4 +++- net/core/sock.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3cfff2a..9856c7a 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4398,7 +4398,9 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, while (order) { if (npages = 1 order) { - page = alloc_pages(gfp_mask | + gfp_t gfp = order 0 ? + gfp_mask ~__GFP_WAIT : gfp_mask; + page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) |
[RFC V3] net: don't wait for order-3 page allocation
We saw excessive direct memory compaction triggered by skb_page_frag_refill. This causes performance issues and add latency. Commit 5640f7685831e0 introduces the order-3 allocation. According to the changelog, the order-3 allocation isn't a must-have but to improve performance. But direct memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of direct memory compaction. This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, direct memory compaction will not be triggered, skb_page_frag_refill will fallback to order-0 immediately, hence the direct memory compaction overhead is avoided. In the allocation failure case, kswapd is waken up and doing compaction, so chances are allocation could success next time. alloc_skb_with_frags is the same. The mellanox driver does similar thing, if this is accepted, we must fix the driver too. V3: fix the same issue in alloc_skb_with_frags as pointed out by Eric V2: make the changelog clearer Cc: Eric Dumazet eduma...@google.com Cc: Chris Mason c...@fb.com Cc: Debabrata Banerjee dbava...@gmail.com Signed-off-by: Shaohua Li s...@fb.com --- net/core/skbuff.c | 2 +- net/core/sock.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3cfff2a..41ec022 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4398,7 +4398,7 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, while (order) { if (npages = 1 order) { - page = alloc_pages(gfp_mask | + page = alloc_pages((gfp_mask ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, diff --git a/net/core/sock.c b/net/core/sock.c index 292f422..e9855a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1883,7 +1883,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) pfrag-offset = 0; if (SKB_FRAG_PAGE_ORDER) { - pfrag-page = alloc_pages(gfp | __GFP_COMP | + pfrag-page = alloc_pages((gfp ~__GFP_WAIT) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, SKB_FRAG_PAGE_ORDER); if (likely(pfrag-page)) { -- 1.8.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2] switchdev: fix BUG when port driver doesn't support set attr op
Thu, Jun 11, 2015 at 05:19:01PM CEST, sfel...@gmail.com wrote: From: Scott Feldman sfel...@gmail.com Fix a BUG_ON() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged port does not support switchdev_port_attr_set op. Don't BUG_ON() if -EOPNOTSUPP is returned. Also change BUG_ON() to netdev_err since this is a normal error path and does not warrant the use of BUG_ON(), which is reserved for unrecoverable errs. Signed-off-by: Scott Feldman sfel...@gmail.com Reported-by: Brenden Blanco bbla...@plumgrid.com Acked-by: Jiri Pirko j...@resnulli.us -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] net: Add sock_common_listen for TCP and DCCP
Code refactoring: 1. Move the common code of inet_listen() and inet_dccp_listen() to sock_common_listen(). 2. Modify and rename inet_listen() to tcp_listen(). 3. Modify and rename inet_dccp_listen() to dccp_listen(). 4. Add new callback pointer listen in struct proto for tcp_listen() and dccp_listen(). This patch makes codes more modularized and removes redudant codes. Signed-off-by: Firo Yang fir...@gmail.com --- v2: In according to the advices of Eric Dumazet, sock_common_listen() keep using TCP_xxx state instead of introducing new aliases. Test info: I test it on my x86 PC. include/net/sock.h | 3 +++ include/net/tcp.h | 1 + net/core/sock.c | 39 + net/dccp/dccp.h | 2 +- net/dccp/ipv4.c | 4 ++-- net/dccp/ipv6.c | 3 ++- net/dccp/proto.c| 62 - net/ipv4/af_inet.c | 58 + net/ipv4/tcp.c | 35 ++ net/ipv4/tcp_ipv4.c | 1 + net/ipv6/af_inet6.c | 2 +- net/ipv6/tcp_ipv6.c | 1 + 12 files changed, 106 insertions(+), 105 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 26c1c31..8066a4c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -934,6 +934,7 @@ struct proto { int (*connect)(struct sock *sk, struct sockaddr *uaddr, int addr_len); + int (*listen)(struct sock *sk, int backlog); int (*disconnect)(struct sock *sk, int flags); struct sock * (*accept)(struct sock *sk, int flags, int *err); @@ -1587,6 +1588,8 @@ int compat_sock_common_setsockopt(struct socket *sock, int level, void sk_common_release(struct sock *sk); +int sock_common_listen(struct socket *sock, int backlog); + /* * Default socket callbacks and setup code */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 978cebe..70d3f64 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -434,6 +434,7 @@ int compat_tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); void tcp_set_keepalive(struct sock *sk, int val); void tcp_syn_ack_timeout(const struct request_sock *req); +int tcp_listen(struct sock *sk, int backlog); int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); void tcp_parse_options(const struct sk_buff *skb, diff --git a/net/core/sock.c b/net/core/sock.c index e72633c..e839721 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2559,6 +2559,45 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, EXPORT_SYMBOL(sock_common_recvmsg); /* + * Move a socket into listening state. + */ +int sock_common_listen(struct socket *sock, int backlog) +{ + struct sock *sk = sock-sk; + unsigned char old_state; + int err; + + lock_sock(sk); + + err = -EINVAL; + if (sock-state != SS_UNCONNECTED) + goto out; + + old_state = sk-sk_state; + /* Since DCCP used the same state value as TCP, here we +* just check the TCP version state. +*/ + if (!((1 old_state) (TCPF_CLOSE | TCPF_LISTEN))) + goto out; + + /* Really, if the socket is already in listen state +* we can only allow the backlog to be adjusted. +*/ + if (old_state != TCP_LISTEN) { + err = sk-sk_prot-listen(sk, backlog); + if (err) + goto out; + } + sk-sk_max_ack_backlog = backlog; + err = 0; + +out: + release_sock(sk); + return err; +} +EXPORT_SYMBOL(sock_common_listen); + +/* * Set socket options on an inet socket. */ int sock_common_setsockopt(struct socket *sock, int level, int optname, diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index bebc735..5a5acbb 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -313,7 +313,7 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); void dccp_shutdown(struct sock *sk, int how); -int inet_dccp_listen(struct socket *sock, int backlog); +int dccp_listen(struct sock *sk, int backlog); unsigned int dccp_poll(struct file *file, struct socket *sock, poll_table *wait); int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index ccf4c56..339f253 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -952,6 +952,7 @@ static struct proto dccp_v4_prot = { .name = DCCP, .owner = THIS_MODULE, .close = dccp_close, + .listen
Re: [PATCH v2] net, swap: Remove a warning and clarify why sk_mem_reclaim is required when deactivating swap
From: Jeff Layton jlay...@poochiereds.net Date: Wed, 10 Jun 2015 21:02:04 -0400 From: Mel Gorman mgor...@suse.de Jeff Layton reported the following; [ 74.232485] [ cut here ] [ 74.233354] WARNING: CPU: 2 PID: 754 at net/core/sock.c:364 sk_clear_memalloc+0x51/0x80() [ 74.234790] Modules linked in: cts rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache xfs libcrc32c snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device nfsd snd_pcm snd_timer snd e1000 ppdev parport_pc joydev parport pvpanic soundcore floppy serio_raw i2c_piix4 pcspkr nfs_acl lockd virtio_balloon acpi_cpufreq auth_rpcgss grace sunrpc qxl drm_kms_helper ttm drm virtio_console virtio_blk virtio_pci ata_generic virtio_ring pata_acpi virtio [ 74.243599] CPU: 2 PID: 754 Comm: swapoff Not tainted 4.1.0-rc6+ #5 [ 74.244635] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 74.245546] 79e69e31 8800d066bde8 8179263d [ 74.246786] 8800d066be28 8109e6fa [ 74.248175] 880118d48000 8800d58f5c08 880036e380a8 [ 74.249483] Call Trace: [ 74.249872] [8179263d] dump_stack+0x45/0x57 [ 74.250703] [8109e6fa] warn_slowpath_common+0x8a/0xc0 [ 74.251655] [8109e82a] warn_slowpath_null+0x1a/0x20 [ 74.252585] [81661241] sk_clear_memalloc+0x51/0x80 [ 74.253519] [a0116c72] xs_disable_swap+0x42/0x80 [sunrpc] [ 74.254537] [a01109de] rpc_clnt_swap_deactivate+0x7e/0xc0 [sunrpc] [ 74.255610] [a03e4fd7] nfs_swap_deactivate+0x27/0x30 [nfs] [ 74.256582] [811e99d4] destroy_swap_extents+0x74/0x80 [ 74.257496] [811ecb52] SyS_swapoff+0x222/0x5c0 [ 74.258318] [81023f27] ? syscall_trace_leave+0xc7/0x140 [ 74.259253] [81798dae] system_call_fastpath+0x12/0x71 [ 74.260158] ---[ end trace 2530722966429f10 ]--- The warning in question was unnecessary but with Jeff's series the rules are also clearer. This patch removes the warning and updates the comment to explain why sk_mem_reclaim() may still be called. [jlayton: remove if (sk-sk_forward_alloc) conditional. As Leon points out that it's not needed.] Cc: Leon Romanovsky l...@leon.nu Signed-off-by: Mel Gorman mgor...@suse.de Signed-off-by: Jeff Layton jeff.lay...@primarydata.com Applied, thanks everyone. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek go...@cumulusnetworks.com wrote: Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are reachable via an interface where carrier is off. No action is taken, but additional flags are passed to userspace to indicate carrier status. Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar and I'm wondering if this could be done without introducing a new flag and just use RTNH_F_DEAD. The link change event would set RTNH_F_DEAD on nh on dev link down, and clear on link up. The sysctl knob would be something like nexthop_dead_on_linkdown, default off. So basically expanding the ways RTNH_F_DEAD can be set. That would simplify the patch set quite a bit and require no changes to iproute2. -scott -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver
From: David Miller da...@davemloft.net Date: Thu, 11 Jun 2015 00:14:55 -0700 (PDT) From: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Date: Thu, 11 Jun 2015 01:02:30 +0300 Ethernet AVB device includes the gPTP timer, so we can implement a PTP clock driver. We're doing that in a separate file, with the main Ethernet driver calling the PTP driver's [de]initialization and interrupt handler functions. Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when that one leaves the operation mode, we have to unregister the PTP clock... :-( Based on the original patches by Masaru Nagai. Signed-off-by: Masaru Nagai masaru.nagai...@renesas.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Applied. I had to fix up this patch because: obj-$(CONFIG_RAVB) += ravb_main.o ravb_ptp.o Doesn't do what you want it to for the modular case. You instead need to say something like: ravb-objs := ravb_main.o ravb_ptp.o obj-$(CONFIG_RAVB) += ravb.o and that's how I fixed up this commit before pushing it out. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next V1] net/ethtool: Add current supported tunable options
Add strings array of the current supported tunable options. Signed-off-by: Hadar Hen Zion had...@mellanox.com Reviewed-by: Amir Vadai am...@mellanox.com --- Changes from V0: - s/ETHTOOL_TUNABLE_COUNT/__ETHTOOL_TUNABLE_COUNT/ include/uapi/linux/ethtool.h | 6 ++ net/core/ethtool.c | 12 2 files changed, 18 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 0594933..cd67aec 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -215,6 +215,11 @@ enum tunable_id { ETHTOOL_ID_UNSPEC, ETHTOOL_RX_COPYBREAK, ETHTOOL_TX_COPYBREAK, + /* +* Add your fresh new tubale attribute above and remember to update +* tunable_strings[] in net/core/ethtool.c +*/ + __ETHTOOL_TUNABLE_COUNT, }; enum tunable_type_id { @@ -545,6 +550,7 @@ enum ethtool_stringset { ETH_SS_NTUPLE_FILTERS, ETH_SS_FEATURES, ETH_SS_RSS_HASH_FUNCS, + ETH_SS_TUNABLES, }; /** diff --git a/net/core/ethtool.c b/net/core/ethtool.c index eb0c3ac..b495ab1 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -106,6 +106,13 @@ rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = { [ETH_RSS_HASH_XOR_BIT] =xor, }; +static const char +tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = { + [ETHTOOL_ID_UNSPEC] = Unspec, + [ETHTOOL_RX_COPYBREAK] = rx-copybreak, + [ETHTOOL_TX_COPYBREAK] = tx-copybreak, +}; + static int ethtool_get_features(struct net_device *dev, void __user *useraddr) { struct ethtool_gfeatures cmd = { @@ -194,6 +201,9 @@ static int __ethtool_get_sset_count(struct net_device *dev, int sset) if (sset == ETH_SS_RSS_HASH_FUNCS) return ARRAY_SIZE(rss_hash_func_strings); + if (sset == ETH_SS_TUNABLES) + return ARRAY_SIZE(tunable_strings); + if (ops-get_sset_count ops-get_strings) return ops-get_sset_count(dev, sset); else @@ -211,6 +221,8 @@ static void __ethtool_get_strings(struct net_device *dev, else if (stringset == ETH_SS_RSS_HASH_FUNCS) memcpy(data, rss_hash_func_strings, sizeof(rss_hash_func_strings)); + else if (stringset == ETH_SS_TUNABLES) + memcpy(data, tunable_strings, sizeof(tunable_strings)); else /* ops-get_strings is valid because checked earlier */ ops-get_strings(dev, stringset, data); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] net: phy: davicom: add IDs for DM9161B and C variants
From: Gustavo Zacarias gust...@zacarias.com.ar Date: Wed, 10 Jun 2015 13:48:20 -0300 Add PHY IDs for Davicom DM9161B and DM9161C variants. Tested with a DM9161C on a custom Atmel-based SAM9X25 board in RMII mode. The DM9161B uses the same model id with just the LSB bit of the version id changing (which is masked out). For all intents and purposes they're the same as the DM9161A with an added GPSI mode and better fabrication process. Signed-off-by: Gustavo Zacarias gust...@zacarias.com.ar Applied, thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2 0/2] net: broadcom MDIO support for broken turn-around
From: Florian Fainelli f.faine...@gmail.com Date: Wed, 10 Jun 2015 12:24:09 -0700 These two patches update the GENET and UniMAC MDIO controllers to deal with PHYs that are known to have a broken turn-around bug (e.g: BCM53125 and others) This utilizes the infrastructure that code recently added to do that in 'net-next'. Note that the changes look nearly identical and I will try to address the MDIO code duplication between GENET and UniMAC in a future patch series. Ok, series applied, thanks Florian. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next V1] net/ethtool: Add current supported tunable options
From: Hadar Hen Zion had...@mellanox.com Date: Thu, 11 Jun 2015 10:28:16 +0300 Add strings array of the current supported tunable options. Signed-off-by: Hadar Hen Zion had...@mellanox.com Reviewed-by: Amir Vadai am...@mellanox.com --- Changes from V0: - s/ETHTOOL_TUNABLE_COUNT/__ETHTOOL_TUNABLE_COUNT/ Applied, thank you. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] net/ps3_gelic: Fix build error with DEBUG
From: Geoff Levand ge...@infradead.org Date: Wed, 10 Jun 2015 10:19:48 -0700 When the DEBUG preprocessor macro is defined the ps3_gelic_net driver build fails due to an undeclared routine gelic_descr_get_status(). This problem was introduced during the code cleanup of commit 6b0c21cede22be1f68f0a632c0ca38008ce1abe7 (net: Fix p3_gelic_net sparse warnings), which re-arranged the ordering of some of the gelic routines. This change just moves the gelic_descr_get_status() routine up in the ps3_gelic_net.c source file. There is no functional change. Fixes build errors like these: drivers/net/ethernet/toshiba/ps3_gelic_net.c: error: implicit declaration of function gelic_descr_get_status Signed-off-by: Geoff Levand ge...@infradead.org Applied, thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html