Netdev List
 help / color / mirror / Atom feed
* Re: [patch net-next v3 03/17] net: rename netdev_phys_port_id to more generic name
From: Andy Gospodarek @ 2014-11-25 15:15 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <1416911328-10979-4-git-send-email-jiri@resnulli.us>

On Tue, Nov 25, 2014 at 11:28:34AM +0100, Jiri Pirko wrote:
> So this can be reused for identification of other "items" as well.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>

Still seems fine for v3.  :-)

Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
> v1->v2->v3:
> -no change
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |  2 +-
>  drivers/net/ethernet/intel/i40e/i40e_main.c      |  2 +-
>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c   |  2 +-
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |  2 +-
>  include/linux/netdevice.h                        | 16 ++++++++--------
>  net/core/dev.c                                   |  2 +-
>  net/core/net-sysfs.c                             |  2 +-
>  net/core/rtnetlink.c                             |  6 +++---
>  8 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index c4bd025..336ef3c 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -12537,7 +12537,7 @@ static int bnx2x_validate_addr(struct net_device *dev)
>  }
>  
>  static int bnx2x_get_phys_port_id(struct net_device *netdev,
> -				  struct netdev_phys_port_id *ppid)
> +				  struct netdev_phys_item_id *ppid)
>  {
>  	struct bnx2x *bp = netdev_priv(netdev);
>  
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 5ed5e40..9ae4270 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -7511,7 +7511,7 @@ static void i40e_del_vxlan_port(struct net_device *netdev,
>  
>  #endif
>  static int i40e_get_phys_port_id(struct net_device *netdev,
> -				 struct netdev_phys_port_id *ppid)
> +				 struct netdev_phys_item_id *ppid)
>  {
>  	struct i40e_netdev_priv *np = netdev_priv(netdev);
>  	struct i40e_pf *pf = np->vsi->back;
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index b7c9978..1597fb0 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -2259,7 +2259,7 @@ static int mlx4_en_set_vf_link_state(struct net_device *dev, int vf, int link_st
>  
>  #define PORT_ID_BYTE_LEN 8
>  static int mlx4_en_get_phys_port_id(struct net_device *dev,
> -				    struct netdev_phys_port_id *ppid)
> +				    struct netdev_phys_item_id *ppid)
>  {
>  	struct mlx4_en_priv *priv = netdev_priv(dev);
>  	struct mlx4_dev *mdev = priv->mdev->dev;
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index 3227c80..1aa25b1 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -461,7 +461,7 @@ static void qlcnic_82xx_cancel_idc_work(struct qlcnic_adapter *adapter)
>  }
>  
>  static int qlcnic_get_phys_port_id(struct net_device *netdev,
> -				   struct netdev_phys_port_id *ppid)
> +				   struct netdev_phys_item_id *ppid)
>  {
>  	struct qlcnic_adapter *adapter = netdev_priv(netdev);
>  	struct qlcnic_hardware_context *ahw = adapter->ahw;
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index fab074e..5b491b3 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -754,13 +754,13 @@ struct netdev_fcoe_hbainfo {
>  };
>  #endif
>  
> -#define MAX_PHYS_PORT_ID_LEN 32
> +#define MAX_PHYS_ITEM_ID_LEN 32
>  
> -/* This structure holds a unique identifier to identify the
> - * physical port used by a netdevice.
> +/* This structure holds a unique identifier to identify some
> + * physical item (port for example) used by a netdevice.
>   */
> -struct netdev_phys_port_id {
> -	unsigned char id[MAX_PHYS_PORT_ID_LEN];
> +struct netdev_phys_item_id {
> +	unsigned char id[MAX_PHYS_ITEM_ID_LEN];
>  	unsigned char id_len;
>  };
>  
> @@ -976,7 +976,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
>   *	USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
>   *
>   * int (*ndo_get_phys_port_id)(struct net_device *dev,
> - *			       struct netdev_phys_port_id *ppid);
> + *			       struct netdev_phys_item_id *ppid);
>   *	Called to get ID of physical port of this device. If driver does
>   *	not implement this, it is assumed that the hw is not able to have
>   *	multiple net devices on single physical port.
> @@ -1152,7 +1152,7 @@ struct net_device_ops {
>  	int			(*ndo_change_carrier)(struct net_device *dev,
>  						      bool new_carrier);
>  	int			(*ndo_get_phys_port_id)(struct net_device *dev,
> -							struct netdev_phys_port_id *ppid);
> +							struct netdev_phys_item_id *ppid);
>  	void			(*ndo_add_vxlan_port)(struct  net_device *dev,
>  						      sa_family_t sa_family,
>  						      __be16 port);
> @@ -2866,7 +2866,7 @@ void dev_set_group(struct net_device *, int);
>  int dev_set_mac_address(struct net_device *, struct sockaddr *);
>  int dev_change_carrier(struct net_device *, bool new_carrier);
>  int dev_get_phys_port_id(struct net_device *dev,
> -			 struct netdev_phys_port_id *ppid);
> +			 struct netdev_phys_item_id *ppid);
>  struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
>  struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
>  				    struct netdev_queue *txq, int *ret);
> diff --git a/net/core/dev.c b/net/core/dev.c
> index ac48362..0814a56 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5846,7 +5846,7 @@ EXPORT_SYMBOL(dev_change_carrier);
>   *	Get device physical port ID
>   */
>  int dev_get_phys_port_id(struct net_device *dev,
> -			 struct netdev_phys_port_id *ppid)
> +			 struct netdev_phys_item_id *ppid)
>  {
>  	const struct net_device_ops *ops = dev->netdev_ops;
>  
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 1a24602..26c46f4 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -404,7 +404,7 @@ static ssize_t phys_port_id_show(struct device *dev,
>  		return restart_syscall();
>  
>  	if (dev_isalive(netdev)) {
> -		struct netdev_phys_port_id ppid;
> +		struct netdev_phys_item_id ppid;
>  
>  		ret = dev_get_phys_port_id(netdev, &ppid);
>  		if (!ret)
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index f2a4b38..0fb3a68 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -869,7 +869,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
>  	       + rtnl_port_size(dev, ext_filter_mask) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
>  	       + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
>  	       + rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */
> -	       + nla_total_size(MAX_PHYS_PORT_ID_LEN); /* IFLA_PHYS_PORT_ID */
> +	       + nla_total_size(MAX_PHYS_ITEM_ID_LEN); /* IFLA_PHYS_PORT_ID */
>  }
>  
>  static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev)
> @@ -953,7 +953,7 @@ static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev,
>  static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev)
>  {
>  	int err;
> -	struct netdev_phys_port_id ppid;
> +	struct netdev_phys_item_id ppid;
>  
>  	err = dev_get_phys_port_id(dev, &ppid);
>  	if (err) {
> @@ -1197,7 +1197,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
>  	[IFLA_PROMISCUITY]	= { .type = NLA_U32 },
>  	[IFLA_NUM_TX_QUEUES]	= { .type = NLA_U32 },
>  	[IFLA_NUM_RX_QUEUES]	= { .type = NLA_U32 },
> -	[IFLA_PHYS_PORT_ID]	= { .type = NLA_BINARY, .len = MAX_PHYS_PORT_ID_LEN },
> +	[IFLA_PHYS_PORT_ID]	= { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
>  	[IFLA_CARRIER_CHANGES]	= { .type = NLA_U32 },  /* ignored */
>  };
>  
> -- 
> 1.9.3
> 

^ permalink raw reply

* Re: [patch net-next v3 05/17] rtnl: expose physical switch id for particular device
From: Andy Gospodarek @ 2014-11-25 15:16 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <1416911328-10979-6-git-send-email-jiri@resnulli.us>

On Tue, Nov 25, 2014 at 11:28:36AM +0100, Jiri Pirko wrote:
> The netdevice represents a port in a switch, it will expose
> IFLA_PHYS_SWITCH_ID value via rtnl. Two netdevices with the same value
> belong to one physical switch.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>

Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
> v2->v3:
> -changed "sw" string to "switch" to avoid confusion
> v1->v2:
> -no change
> ---
>  include/uapi/linux/if_link.h |  1 +
>  net/core/rtnetlink.c         | 26 +++++++++++++++++++++++++-
>  2 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index 7072d83..4163753 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -145,6 +145,7 @@ enum {
>  	IFLA_CARRIER,
>  	IFLA_PHYS_PORT_ID,
>  	IFLA_CARRIER_CHANGES,
> +	IFLA_PHYS_SWITCH_ID,
>  	__IFLA_MAX
>  };
>  
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 0fb3a68..bd5e783 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -44,6 +44,7 @@
>  
>  #include <linux/inet.h>
>  #include <linux/netdevice.h>
> +#include <net/switchdev.h>
>  #include <net/ip.h>
>  #include <net/protocol.h>
>  #include <net/arp.h>
> @@ -869,7 +870,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
>  	       + rtnl_port_size(dev, ext_filter_mask) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
>  	       + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
>  	       + rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */
> -	       + nla_total_size(MAX_PHYS_ITEM_ID_LEN); /* IFLA_PHYS_PORT_ID */
> +	       + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_PORT_ID */
> +	       + nla_total_size(MAX_PHYS_ITEM_ID_LEN); /* IFLA_PHYS_SWITCH_ID */
>  }
>  
>  static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev)
> @@ -968,6 +970,24 @@ static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev)
>  	return 0;
>  }
>  
> +static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
> +{
> +	int err;
> +	struct netdev_phys_item_id psid;
> +
> +	err = netdev_switch_parent_id_get(dev, &psid);
> +	if (err) {
> +		if (err == -EOPNOTSUPP)
> +			return 0;
> +		return err;
> +	}
> +
> +	if (nla_put(skb, IFLA_PHYS_SWITCH_ID, psid.id_len, psid.id))
> +		return -EMSGSIZE;
> +
> +	return 0;
> +}
> +
>  static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
>  			    int type, u32 pid, u32 seq, u32 change,
>  			    unsigned int flags, u32 ext_filter_mask)
> @@ -1040,6 +1060,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
>  	if (rtnl_phys_port_id_fill(skb, dev))
>  		goto nla_put_failure;
>  
> +	if (rtnl_phys_switch_id_fill(skb, dev))
> +		goto nla_put_failure;
> +
>  	attr = nla_reserve(skb, IFLA_STATS,
>  			sizeof(struct rtnl_link_stats));
>  	if (attr == NULL)
> @@ -1199,6 +1222,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
>  	[IFLA_NUM_RX_QUEUES]	= { .type = NLA_U32 },
>  	[IFLA_PHYS_PORT_ID]	= { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
>  	[IFLA_CARRIER_CHANGES]	= { .type = NLA_U32 },  /* ignored */
> +	[IFLA_PHYS_SWITCH_ID]	= { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
>  };
>  
>  static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [patch net-next v3 02/17] net: make vid as a parameter for ndo_fdb_add/ndo_fdb_del
From: Jiri Pirko @ 2014-11-25 15:18 UTC (permalink / raw)
  To: Andy Gospodarek
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <20141125151312.GC27416@gospo.rtplab.test>

Tue, Nov 25, 2014 at 04:13:12PM CET, gospo@cumulusnetworks.com wrote:
>On Tue, Nov 25, 2014 at 11:28:33AM +0100, Jiri Pirko wrote:
>> Do the work of parsing NDA_VLAN directly in rtnetlink code, pass simple
>> u16 vid to drivers from there.
>> 
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>
>Structurally this looks fine, just a misspelling noted below.
>
>Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>
>
>> ---
>> new in v3
>> ---
>>  drivers/net/ethernet/intel/i40e/i40e_main.c      |  2 +-
>>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |  4 +-
>>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |  9 +++--
>>  drivers/net/macvlan.c                            |  4 +-
>>  drivers/net/vxlan.c                              |  4 +-
>>  include/linux/netdevice.h                        |  8 ++--
>>  include/linux/rtnetlink.h                        |  6 ++-
>>  net/bridge/br_fdb.c                              | 39 ++----------------
>>  net/bridge/br_private.h                          |  4 +-
>>  net/core/rtnetlink.c                             | 50 ++++++++++++++++++++----
>>  10 files changed, 70 insertions(+), 60 deletions(-)
>> 
>[...]
>> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>> index a688268..f2a4b38 100644
>> --- a/net/core/rtnetlink.c
>> +++ b/net/core/rtnetlink.c
>> @@ -36,6 +36,7 @@
>>  #include <linux/mutex.h>
>>  #include <linux/if_addr.h>
>>  #include <linux/if_bridge.h>
>> +#include <linux/if_vlan.h>
>>  #include <linux/pci.h>
>>  #include <linux/etherdevice.h>
>>  
>> @@ -2312,7 +2313,7 @@ errout:
>>  int ndo_dflt_fdb_add(struct ndmsg *ndm,
>>  		     struct nlattr *tb[],
>>  		     struct net_device *dev,
>> -		     const unsigned char *addr,
>> +		     const unsigned char *addr, u16 vid,
>>  		     u16 flags)
>>  {
>>  	int err = -EINVAL;
>> @@ -2338,6 +2339,28 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
>>  }
>>  EXPORT_SYMBOL(ndo_dflt_fdb_add);
>>  
>> +static int fbd_vid_parse(struct nlattr *vlan_attr, u16 *p_vid)
>I presume this is a misspelling?

Darn. Thanks. Will fix this.

>
>[...]
>> @@ -2370,6 +2394,10 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
>>  
>>  	addr = nla_data(tb[NDA_LLADDR]);
>>  
>> +	err = fbd_vid_parse(tb[NDA_VLAN], &vid);
>Same here....
>
>> +	if (err)
>> +		return err;
>> +
>>  	err = -EOPNOTSUPP;
>>  
>>  	/* Support fdb on master device the net/bridge default case */
>
>[...]
>> @@ -2465,6 +2496,10 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
>>  
>>  	addr = nla_data(tb[NDA_LLADDR]);
>>  
>> +	err = fbd_vid_parse(tb[NDA_VLAN], &vid);
>...and here.
>
>> +	if (err)
>> +		return err;
>> +
>>  	err = -EOPNOTSUPP;
>>  
>>  	/* Support fdb on master device the net/bridge default case */
>> @@ -2474,7 +2509,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
>>  		const struct net_device_ops *ops = br_dev->netdev_ops;
>>  
>>  		if (ops->ndo_fdb_del)
>> -			err = ops->ndo_fdb_del(ndm, tb, dev, addr);
>> +			err = ops->ndo_fdb_del(ndm, tb, dev, addr, vid);
>>  
>>  		if (err)
>>  			goto out;
>> @@ -2485,9 +2520,10 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
>>  	/* Embedded bridge, macvlan, and any other device support */
>>  	if (ndm->ndm_flags & NTF_SELF) {
>>  		if (dev->netdev_ops->ndo_fdb_del)
>> -			err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr);
>> +			err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr,
>> +							   vid);
>>  		else
>> -			err = ndo_dflt_fdb_del(ndm, tb, dev, addr);
>> +			err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid);
>>  
>>  		if (!err) {
>>  			rtnl_fdb_notify(dev, addr, RTM_DELNEIGH);
>> -- 
>> 1.9.3
>> 

^ permalink raw reply

* Re: [patch net-next v3 01/17] bridge: rename fdb_*_hw to fdb_*_hw_addr to avoid confusion
From: Jamal Hadi Salim @ 2014-11-25 15:26 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-2-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> The current name might seem that this actually offloads the fdb entry to
> hw. So rename it to clearly present that this for hardware address
> addition/removal.
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 06/17] net-sysfs: expose physical switch id for particular device
From: Andy Gospodarek @ 2014-11-25 15:28 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <1416911328-10979-7-git-send-email-jiri@resnulli.us>

On Tue, Nov 25, 2014 at 11:28:37AM +0100, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>

Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
> v2->v3:
> -changed "sw" string to "switch" to avoid confusion
> v1->v2:
> -no change
> ---
>  net/core/net-sysfs.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 26c46f4..9993412 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -12,6 +12,7 @@
>  #include <linux/capability.h>
>  #include <linux/kernel.h>
>  #include <linux/netdevice.h>
> +#include <net/switchdev.h>
>  #include <linux/if_arp.h>
>  #include <linux/slab.h>
>  #include <linux/nsproxy.h>
> @@ -416,6 +417,28 @@ static ssize_t phys_port_id_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(phys_port_id);
>  
> +static ssize_t phys_switch_id_show(struct device *dev,
> +				   struct device_attribute *attr, char *buf)
> +{
> +	struct net_device *netdev = to_net_dev(dev);
> +	ssize_t ret = -EINVAL;
> +
> +	if (!rtnl_trylock())
> +		return restart_syscall();
> +
> +	if (dev_isalive(netdev)) {
> +		struct netdev_phys_item_id ppid;
> +
> +		ret = netdev_switch_parent_id_get(netdev, &ppid);
> +		if (!ret)
> +			ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
> +	}
> +	rtnl_unlock();
> +
> +	return ret;
> +}
> +static DEVICE_ATTR_RO(phys_switch_id);
> +
>  static struct attribute *net_class_attrs[] = {
>  	&dev_attr_netdev_group.attr,
>  	&dev_attr_type.attr,
> @@ -441,6 +464,7 @@ static struct attribute *net_class_attrs[] = {
>  	&dev_attr_tx_queue_len.attr,
>  	&dev_attr_gro_flush_timeout.attr,
>  	&dev_attr_phys_port_id.attr,
> +	&dev_attr_phys_switch_id.attr,
>  	NULL,
>  };
>  ATTRIBUTE_GROUPS(net_class);
> -- 
> 1.9.3
> 

^ permalink raw reply

* Re: [PATCH] net: team: expose sysfs attributes for each team option
From: Jiri Pirko @ 2014-11-25 15:37 UTC (permalink / raw)
  To: Hamad Kadmany; +Cc: netdev
In-Reply-To: <20141119124043.GC1926@nanopsycho.orion>

Wed, Nov 19, 2014 at 01:40:43PM CET, jiri@resnulli.us wrote:
>Wed, Nov 19, 2014 at 01:28:19PM CET, hkadmany@codeaurora.org wrote:
>>On Mon, November 17, 2014 1:02 pm, Jiri Pirko wrote:
>>>
>>> Nak.
>>>
>>> I don't like this patch. The plan for team was keep things simple and to
>>> have single userspace api using netlink, as that is the correct way to
>>> deal with things. Sysfs for this use-case is not. Please, use netlink api.
>>
>>Using team driver requires using libnl3. In Android based platforms, libnl3 is not supported, and libnl3 license poses constraints in Android's user-space.
>>
>>This is the reason for the this change, to have at least the team options exposed through sysfs.
>
>No, that is certainly not the reason. If libnl3 does not suit you, use a
>different lib. It is in my opinion unacceptaptable to work around
>certain licence issues by adding parallel sysfs api (not to mention that
>sysfs is totally unsuitable for that).
>
>You should use existing Netlink API. That's it.

Also, using Netlink API, you get all the events to your userspace
daemon. Sysfs is just not suitable for that.

>
>>
>>
>>>
>>>>
>>>>Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
>>>>---
>>>> drivers/net/team/team.c | 282 ++++++++++++++++++++++++++++++++++++++++++++++--
>>>> include/linux/if_team.h |   3 +
>>>> 2 files changed, 278 insertions(+), 7 deletions(-)
>>>>
>>>>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>>>>index 1222229..afd2f8f 100644
>>>>--- a/drivers/net/team/team.c
>>>>+++ b/drivers/net/team/team.c
>>>>@@ -110,8 +110,198 @@ struct team_option_inst { /* One for each option instance */
>>>> 	struct team_option_inst_info info;
>>>> 	bool changed;
>>>> 	bool removed;
>>>>+	bool dev_attr_file_exist;
>>>>+	struct device_attribute dev_attr; /* corresponding sysfs attribute */
>>>> };
>>>>
>>>>+static struct attribute *team_sysfs_attrs[] = {
>>>>+	NULL,
>>>>+};
>>>>+
>>>>+static struct attribute_group team_sysfs_attr_group = {
>>>>+	.attrs = team_sysfs_attrs,
>>>>+};
>>>>+
>>>>+/* Device attributes (sysfs) */
>>>>+
>>>>+static ssize_t show_attribute(struct device *dev,
>>>>+			      struct device_attribute *attr,
>>>>+			      char *buf)
>>>>+{
>>>>+	struct team *team = dev_get_drvdata(dev);
>>>>+	struct team_option_inst *opt_inst;
>>>>+	ssize_t ret;
>>>>+	struct team_option *option;
>>>>+	struct team_gsetter_ctx ctx;
>>>>+
>>>>+	if (mutex_lock_interruptible(&team->lock))
>>>>+		return -ERESTARTSYS;
>>>>+
>>>>+	opt_inst = container_of(attr, struct team_option_inst, dev_attr);
>>>>+	option = opt_inst->option;
>>>>+	if (!option->getter) {
>>>>+		ret = -EOPNOTSUPP;
>>>>+		netdev_err(team->dev,
>>>>+			   "Option %s is write only\n", attr->attr.name);
>>>>+		goto exit;
>>>>+	}
>>>>+
>>>>+	ctx.info = &opt_inst->info;
>>>>+	/* let the option getter do its job */
>>>>+	ret = option->getter(team, &ctx);
>>>>+	if (ret)
>>>>+		goto exit;
>>>>+
>>>>+	/* translate option's output into sysfs output */
>>>>+	switch (option->type) {
>>>>+	case TEAM_OPTION_TYPE_U32:
>>>>+		ret = scnprintf(buf, PAGE_SIZE, "%u\n", ctx.data.u32_val);
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_STRING:
>>>>+		ret = scnprintf(buf, PAGE_SIZE, "%s\n", ctx.data.str_val);
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_BINARY:
>>>>+		if (ctx.data.bin_val.len > PAGE_SIZE) {
>>>>+			netdev_err(team->dev,
>>>>+				   "Option output is too long (%d)\n",
>>>>+				   ctx.data.bin_val.len);
>>>>+			break;
>>>>+		}
>>>>+
>>>>+		memcpy(buf, ctx.data.bin_val.ptr, ctx.data.bin_val.len);
>>>>+		ret = ctx.data.bin_val.len;
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_BOOL:
>>>>+		ret = scnprintf(buf, PAGE_SIZE, "%d\n", ctx.data.bool_val);
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_S32:
>>>>+		ret = scnprintf(buf, PAGE_SIZE, "%d\n", ctx.data.s32_val);
>>>>+		break;
>>>>+	default:
>>>>+		BUG();
>>>>+	}
>>>>+
>>>>+exit:
>>>>+	mutex_unlock(&team->lock);
>>>>+
>>>>+	return ret;
>>>>+}
>>>>+
>>>>+static int team_nl_send_event_options_get(struct team *team,
>>>>+					  struct list_head *sel_opt_inst_list);
>>>>+
>>>>+static ssize_t set_attribute(struct device *dev,
>>>>+			     struct device_attribute *attr,
>>>>+			     const char *buf, size_t count)
>>>>+{
>>>>+	struct team_option_inst *opt_inst;
>>>>+	struct team *team = dev_get_drvdata(dev);
>>>>+	int err = 0;
>>>>+	struct team_option *option = NULL;
>>>>+	struct team_gsetter_ctx ctx;
>>>>+
>>>>+	LIST_HEAD(opt_inst_list);
>>>>+
>>>>+	if (mutex_lock_interruptible(&team->lock))
>>>>+		return -ERESTARTSYS;
>>>>+
>>>>+	opt_inst = container_of(attr, struct team_option_inst, dev_attr);
>>>>+	option = opt_inst->option;
>>>>+	if (!option->setter) {
>>>>+		netdev_err(team->dev,
>>>>+			   "Option %s is read only\n", attr->attr.name);
>>>>+		err = -EOPNOTSUPP;
>>>>+		goto exit;
>>>>+	}
>>>>+
>>>>+	ctx.info = &opt_inst->info;
>>>>+
>>>>+	/* translate sysfs input into option's input */
>>>>+	switch (option->type) {
>>>>+	case TEAM_OPTION_TYPE_U32:
>>>>+		err = kstrtoint(buf, 0, &ctx.data.u32_val);
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_STRING:
>>>>+		if (count > TEAM_STRING_MAX_LEN) {
>>>>+			netdev_err(team->dev,
>>>>+				   "Input buffer too long (%zu)\n", count);
>>>>+			err = -EINVAL;
>>>>+			break;
>>>>+		}
>>>>+		ctx.data.str_val = buf;
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_BINARY:
>>>>+		ctx.data.bin_val.len = count;
>>>>+		ctx.data.bin_val.ptr = buf;
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_BOOL:
>>>>+		err = strtobool(buf, &ctx.data.bool_val);
>>>>+		break;
>>>>+	case TEAM_OPTION_TYPE_S32:
>>>>+		err = kstrtoint(buf, 0, &ctx.data.s32_val);
>>>>+		break;
>>>>+	default:
>>>>+		BUG();
>>>>+	}
>>>>+
>>>>+	if (err) {
>>>>+		netdev_err(team->dev, "Failed to translate input buffer\n");
>>>>+		goto exit;
>>>>+	}
>>>>+
>>>>+	/* let the option setter do its job */
>>>>+	err = option->setter(team, &ctx);
>>>>+	if (err)
>>>>+		goto exit;
>>>>+
>>>>+	/* propagate option changed event */
>>>>+	opt_inst->changed = true;
>>>>+	list_add(&opt_inst->tmp_list, &opt_inst_list);
>>>>+	err = team_nl_send_event_options_get(team, &opt_inst_list);
>>>>+	if (err == -ESRCH) /* no listeners, not a real error */
>>>>+		err = 0;
>>>>+
>>>>+exit:
>>>>+	mutex_unlock(&team->lock);
>>>>+
>>>>+	if (!err)
>>>>+		err = count;
>>>>+	return err;
>>>>+}
>>>>+
>>>>+/* create sysfs attribute for each option that is being registered */
>>>>+static int __team_option_add_sysfs_attr(struct team *team,
>>>>+					struct team_option_inst *opt_inst,
>>>>+					bool create_sysfs_file)
>>>>+{
>>>>+	int err = 0;
>>>>+	struct device_attribute *new_dev_attr = &opt_inst->dev_attr;
>>>>+
>>>>+	new_dev_attr->attr.name = opt_inst->option->name;
>>>>+	new_dev_attr->attr.mode = S_IRUGO | S_IWUSR;
>>>>+	new_dev_attr->show = show_attribute;
>>>>+	new_dev_attr->store = set_attribute;
>>>>+
>>>>+	if (create_sysfs_file) {
>>>>+		err = sysfs_create_file(&team->dev->dev.kobj,
>>>>+					&new_dev_attr->attr);
>>>>+		if (err)
>>>>+			netdev_err(team->dev,
>>>>+				   "Failed to create sysfs attribute %s\n",
>>>>+				   new_dev_attr->attr.name);
>>>>+	}
>>>>+
>>>>+	return err;
>>>>+}
>>>>+
>>>>+static void __team_option_del_sysfs_attr(struct team *team,
>>>>+					 struct team_option_inst *opt_inst)
>>>>+{
>>>>+	if (opt_inst->dev_attr_file_exist)
>>>>+		sysfs_remove_file(&team->dev->dev.kobj,
>>>>+				  &opt_inst->dev_attr.attr);
>>>>+}
>>>>+
>>>> static struct team_option *__team_find_option(struct team *team,
>>>> 					      const char *opt_name)
>>>> {
>>>>@@ -124,8 +314,10 @@ static struct team_option *__team_find_option(struct team *team,
>>>> 	return NULL;
>>>> }
>>>>
>>>>-static void __team_option_inst_del(struct team_option_inst *opt_inst)
>>>>+static void __team_option_inst_del(struct team *team,
>>>>+				   struct team_option_inst *opt_inst)
>>>> {
>>>>+	__team_option_del_sysfs_attr(team, opt_inst);
>>>> 	list_del(&opt_inst->list);
>>>> 	kfree(opt_inst);
>>>> }
>>>>@@ -137,7 +329,7 @@ static void __team_option_inst_del_option(struct team *team,
>>>>
>>>> 	list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) {
>>>> 		if (opt_inst->option == option)
>>>>-			__team_option_inst_del(opt_inst);
>>>>+			__team_option_inst_del(team, opt_inst);
>>>> 	}
>>>> }
>>>>
>>>>@@ -162,6 +354,7 @@ static int __team_option_inst_add(struct team *team, struct team_option *option,
>>>> 		opt_inst->info.array_index = i;
>>>> 		opt_inst->changed = true;
>>>> 		opt_inst->removed = false;
>>>>+		opt_inst->dev_attr_file_exist = false;
>>>> 		list_add_tail(&opt_inst->list, &team->option_inst_list);
>>>> 		if (option->init) {
>>>> 			err = option->init(team, &opt_inst->info);
>>>>@@ -170,6 +363,20 @@ static int __team_option_inst_add(struct team *team, struct team_option *option,
>>>> 		}
>>>>
>>>> 	}
>>>>+
>>>>+	/* add sysfs attribute. per-port and array options are skipped */
>>>>+	if (!option->per_port && !option->array_size) {
>>>>+		/* create the sysfs file only if our state allows it */
>>>>+		bool create_sysfs_file = device_is_registered(&team->dev->dev);
>>>>+
>>>>+		err = __team_option_add_sysfs_attr(team, opt_inst,
>>>>+						   create_sysfs_file);
>>>>+		if (err)
>>>>+			return err;
>>>>+
>>>>+		opt_inst->dev_attr_file_exist = true;
>>>>+	}
>>>>+
>>>> 	return 0;
>>>> }
>>>>
>>>>@@ -218,7 +425,7 @@ static void __team_option_inst_del_port(struct team *team,
>>>> 	list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) {
>>>> 		if (opt_inst->option->per_port &&
>>>> 		    opt_inst->info.port == port)
>>>>-			__team_option_inst_del(opt_inst);
>>>>+			__team_option_inst_del(team, opt_inst);
>>>> 	}
>>>> }
>>>>
>>>>@@ -337,6 +544,51 @@ static void __team_options_unregister(struct team *team,
>>>>
>>>> static void __team_options_change_check(struct team *team);
>>>>
>>>>+static void team_attr_grp_free(struct team *team)
>>>>+{
>>>>+	kfree(team->attr_grp.attrs);
>>>>+}
>>>>+
>>>>+/* allocate attribute group for creating sysfs for team's own options */
>>>>+static int team_attr_grp_alloc(struct team *team)
>>>>+{
>>>>+	struct attribute **attributes;
>>>>+	struct team_option_inst *opt_inst;
>>>>+	int num_attr = 0;
>>>>+	struct team_option *option;
>>>>+
>>>>+	list_for_each_entry(opt_inst, &team->option_inst_list, list) {
>>>>+		option = opt_inst->option;
>>>>+		/* per-port and array options currently not supported as
>>>>+		 * sysfs attributes
>>>>+		 */
>>>>+		if (option->per_port || option->array_size)
>>>>+			continue;
>>>>+
>>>>+		num_attr++;
>>>>+	}
>>>>+
>>>>+	/* +1 for having NULL as last item in the array */
>>>>+	attributes = kzalloc((num_attr + 1) * sizeof(*attributes), GFP_KERNEL);
>>>>+	if (!attributes)
>>>>+		return -ENOMEM;
>>>>+	team->attr_grp.attrs = attributes;
>>>>+
>>>>+	num_attr = 0;
>>>>+	list_for_each_entry(opt_inst, &team->option_inst_list, list) {
>>>>+		option = opt_inst->option;
>>>>+		/* per-port and array options currently not supported as
>>>>+		 * sysfs attributes
>>>>+		 */
>>>>+		if (option->per_port || option->array_size)
>>>>+			continue;
>>>>+
>>>>+		attributes[num_attr++] = &opt_inst->dev_attr.attr;
>>>>+	}
>>>>+
>>>>+	return 0;
>>>>+}
>>>>+
>>>> int team_options_register(struct team *team,
>>>> 			  const struct team_option *option,
>>>> 			  size_t option_count)
>>>>@@ -1380,15 +1632,28 @@ static int team_init(struct net_device *dev)
>>>>
>>>> 	INIT_LIST_HEAD(&team->option_list);
>>>> 	INIT_LIST_HEAD(&team->option_inst_list);
>>>>-	err = team_options_register(team, team_options, ARRAY_SIZE(team_options));
>>>>+
>>>>+	err = team_options_register(team, team_options,
>>>>+				    ARRAY_SIZE(team_options));
>>>> 	if (err)
>>>> 		goto err_options_register;
>>>> 	netif_carrier_off(dev);
>>>>
>>>> 	team_set_lockdep_class(dev);
>>>>
>>>>+	/* store team context, to be used by Device attributes getter/setter */
>>>>+	dev_set_drvdata(&dev->dev, team);
>>>>+
>>>>+	/* allocate and register sysfs attributes for team's own options */
>>>>+	err = team_attr_grp_alloc(team);
>>>>+	if (err)
>>>>+		goto err_grp_alloc;
>>>>+	dev->sysfs_groups[0] = &team->attr_grp;
>>>>+
>>>> 	return 0;
>>>>
>>>>+err_grp_alloc:
>>>>+	team_options_unregister(team, team_options, ARRAY_SIZE(team_options));
>>>> err_options_register:
>>>> 	team_queue_override_fini(team);
>>>> err_team_queue_override_init:
>>>>@@ -1407,9 +1672,15 @@ static void team_uninit(struct net_device *dev)
>>>> 	list_for_each_entry_safe(port, tmp, &team->port_list, list)
>>>> 		team_port_del(team, port->dev);
>>>>
>>>>+	sysfs_remove_group(&team->dev->dev.kobj, &team->attr_grp);
>>>>+	team_attr_grp_free(team);
>>>>+	/* set to dummy group to avoid double free by core */
>>>>+	dev->sysfs_groups[0] = &team_sysfs_attr_group;
>>>>+
>>>> 	__team_change_mode(team, NULL); /* cleanup */
>>>> 	__team_options_unregister(team, team_options, ARRAY_SIZE(team_options));
>>>> 	team_queue_override_fini(team);
>>>>+
>>>> 	mutex_unlock(&team->lock);
>>>> }
>>>>
>>>>@@ -2194,9 +2465,6 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info)
>>>> 	return err;
>>>> }
>>>>
>>>>-static int team_nl_send_event_options_get(struct team *team,
>>>>-					  struct list_head *sel_opt_inst_list);
>>>>-
>>>> static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
>>>> {
>>>> 	struct team *team;
>>>>diff --git a/include/linux/if_team.h b/include/linux/if_team.h
>>>>index 25b8b15..2e9fb2a 100644
>>>>--- a/include/linux/if_team.h
>>>>+++ b/include/linux/if_team.h
>>>>@@ -188,6 +188,9 @@ struct team {
>>>> 	struct list_head option_list;
>>>> 	struct list_head option_inst_list; /* list of option instances */
>>>>
>>>>+	/* attribute group for registering team's own options at init */
>>>>+	struct attribute_group attr_grp;
>>>>+
>>>> 	const struct team_mode *mode;
>>>> 	struct team_mode_ops ops;
>>>> 	bool user_carrier_enabled;
>>>>--
>>>>1.8.5.2
>>>>--
>>>>Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
>>>>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>>>>a Linux Foundation Collaborative Project
>>>>
>>>
>>
>>

^ permalink raw reply

* Re: [patch net-next v3 02/17] net: make vid as a parameter for ndo_fdb_add/ndo_fdb_del
From: Jamal Hadi Salim @ 2014-11-25 15:38 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-3-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> Do the work of parsing NDA_VLAN directly in rtnetlink code, pass simple
> u16 vid to drivers from there.
>

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

I know this maintains status quo of what is already in the kernel.
But we need to take care of policy (pass it from user space) which
dictates how to proceed on failure. Three possible options:
1) If something fails just continue with the rest of the transaction.
Return success if at least one thing succeeds.
2) If something fails stop transaction and return some partial success code
3) If something fails undo everything that has been done and return failure.

So two bits from somewhere would be useful to send from userspace->kernel


> +static int fbd_vid_parse(struct nlattr *vlan_attr, u16 *p_vid)

typo fbd_vid_parse -> fdb_vid_parse

cheers,
jamal

^ permalink raw reply

* [PATCH net] tcp: fix possible NULL dereference in tcp_vX_send_reset()
From: Eric Dumazet @ 2014-11-25 15:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Daniel Borkmann, Jaša Bartelj

From: Eric Dumazet <edumazet@google.com>

After commit ca777eff51f7 ("tcp: remove dst refcount false sharing for
prequeue mode") we have to relax check against skb dst in
tcp_v[46]_send_reset() if prequeue dropped the dst.

If a socket is provided, a full lookup was done to find this socket,
so the dst test can be skipped.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88191
Reported-by: Jaša Bartelj <jasa.bartelj@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Daniel Borkmann <dborkman@redhat.com>
Fixes: ca777eff51f7 ("tcp: remove dst refcount false sharing for prequeue mode")
---
 net/ipv4/tcp_ipv4.c |    5 ++++-
 net/ipv6/tcp_ipv6.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9c7d7621466b..147be2024290 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -598,7 +598,10 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
 	if (th->rst)
 		return;
 
-	if (skb_rtable(skb)->rt_type != RTN_LOCAL)
+	/* If sk not NULL, it means we did a successful lookup and incoming
+	 * route had to be correct. prequeue might have dropped our dst.
+	 */
+	if (!sk && skb_rtable(skb)->rt_type != RTN_LOCAL)
 		return;
 
 	/* Swap the send and the receive. */
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ace29b60813c..dc495ae2ead0 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -903,7 +903,10 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 	if (th->rst)
 		return;
 
-	if (!ipv6_unicast_destination(skb))
+	/* If sk not NULL, it means we did a successful lookup and incoming
+	 * route had to be correct. prequeue might have dropped our dst.
+	 */
+	if (!sk && !ipv6_unicast_destination(skb))
 		return;
 
 #ifdef CONFIG_TCP_MD5SIG

^ permalink raw reply related

* Fw: [Bug 88871] New: SO_BINDTODEVICE set sock's sk_bound_dev_if ,but interface's index can chang where interface down and up
From: Stephen Hemminger @ 2014-11-25 15:43 UTC (permalink / raw)
  To: netdev

This is not really a bug.

Begin forwarded message:

Date: Mon, 24 Nov 2014 22:50:49 -0800
From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
To: "stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: [Bug 88871] New: SO_BINDTODEVICE set sock's sk_bound_dev_if ,but interface's index can chang where interface down and up


https://bugzilla.kernel.org/show_bug.cgi?id=88871

            Bug ID: 88871
           Summary: SO_BINDTODEVICE set sock's sk_bound_dev_if ,but
                    interface's index can chang where interface down and
                    up
           Product: Networking
           Version: 2.5
    Kernel Version: 3.4
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: Other
          Assignee: shemminger@linux-foundation.org
          Reporter: 10142904@qq.com
        Regression: No

call setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface_brlan, iface_len + 1),
the sock's sk_bound_dev_if be set to iface_brlan's index, when i pull out other
cab and plug in,  the br-lan's index can changed, the tcp packet to the socket
be rest, because the orignal sk_bound_dev_if not match current br-lan's index

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply

* Re: [patch net-next v3 02/17] net: make vid as a parameter for ndo_fdb_add/ndo_fdb_del
From: John Fastabend @ 2014-11-25 15:43 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Andy Gospodarek, netdev, davem, nhorman, andy, tgraf, dborkman,
	ogerlitz, jesse, pshelar, azhou, ben, stephen, jeffrey.t.kirsher,
	vyasevic, xiyou.wangcong, john.r.fastabend, edumazet, jhs,
	sfeldma, f.fainelli, roopa, linville, jasowang, ebiederm,
	nicolas.dichtel, ryazanov.s.a, buytenh, aviadr, nbd,
	alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet
In-Reply-To: <20141125151811.GF1971@nanopsycho.orion>

On 11/25/2014 07:18 AM, Jiri Pirko wrote:
> Tue, Nov 25, 2014 at 04:13:12PM CET, gospo@cumulusnetworks.com wrote:
>> On Tue, Nov 25, 2014 at 11:28:33AM +0100, Jiri Pirko wrote:
>>> Do the work of parsing NDA_VLAN directly in rtnetlink code, pass simple
>>> u16 vid to drivers from there.
>>>
>>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>>
>> Structurally this looks fine, just a misspelling noted below.
>>
>> Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>
>>

If your going to spin this, should we return an error from
ndo_dflt_fdb_add() when we have a non-zero vid? The dflt
handler uses the dev_(mc|uc)_add_excl routines which will
not consume vids.

If you want to address this with a follow up patch I'm OK
with that. Go ahead and add my ack,

Acked-by: John Fastabend <john.r.fastabend@intel.com>


-- 
John Fastabend         Intel Corporation

^ permalink raw reply

* Re: [patch net-next v3 03/17] net: rename netdev_phys_port_id to more generic name
From: Jamal Hadi Salim @ 2014-11-25 15:44 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-4-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> So this can be reused for identification of other "items" as well.
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>



Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 04/17] net: introduce generic switch devices support
From: Jamal Hadi Salim @ 2014-11-25 15:51 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-5-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> The goal of this is to provide a possibility to support various switch
> chips. Drivers should implement relevant ndos to do so. Now there is
> only one ndo defined:
> - for getting physical switch id is in place.
>

I am not sure switch id is the right term. I have a network processor
that *does not* do switching. I am not sure if "chip" or "ASIC" or
"offload_id" would be the right term. switch doesnt sound right.

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 06/17] net-sysfs: expose physical switch id for particular device
From: Jamal Hadi Salim @ 2014-11-25 15:53 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-7-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
> ---
> v2->v3:
> -changed "sw" string to "switch" to avoid confusion
> v1->v2:
> -no change


tied to patches 5 and 4 in terms of the noun used.

cheers,
jamal

^ permalink raw reply

* Re: linux-next: manual merge of the net-next tree with the vfs tree
From: Pablo Neira Ayuso @ 2014-11-25 15:56 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: Stephen Rothwell, David Miller, netdev, Al Viro, linux-next,
	linux-kernel, Steven Rostedt (Red Hat)
In-Reply-To: <547466C8.1000203@redhat.com>

On Tue, Nov 25, 2014 at 09:23:52AM -0200, Marcelo Ricardo Leitner wrote:
> On 25-11-2014 00:42, Stephen Rothwell wrote:
> >Hi all,
> >
> >Today's linux-next merge of the net-next tree got a conflict in
> >net/netfilter/nf_log.c between commit e71456ae9871 ("netfilter: Remove
> >checks of seq_printf() return values") from the vfs tree and commit
> >0c26ed1c07f1 ("netfilter: nf_log: Introduce nft_log_dereference()
> >macro") from the net-next tree.
> >
> >I fixed it up (see below) and can carry the fix as necessary (no action
> >is required).
> >
> 
> Looks good to me, thanks Stephen.

Also to me, thanks Stephen and Marcelo.

^ permalink raw reply

* Re: [patch net-next v3 07/17] rocker: introduce rocker switch driver
From: Jamal Hadi Salim @ 2014-11-25 15:57 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-8-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> This patch introduces the first driver to benefit from the switchdev
> infrastructure and to implement newly introduced switch ndos. This is a
> driver for emulated switch chip implemented in qemu:
> https://github.com/sfeldma/qemu-rocker/
>
> This patch is a result of joint work with Scott Feldman.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> Reviewed-by: Thomas Graf <tgraf@suug.ch>
> Reviewed-by: John Fastabend <john.r.fastabend@intel.com>

Users should be a different patch set for easier review.
I think you should separate rocker to be another patch series.

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 08/17] bridge: call netdev_sw_port_stp_update when bridge port STP status changes
From: Andy Gospodarek @ 2014-11-25 15:58 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <1416911328-10979-9-git-send-email-jiri@resnulli.us>

On Tue, Nov 25, 2014 at 11:28:39AM +0100, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
> 
> To notify switch driver of change in STP state of bridge port, add new
> .ndo op and provide switchdev wrapper func to call ndo op. Use it in bridge
> code then.
> 
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
> v2->v3:
> -changed "sw" string to "switch" to avoid confusion
> v1->v2:
> -no change
> ---
>  include/linux/netdevice.h |  5 +++++
>  include/net/switchdev.h   |  7 +++++++
>  net/bridge/br_stp.c       |  2 ++
>  net/switchdev/switchdev.c | 19 +++++++++++++++++++
>  4 files changed, 33 insertions(+)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index ce096dc..66cb64e 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1024,6 +1024,9 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
>   *	Called to get an ID of the switch chip this port is part of.
>   *	If driver implements this, it indicates that it represents a port
>   *	of a switch chip.
> + * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
> + *	Called to notify switch device port of bridge port STP
> + *	state change.
>   */
>  struct net_device_ops {
>  	int			(*ndo_init)(struct net_device *dev);
> @@ -1180,6 +1183,8 @@ struct net_device_ops {
>  #ifdef CONFIG_NET_SWITCHDEV
>  	int			(*ndo_switch_parent_id_get)(struct net_device *dev,
>  							    struct netdev_phys_item_id *psid);
> +	int			(*ndo_switch_port_stp_update)(struct net_device *dev,
> +							      u8 state);
>  #endif
>  };
>  
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index 7a52360..8a6d164 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -16,6 +16,7 @@
>  
>  int netdev_switch_parent_id_get(struct net_device *dev,
>  				struct netdev_phys_item_id *psid);
> +int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
>  
>  #else
>  
> @@ -25,6 +26,12 @@ static inline int netdev_switch_parent_id_get(struct net_device *dev,
>  	return -EOPNOTSUPP;
>  }
>  
> +static inline int netdev_switch_port_stp_update(struct net_device *dev,
> +						u8 state)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
>  #endif
>  
>  #endif /* _LINUX_SWITCHDEV_H_ */
> diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
> index 2b047bc..35e016c 100644
> --- a/net/bridge/br_stp.c
> +++ b/net/bridge/br_stp.c
> @@ -12,6 +12,7 @@
>   */
>  #include <linux/kernel.h>
>  #include <linux/rculist.h>
> +#include <net/switchdev.h>
>  
>  #include "br_private.h"
>  #include "br_private_stp.h"
> @@ -39,6 +40,7 @@ void br_log_state(const struct net_bridge_port *p)
>  void br_set_state(struct net_bridge_port *p, unsigned int state)
>  {
>  	p->state = state;
> +	netdev_switch_port_stp_update(p->dev, state);

The only thing that concerns me about this patch is the fact that there
is nothing paying attention to the return code.

This means if *something* in the driver fails to set the STP state we
have no way to feed this information back to the user to let them know
that their hardware isn't exactly functioning as we expect.

I do not expect that this first set would provide full feedback to
br_make_forwarding, br_make_blocking, etc, to allow spanning tree to
properly deal with the failure (that change is fine to add later), but a
short one-liner indicating that the call to the hardware  failed would e
good.  What about something simple like this:

void br_set_state(struct net_bridge_port *p, unsigned int state)
{
	int ret;
	p->state = state;
	ret = netdev_switch_port_stp_update(p->dev, state);
	if (ret && ret != -EOPNOTSUPP)
		br_warn(br, "error setting offload STP state for interface %s\n",
			p->dev->name);
}

>  
>  /* called under bridge lock */
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index 66973de..d162b21 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -31,3 +31,22 @@ int netdev_switch_parent_id_get(struct net_device *dev,
>  	return ops->ndo_switch_parent_id_get(dev, psid);
>  }
>  EXPORT_SYMBOL(netdev_switch_parent_id_get);
> +
> +/**
> + *	netdev_switch_port_stp_update - Notify switch device port of STP
> + *					state change
> + *	@dev: port device
> + *	@state: port STP state
> + *
> + *	Notify switch device port of bridge port STP state change.
> + */
> +int netdev_switch_port_stp_update(struct net_device *dev, u8 state)
> +{
> +	const struct net_device_ops *ops = dev->netdev_ops;
> +
> +	if (!ops->ndo_switch_port_stp_update)
> +		return -EOPNOTSUPP;
> +	WARN_ON(!ops->ndo_switch_parent_id_get);
> +	return ops->ndo_switch_port_stp_update(dev, state);
> +}
> +EXPORT_SYMBOL(netdev_switch_port_stp_update);
> -- 
> 1.9.3
> 

^ permalink raw reply

* Re: [patch net-next v3 09/17] bridge: add API to notify bridge driver of learned FBD on offloaded device
From: Jamal Hadi Salim @ 2014-11-25 16:01 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-10-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> When the swdev device learns a new mac/vlan on a port, it sends some async
> notification to the driver and the driver installs an FDB in the device.
> To give a holistic system view, the learned mac/vlan should be reflected
> in the bridge's FBD table, so the user, using normal iproute2 cmds, can view
> what is currently learned by the device.  This API on the bridge driver gives
> a way for the swdev driver to install an FBD entry in the bridge FBD table.
> (And remove one).
>
> This is equivalent to the device running these cmds:
>
>    bridge fdb [add|del] <mac> dev <dev> vid <vlan id> master
>
> This patch needs some extra eyeballs for review, in paricular around the
> locking and contexts.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Like it (thanks for taking the earlier feedback) but I do not see
other issue we discussed on policy attribute check that
says "I need you to sync this from offload/chip to kernel" so for now
only conditional Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 13/17] bridge: move private brport flags to if_bridge.h so port drivers can use flags
From: Andy Gospodarek @ 2014-11-25 16:01 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, bcrl
In-Reply-To: <1416911328-10979-14-git-send-email-jiri@resnulli.us>

On Tue, Nov 25, 2014 at 11:28:44AM +0100, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
> 
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
> new in v3
> ---
>  include/linux/if_bridge.h | 11 +++++++++++
>  net/bridge/br_private.h   | 10 ----------
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
> index fa2eca6..b4bb104 100644
> --- a/include/linux/if_bridge.h
> +++ b/include/linux/if_bridge.h
> @@ -32,6 +32,17 @@ struct br_ip_list {
>  	struct br_ip addr;
>  };
>  
> +#define BR_HAIRPIN_MODE		0x00000001
> +#define BR_BPDU_GUARD           0x00000002
> +#define BR_ROOT_BLOCK		0x00000004
> +#define BR_MULTICAST_FAST_LEAVE	0x00000008
> +#define BR_ADMIN_COST		0x00000010
> +#define BR_LEARNING		0x00000020
> +#define BR_FLOOD		0x00000040
> +#define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
> +#define BR_PROMISC		0x00000080
> +#define BR_PROXYARP		0x00000100
> +
>  extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
>  
>  typedef int br_should_route_hook_t(struct sk_buff *skb);
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 02cd63b..3116bb0 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -164,16 +164,6 @@ struct net_bridge_port
>  	struct rcu_head			rcu;
>  
>  	unsigned long 			flags;
> -#define BR_HAIRPIN_MODE		0x00000001
> -#define BR_BPDU_GUARD           0x00000002
> -#define BR_ROOT_BLOCK		0x00000004
> -#define BR_MULTICAST_FAST_LEAVE	0x00000008
> -#define BR_ADMIN_COST		0x00000010
> -#define BR_LEARNING		0x00000020
> -#define BR_FLOOD		0x00000040
> -#define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
> -#define BR_PROMISC		0x00000080
> -#define BR_PROXYARP		0x00000100
>  
>  #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
>  	struct bridge_mcast_own_query	ip4_own_query;
> -- 
> 1.9.3
> 

^ permalink raw reply

* Re: [patch net-next v3 10/17] rocker: implement rocker ofdpa flow table manipulation
From: Jamal Hadi Salim @ 2014-11-25 16:03 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-11-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> The rocker driver maintains 4 hash tables: flows, groups, FDB, and VLANs.
>
> Flow and group tables track the entries installed to OF-DPA tables,
> per the OF-DPA spec.  See OF-DPA spec for full description of fields
> in each flow and group table.  New table entries are pushed to the
> device with ADD cmd.  Updated entries are pushed to the device with
> MOD cmd.  For flow table entries, a crc32 key is made from fields of
> the particular field.  For group table entries, the group_id is used
> as the key.
>
> The FDB table tracks fdb entries learned by the device or manually
> pushed to the bridge by the user.  A crc32 key is made from the
> port/mac/vlan tuple for the fdb entry.
>
> The VLAN table tracks the ifindex-to-internal-vlan mapping for
> untagged pkts.  On ingress, an untagged pkt is inserted with an
> internal VLAN ID based on the input port's current internal VLAN ID.
> The input port's internal VLAN will either be referenced by the port's
> ifindex, if not bridged, or the containing bridge's ifindex, if
> bridged.  Since the ifindex space isn't within a fixed range, uses a
> hash table (with ifindex as key) to track internal VLAN ID for a given
> ifindex.  The internal VLAN ID range is fixed and currently uses the
> upper 255 VLAN IDs, starting at 0xf00.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Same comment as before:
I think Rocker should be a separate patch. I will make time to review
if you do that..

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 15/17] bridge: add new hwmode swdev
From: Roopa Prabhu @ 2014-11-25 16:03 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-16-git-send-email-jiri@resnulli.us>

On 11/25/14, 2:28 AM, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> Current hwmode settings are "vepa" or "veb".  These are for NIC interfaces
> with basic bridging function offloaded to HW.  Add new "swdev" for full
> switch device offloads.

still voting for a generic feature flag like NETIF_F_HW_OFFLOAD for use 
by bridge/bond/vxlan. I can resubmit my patch that does this.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
> new in v3
> ---
>   include/uapi/linux/if_bridge.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> index da17e45..60425ca 100644
> --- a/include/uapi/linux/if_bridge.h
> +++ b/include/uapi/linux/if_bridge.h
> @@ -105,6 +105,7 @@ struct __fdb_entry {
>   
>   #define BRIDGE_MODE_VEB		0	/* Default loopback mode */
>   #define BRIDGE_MODE_VEPA	1	/* 802.1Qbg defined VEPA mode */
> +#define BRIDGE_MODE_SWDEV       2       /* Full switch device offload */
>   
>   /* Bridge management nested attributes
>    * [IFLA_AF_SPEC] = {

^ permalink raw reply

* Re: [patch net-next v3 02/17] net: make vid as a parameter for ndo_fdb_add/ndo_fdb_del
From: John Fastabend @ 2014-11-25 16:01 UTC (permalink / raw)
  To: Jamal Hadi Salim, Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	edumazet, sfeldma, f.fainelli, roopa, linville, jasowang,
	ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh, aviadr, nbd,
	alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <5474A25C.3080505@mojatatu.com>

On 11/25/2014 07:38 AM, Jamal Hadi Salim wrote:
> On 11/25/14 05:28, Jiri Pirko wrote:
>> Do the work of parsing NDA_VLAN directly in rtnetlink code, pass simple
>> u16 vid to drivers from there.
>>
> 
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> 
> I know this maintains status quo of what is already in the kernel.
> But we need to take care of policy (pass it from user space) which
> dictates how to proceed on failure. Three possible options:
> 1) If something fails just continue with the rest of the transaction.
> Return success if at least one thing succeeds.

I'm not sure how (1) works. We can't just let user-space/management
software run along thinking its configuration is set when its
not. At least it doesn't look very appealing for the software I'm
looking at.

> 2) If something fails stop transaction and return some partial success code

Option (2) is the current behavior of fdb this is straight forward
and punts the complexity to user space. And at least the state is
always known.

> 3) If something fails undo everything that has been done and return failure.
> 

Sure this would be nice to have when doing bulk updates and is more
useful on hardware that has a commit phase where updates don't actually
occur until they are committed.

> So two bits from somewhere would be useful to send from userspace->kernel
> 

+1 for a follow up patch though.

> 
>> +static int fbd_vid_parse(struct nlattr *vlan_attr, u16 *p_vid)
> 
> typo fbd_vid_parse -> fdb_vid_parse
> 
> cheers,
> jamal
> 
> 

^ permalink raw reply

* Re: [patch net-next v3 11/17] rocker: implement L2 bridge offloading
From: Jamal Hadi Salim @ 2014-11-25 16:04 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-12-git-send-email-jiri@resnulli.us>

Same comment on rocker.
Please make a separate patch set.

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 12/17] rocker: implement ndo_fdb_dump
From: Jamal Hadi Salim @ 2014-11-25 16:04 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-13-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
> new in v3

Same comment as before on rocker

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next v3 14/17] bridge: add new brport flag LEARNING_SYNC
From: Roopa Prabhu @ 2014-11-25 16:05 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-15-git-send-email-jiri@resnulli.us>

On 11/25/14, 2:28 AM, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> This policy flag controls syncing of learned FDB entries to bridge's FDB.  If
> on, FDB entries learned on bridge port device will be synced.  If off, device
> may still learn new FDB entries but they will not be synced with bridge's FDB.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Acked-by: Roopa Prabhu<roopa@cumulusnetworks.com>


> ---
> new in v3
> ---
>   include/linux/if_bridge.h    | 1 +
>   include/uapi/linux/if_link.h | 1 +
>   2 files changed, 2 insertions(+)
>
> diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
> index b4bb104..67b7a8e 100644
> --- a/include/linux/if_bridge.h
> +++ b/include/linux/if_bridge.h
> @@ -42,6 +42,7 @@ struct br_ip_list {
>   #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
>   #define BR_PROMISC		0x00000080
>   #define BR_PROXYARP		0x00000100
> +#define BR_LEARNING_SYNC	0x00000200
>   
>   extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
>   
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index 4163753..d8e6a31 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -245,6 +245,7 @@ enum {
>   	IFLA_BRPORT_LEARNING,	/* mac learning */
>   	IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
>   	IFLA_BRPORT_PROXYARP,	/* proxy ARP */
> +	IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */
>   	__IFLA_BRPORT_MAX
>   };
>   #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)

^ permalink raw reply

* Re: [patch net-next v3 13/17] bridge: move private brport flags to if_bridge.h so port drivers can use flags
From: Jamal Hadi Salim @ 2014-11-25 16:05 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, sfeldma, f.fainelli, roopa, linville,
	jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a, buytenh,
	aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye, simon.horman,
	alexander.h.duyck, john.ronciak, mleitner, shrijeet, gospo, bcrl
In-Reply-To: <1416911328-10979-14-git-send-email-jiri@resnulli.us>

On 11/25/14 05:28, Jiri Pirko wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---


Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox