Netdev List
 help / color / mirror / Atom feed
* Re: [patch net-next-2.6] net: allow notifier subscribers to forbid device from closing
From: Stephen Hemminger @ 2011-08-31 15:20 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, eric.dumazet, bhutchings
In-Reply-To: <1314803731-1222-1-git-send-email-jpirko@redhat.com>

On Wed, 31 Aug 2011 17:15:31 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> In some situations, like when the device is used as slave device in
> bond/br/etc it is not nice if someone closes the device. This allows
> it's masters to forbid this closure.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

I don't think this is necessary, for bridging case.
bridging handles it. And bonding should as well.
It is a good way to test STP etc.

Is this a case of "you really shouldn't do this", or
"don't do this it will crash"? In general Linux allows the
former and uses references to prevent the later.

^ permalink raw reply

* Re: [PATCH 1/3] bnx2x: remove TPA_ENABLE_FLAG
From: Vlad Zolotarov @ 2011-08-31 15:16 UTC (permalink / raw)
  To: Michal Schmidt
  Cc: netdev@vger.kernel.org, Dmitry Kravkov, Eilon Greenstein,
	mirqus@gmail.com
In-Reply-To: <1314802836-9862-2-git-send-email-mschmidt@redhat.com>

On Wednesday 31 August 2011 18:00:34 Michal Schmidt wrote:
>  	if (bnx2x_reload) {
> -		if (bp->recovery_state == BNX2X_RECOVERY_DONE)
> +		if (bp->recovery_state == BNX2X_RECOVERY_DONE) {
> +			/*
> +			 * Cheat! Normally dev->features will be set after we
> +			 * return, but that's too late. We need to know how to
> +			 * configure the NIC when reloading it, so update
> +			 * the features early.
> +			 */
> +			dev->features = features;
>  			return bnx2x_reload_if_running(dev);

NACK 

This is bogus - what if bnx2x_reload_if_running(dev) (bnx2x_nic_load()) 
failes? The original dev->features would be lost... Pls., see my latest 
response on your previouse patch series thread.

thanks,
vlad

> +		}
>  		/* else: bnx2x_nic_load() will be called at end of recovery */
>  	}
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e7b584b..fd32c04
> 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -9757,13 +9757,10 @@ static int __devinit bnx2x_init_bp(struct bnx2x
> *bp) bp->multi_mode = multi_mode;
> 
>  	/* Set TPA flags */
> -	if (disable_tpa) {
> -		bp->flags &= ~TPA_ENABLE_FLAG;
> +	if (disable_tpa)
>  		bp->dev->features &= ~NETIF_F_LRO;
> -	} else {
> -		bp->flags |= TPA_ENABLE_FLAG;
> +	else
>  		bp->dev->features |= NETIF_F_LRO;
> -	}
>  	bp->disable_tpa = disable_tpa;
> 
>  	if (CHIP_IS_E1(bp))

^ permalink raw reply

* [patch net-next-2.6] net: allow notifier subscribers to forbid device from closing
From: Jiri Pirko @ 2011-08-31 15:15 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, bhutchings, shemminger

In some situations, like when the device is used as slave device in
bond/br/etc it is not nice if someone closes the device. This allows
it's masters to forbid this closure.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 include/linux/netdevice.h |    1 +
 net/core/dev.c            |   34 ++++++++++++++++++++++++++++------
 net/core/rtnetlink.c      |    1 +
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index dad7e4d..b8047d3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1559,6 +1559,7 @@ struct packet_type {
 #define NETDEV_RELEASE		0x0012
 #define NETDEV_NOTIFY_PEERS	0x0013
 #define NETDEV_JOIN		0x0014
+#define NETDEV_PRE_DOWN		0x0015
 
 extern int register_netdevice_notifier(struct notifier_block *nb);
 extern int unregister_netdevice_notifier(struct notifier_block *nb);
diff --git a/net/core/dev.c b/net/core/dev.c
index 11b0fc7..d252a7e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1253,11 +1253,24 @@ static int __dev_close_many(struct list_head *head)
 	return 0;
 }
 
+static int __dev_pre_close(struct net_device *dev)
+{
+	int err;
+
+	err = call_netdevice_notifiers(NETDEV_PRE_DOWN, dev);
+	if (err)
+		return notifier_to_errno(err);
+	return 0;
+}
+
 static int __dev_close(struct net_device *dev)
 {
 	int retval;
 	LIST_HEAD(single);
 
+	retval = __dev_pre_close(dev);
+	if (retval)
+		return retval;
 	list_add(&dev->unreg_list, &single);
 	retval = __dev_close_many(&single);
 	list_del(&single);
@@ -1269,9 +1282,12 @@ static int dev_close_many(struct list_head *head)
 	struct net_device *dev, *tmp;
 	LIST_HEAD(tmp_list);
 
-	list_for_each_entry_safe(dev, tmp, head, unreg_list)
+	list_for_each_entry_safe(dev, tmp, head, unreg_list) {
 		if (!(dev->flags & IFF_UP))
 			list_move(&dev->unreg_list, &tmp_list);
+		else
+			__dev_pre_close(dev);
+	}
 
 	__dev_close_many(head);
 
@@ -1289,21 +1305,26 @@ static int dev_close_many(struct list_head *head)
  *	dev_close - shutdown an interface.
  *	@dev: device to shutdown
  *
- *	This function moves an active device into down state. A
- *	%NETDEV_GOING_DOWN is sent to the netdev notifier chain. The device
- *	is then deactivated and finally a %NETDEV_DOWN is sent to the notifier
- *	chain.
+ *	This function moves an active device into down state.
+ *	A %NETDEV_PRE_DOWN and %NETDEV_GOING_DOWN is sent to the netdev
+ *	notifier chain. The device is then deactivated and finally
+ *	a %NETDEV_DOWN is sent to the notifier chain.
  */
 int dev_close(struct net_device *dev)
 {
+	int retval = 0;
+
 	if (dev->flags & IFF_UP) {
 		LIST_HEAD(single);
 
+		retval = __dev_pre_close(dev);
+		if (retval)
+			return retval;
 		list_add(&dev->unreg_list, &single);
 		dev_close_many(&single);
 		list_del(&single);
 	}
-	return 0;
+	return retval;
 }
 EXPORT_SYMBOL(dev_close);
 
@@ -1397,6 +1418,7 @@ rollback:
 				break;
 
 			if (dev->flags & IFF_UP) {
+				nb->notifier_call(nb, NETDEV_PRE_DOWN, dev);
 				nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
 				nb->notifier_call(nb, NETDEV_DOWN, dev);
 			}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 39f8dd6..34f5b32 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1997,6 +1997,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_UP:
 	case NETDEV_DOWN:
 	case NETDEV_PRE_UP:
+	case NETDEV_PRE_DOWN:
 	case NETDEV_POST_INIT:
 	case NETDEV_REGISTER:
 	case NETDEV_CHANGE:
-- 
1.7.6

^ permalink raw reply related

* [PATCH] iPhone 4 Verizon CDMA USB Product ID add
From: Kavan Smith @ 2011-08-31 15:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Kavan Smith

Add USB product ID for iPhone 4 CDMA Verizon
Tested on at least 2 devices

Signed-off-by: Kavan Smith <kavansmith82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

---
 drivers/net/usb/ipheth.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 15772b1..13c1f04 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -59,6 +59,7 @@
 #define USB_PRODUCT_IPHONE_3G   0x1292
 #define USB_PRODUCT_IPHONE_3GS  0x1294
 #define USB_PRODUCT_IPHONE_4	0x1297
+#define USB_PRODUCT_IPHONE_4_VZW 0x129c
 
 #define IPHETH_USBINTF_CLASS    255
 #define IPHETH_USBINTF_SUBCLASS 253
@@ -98,6 +99,10 @@ static struct usb_device_id ipheth_table[] = {
 		USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4,
 		IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
 		IPHETH_USBINTF_PROTO) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(
+		USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
+		IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
+		IPHETH_USBINTF_PROTO) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, ipheth_table);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH 7/7] bnx2x: expose HW RX VLAN stripping toggle
From: Vlad Zolotarov @ 2011-08-31 15:07 UTC (permalink / raw)
  To: Michal Schmidt
  Cc: Michał Mirosław, netdev@vger.kernel.org, Dmitry Kravkov,
	Eilon Greenstein
In-Reply-To: <20110831155324.7554d035@alice>

On Wednesday 31 August 2011 16:53:24 Michal Schmidt wrote:
> On Wed, 31 Aug 2011 15:01:39 +0300 Vlad Zolotarov wrote:
> > On Tuesday 30 August 2011 22:30:11 Michal Schmidt wrote:
> > > > and then also in fp->flags.  Are the
> > > > fp->flags strictly mirroring hardware state (as in: there is no
> > > > way the states can differ in any point in time where the flags are
> > > > tested)?
> > > 
> > > Yes. This is the purpose of the second mirroring of the flag.
> > 
> > Michal,
> > although the above is true i'd say it's a bit of an overkill:
> > RX VLAN stripping is configured in a function level, so keeping it in
> > a per queue level is not needed.
> > 
> > The problem u were trying to resolve (and u resolved it) was to
> > separate the RX_VLAN_ENABLED flag semantics into two: requested
> > feature and HW configured feature in order to further check the
> > second in the fast path, while setting the first one in the
> > set_features(). Then the second lag is updated according to the first
> > one during the loading of the function (bnx2x_nic_load()).
> > 
> > Therefore it would be enough to just add those two flags in the
> > function (bp) level keeping the rest of your patch as it is. This
> > would also cancel the need for a patch 6.
> 
> Alright, I will remove the per-fp flag and move it to bp.
> 
> I will also apply the cheat suggested by Michał, so that:
>  - dev->features & NETIF_F_HW_VLAN_RX is the requested state
>  - bp->flags & RX_VLAN_STRIP_FLAG is the HW configured state
> => Only one new bp flag needed, not two.
> 
> BTW, Michał's cheat should apply to TPA_ENABLE_FLAG as well - it only
> mirrors NETIF_F_LRO. But for TPA the HW configured state is really
> per-queue (fp->disable_tpa). I will remove TPA_ENABLE_FLAG unless you
> object to Michał's "cheat".

I agree the TPA_ENABLE_FLAG may and should be removed.
However I didn’t like the idea of relying on the current implementation 
of the calling function (__netdev_update_features()). If u want to change 
the implementation the way we rely on the dev->features in the 
ndo_set_features() flow, which is a semantics change, u'd rather change 
the __netdev_update_features() so that it sets the dev->features before 
ndo_set_features() call and restores it in case of a failure. Something like this:

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0a7f619..a5f6d3e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -943,8 +943,7 @@ struct net_device_ops {
                                                 struct net_device *slave_dev);
        u32                     (*ndo_fix_features)(struct net_device *dev,
                                                    u32 features);
-       int                     (*ndo_set_features)(struct net_device *dev,
-                                                   u32 features);
+       int                     (*ndo_set_features)(struct net_device *dev);
 };
 
 /*
diff --git a/net/core/dev.c b/net/core/dev.c
index b2e262e..474e539 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5321,7 +5321,7 @@ static u32 netdev_fix_features(struct net_device *dev, u32 features)
 
 int __netdev_update_features(struct net_device *dev)
 {
-       u32 features;
+       u32 features, old_features;
        int err = 0;
 
        ASSERT_RTNL();
@@ -5340,19 +5340,23 @@ int __netdev_update_features(struct net_device *dev)
        netdev_dbg(dev, "Features changed: 0x%08x -> 0x%08x\n",
                dev->features, features);
 
+       /* Remember the original features and set the new ones */
+       old_features = dev->features;
+       dev->features = features;
+
        if (dev->netdev_ops->ndo_set_features)
-               err = dev->netdev_ops->ndo_set_features(dev, features);
+               err = dev->netdev_ops->ndo_set_features(dev);
 
        if (unlikely(err < 0)) {
+               /* Restore the original features */
+               dev->features = old_features;
+
                netdev_err(dev,
                        "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
                        err, features, dev->features);
                return -1;
        }
 
-       if (!err)
-               dev->features = features;
-
        return 1;
 }

However, this would involve updating all other L2 drivers that implement ndo_set_features().

Pls., comment.

thanks,
vlad

> 
> Thanks,
> Michal

^ permalink raw reply related

* [PATCH 3/3] bnx2x: expose HW RX VLAN stripping toggle
From: Michal Schmidt @ 2011-08-31 15:00 UTC (permalink / raw)
  To: netdev; +Cc: vladz, dmitry, eilong, mirqus
In-Reply-To: <1314802836-9862-1-git-send-email-mschmidt@redhat.com>

Allow disabling of HW RX VLAN stripping with ethtool.

[v3: per-queue flag was overkill, store the HW config in bp.
     Suggestions by Vlad Zolotarov and Michał Mirosław.]

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |   20 +++++++++++++++-----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   10 +++++-----
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 5d5f323..b85017e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1174,7 +1174,7 @@ struct bnx2x {
 #define USING_MSIX_FLAG			(1 << 5)
 #define USING_MSI_FLAG			(1 << 6)
 #define DISABLE_MSI_FLAG		(1 << 7)
-
+#define RX_VLAN_STRIP_FLAG		(1 << 8)
 #define NO_MCP_FLAG			(1 << 9)
 
 #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index c660317..6e1b4b4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -385,6 +385,10 @@ static inline u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
 	else /* IPv4 */
 		hdrs_len += sizeof(struct iphdr);
 
+	/* VLAN header present and not stripped by HW */
+	if ((parsing_flags & PARSING_FLAGS_VLAN) &&
+	    !(bp->flags & RX_VLAN_STRIP_FLAG))
+		hdrs_len += VLAN_HLEN;
 
 	/* Check if there was a TCP timestamp, if there is it's will
 	 * always be 12 bytes length: nop nop kind length echo val.
@@ -412,7 +416,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 	frag_size = le16_to_cpu(cqe->pkt_len) - len_on_bd;
 	pages = SGE_PAGE_ALIGN(frag_size) >> SGE_PAGE_SHIFT;
 
-	/* This is needed in order to enable forwarding support */
+	/* Doing LRO, let TCP know the receive MSS */
 	if (frag_size)
 		skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp,
 					tpa_info->parsing_flags, len_on_bd);
@@ -514,7 +518,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 		if (!bnx2x_fill_frag_skb(bp, fp, queue, skb, cqe, cqe_idx)) {
-			if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN)
+			if ((tpa_info->parsing_flags & PARSING_FLAGS_VLAN) &&
+			    (bp->flags & RX_VLAN_STRIP_FLAG))
 				__vlan_hwaccel_put_tag(skb, tpa_info->vlan_tag);
 			napi_gro_receive(&fp->napi, skb);
 		} else {
@@ -745,8 +750,8 @@ reuse_rx:
 
 		skb_record_rx_queue(skb, fp->index);
 
-		if (le16_to_cpu(cqe_fp->pars_flags.flags) &
-		    PARSING_FLAGS_VLAN)
+		if ((le16_to_cpu(cqe_fp->pars_flags.flags) &
+		    PARSING_FLAGS_VLAN) && (bp->flags & RX_VLAN_STRIP_FLAG))
 			__vlan_hwaccel_put_tag(skb,
 					       le16_to_cpu(cqe_fp->vlan_tag));
 		napi_gro_receive(&fp->napi, skb);
@@ -1711,6 +1716,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 
 	bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
 
+	if (bp->dev->features & NETIF_F_HW_VLAN_RX)
+		bp->flags |= RX_VLAN_STRIP_FLAG;
+	else
+		bp->flags &= ~RX_VLAN_STRIP_FLAG;
+
 	/* Set the initial link reported state to link down */
 	bnx2x_acquire_phy_lock(bp);
 	memset(&bp->last_reported_link, 0, sizeof(bp->last_reported_link));
@@ -3412,7 +3422,7 @@ int bnx2x_set_features(struct net_device *dev, u32 features)
 	struct bnx2x *bp = netdev_priv(dev);
 	bool bnx2x_reload = false;
 
-	if ((features ^ dev->features) & NETIF_F_LRO)
+	if ((features ^ dev->features) & (NETIF_F_LRO | NETIF_F_HW_VLAN_RX))
 		bnx2x_reload = true;
 
 	if (features & NETIF_F_LOOPBACK) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index c1285db..e61be4e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -2720,9 +2720,8 @@ static inline unsigned long bnx2x_get_q_flags(struct bnx2x *bp,
 		__set_bit(BNX2X_Q_FLG_MCAST, &flags);
 	}
 
-	/* Always set HW VLAN stripping */
-	__set_bit(BNX2X_Q_FLG_VLAN, &flags);
-
+	if (bp->flags & RX_VLAN_STRIP_FLAG)
+		__set_bit(BNX2X_Q_FLG_VLAN, &flags);
 
 	return flags | bnx2x_get_common_flags(bp, fp, true);
 }
@@ -10265,12 +10264,13 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 
 	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_LRO |
-		NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_HW_VLAN_TX;
+		NETIF_F_RXCSUM | NETIF_F_RXHASH |
+		NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
 
 	dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
 
-	dev->features |= dev->hw_features | NETIF_F_HW_VLAN_RX;
+	dev->features |= dev->hw_features;
 	if (bp->flags & USING_DAC_FLAG)
 		dev->features |= NETIF_F_HIGHDMA;
 
-- 
1.7.6

^ permalink raw reply related

* [PATCH 2/3] bnx2x: do not set NETIF_F_LRO in bnx2x_init_bp
From: Michal Schmidt @ 2011-08-31 15:00 UTC (permalink / raw)
  To: netdev; +Cc: vladz, dmitry, eilong, mirqus
In-Reply-To: <1314802836-9862-1-git-send-email-mschmidt@redhat.com>

bnx2x_fix_features() will take care of clearing NETIF_F_LRO if
'disable_tpa' is used.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index fd32c04..c1285db 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9755,12 +9755,6 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
 					"must load devices in order!\n");
 
 	bp->multi_mode = multi_mode;
-
-	/* Set TPA flags */
-	if (disable_tpa)
-		bp->dev->features &= ~NETIF_F_LRO;
-	else
-		bp->dev->features |= NETIF_F_LRO;
 	bp->disable_tpa = disable_tpa;
 
 	if (CHIP_IS_E1(bp))
-- 
1.7.6

^ permalink raw reply related

* [PATCH 1/3] bnx2x: remove TPA_ENABLE_FLAG
From: Michal Schmidt @ 2011-08-31 15:00 UTC (permalink / raw)
  To: netdev; +Cc: vladz, dmitry, eilong, mirqus
In-Reply-To: <1314802836-9862-1-git-send-email-mschmidt@redhat.com>

TPA_ENABLE_FLAG is unnecessary, because it mirrors NETIF_F_LRO.

The "cheat" in bnx2x_set_features() was suggested by Michał Mirosław.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |   24 +++++++++++-----------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    7 +----
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 735e491..5d5f323 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1174,7 +1174,7 @@ struct bnx2x {
 #define USING_MSIX_FLAG			(1 << 5)
 #define USING_MSI_FLAG			(1 << 6)
 #define DISABLE_MSI_FLAG		(1 << 7)
-#define TPA_ENABLE_FLAG			(1 << 8)
+
 #define NO_MCP_FLAG			(1 << 9)
 
 #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a08b101..c660317 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -62,7 +62,7 @@ static inline void bnx2x_bz_fp(struct bnx2x *bp, int index)
 	 * set the tpa flag for each queue. The tpa flag determines the queue
 	 * minimal size so it must be set prior to queue memory allocation
 	 */
-	fp->disable_tpa = ((bp->flags & TPA_ENABLE_FLAG) == 0);
+	fp->disable_tpa = !(bp->dev->features & NETIF_F_LRO);
 
 #ifdef BCM_CNIC
 	/* We don't want TPA on an FCoE L2 ring */
@@ -3410,13 +3410,10 @@ u32 bnx2x_fix_features(struct net_device *dev, u32 features)
 int bnx2x_set_features(struct net_device *dev, u32 features)
 {
 	struct bnx2x *bp = netdev_priv(dev);
-	u32 flags = bp->flags;
 	bool bnx2x_reload = false;
 
-	if (features & NETIF_F_LRO)
-		flags |= TPA_ENABLE_FLAG;
-	else
-		flags &= ~TPA_ENABLE_FLAG;
+	if ((features ^ dev->features) & NETIF_F_LRO)
+		bnx2x_reload = true;
 
 	if (features & NETIF_F_LOOPBACK) {
 		if (bp->link_params.loopback_mode != LOOPBACK_BMAC) {
@@ -3430,14 +3427,17 @@ int bnx2x_set_features(struct net_device *dev, u32 features)
 		}
 	}
 
-	if (flags ^ bp->flags) {
-		bp->flags = flags;
-		bnx2x_reload = true;
-	}
-
 	if (bnx2x_reload) {
-		if (bp->recovery_state == BNX2X_RECOVERY_DONE)
+		if (bp->recovery_state == BNX2X_RECOVERY_DONE) {
+			/*
+			 * Cheat! Normally dev->features will be set after we
+			 * return, but that's too late. We need to know how to
+			 * configure the NIC when reloading it, so update
+			 * the features early.
+			 */
+			dev->features = features;
 			return bnx2x_reload_if_running(dev);
+		}
 		/* else: bnx2x_nic_load() will be called at end of recovery */
 	}
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e7b584b..fd32c04 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9757,13 +9757,10 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
 	bp->multi_mode = multi_mode;
 
 	/* Set TPA flags */
-	if (disable_tpa) {
-		bp->flags &= ~TPA_ENABLE_FLAG;
+	if (disable_tpa)
 		bp->dev->features &= ~NETIF_F_LRO;
-	} else {
-		bp->flags |= TPA_ENABLE_FLAG;
+	else
 		bp->dev->features |= NETIF_F_LRO;
-	}
 	bp->disable_tpa = disable_tpa;
 
 	if (CHIP_IS_E1(bp))
-- 
1.7.6

^ permalink raw reply related

* [PATCH 0/3 net-next] bnx2x: VLAN stripping toggle and a small cleanup
From: Michal Schmidt @ 2011-08-31 15:00 UTC (permalink / raw)
  To: netdev; +Cc: vladz, dmitry, eilong, mirqus

Hello,
a couple of cleanups and the addition of the VLAN stripping toggle, updated
according to Vlad's and Michał's feedback.

Michal Schmidt (3):
  bnx2x: remove TPA_ENABLE_FLAG
  bnx2x: do not set NETIF_F_LRO in bnx2x_init_bp
  bnx2x: expose HW RX VLAN stripping toggle

 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |   42 +++++++++++++--------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   19 +++-------
 3 files changed, 32 insertions(+), 31 deletions(-)

-- 
1.7.6

^ permalink raw reply

* Re: [PATCH 7/7] bnx2x: expose HW RX VLAN stripping toggle
From: Michal Schmidt @ 2011-08-31 13:53 UTC (permalink / raw)
  To: Vlad Zolotarov
  Cc: Michał Mirosław, netdev@vger.kernel.org, Dmitry Kravkov,
	Eilon Greenstein
In-Reply-To: <201108311501.39936.vladz@broadcom.com>

On Wed, 31 Aug 2011 15:01:39 +0300 Vlad Zolotarov wrote:
> On Tuesday 30 August 2011 22:30:11 Michal Schmidt wrote:
> 
> > > and then also in fp->flags.  Are the
> > > fp->flags strictly mirroring hardware state (as in: there is no
> > > way the states can differ in any point in time where the flags are
> > > tested)?
> > 
> > Yes. This is the purpose of the second mirroring of the flag.
> 
> Michal,
> although the above is true i'd say it's a bit of an overkill:
> RX VLAN stripping is configured in a function level, so keeping it in
> a per queue level is not needed. 
> 
> The problem u were trying to resolve (and u resolved it) was to
> separate the RX_VLAN_ENABLED flag semantics into two: requested
> feature and HW configured feature in order to further check the
> second in the fast path, while setting the first one in the
> set_features(). Then the second lag is updated according to the first
> one during the loading of the function (bnx2x_nic_load()).
> 
> Therefore it would be enough to just add those two flags in the
> function (bp) level keeping the rest of your patch as it is. This
> would also cancel the need for a patch 6.

Alright, I will remove the per-fp flag and move it to bp.

I will also apply the cheat suggested by Michał, so that:
 - dev->features & NETIF_F_HW_VLAN_RX is the requested state
 - bp->flags & RX_VLAN_STRIP_FLAG is the HW configured state
=> Only one new bp flag needed, not two.

BTW, Michał's cheat should apply to TPA_ENABLE_FLAG as well - it only
mirrors NETIF_F_LRO. But for TPA the HW configured state is really
per-queue (fp->disable_tpa). I will remove TPA_ENABLE_FLAG unless you
object to Michał's "cheat".

Thanks,
Michal

^ permalink raw reply

* Re: BQL crap and wireless
From: Jim Gettys @ 2011-08-31 13:28 UTC (permalink / raw)
  To: Andrew McGregor
  Cc: Adrian Chadd, Tom Herbert, Luis R. Rodriguez, Dave Taht,
	linux-wireless, Matt Smith, Kevin Hayes, Derek Smithies, netdev
In-Reply-To: <9BB251C1-A211-486D-A717-59149AC3A709@gmail.com>

On 08/30/2011 05:47 PM, Andrew McGregor wrote:
> On 31/08/2011, at 1:58 AM, Jim Gettys wrote:
>
>> On 08/29/2011 11:42 PM, Adrian Chadd wrote:
>>> On 30 August 2011 11:34, Tom Herbert <therbert@google.com> wrote:
>>>
>>> C(P) is going to be quite variable - a full frame retransmit of a 4ms
>>> long aggregate frame is SUM(exponential backoff, grab the air,
>>> preamble, header, 4ms, etc. for each pass.)
>>>
>> It's not clear to me that doing heroic measures to compute the cost is
>> going to be worthwhile due to the rate at which the costs can change on
>> wireless; just getting into the rough ballpark may be enough. But
>> buffering algorithms and AQM algorithms are going to need an estimate of
>> the *time* it will take to transmit data, more than # of bytes or packets.
> That's not heroic measures; mac80211 needs all the code to calculate these times anyway, it's just a matter of collecting together some things we already know and calling the right function.
>
>

Fine; if it's easy, accurate is better (presuming the costs get
recalculated when circumstances change). We also will need the amount of
data being transmitted; it is the rate of transmission (the rate at
which the buffers are draining) that we'll likely need.

Here's what I've gleaned from reading "RED in a different light",  Van
Jacobson's Mitre talk and several conversations with Kathleen Nichols
and Van: AQM algorithms that can handle variable bandwidth environments
will need to be able to know the rate at which buffers empty.  It's the
direction they are going with their experiments on a "RED light" algorithm.

The fundamental insight as to why classic RED can't work in the wireless
environment is that the instantaneous queue length has little actual
information in it. Classic RED is tuned using the queue length as its
basic parameter.  Their belief as to algorithms that will work is that
the need to keep track of the running queue length *minimum over time*;
you want to keep the buffers small on a longer term basis (so they both
can absorb transients, which is their reason for existence, while
keeping the latency typically low).  The additional major challenge we
face that core routers do not is the highly variable traffic of mixed
mice and elephants.  What actually works only time will tell.

So in an environment in which the rate of transmission is highly
variable, such as wireless, or even possibly modern broadband with
PowerBoost, classic RED or similar algorithms that do not take the
buffer drain rate cannot possibly hack it properly.
                        - Jim

^ permalink raw reply

* Re: 802.1Q VLAN random tag injected when vlan configured on forcedeth interface
From: Ruslan N. Marchenko @ 2011-08-31 13:10 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1314715362.2935.27.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Tue, Aug 30, 2011 at 04:42:42PM +0200, Eric Dumazet wrote:
> Le mardi 30 août 2011 à 16:23 +0200, Ruslan N. Marchenko a écrit :
> > On Tue, Aug 30, 2011 at 03:46:24PM +0200, Ruslan N. Marchenko wrote:
> > > On Tue, Aug 30, 2011 at 03:23:48PM +0200, Eric Dumazet wrote:
> > > > 
> > > > What kernel version are you using ?
> > > > 
> > > Oh, sorry for missing it, it runs on 
> > > Linux ruff.mobi 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:05:14 UTC 2011 i686 i686 i386 GNU/Linux
> > > 
> > > Just fyi - the openwrt box to which it is connected is 
> > > Linux OpenWrt 2.6.39.2 #2 Fri Aug 12 09:36:23 EEST 2011 mips GNU/Linux
> > > although packet drop happens even if there're no vlans configured on remote side.
> > > 
> > Here is double-tag sample:
> > 16:20:31.151268 e0:46:9a:4e:88:1d > 00:26:18:40:21:62, ethertype 802.1Q (0x8100), length 106: vlan 2112, p 7, ethertype 802.1Q, vlan 6, p 0, ethertype IPv4, [|ip]
> >         0x0000:  0026 1840 2162 e046 9a4e 881d 8100 e840
> >         0x0010:  8100 0006 0800 4500 0054 abec 0000
> > 
> > 
> 
> Latest kernel should be fine. Some patches need to be backported by
> Ubuntu team, if you can test them.
> 
> commit 9331db4f00cfee8a79d2147ac83723ef436b9759
> Author: Jiri Pirko <jpirko@redhat.com>
> Date:   Wed Aug 17 23:50:37 2011 -0700
> 
>     forcedeth: call vlan_mode only if hw supports vlans
>     
>     If hw does not support vlans, dont call nv_vlan_mode because it has no point.
>     I believe that this should fix issues on older non-vlan supportive
>     chips (like Ingo has).
>     
>     Reported-ty: Ingo Molnar <mingo@elte.hu>
>     Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> commit 0891b0e08937aaec2c4734acb94c5ff8042313bb
> Author: Jiri Pirko <jpirko@redhat.com>
> Date:   Tue Jul 26 10:19:28 2011 +0000
> 
>     forcedeth: fix vlans
>     
>     For some reason, when rxaccel is disabled, NV_RX3_VLAN_TAG_PRESENT is
>     still set and some pseudorandom vids appear. So check for
>     NETIF_F_HW_VLAN_RX as well. Also set correctly hw_features and set vlan
>     mode on probe.
>     
>     Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> commit 3326c784c9f492e988617d93f647ae0cfd4c8d09
> Author: Jiri Pirko <jpirko@redhat.com>
> Date:   Wed Jul 20 04:54:38 2011 +0000
> 
>     forcedeth: do vlan cleanup
>     
>     - unify vlan and nonvlan rx path
>     - kill np->vlangrp and nv_vlan_rx_register
>     - allow to turn on/off rx vlan accel via ethtool (set_features)
>     
>     Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> 

Thanks Eric for quick hint, atom n270 however is not as fast in compiling kernel :D
I'm trying to backport the patch (and dependencies) and compile kernel with it, takes lot of time though. Will report back and raise a report/request to ubuntu kernel team. Anyway it seems exactly what I have.

Cheers,
Ruslan

^ permalink raw reply

* Re: [PATCH 2/2] Add a netlink attribute INET_DIAG_SECCTX
From: Stephen Smalley @ 2011-08-31 12:08 UTC (permalink / raw)
  To: rongqing.li; +Cc: netdev, selinux, linux-security-module
In-Reply-To: <1314779777-12669-3-git-send-email-rongqing.li@windriver.com>

On Wed, 2011-08-31 at 16:36 +0800, rongqing.li@windriver.com wrote:
> From: Roy.Li <rongqing.li@windriver.com>
> 
> Add a new netlink attribute INET_DIAG_SECCTX to dump the security
> context of TCP sockets.
> 
> The element sk_security of struct sock represents the socket
> security context ID, which is inherited from the parent process
> when the socket is created.
> 
> but when SELinux type_transition rule is applied to socket, or
> application sets /proc/xxx/attr/createsock, the socket security
> context would be different from the creating process. For these
> conditions, the "netstat -Z" will return wrong value, since
> "netstat -Z" only returns the process security context as socket
> process security.
> 
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
>  include/linux/inet_diag.h |    3 ++-
>  net/ipv4/inet_diag.c      |   38 +++++++++++++++++++++++++++++++++-----
>  2 files changed, 35 insertions(+), 6 deletions(-)

> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 389a2e6..1faf752 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -34,6 +34,8 @@
>  
>  #include <linux/inet_diag.h>
>  
> +#define MAX_SECCTX_LEN 128

We don't impose such a (low) limit on other interfaces for reporting
security contexts.  Can you just size the buffer appropriately for the
actual secctx length?

-- 
Stephen Smalley
National Security Agency


^ permalink raw reply

* Re: [PATCH 7/7] bnx2x: expose HW RX VLAN stripping toggle
From: Vlad Zolotarov @ 2011-08-31 12:01 UTC (permalink / raw)
  To: Michal Schmidt
  Cc: Michał Mirosław, netdev@vger.kernel.org, Dmitry Kravkov,
	Eilon Greenstein
In-Reply-To: <4E5D3A43.1060202@redhat.com>

On Tuesday 30 August 2011 22:30:11 Michal Schmidt wrote:

> > and then also in fp->flags.  Are the
> > fp->flags strictly mirroring hardware state (as in: there is no way
> > the states can differ in any point in time where the flags are
> > tested)?
> 
> Yes. This is the purpose of the second mirroring of the flag.

Michal,
although the above is true i'd say it's a bit of an overkill:
RX VLAN stripping is configured in a function level, so keeping it in a per 
queue level is not needed. 

The problem u were trying to resolve (and u resolved it) was to separate the 
RX_VLAN_ENABLED flag semantics into two: requested feature and HW configured 
feature in order to further check the second in the fast path, while setting 
the first one in the set_features(). Then the second lag is updated according 
to the first one during the loading of the function (bnx2x_nic_load()).

Therefore it would be enough to just add those two flags in the function (bp) 
level keeping the rest of your patch as it is. This would also cancel the need 
for a patch 6.

Thanks,
vlad

^ permalink raw reply

* [PATCH 14/14] r8169: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Realtek linux nic maintainers, Francois Romieu
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
Cc: Francois Romieu <romieu@fr.zoreil.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/realtek/r8169.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 1cf8c3c..835bbb5 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5027,7 +5027,7 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
 
 		txd = tp->TxDescArray + entry;
 		len = frag->size;
-		addr = ((void *) page_address(frag->page)) + frag->page_offset;
+		addr = skb_frag_address(frag);
 		mapping = dma_map_single(d, addr, len, DMA_TO_DEVICE);
 		if (unlikely(dma_mapping_error(d, mapping))) {
 			if (net_ratelimit())
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 13/14] qlge: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev
  Cc: Ian Campbell, Anirban Chakraborty, Jitendra Kalsaria, Ron Mercer,
	linux-driver
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
Cc: linux-driver@qlogic.com
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 39360c4..ce6c6fe 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1431,10 +1431,8 @@ static int ql_map_send(struct ql_adapter *qdev,
 			map_idx++;
 		}
 
-		map =
-		    pci_map_page(qdev->pdev, frag->page,
-				 frag->page_offset, frag->size,
-				 PCI_DMA_TODEVICE);
+		map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
+				       PCI_DMA_TODEVICE);
 
 		err = pci_dma_mapping_error(qdev->pdev, map);
 		if (err) {
@@ -1477,8 +1475,6 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev,
 {
 	struct sk_buff *skb;
 	struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring);
-	struct skb_frag_struct *rx_frag;
-	int nr_frags;
 	struct napi_struct *napi = &rx_ring->napi;
 
 	napi->dev = qdev->ndev;
@@ -1492,12 +1488,10 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev,
 		return;
 	}
 	prefetch(lbq_desc->p.pg_chunk.va);
-	rx_frag = skb_shinfo(skb)->frags;
-	nr_frags = skb_shinfo(skb)->nr_frags;
-	rx_frag += nr_frags;
-	rx_frag->page = lbq_desc->p.pg_chunk.page;
-	rx_frag->page_offset = lbq_desc->p.pg_chunk.offset;
-	rx_frag->size = length;
+	__skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,
+			     lbq_desc->p.pg_chunk.page,
+			     lbq_desc->p.pg_chunk.offset,
+			     length);
 
 	skb->len += length;
 	skb->data_len += length;
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 12/14] qlcnic: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Anirban Chakraborty, Sony Chacko, linux-driver
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: Sony Chacko <sony.chacko@qlogic.com>
Cc: linux-driver@qlogic.com
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 690c93f..501e16b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2135,8 +2135,8 @@ qlcnic_map_tx_skb(struct pci_dev *pdev,
 		frag = &skb_shinfo(skb)->frags[i];
 		nf = &pbuf->frag_array[i+1];
 
-		map = pci_map_page(pdev, frag->page, frag->page_offset,
-				frag->size, PCI_DMA_TODEVICE);
+		map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
+				       PCI_DMA_TODEVICE);
 		if (pci_dma_mapping_error(pdev, map))
 			goto unwind;
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 11/14] qla3xxx: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Ron Mercer, linux-driver
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
Cc: linux-driver@qlogic.com
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/qlogic/qla3xxx.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 8cab61c..1871d88 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2388,9 +2388,8 @@ static int ql_send_map(struct ql3_adapter *qdev,
 			seg++;
 		}
 
-		map = pci_map_page(qdev->pdev, frag->page,
-				   frag->page_offset, frag->size,
-				   PCI_DMA_TODEVICE);
+		map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
+				       PCI_DMA_TODEVICE);
 
 		err = pci_dma_mapping_error(qdev->pdev, map);
 		if (err) {
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 10/14] qeth: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev
  Cc: Ian Campbell, Ursula Braun, Frank Blaschka, linux390,
	Martin Schwidefsky, Heiko Carstens, linux-s390
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ursula Braun <ursula.braun@de.ibm.com>
Cc: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Cc: linux390@de.ibm.com
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 drivers/s390/net/qeth_core_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 97172f8..8153443 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3694,7 +3694,8 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
 
 	for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
 		frag = &skb_shinfo(skb)->frags[cnt];
-		buffer->element[element].addr = (char *)page_to_phys(frag->page)
+		buffer->element[element].addr = (char *)
+			page_to_phys(skb_frag_page(frag))
 			+ frag->page_offset;
 		buffer->element[element].length = frag->size;
 		buffer->element[element].eflags = SBAL_EFLAGS_MIDDLE_FRAG;
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 09/14] pasemi: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Olof Johansson
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/pasemi/pasemi_mac.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index fad620d..5322095 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -1505,9 +1505,8 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
 	for (i = 0; i < nfrags; i++) {
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-		map[i+1] = pci_map_page(mac->dma_pdev, frag->page,
-					frag->page_offset, frag->size,
-					PCI_DMA_TODEVICE);
+		map[i + 1] = skb_frag_dma_map(&mac->dma_pdev->dev, frag, 0,
+					      frag->size, PCI_DMA_TODEVICE);
 		map_size[i+1] = frag->size;
 		if (pci_dma_mapping_error(mac->dma_pdev, map[i+1])) {
 			nfrags = i;
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 08/14] ns83820: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/natsemi/ns83820.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
index 1a1e20e..e0895e4 100644
--- a/drivers/net/ethernet/natsemi/ns83820.c
+++ b/drivers/net/ethernet/natsemi/ns83820.c
@@ -1160,9 +1160,8 @@ again:
 		if (!nr_frags)
 			break;
 
-		buf = pci_map_page(dev->pci_dev, frag->page,
-				   frag->page_offset,
-				   frag->size, PCI_DMA_TODEVICE);
+		buf = skb_frag_dma_map(&dev->pci_dev->dev, frag, 0,
+				       frag->size, PCI_DMA_TODEVICE);
 		dprintk("frag: buf=%08Lx  page=%08lx offset=%08lx\n",
 			(long long)buf, (long) page_to_pfn(frag->page),
 			frag->page_offset);
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 07/14] niu: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:46 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/sun/niu.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 3c9ef1c..cad58f2 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3290,11 +3290,8 @@ static void niu_rx_skb_append(struct sk_buff *skb, struct page *page,
 			      u32 offset, u32 size)
 {
 	int i = skb_shinfo(skb)->nr_frags;
-	skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-	frag->page = page;
-	frag->page_offset = offset;
-	frag->size = size;
+	__skb_fill_page_desc(skb, i, page, offset, size);
 
 	skb->len += size;
 	skb->data_len += size;
@@ -6737,7 +6734,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 		len = frag->size;
-		mapping = np->ops->map_page(np->device, frag->page,
+		mapping = np->ops->map_page(np->device, skb_frag_page(frag),
 					    frag->page_offset, len,
 					    DMA_TO_DEVICE);
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 06/14] netxen: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:46 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Sony Chacko, Rajesh Borundia
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Sony Chacko <sony.chacko@qlogic.com>
Cc: Rajesh Borundia <rajesh.borundia@qlogic.com>
Cc: netdev@vger.kernel.org
---
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index de18e47..694130e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1844,8 +1844,8 @@ netxen_map_tx_skb(struct pci_dev *pdev,
 		frag = &skb_shinfo(skb)->frags[i];
 		nf = &pbuf->frag_array[i+1];
 
-		map = pci_map_page(pdev, frag->page, frag->page_offset,
-				frag->size, PCI_DMA_TODEVICE);
+		map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
+				       PCI_DMA_TODEVICE);
 		if (pci_dma_mapping_error(pdev, map))
 			goto unwind;
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 05/14] mv643xx: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:46 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell, Lennert Buytenhek
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/marvell/mv643xx_eth.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 1e2c9f07..7325737 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -752,10 +752,10 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb)
 
 		desc->l4i_chk = 0;
 		desc->byte_cnt = this_frag->size;
-		desc->buf_ptr = dma_map_page(mp->dev->dev.parent,
-					     this_frag->page,
-					     this_frag->page_offset,
-					     this_frag->size, DMA_TO_DEVICE);
+		desc->buf_ptr = skb_frag_dma_map(mp->dev->dev.parent,
+						 this_frag, 0,
+						 this_frag->size,
+						 DMA_TO_DEVICE);
 	}
 }
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 04/14] macvtap: convert to SKB paged frag API.
From: Ian Campbell @ 2011-08-31 10:46 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell
In-Reply-To: <1314787608.28989.41.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/macvtap.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index ab96c31..7c3f84a 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -503,10 +503,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
 		skb->truesize += len;
 		atomic_add(len, &skb->sk->sk_wmem_alloc);
 		while (len) {
-			f = &skb_shinfo(skb)->frags[i];
-			f->page = page[i];
-			f->page_offset = base & ~PAGE_MASK;
-			f->size = min_t(int, len, PAGE_SIZE - f->page_offset);
+			__skb_fill_page_desc(
+				skb, i, page[i],
+				base & ~PAGE_MASK,
+				min_t(int, len, PAGE_SIZE - f->page_offset));
 			skb_shinfo(skb)->nr_frags++;
 			/* increase sk_wmem_alloc */
 			base += f->size;
-- 
1.7.2.5

^ permalink raw reply related


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