Netdev List
 help / color / mirror / Atom feed
* (unknown)
From: julien.parvole @ 2014-11-13  2:10 UTC (permalink / raw)




Greetings,

I hope this proposal meets you in a good state of health.

Please can you help me re-profile fund? I am Mr Nobuyuki Hirano,  
President and CEO of The Bank of Tokyo-Mitsubishi UFJ. A sum of Twenty  
three million, two Hundred Thousand dollars  was deposited by my Late  
customer (Fadel Ahmed) who died without declaring any next of kin  
before his death in 2009.

My suggestion to you is to stand as the next of kin to Fadel Ahmed. We  
shall share in the ratio of 50% for me, 50% for you. Please contact me  
via this e- mail: mr.nobuyukihirano@foxmail.com thanks.

Sincerely,
Mr. Nobuyuki Hirano

^ permalink raw reply

* Re: [PATCH net-next 2/2] r8152: adjust rtl_start_rx
From: David Miller @ 2014-11-13  3:31 UTC (permalink / raw)
  To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb
In-Reply-To: <0835B3720019904CB8F7AA43166CEEB2ECE8EF@RTITMBSV03.realtek.com.tw>

From: Hayes Wang <hayeswang@realtek.com>
Date: Thu, 13 Nov 2014 02:31:14 +0000

> My last method which I mentioned yesterday is similar to
> this one. The difference is that I would re-use the rx
> buffers, so I have to add them to the list for re-submitting,
> not alwayes allocate new one.
> 
> Although one rx buffer could contain many packets, I don't
> think the whole size of the rx buffer is alwayes used.
> Therefore, I re-use the rx buffers to avoid allocating
> the 16K bytes rx buffer alwayes. This also makes sure that
> I always have the buffers to submit without allocating new
> one.
> 
> If you could accept this, I would modify this patch by
> this way.

I'll reread your original patch and think some more about this.

Thanks.

^ permalink raw reply

* Re: [PATCH net-next] net: systemport: fix tx work done in TX napi poll
From: David Miller @ 2014-11-13  3:21 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, edumazet
In-Reply-To: <1415835643-13767-1-git-send-email-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 12 Nov 2014 15:40:43 -0800

> With commit d75b1ade567 ("net: less interrupt masking in NAPI") napi
> repoll is done only when work_done == budget. bcm_sysport_tx_poll()
> always returns 0 whether or not we completed the poll quantum.
> 
> Fix this by returning either 0 when we did complete the TX ring reclaim,
> or budget to trigger a repoll.
> 
> Fixes: d75b1ade567 ("net: less interrupt masking in NAPI")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] enic: fix work done in tx napi_poll
From: David Miller @ 2014-11-13  3:18 UTC (permalink / raw)
  To: f.fainelli; +Cc: _govind, netdev, ssujith, edumazet
In-Reply-To: <5463F0C6.80501@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 12 Nov 2014 15:44:06 -0800

> On 11/12/2014 02:42 PM, Govindarajulu Varadarajan wrote:
>> With the commit d75b1ade567 ("net: less interrupt masking in NAPI") napi repoll
>> is done only when work_done == budget. In tx napi poll we always return 0.
>> So tx napi is not called again and we do not clean up the tx ring.
> 
> Good catch, I had exactly the same bug in bcmsysport.c, sounds like
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c could also need a fix.
> 
> Thanks!
> 
>> 
>> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>

Applied, thanks everyone.

^ permalink raw reply

* Re: [PATCH] irda: Fix build failures after IRDA_DEBUG->pr_debug
From: David Miller @ 2014-11-13  3:01 UTC (permalink / raw)
  To: joe; +Cc: samuel, netdev, fengguang.wu
In-Reply-To: <1415844947.4269.5.camel@perches.com>

From: Joe Perches <joe@perches.com>
Date: Wed, 12 Nov 2014 18:15:47 -0800

> Fix the build failures that result from the use of pr_debug
> without the referenced char * arrays being defined.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
 ...
> Let me know if you want this as a a patch or a
> reversion followed by a consolidated new version.

I'll just apply this patch, it's the cleanest thing to do at this
point.

Thanks.

^ permalink raw reply

* [PATCH] brcmfmac: kill URB when request timed out
From: Mathy Vanhoef @ 2014-11-13  2:33 UTC (permalink / raw)
  To: brudley, arend, frankyl, meuleman, John Linville, pieterpg,
	linux-wireless, brcm80211-dev-list, netdev, linux-kernel

Kill the submitted URB in brcmf_usb_dl_cmd if the request timed out. This
assures the URB is never submitted twice. It also prevents a possible
use-after-free of the URB transfer buffer if a timeout occurs.

Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
---
For a discussion about this patch and the underlying problem, see the mails
with as subject "[PATCH] brcmfmac: unlink URB when request timed out".

 drivers/net/wireless/brcm80211/brcmfmac/usb.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index 5265aa7..4572def 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -738,10 +738,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd,
 		goto finalize;
 	}
 
-	if (!brcmf_usb_ioctl_resp_wait(devinfo))
+	if (!brcmf_usb_ioctl_resp_wait(devinfo)) {
+		usb_kill_urb(devinfo->ctl_urb);
 		ret = -ETIMEDOUT;
-	else
+	} else {
 		memcpy(buffer, tmpbuf, buflen);
+	}
 
 finalize:
 	kfree(tmpbuf);
-- 
1.7.10.4

^ permalink raw reply related

* RE: [PATCH net-next 2/2] r8152: adjust rtl_start_rx
From: Hayes Wang @ 2014-11-13  2:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev@vger.kernel.org, nic_swsd, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
In-Reply-To: <20141112.144949.645590790916569141.davem@davemloft.net>

David Miller [mailto:davem@davemloft.net] 
> Sent: Thursday, November 13, 2014 3:50 AM
[...]
> > According to the usbnet.c, it would make sure to submit the
> > number of min(10, RX_QLEN(dev)) rx buffers. If there are
> > not enough rx buffers, it schedule a tasklet for next try.
> > 
> > The brief flow is as following.
> > 1. Call open().
> >    - schedule a tasklet.
> > 2. Tasklet is called.
> >    if (dev->rxq.qlen < RX_QLEN(dev)) {
> > 	   - submit rx buffers util the number of
> > 	     min(10, RX_QLEN(dev)). If the error
> > 	     occurs, break the loop.
> > 	   - If the dev->rxq.qlen < RX_QLEN(dev),
> > 	     schedule the tasklet.
> >    }
> 
> That sounds like a better recovery model, why don't you mimick it?

My last method which I mentioned yesterday is similar to
this one. The difference is that I would re-use the rx
buffers, so I have to add them to the list for re-submitting,
not alwayes allocate new one.

Although one rx buffer could contain many packets, I don't
think the whole size of the rx buffer is alwayes used.
Therefore, I re-use the rx buffers to avoid allocating
the 16K bytes rx buffer alwayes. This also makes sure that
I always have the buffers to submit without allocating new
one.

If you could accept this, I would modify this patch by
this way.
 
Best Regards,
Hayes

^ permalink raw reply

* [PATCH] irda: Fix build failures after IRDA_DEBUG->pr_debug
From: Joe Perches @ 2014-11-13  2:15 UTC (permalink / raw)
  To: David Miller; +Cc: samuel, netdev, Fengguang Wu
In-Reply-To: <1415840172.4269.1.camel@perches.com>

Fix the build failures that result from the use of pr_debug
without the referenced char * arrays being defined.

Signed-off-by: Joe Perches <joe@perches.com>
---
On Wed, 2014-11-12 at 16:56 -0800, Joe Perches wrote:
> On Wed, 2014-11-12 at 13:57 -0500, David Miller wrote:
> > From: Joe Perches <joe@perches.com>
> > Date: Tue, 11 Nov 2014 14:44:57 -0800
> > > Use the normal kernel debugging mechanism which also
> > > enables dynamic_debug at the same time.
> > Applied to net-next, thanks Joe.
> Apologies.
> 
> There was obviously insufficient platform and
> config option testing on this patch.
> 
> David, can you lease revert and I'll work out the
> various platform options defects that have been
> reported by Fengguang's kbuild test robot.

I believe this should fix all the build failures.

Let me know if you want this as a a patch or a
reversion followed by a consolidated new version.

 net/irda/ircomm/ircomm_event.c      | 4 +---
 net/irda/ircomm/ircomm_tty_attach.c | 4 +---
 net/irda/iriap.c                    | 4 +---
 net/irda/irlap.c                    | 4 +---
 net/irda/irlap_event.c              | 4 +---
 net/irda/irlmp_event.c              | 4 +---
 6 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c
index 0476da2..b0730ac 100644
--- a/net/irda/ircomm/ircomm_event.c
+++ b/net/irda/ircomm/ircomm_event.c
@@ -54,8 +54,7 @@ const char *const ircomm_state[] = {
 	"IRCOMM_CONN",
 };
 
-#ifdef CONFIG_IRDA_DEBUG
-static const char *const ircomm_event[] = {
+static const char *const ircomm_event[] __maybe_unused = {
 	"IRCOMM_CONNECT_REQUEST",
 	"IRCOMM_CONNECT_RESPONSE",
 	"IRCOMM_TTP_CONNECT_INDICATION",
@@ -73,7 +72,6 @@ static const char *const ircomm_event[] = {
 	"IRCOMM_CONTROL_REQUEST",
 	"IRCOMM_CONTROL_INDICATION",
 };
-#endif /* CONFIG_IRDA_DEBUG */
 
 static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event,
 		      struct sk_buff *skb, struct ircomm_info *info) =
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index 549ca14..61137f8 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -89,8 +89,7 @@ const char *const ircomm_tty_state[] = {
 	"*** ERROR *** ",
 };
 
-#ifdef CONFIG_IRDA_DEBUG
-static const char *const ircomm_tty_event[] = {
+static const char *const ircomm_tty_event[] __maybe_unused = {
 	"IRCOMM_TTY_ATTACH_CABLE",
 	"IRCOMM_TTY_DETACH_CABLE",
 	"IRCOMM_TTY_DATA_REQUEST",
@@ -106,7 +105,6 @@ static const char *const ircomm_tty_event[] = {
 	"IRCOMM_TTY_GOT_LSAPSEL",
 	"*** ERROR ****",
 };
-#endif /* CONFIG_IRDA_DEBUG */
 
 static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
 		      struct sk_buff *skb, struct ircomm_tty_info *info) =
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 7a93cdd..4a7ae32a 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -43,9 +43,8 @@
 #include <net/irda/iriap_event.h>
 #include <net/irda/iriap.h>
 
-#ifdef CONFIG_IRDA_DEBUG
 /* FIXME: This one should go in irlmp.c */
-static const char *const ias_charset_types[] = {
+static const char *const ias_charset_types[] __maybe_unused = {
 	"CS_ASCII",
 	"CS_ISO_8859_1",
 	"CS_ISO_8859_2",
@@ -58,7 +57,6 @@ static const char *const ias_charset_types[] = {
 	"CS_ISO_8859_9",
 	"CS_UNICODE"
 };
-#endif	/* CONFIG_IRDA_DEBUG */
 
 static hashbin_t *iriap = NULL;
 static void *service_handle;
diff --git a/net/irda/irlap.c b/net/irda/irlap.c
index 4b011b7a..7f2cafd 100644
--- a/net/irda/irlap.c
+++ b/net/irda/irlap.c
@@ -60,8 +60,7 @@ static void __irlap_close(struct irlap_cb *self);
 static void irlap_init_qos_capabilities(struct irlap_cb *self,
 					struct qos_info *qos_user);
 
-#ifdef CONFIG_IRDA_DEBUG
-static const char *const lap_reasons[] = {
+static const char *const lap_reasons[] __maybe_unused = {
 	"ERROR, NOT USED",
 	"LAP_DISC_INDICATION",
 	"LAP_NO_RESPONSE",
@@ -71,7 +70,6 @@ static const char *const lap_reasons[] = {
 	"LAP_PRIMARY_CONFLICT",
 	"ERROR, NOT USED",
 };
-#endif	/* CONFIG_IRDA_DEBUG */
 
 int __init irlap_init(void)
 {
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index 245d87b..0e1b4d7 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -78,8 +78,7 @@ static int irlap_state_sclose (struct irlap_cb *self, IRLAP_EVENT event,
 static int irlap_state_reset_check(struct irlap_cb *, IRLAP_EVENT event,
 				   struct sk_buff *, struct irlap_info *);
 
-#ifdef CONFIG_IRDA_DEBUG
-static const char *const irlap_event[] = {
+static const char *const irlap_event[] __maybe_unused = {
 	"DISCOVERY_REQUEST",
 	"CONNECT_REQUEST",
 	"CONNECT_RESPONSE",
@@ -119,7 +118,6 @@ static const char *const irlap_event[] = {
 	"BACKOFF_TIMER_EXPIRED",
 	"MEDIA_BUSY_TIMER_EXPIRED",
 };
-#endif	/* CONFIG_IRDA_DEBUG */
 
 const char *const irlap_state[] = {
 	"LAP_NDM",
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index 22c019c..e306cf2 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -48,8 +48,7 @@ const char *const irlsap_state[] = {
 	"LSAP_SETUP_PEND",
 };
 
-#ifdef CONFIG_IRDA_DEBUG
-static const char *const irlmp_event[] = {
+static const char *const irlmp_event[] __maybe_unused = {
 	"LM_CONNECT_REQUEST",
 	"LM_CONNECT_CONFIRM",
 	"LM_CONNECT_RESPONSE",
@@ -75,7 +74,6 @@ static const char *const irlmp_event[] = {
 	"LM_LAP_DISCOVERY_CONFIRM",
 	"LM_LAP_IDLE_TIMEOUT",
 };
-#endif	/* CONFIG_IRDA_DEBUG */
 
 /* LAP Connection control proto declarations */
 static void irlmp_state_standby  (struct lap_cb *, IRLMP_EVENT,

^ permalink raw reply related

* Re: [PATCH] crypto: aesni-intel - avoid IPsec re-ordering
From: Ming Liu @ 2014-11-13  1:53 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: herbert, davem, ying.xue, linux-crypto, netdev
In-Reply-To: <20141112114859.GO6390@secunet.com>

On 11/12/2014 07:48 PM, Steffen Klassert wrote:
> On Wed, Nov 12, 2014 at 06:41:28PM +0800, Ming Liu wrote:
>> On 11/12/2014 04:41 PM, Steffen Klassert wrote:
>>> On Wed, Nov 12, 2014 at 01:49:31PM +0800, Ming Liu wrote:
>>>>   }
>>>> @@ -147,11 +149,9 @@ static void cryptd_queue_worker(struct work_struct *work)
>>>>   	preempt_disable();
>>>>   	backlog = crypto_get_backlog(&cpu_queue->queue);
>>>>   	req = crypto_dequeue_request(&cpu_queue->queue);
>>>> -	preempt_enable();
>>>> -	local_bh_enable();
>>> Everything below the local_bh_enable() should not run in atomic context
>>> as the subsequent functions may set the CRYPTO_TFM_REQ_MAY_SLEEP flag.
>> If I turn off all the CRYPTO_TFM_REQ_MAY_SLEEP in cryptd.c, is that
>> going to work?
> Well, this might make the cryptd function accessible in atomic context,
> but it does not solve the other problems with this approach. Also,
> cryptd can be used to move requests out of atomic context and I think
> it should stay as it is.

OK, got it. Thanks for the information.

the best,
thank you
>
>

^ permalink raw reply

* Re: [PATCH] crypto: aesni-intel - avoid IPsec re-ordering
From: Ming Liu @ 2014-11-13  1:52 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Herbert Xu, davem, ying.xue, linux-crypto, netdev
In-Reply-To: <20141112114316.GN6390@secunet.com>

On 11/12/2014 07:43 PM, Steffen Klassert wrote:
> On Wed, Nov 12, 2014 at 06:41:30PM +0800, Ming Liu wrote:
>> On 11/12/2014 04:51 PM, Herbert Xu wrote:
>>> On Wed, Nov 12, 2014 at 09:41:38AM +0100, Steffen Klassert wrote:
>>>> Can't we just use cryptd unconditionally to fix this reordering problem?
>>> I think the idea is that most of the time cryptd isn't required
>>> so we want to stick with direct processing to lower latency.
>>>
>>> I think the simplest fix would be to punt to cryptd as long as
>>> there are cryptd requests queued.
>> I've tried that method when I started to think about the fix, but it
>> will cause 2 other issues per test while resolving the reordering
>> one, as follows:
>> 1 The work queue can not handle so many packets when the traffic is
>> very high(over 200M/S), and it would drop most of them when the
>> queue length is beyond CRYPTD_MAX_CPU_QLEN.
> That's why I've proposed to adjust CRYPTD_MAX_CPU_QLEN in my other mail.
> But anyway, it still does not fix the reorder problem completely.
> We still have a problem if subsequent algorithms run asynchronously
> or if we get interrupted while we are processing the last request
> from the queue.
>
> I think we have only two options, either processing all calls
> directly or use cryptd unconditionally. Mixing direct and
> asynchronous calls will lead to problems.
>
> If we don't want to use cryptd unconditionally, we could use
> direct calls for all requests. If the fpu is not usable, we
> maybe could fallback to an algorithm that does not need the
> fpu, such as aes-generic.
Yes, this is a good idea, I will try to work on it based on your 
suggestion. Thanks!

the best,
thank you
>
>
>

^ permalink raw reply

* [PATCH 2/2] net/smsc911x: Fix delays in the PHY enable/disable routines
From: Alexander Kochetkov @ 2014-11-13  1:26 UTC (permalink / raw)
  To: netdev; +Cc: steve.glendinning, Alexander Kochetkov
In-Reply-To: <1415841980-14250-1-git-send-email-al.kochet@gmail.com>

Increased delay in the smsc911x_phy_disable_energy_detect (from 1ms to 2ms).
Dropped delays in the smsc911x_phy_enable_energy_detect (100ms and 1ms).

The patch affect SMSC LAN generation 4 chips with integrated PHY (LAN9221).

I saw problems with soft reset due to wrong udelay timings.
After I fixed udelay, I measured the time needed to bring integrated PHY
from power-down to operational mode (the time beetween clearing EDPWRDOWN
bit and soft reset complete event). I got 1ms (measured using ktime_get).
The value is equal to the current value (1ms) used in the
smsc911x_phy_disable_energy_detect. It is near the upper bound and in order
to avoid rare soft reset faults it is doubled (2ms).

I don't know official timing for bringing up integrated PHY as specs doesn't
clarify this (or may be I didn't found).

It looks safe to drop delays before and after setting EDPWRDOWN bit
(enable PHY power-down mode). I didn't saw any regressions with the patch.

The patch was reviewed by Steve Glendinning and Microchip Team.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Acked-by: Steve Glendinning <steve.glendinning@shawell.net>
---
 drivers/net/ethernet/smsc/smsc911x.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index c657184..b2b3170 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1366,8 +1366,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
 			SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
 			return rc;
 		}
-
-		mdelay(1);
+		/* Allow PHY to wakeup */
+		mdelay(2);
 	}
 
 	return 0;
@@ -1389,7 +1389,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)
 
 	/* Only enable if energy detect mode is already disabled */
 	if (!(rc & MII_LAN83C185_EDPWRDOWN)) {
-		mdelay(100);
 		/* Enable energy detect mode for this SMSC Transceivers */
 		rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
 			       rc | MII_LAN83C185_EDPWRDOWN);
@@ -1398,8 +1397,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)
 			SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
 			return rc;
 		}
-
-		mdelay(1);
 	}
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 1/2] net/smsc911x: Fix rare soft reset timeout issue due to PHY power-down mode
From: Alexander Kochetkov @ 2014-11-13  1:26 UTC (permalink / raw)
  To: netdev; +Cc: steve.glendinning, Alexander Kochetkov

The patch affect SMSC LAN generation 4 chips with integrated PHY (LAN9221).

It is possible that PHY could enter power-down mode (ENERGYON clear),
between ENERGYON bit check in smsc911x_phy_disable_energy_detect and SRST
bit set in smsc911x_soft_reset. This could happen, for example, if someone
disconnect ethernet cable between the checks. The PHY in a power-down mode
would prevent the MAC portion of chip to be software reseted.

Initially found by code review, confirmed later using test case.

This is low probability issue, and in order to reproduce it you have to
run the script:

while true; do
	ifconfig eth0 down
	ifconfig eth0 up || break
done

While the script is running you have to plug/unplug ethernet cable many
times (using gpio controlled ethernet switch, for example) until get:

[ 4516.477783] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 4516.512207] smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xce006000, IRQ: 336
[ 4516.524658] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 4516.559082] smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xce006000, IRQ: 336
[ 4516.571990] ADDRCONF(NETDEV_UP): eth0: link is not ready
ifconfig: SIOCSIFFLAGS: Input/output error

The patch was reviewed by Steve Glendinning and Microchip Team.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Acked-by: Steve Glendinning <steve.glendinning@shawell.net>
---
 drivers/net/ethernet/smsc/smsc911x.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 8564f23..c657184 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1356,12 +1356,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
 		return rc;
 	}
 
-	/*
-	 * If energy is detected the PHY is already awake so is not necessary
-	 * to disable the energy detect power-down mode.
-	 */
-	if ((rc & MII_LAN83C185_EDPWRDOWN) &&
-	    !(rc & MII_LAN83C185_ENERGYON)) {
+	/* Only disable if energy detect mode is already enabled */
+	if (rc & MII_LAN83C185_EDPWRDOWN) {
 		/* Disable energy detect mode for this SMSC Transceivers */
 		rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
 			       rc & (~MII_LAN83C185_EDPWRDOWN));
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next] cxgb4i/cxgb4 : Refactor macros to conform to uniform standards
From: Anish Bhatt @ 2014-11-13  1:15 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA, linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, hch-wEGCiKHe2LqWVfeAwA7xHQ,
	jbottomley-bzQdu9zFT3WakBO8gow8eQ, roland-BHEL68pLQRGGvPXPguhicg,
	hariprasad-ut6Up61K2wZBDgjK7y7TUQ, kxie-ut6Up61K2wZBDgjK7y7TUQ,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW, Anish Bhatt

Refactored all macros used in cxgb4i as part of previously started cxgb4 macro
names cleanup. Makes them more uniform and avoids namespace collision.
Minor changes in other drivers where required as some of these macros are used
 by multiple drivers, affected drivers are iw_cxgb4, cxgb4(vf) & csiostor

Signed-off-by: Anish Bhatt <anish-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/cm.c                | 104 ++++++++++----------
 drivers/infiniband/hw/cxgb4/mem.c               |  20 ++--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |   4 +-
 drivers/net/ethernet/chelsio/cxgb4/l2t.c        |   2 +-
 drivers/net/ethernet/chelsio/cxgb4/sge.c        |   2 +-
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h     | 120 +++++++++++++++++-------
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   |   6 +-
 drivers/net/ethernet/chelsio/cxgb4vf/sge.c      |   2 +-
 drivers/scsi/csiostor/csio_lnode.c              |   2 +-
 drivers/scsi/csiostor/csio_scsi.c               |   2 +-
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c              |  78 +++++++--------
 11 files changed, 200 insertions(+), 142 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index a07d8e124a80..83fa16fa4644 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -649,31 +649,31 @@ static int send_connect(struct c4iw_ep *ep)
 	 * remainder will be specified in the rx_data_ack.
 	 */
 	win = ep->rcv_win >> 10;
-	if (win > RCV_BUFSIZ_MASK)
-		win = RCV_BUFSIZ_MASK;
+	if (win > RCV_BUFSIZ_M)
+		win = RCV_BUFSIZ_M;
 
 	opt0 = (nocong ? NO_CONG(1) : 0) |
-	       KEEP_ALIVE(1) |
+	       KEEP_ALIVE_F |
 	       DELACK(1) |
-	       WND_SCALE(wscale) |
-	       MSS_IDX(mtu_idx) |
-	       L2T_IDX(ep->l2t->idx) |
-	       TX_CHAN(ep->tx_chan) |
-	       SMAC_SEL(ep->smac_idx) |
+	       WND_SCALE_V(wscale) |
+	       MSS_IDX_V(mtu_idx) |
+	       L2T_IDX_V(ep->l2t->idx) |
+	       TX_CHAN_V(ep->tx_chan) |
+	       SMAC_SEL_V(ep->smac_idx) |
 	       DSCP(ep->tos) |
-	       ULP_MODE(ULP_MODE_TCPDDP) |
-	       RCV_BUFSIZ(win);
-	opt2 = RX_CHANNEL(0) |
+	       ULP_MODE_V(ULP_MODE_TCPDDP) |
+	       RCV_BUFSIZ_V(win);
+	opt2 = RX_CHANNEL_V(0) |
 	       CCTRL_ECN(enable_ecn) |
-	       RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid);
+	       RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid);
 	if (enable_tcp_timestamps)
 		opt2 |= TSTAMPS_EN(1);
 	if (enable_tcp_sack)
 		opt2 |= SACK_EN(1);
 	if (wscale && enable_tcp_window_scaling)
-		opt2 |= WND_SCALE_EN(1);
+		opt2 |= WND_SCALE_EN_F;
 	if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) {
-		opt2 |= T5_OPT_2_VALID;
+		opt2 |= T5_OPT_2_VALID_F;
 		opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE);
 		opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */
 	}
@@ -736,7 +736,7 @@ static int send_connect(struct c4iw_ep *ep)
 			t5_req->local_ip = la->sin_addr.s_addr;
 			t5_req->peer_ip = ra->sin_addr.s_addr;
 			t5_req->opt0 = cpu_to_be64(opt0);
-			t5_req->params = cpu_to_be64(V_FILTER_TUPLE(
+			t5_req->params = cpu_to_be64(FILTER_TUPLE_V(
 						     cxgb4_select_ntuple(
 					     ep->com.dev->rdev.lldi.ports[0],
 					     ep->l2t)));
@@ -762,7 +762,7 @@ static int send_connect(struct c4iw_ep *ep)
 			t5_req6->peer_ip_lo = *((__be64 *)
 						(ra6->sin6_addr.s6_addr + 8));
 			t5_req6->opt0 = cpu_to_be64(opt0);
-			t5_req6->params = cpu_to_be64(V_FILTER_TUPLE(
+			t5_req6->params = cpu_to_be64(FILTER_TUPLE_V(
 							cxgb4_select_ntuple(
 						ep->com.dev->rdev.lldi.ports[0],
 						ep->l2t)));
@@ -1249,15 +1249,15 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits)
 	 * due to the limit in the number of bits in the RCV_BUFSIZ field,
 	 * then add the overage in to the credits returned.
 	 */
-	if (ep->rcv_win > RCV_BUFSIZ_MASK * 1024)
-		credits += ep->rcv_win - RCV_BUFSIZ_MASK * 1024;
+	if (ep->rcv_win > RCV_BUFSIZ_M * 1024)
+		credits += ep->rcv_win - RCV_BUFSIZ_M * 1024;
 
 	req = (struct cpl_rx_data_ack *) skb_put(skb, wrlen);
 	memset(req, 0, wrlen);
 	INIT_TP_WR(req, ep->hwtid);
 	OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK,
 						    ep->hwtid));
-	req->credit_dack = cpu_to_be32(credits | RX_FORCE_ACK(1) |
+	req->credit_dack = cpu_to_be32(credits | RX_FORCE_ACK_F |
 				       F_RX_DACK_CHANGE |
 				       V_RX_DACK_MODE(dack_mode));
 	set_wr_txq(skb, CPL_PRIORITY_ACK, ep->ctrlq_idx);
@@ -1778,34 +1778,34 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
 	 * remainder will be specified in the rx_data_ack.
 	 */
 	win = ep->rcv_win >> 10;
-	if (win > RCV_BUFSIZ_MASK)
-		win = RCV_BUFSIZ_MASK;
+	if (win > RCV_BUFSIZ_M)
+		win = RCV_BUFSIZ_M;
 
 	req->tcb.opt0 = (__force __be64) (TCAM_BYPASS(1) |
 		(nocong ? NO_CONG(1) : 0) |
-		KEEP_ALIVE(1) |
+		KEEP_ALIVE_F |
 		DELACK(1) |
-		WND_SCALE(wscale) |
-		MSS_IDX(mtu_idx) |
-		L2T_IDX(ep->l2t->idx) |
-		TX_CHAN(ep->tx_chan) |
-		SMAC_SEL(ep->smac_idx) |
+		WND_SCALE_V(wscale) |
+		MSS_IDX_V(mtu_idx) |
+		L2T_IDX_V(ep->l2t->idx) |
+		TX_CHAN_V(ep->tx_chan) |
+		SMAC_SEL_V(ep->smac_idx) |
 		DSCP(ep->tos) |
-		ULP_MODE(ULP_MODE_TCPDDP) |
-		RCV_BUFSIZ(win));
+		ULP_MODE_V(ULP_MODE_TCPDDP) |
+		RCV_BUFSIZ_V(win));
 	req->tcb.opt2 = (__force __be32) (PACE(1) |
 		TX_QUEUE(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) |
-		RX_CHANNEL(0) |
+		RX_CHANNEL_V(0) |
 		CCTRL_ECN(enable_ecn) |
-		RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid));
+		RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid));
 	if (enable_tcp_timestamps)
-		req->tcb.opt2 |= (__force __be32) TSTAMPS_EN(1);
+		req->tcb.opt2 |= (__force __be32)TSTAMPS_EN(1);
 	if (enable_tcp_sack)
-		req->tcb.opt2 |= (__force __be32) SACK_EN(1);
+		req->tcb.opt2 |= (__force __be32)SACK_EN(1);
 	if (wscale && enable_tcp_window_scaling)
-		req->tcb.opt2 |= (__force __be32) WND_SCALE_EN(1);
-	req->tcb.opt0 = cpu_to_be64((__force u64) req->tcb.opt0);
-	req->tcb.opt2 = cpu_to_be32((__force u32) req->tcb.opt2);
+		req->tcb.opt2 |= (__force __be32)WND_SCALE_EN_F;
+	req->tcb.opt0 = cpu_to_be64((__force u64)req->tcb.opt0);
+	req->tcb.opt2 = cpu_to_be32((__force u32)req->tcb.opt2);
 	set_wr_txq(skb, CPL_PRIORITY_CONTROL, ep->ctrlq_idx);
 	set_bit(ACT_OFLD_CONN, &ep->com.history);
 	c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
@@ -2178,28 +2178,28 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
 	 * remainder will be specified in the rx_data_ack.
 	 */
 	win = ep->rcv_win >> 10;
-	if (win > RCV_BUFSIZ_MASK)
-		win = RCV_BUFSIZ_MASK;
+	if (win > RCV_BUFSIZ_M)
+		win = RCV_BUFSIZ_M;
 	opt0 = (nocong ? NO_CONG(1) : 0) |
-	       KEEP_ALIVE(1) |
+	       KEEP_ALIVE_F |
 	       DELACK(1) |
-	       WND_SCALE(wscale) |
-	       MSS_IDX(mtu_idx) |
-	       L2T_IDX(ep->l2t->idx) |
-	       TX_CHAN(ep->tx_chan) |
-	       SMAC_SEL(ep->smac_idx) |
+	       WND_SCALE_V(wscale) |
+	       MSS_IDX_V(mtu_idx) |
+	       L2T_IDX_V(ep->l2t->idx) |
+	       TX_CHAN_V(ep->tx_chan) |
+	       SMAC_SEL_V(ep->smac_idx) |
 	       DSCP(ep->tos >> 2) |
-	       ULP_MODE(ULP_MODE_TCPDDP) |
-	       RCV_BUFSIZ(win);
-	opt2 = RX_CHANNEL(0) |
-	       RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid);
+	       ULP_MODE_V(ULP_MODE_TCPDDP) |
+	       RCV_BUFSIZ_V(win);
+	opt2 = RX_CHANNEL_V(0) |
+	       RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid);
 
 	if (enable_tcp_timestamps && req->tcpopt.tstamp)
 		opt2 |= TSTAMPS_EN(1);
 	if (enable_tcp_sack && req->tcpopt.sack)
 		opt2 |= SACK_EN(1);
 	if (wscale && enable_tcp_window_scaling)
-		opt2 |= WND_SCALE_EN(1);
+		opt2 |= WND_SCALE_EN_F;
 	if (enable_ecn) {
 		const struct tcphdr *tcph;
 		u32 hlen = ntohl(req->hdr_len);
@@ -2211,7 +2211,7 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
 	}
 	if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) {
 		u32 isn = (prandom_u32() & ~7UL) - 1;
-		opt2 |= T5_OPT_2_VALID;
+		opt2 |= T5_OPT_2_VALID_F;
 		opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE);
 		opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */
 		rpl5 = (void *)rpl;
@@ -3557,7 +3557,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
 	 * We store the qid in opt2 which will be used by the firmware
 	 * to send us the wr response.
 	 */
-	req->tcb.opt2 = htonl(V_RSS_QUEUE(rss_qid));
+	req->tcb.opt2 = htonl(RSS_QUEUE_V(rss_qid));
 
 	/*
 	 * We initialize the MSS index in TCB to 0xF.
@@ -3565,7 +3565,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
 	 * TCB picks up the correct value. If this was 0
 	 * TP will ignore any value > 0 for MSS index.
 	 */
-	req->tcb.opt0 = cpu_to_be64(V_MSS_IDX(0xF));
+	req->tcb.opt0 = cpu_to_be64(MSS_IDX_V(0xF));
 	req->cookie = (unsigned long)skb;
 
 	set_wr_txq(req_skb, CPL_PRIORITY_CONTROL, port_id);
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 9335148c1ad9..0744455cd88b 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -78,14 +78,14 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr,
 			(wait ? FW_WR_COMPL_F : 0));
 	req->wr.wr_lo = wait ? (__force __be64)(unsigned long) &wr_wait : 0L;
 	req->wr.wr_mid = cpu_to_be32(FW_WR_LEN16_V(DIV_ROUND_UP(wr_len, 16)));
-	req->cmd = cpu_to_be32(ULPTX_CMD(ULP_TX_MEM_WRITE));
+	req->cmd = cpu_to_be32(ULPTX_CMD_V(ULP_TX_MEM_WRITE));
 	req->cmd |= cpu_to_be32(V_T5_ULP_MEMIO_ORDER(1));
-	req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN(len>>5));
+	req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN_V(len>>5));
 	req->len16 = cpu_to_be32(DIV_ROUND_UP(wr_len-sizeof(req->wr), 16));
-	req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR(addr));
+	req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR_V(addr));
 
 	sgl = (struct ulptx_sgl *)(req + 1);
-	sgl->cmd_nsge = cpu_to_be32(ULPTX_CMD(ULP_TX_SC_DSGL) |
+	sgl->cmd_nsge = cpu_to_be32(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
 				    ULPTX_NSGE(1));
 	sgl->len0 = cpu_to_be32(len);
 	sgl->addr0 = cpu_to_be64(data);
@@ -107,12 +107,12 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len,
 	u8 wr_len, *to_dp, *from_dp;
 	int copy_len, num_wqe, i, ret = 0;
 	struct c4iw_wr_wait wr_wait;
-	__be32 cmd = cpu_to_be32(ULPTX_CMD(ULP_TX_MEM_WRITE));
+	__be32 cmd = cpu_to_be32(ULPTX_CMD_V(ULP_TX_MEM_WRITE));
 
 	if (is_t4(rdev->lldi.adapter_type))
-		cmd |= cpu_to_be32(ULP_MEMIO_ORDER(1));
+		cmd |= cpu_to_be32(ULP_MEMIO_ORDER_F);
 	else
-		cmd |= cpu_to_be32(V_T5_ULP_MEMIO_IMM(1));
+		cmd |= cpu_to_be32(T5_ULP_MEMIO_IMM_F);
 
 	addr &= 0x7FFFFFF;
 	PDBG("%s addr 0x%x len %u\n", __func__, addr, len);
@@ -144,14 +144,14 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len,
 				       FW_WR_LEN16_V(DIV_ROUND_UP(wr_len, 16)));
 
 		req->cmd = cmd;
-		req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN(
+		req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN_V(
 				DIV_ROUND_UP(copy_len, T4_ULPTX_MIN_IO)));
 		req->len16 = cpu_to_be32(DIV_ROUND_UP(wr_len-sizeof(req->wr),
 						      16));
-		req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR(addr + i * 3));
+		req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR_V(addr + i * 3));
 
 		sc = (struct ulptx_idata *)(req + 1);
-		sc->cmd_more = cpu_to_be32(ULPTX_CMD(ULP_TX_SC_IMM));
+		sc->cmd_more = cpu_to_be32(ULPTX_CMD_V(ULP_TX_SC_IMM));
 		sc->len = cpu_to_be32(roundup(copy_len, T4_ULPTX_MIN_IO));
 
 		to_dp = (u8 *)(sc + 1);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 660bf0f79ac5..19ffe9bc1933 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -3476,7 +3476,7 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid,
 	req->local_ip = sip;
 	req->peer_ip = htonl(0);
 	chan = rxq_to_chan(&adap->sge, queue);
-	req->opt0 = cpu_to_be64(TX_CHAN(chan));
+	req->opt0 = cpu_to_be64(TX_CHAN_V(chan));
 	req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
 				SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
 	ret = t4_mgmt_tx(adap, skb);
@@ -3519,7 +3519,7 @@ int cxgb4_create_server6(const struct net_device *dev, unsigned int stid,
 	req->peer_ip_hi = cpu_to_be64(0);
 	req->peer_ip_lo = cpu_to_be64(0);
 	chan = rxq_to_chan(&adap->sge, queue);
-	req->opt0 = cpu_to_be64(TX_CHAN(chan));
+	req->opt0 = cpu_to_be64(TX_CHAN_V(chan));
 	req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
 				SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
 	ret = t4_mgmt_tx(adap, skb);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
index 96041397ee15..1eca0e21f738 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
@@ -436,7 +436,7 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
 	if (tp->vnic_shift >= 0) {
 		u32 viid = cxgb4_port_viid(dev);
 		u32 vf = FW_VIID_VIN_GET(viid);
-		u32 pf = FW_VIID_PFN_GET(viid);
+		u32 pf = FW_VIID_PFN_G(viid);
 		u32 vld = FW_VIID_VIVLD_GET(viid);
 
 		ntuple |= (u64)(V_FT_VNID_ID_VF(vf) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index dacd95008333..91dbf98036cc 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -816,7 +816,7 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *q,
 		sgl->addr0 = cpu_to_be64(addr[1]);
 	}
 
-	sgl->cmd_nsge = htonl(ULPTX_CMD(ULP_TX_SC_DSGL) | ULPTX_NSGE(nfrags));
+	sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) | ULPTX_NSGE(nfrags));
 	if (likely(--nfrags == 0))
 		return;
 	/*
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
index 5f4db2398c71..0f89f68948ab 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
@@ -205,16 +205,62 @@ struct work_request_hdr {
 #define WR_HDR struct work_request_hdr wr
 
 /* option 0 fields */
-#define S_MSS_IDX    60
-#define M_MSS_IDX    0xF
-#define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX)
-#define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
+#define TX_CHAN_S    2
+#define TX_CHAN_V(x) ((x) << TX_CHAN_S)
+
+#define ULP_MODE_S    8
+#define ULP_MODE_V(x) ((x) << ULP_MODE_S)
+
+#define RCV_BUFSIZ_S    12
+#define RCV_BUFSIZ_M    0x3FFU
+#define RCV_BUFSIZ_V(x) ((x) << RCV_BUFSIZ_S)
+
+#define SMAC_SEL_S    28
+#define SMAC_SEL_V(x) ((__u64)(x) << SMAC_SEL_S)
+
+#define L2T_IDX_S    36
+#define L2T_IDX_V(x) ((__u64)(x) << L2T_IDX_S)
+
+#define WND_SCALE_S    50
+#define WND_SCALE_V(x) ((__u64)(x) << WND_SCALE_S)
+
+#define KEEP_ALIVE_S    54
+#define KEEP_ALIVE_V(x) ((__u64)(x) << KEEP_ALIVE_S)
+#define KEEP_ALIVE_F    KEEP_ALIVE_V(1ULL)
+
+#define MSS_IDX_S    60
+#define MSS_IDX_M    0xF
+#define MSS_IDX_V(x) ((__u64)(x) << MSS_IDX_S)
+#define MSS_IDX_G(x) (((x) >> MSS_IDX_S) & MSS_IDX_M)
 
 /* option 2 fields */
-#define S_RSS_QUEUE    0
-#define M_RSS_QUEUE    0x3FF
-#define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)
-#define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE)
+#define RSS_QUEUE_S    0
+#define RSS_QUEUE_M    0x3FF
+#define RSS_QUEUE_V(x) ((x) << RSS_QUEUE_S)
+#define RSS_QUEUE_G(x) (((x) >> RSS_QUEUE_S) & RSS_QUEUE_M)
+
+#define RSS_QUEUE_VALID_S    10
+#define RSS_QUEUE_VALID_V(x) ((x) << RSS_QUEUE_VALID_S)
+#define RSS_QUEUE_VALID_F    RSS_QUEUE_VALID_V(1U)
+
+#define RX_FC_DISABLE_S    20
+#define RX_FC_DISABLE_V(x) ((x) << RX_FC_DISABLE_S)
+#define RX_FC_DISABLE_F    RX_FC_DISABLE_V(1U)
+
+#define RX_FC_VALID_S    22
+#define RX_FC_VALID_V(x) ((x) << RX_FC_VALID_S)
+#define RX_FC_VALID_F    RX_FC_VALID_V(1U)
+
+#define RX_CHANNEL_S    26
+#define RX_CHANNEL_V(x) ((x) << RX_CHANNEL_S)
+
+#define WND_SCALE_EN_S    28
+#define WND_SCALE_EN_V(x) ((x) << WND_SCALE_EN_S)
+#define WND_SCALE_EN_F    WND_SCALE_EN_V(1U)
+
+#define T5_OPT_2_VALID_S    31
+#define T5_OPT_2_VALID_V(x) ((x) << T5_OPT_2_VALID_S)
+#define T5_OPT_2_VALID_F    T5_OPT_2_VALID_V(1U)
 
 struct cpl_pass_open_req {
 	WR_HDR;
@@ -224,20 +270,11 @@ struct cpl_pass_open_req {
 	__be32 local_ip;
 	__be32 peer_ip;
 	__be64 opt0;
-#define TX_CHAN(x)    ((x) << 2)
 #define NO_CONG(x)    ((x) << 4)
 #define DELACK(x)     ((x) << 5)
-#define ULP_MODE(x)   ((x) << 8)
-#define RCV_BUFSIZ(x) ((x) << 12)
-#define RCV_BUFSIZ_MASK 0x3FFU
 #define DSCP(x)       ((x) << 22)
-#define SMAC_SEL(x)   ((u64)(x) << 28)
-#define L2T_IDX(x)    ((u64)(x) << 36)
 #define TCAM_BYPASS(x) ((u64)(x) << 48)
 #define NAGLE(x)      ((u64)(x) << 49)
-#define WND_SCALE(x)  ((u64)(x) << 50)
-#define KEEP_ALIVE(x) ((u64)(x) << 54)
-#define MSS_IDX(x)    ((u64)(x) << 60)
 	__be64 opt1;
 #define SYN_RSS_ENABLE   (1 << 0)
 #define SYN_RSS_QUEUE(x) ((x) << 2)
@@ -267,20 +304,13 @@ struct cpl_pass_accept_rpl {
 	WR_HDR;
 	union opcode_tid ot;
 	__be32 opt2;
-#define RSS_QUEUE(x)         ((x) << 0)
-#define RSS_QUEUE_VALID      (1 << 10)
 #define RX_COALESCE_VALID(x) ((x) << 11)
 #define RX_COALESCE(x)       ((x) << 12)
 #define PACE(x)	      ((x) << 16)
-#define RX_FC_VALID	     ((1U) << 19)
-#define RX_FC_DISABLE	     ((1U) << 20)
 #define TX_QUEUE(x)          ((x) << 23)
-#define RX_CHANNEL(x)        ((x) << 26)
 #define CCTRL_ECN(x)         ((x) << 27)
-#define WND_SCALE_EN(x)      ((x) << 28)
 #define TSTAMPS_EN(x)        ((x) << 29)
 #define SACK_EN(x)           ((x) << 30)
-#define T5_OPT_2_VALID	     ((1U) << 31)
 	__be64 opt0;
 };
 
@@ -305,10 +335,10 @@ struct cpl_act_open_req {
 	__be32 opt2;
 };
 
-#define S_FILTER_TUPLE  24
-#define M_FILTER_TUPLE  0xFFFFFFFFFF
-#define V_FILTER_TUPLE(x) ((x) << S_FILTER_TUPLE)
-#define G_FILTER_TUPLE(x) (((x) >> S_FILTER_TUPLE) & M_FILTER_TUPLE)
+#define FILTER_TUPLE_S  24
+#define FILTER_TUPLE_M  0xFFFFFFFFFF
+#define FILTER_TUPLE_V(x) ((x) << FILTER_TUPLE_S)
+#define FILTER_TUPLE_G(x) (((x) >> FILTER_TUPLE_S) & FILTER_TUPLE_M)
 struct cpl_t5_act_open_req {
 	WR_HDR;
 	union opcode_tid ot;
@@ -579,10 +609,16 @@ struct cpl_rx_data_ack {
 	WR_HDR;
 	union opcode_tid ot;
 	__be32 credit_dack;
-#define RX_CREDITS(x)   ((x) << 0)
-#define RX_FORCE_ACK(x) ((x) << 28)
 };
 
+/* cpl_rx_data_ack.ack_seq fields */
+#define RX_CREDITS_S    0
+#define RX_CREDITS_V(x) ((x) << RX_CREDITS_S)
+
+#define RX_FORCE_ACK_S    28
+#define RX_FORCE_ACK_V(x) ((x) << RX_FORCE_ACK_S)
+#define RX_FORCE_ACK_F    RX_FORCE_ACK_V(1U)
+
 struct cpl_rx_pkt {
 	struct rss_header rsshdr;
 	u8 opcode;
@@ -803,6 +839,9 @@ enum {
 	ULP_TX_SC_ISGL = 0x83
 };
 
+#define ULPTX_CMD_S    24
+#define ULPTX_CMD_V(x) ((x) << ULPTX_CMD_S)
+
 struct ulptx_sge_pair {
 	__be32 len[2];
 	__be64 addr[2];
@@ -810,7 +849,6 @@ struct ulptx_sge_pair {
 
 struct ulptx_sgl {
 	__be32 cmd_nsge;
-#define ULPTX_CMD(x) ((x) << 24)
 #define ULPTX_NSGE(x) ((x) << 0)
 #define ULPTX_MORE (1U << 23)
 	__be32 len0;
@@ -821,15 +859,21 @@ struct ulptx_sgl {
 struct ulp_mem_io {
 	WR_HDR;
 	__be32 cmd;
-#define ULP_MEMIO_ORDER(x) ((x) << 23)
 	__be32 len16;             /* command length */
 	__be32 dlen;              /* data length in 32-byte units */
-#define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
 	__be32 lock_addr;
-#define ULP_MEMIO_ADDR(x) ((x) << 0)
 #define ULP_MEMIO_LOCK(x) ((x) << 31)
 };
 
+/* additional ulp_mem_io.cmd fields */
+#define ULP_MEMIO_ORDER_S    23
+#define ULP_MEMIO_ORDER_V(x) ((x) << ULP_MEMIO_ORDER_S)
+#define ULP_MEMIO_ORDER_F    ULP_MEMIO_ORDER_V(1U)
+
+#define T5_ULP_MEMIO_IMM_S    23
+#define T5_ULP_MEMIO_IMM_V(x) ((x) << T5_ULP_MEMIO_IMM_S)
+#define T5_ULP_MEMIO_IMM_F    T5_ULP_MEMIO_IMM_V(1U)
+
 #define S_T5_ULP_MEMIO_IMM    23
 #define V_T5_ULP_MEMIO_IMM(x) ((x) << S_T5_ULP_MEMIO_IMM)
 #define F_T5_ULP_MEMIO_IMM    V_T5_ULP_MEMIO_IMM(1U)
@@ -838,4 +882,12 @@ struct ulp_mem_io {
 #define V_T5_ULP_MEMIO_ORDER(x) ((x) << S_T5_ULP_MEMIO_ORDER)
 #define F_T5_ULP_MEMIO_ORDER    V_T5_ULP_MEMIO_ORDER(1U)
 
+/* ulp_mem_io.lock_addr fields */
+#define ULP_MEMIO_ADDR_S    0
+#define ULP_MEMIO_ADDR_V(x) ((x) << ULP_MEMIO_ADDR_S)
+
+/* ulp_mem_io.dlen fields */
+#define ULP_MEMIO_DATA_LEN_S    0
+#define ULP_MEMIO_DATA_LEN_V(x) ((x) << ULP_MEMIO_DATA_LEN_S)
+
 #endif  /* __T4_MSG_H */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
index 7cca67fde4f4..6fc46dc11988 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
@@ -1395,7 +1395,11 @@ struct fw_eq_ofld_cmd {
  * Macros for VIID parsing:
  * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
  */
-#define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
+
+#define FW_VIID_PFN_S           8
+#define FW_VIID_PFN_M           0x7
+#define FW_VIID_PFN_G(x)        (((x) >> FW_VIID_PFN_S) & FW_VIID_PFN_M)
+
 #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
 #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
 
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index cd538afa40dd..aff6d37f2676 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -907,7 +907,7 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *tq,
 		sgl->addr0 = cpu_to_be64(addr[1]);
 	}
 
-	sgl->cmd_nsge = htonl(ULPTX_CMD(ULP_TX_SC_DSGL) |
+	sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
 			      ULPTX_NSGE(nfrags));
 	if (likely(--nfrags == 0))
 		return;
diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c
index 48e45b1ea4e5..87f9280d9b43 100644
--- a/drivers/scsi/csiostor/csio_lnode.c
+++ b/drivers/scsi/csiostor/csio_lnode.c
@@ -1757,7 +1757,7 @@ csio_ln_mgmt_submit_wr(struct csio_mgmtm *mgmtm, struct csio_ioreq *io_req,
 		csio_wr_copy_to_wrp(pld->vaddr, &wrp, wr_off, im_len);
 	else {
 		/* Program DSGL to dma payload */
-		dsgl.cmd_nsge = htonl(ULPTX_CMD(ULP_TX_SC_DSGL) |
+		dsgl.cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
 					ULPTX_MORE | ULPTX_NSGE(1));
 		dsgl.len0 = cpu_to_be32(pld_len);
 		dsgl.addr0 = cpu_to_be64(pld->paddr);
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index b37c69a2772a..b9c012ba34f8 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -322,7 +322,7 @@ csio_scsi_init_ultptx_dsgl(struct csio_hw *hw, struct csio_ioreq *req,
 	struct csio_dma_buf *dma_buf;
 	struct scsi_cmnd *scmnd = csio_scsi_cmnd(req);
 
-	sgl->cmd_nsge = htonl(ULPTX_CMD(ULP_TX_SC_DSGL) | ULPTX_MORE |
+	sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) | ULPTX_MORE |
 				     ULPTX_NSGE(req->nsge));
 	/* Now add the data SGLs */
 	if (likely(!req->dcopy)) {
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index ccacf09c2c16..ed0e16866dc7 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -188,18 +188,18 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
 	unsigned int qid_atid = ((unsigned int)csk->atid) |
 				 (((unsigned int)csk->rss_qid) << 14);
 
-	opt0 = KEEP_ALIVE(1) |
-		WND_SCALE(wscale) |
-		MSS_IDX(csk->mss_idx) |
-		L2T_IDX(((struct l2t_entry *)csk->l2t)->idx) |
-		TX_CHAN(csk->tx_chan) |
-		SMAC_SEL(csk->smac_idx) |
-		ULP_MODE(ULP_MODE_ISCSI) |
-		RCV_BUFSIZ(cxgb4i_rcv_win >> 10);
-	opt2 = RX_CHANNEL(0) |
-		RSS_QUEUE_VALID |
-		(1 << 20) |
-		RSS_QUEUE(csk->rss_qid);
+	opt0 = KEEP_ALIVE_F |
+		WND_SCALE_V(wscale) |
+		MSS_IDX_V(csk->mss_idx) |
+		L2T_IDX_V(((struct l2t_entry *)csk->l2t)->idx) |
+		TX_CHAN_V(csk->tx_chan) |
+		SMAC_SEL_V(csk->smac_idx) |
+		ULP_MODE_V(ULP_MODE_ISCSI) |
+		RCV_BUFSIZ_V(cxgb4i_rcv_win >> 10);
+	opt2 = RX_CHANNEL_V(0) |
+		RSS_QUEUE_VALID_F |
+		(RX_FC_DISABLE_F) |
+		RSS_QUEUE_V(csk->rss_qid);
 
 	if (is_t4(lldi->adapter_type)) {
 		struct cpl_act_open_req *req =
@@ -216,7 +216,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
 		req->params = cpu_to_be32(cxgb4_select_ntuple(
 					csk->cdev->ports[csk->port_id],
 					csk->l2t));
-		opt2 |= 1 << 22;
+		opt2 |= RX_FC_VALID_F;
 		req->opt2 = cpu_to_be32(opt2);
 
 		log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
@@ -236,7 +236,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
 		req->local_ip = csk->saddr.sin_addr.s_addr;
 		req->peer_ip = csk->daddr.sin_addr.s_addr;
 		req->opt0 = cpu_to_be64(opt0);
-		req->params = cpu_to_be64(V_FILTER_TUPLE(
+		req->params = cpu_to_be64(FILTER_TUPLE_V(
 				cxgb4_select_ntuple(
 					csk->cdev->ports[csk->port_id],
 					csk->l2t)));
@@ -271,19 +271,19 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
 	unsigned int qid_atid = ((unsigned int)csk->atid) |
 				 (((unsigned int)csk->rss_qid) << 14);
 
-	opt0 = KEEP_ALIVE(1) |
-		WND_SCALE(wscale) |
-		MSS_IDX(csk->mss_idx) |
-		L2T_IDX(((struct l2t_entry *)csk->l2t)->idx) |
-		TX_CHAN(csk->tx_chan) |
-		SMAC_SEL(csk->smac_idx) |
-		ULP_MODE(ULP_MODE_ISCSI) |
-		RCV_BUFSIZ(cxgb4i_rcv_win >> 10);
+	opt0 = KEEP_ALIVE_F |
+		WND_SCALE_V(wscale) |
+		MSS_IDX_V(csk->mss_idx) |
+		L2T_IDX_V(((struct l2t_entry *)csk->l2t)->idx) |
+		TX_CHAN_V(csk->tx_chan) |
+		SMAC_SEL_V(csk->smac_idx) |
+		ULP_MODE_V(ULP_MODE_ISCSI) |
+		RCV_BUFSIZ_V(cxgb4i_rcv_win >> 10);
 
-	opt2 = RX_CHANNEL(0) |
-		RSS_QUEUE_VALID |
-		RX_FC_DISABLE |
-		RSS_QUEUE(csk->rss_qid);
+	opt2 = RX_CHANNEL_V(0) |
+		RSS_QUEUE_VALID_F |
+		RX_FC_DISABLE_F |
+		RSS_QUEUE_V(csk->rss_qid);
 
 	if (t4) {
 		struct cpl_act_open_req6 *req =
@@ -304,7 +304,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
 
 		req->opt0 = cpu_to_be64(opt0);
 
-		opt2 |= RX_FC_VALID;
+		opt2 |= RX_FC_VALID_F;
 		req->opt2 = cpu_to_be32(opt2);
 
 		req->params = cpu_to_be32(cxgb4_select_ntuple(
@@ -327,10 +327,10 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
 									8);
 		req->opt0 = cpu_to_be64(opt0);
 
-		opt2 |= T5_OPT_2_VALID;
+		opt2 |= T5_OPT_2_VALID_F;
 		req->opt2 = cpu_to_be32(opt2);
 
-		req->params = cpu_to_be64(V_FILTER_TUPLE(cxgb4_select_ntuple(
+		req->params = cpu_to_be64(FILTER_TUPLE_V(cxgb4_select_ntuple(
 					  csk->cdev->ports[csk->port_id],
 					  csk->l2t)));
 	}
@@ -451,7 +451,8 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)
 	INIT_TP_WR(req, csk->tid);
 	OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK,
 				      csk->tid));
-	req->credit_dack = cpu_to_be32(RX_CREDITS(credits) | RX_FORCE_ACK(1));
+	req->credit_dack = cpu_to_be32(RX_CREDITS_V(credits)
+				       | RX_FORCE_ACK_F);
 	cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb);
 	return credits;
 }
@@ -1440,16 +1441,16 @@ static inline void ulp_mem_io_set_hdr(struct cxgb4_lld_info *lldi,
 
 	INIT_ULPTX_WR(req, wr_len, 0, 0);
 	if (is_t4(lldi->adapter_type))
-		req->cmd = htonl(ULPTX_CMD(ULP_TX_MEM_WRITE) |
-					(ULP_MEMIO_ORDER(1)));
+		req->cmd = htonl(ULPTX_CMD_V(ULP_TX_MEM_WRITE) |
+					(ULP_MEMIO_ORDER_F));
 	else
-		req->cmd = htonl(ULPTX_CMD(ULP_TX_MEM_WRITE) |
-					(V_T5_ULP_MEMIO_IMM(1)));
-	req->dlen = htonl(ULP_MEMIO_DATA_LEN(dlen >> 5));
-	req->lock_addr = htonl(ULP_MEMIO_ADDR(pm_addr >> 5));
+		req->cmd = htonl(ULPTX_CMD_V(ULP_TX_MEM_WRITE) |
+					(T5_ULP_MEMIO_IMM_F));
+	req->dlen = htonl(ULP_MEMIO_DATA_LEN_V(dlen >> 5));
+	req->lock_addr = htonl(ULP_MEMIO_ADDR_V(pm_addr >> 5));
 	req->len16 = htonl(DIV_ROUND_UP(wr_len - sizeof(req->wr), 16));
 
-	idata->cmd_more = htonl(ULPTX_CMD(ULP_TX_SC_IMM));
+	idata->cmd_more = htonl(ULPTX_CMD_V(ULP_TX_SC_IMM));
 	idata->len = htonl(dlen);
 }
 
@@ -1673,7 +1674,8 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
 	cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
 	cdev->itp = &cxgb4i_iscsi_transport;
 
-	cdev->pfvf = FW_VIID_PFN_GET(cxgb4_port_viid(lldi->ports[0])) << 8;
+	cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0]))
+			<< FW_VIID_PFN_S;
 	pr_info("cdev 0x%p,%s, pfvf %u.\n",
 		cdev, lldi->ports[0]->name, cdev->pfvf);
 
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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] net: pxa168_eth: move SET_NETDEV_DEV a bit earlier
From: Jisheng Zhang @ 2014-11-13  1:04 UTC (permalink / raw)
  To: David Miller
  Cc: antoine.tenart@free-electrons.com, arnd@arndb.de,
	sebastian.hesselbarth@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20141112.150810.806933062338696000.davem@davemloft.net>

Dear David,

On Wed, 12 Nov 2014 12:08:10 -0800
David Miller <davem@davemloft.net> wrote:

> From: Jisheng Zhang <jszhang@marvell.com>
> Date: Wed, 12 Nov 2014 19:08:47 +0800
> 
> > This is to ensure the net_device's dev.parent is set before we used it
> > in dma_zalloc_coherent() from init_hash_table().
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> 
> Please always be explicit about what tree you generated this patch against
> and therefore expect it to be applied to by saying "[PATCH net-next]" or
> similar in your Subject line.

Got it. I will take care next time.

Thanks a lot

^ permalink raw reply

* Re: [PATCH] irda: Convert IRDA_DEBUG to pr_debug
From: Joe Perches @ 2014-11-13  0:56 UTC (permalink / raw)
  To: David Miller; +Cc: samuel, netdev
In-Reply-To: <20141112.135719.707307878615480184.davem@davemloft.net>

On Wed, 2014-11-12 at 13:57 -0500, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Tue, 11 Nov 2014 14:44:57 -0800
> > Use the normal kernel debugging mechanism which also
> > enables dynamic_debug at the same time.
> Applied to net-next, thanks Joe.

Apologies.

There was obviously insufficient platform and
config option testing on this patch.

David, can you lease revert and I'll work out the
various platform options defects that have been
reported by Fengguang's kbuild test robot.

^ permalink raw reply

* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2014-11-13  0:35 UTC (permalink / raw)
  To: David Miller, netdev
  Cc: linux-next, linux-kernel, Hariprasad Shenai, Alexander Duyck

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
drivers/net/ethernet/chelsio/cxgb4vf/sge.c between commit 65f6ecc93e7c
("cxgb4vf: Move fl_starv_thres into adapter->sge data structure") from
the net tree and commit aa9cd31c3f3e ("cxgb4/cxgb4vf: Replace
__skb_alloc_page with __dev_alloc_page") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index fdd078d7d82c,cd538afa40dd..000000000000
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@@ -608,8 -614,7 +610,7 @@@ static unsigned int refill_fl(struct ad
  		goto alloc_small_pages;
  
  	while (n) {
- 		page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN,
- 				   s->fl_pg_order);
 -		page = __dev_alloc_pages(gfp, FL_PG_ORDER);
++		page = __dev_alloc_pages(gfp, s->fl_pg_order);
  		if (unlikely(!page)) {
  			/*
  			 * We've failed inour attempt to allocate a "large

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH net-next 1/1] ipvlan: Initial check-in of the IPVLAN driver.
From: Mahesh Bandewar @ 2014-11-12 23:56 UTC (permalink / raw)
  To: Pavel Emelyanov
  Cc: netdev, Eric Dumazet, Maciej Zenczykowski, Laurent Chavey,
	Tim Hockin, David Miller, Brandon Philips
In-Reply-To: <546386AF.9030300@parallels.com>

On Wed, Nov 12, 2014 at 8:11 AM, Pavel Emelyanov <xemul@parallels.com> wrote:
> On 11/12/2014 02:29 AM, Mahesh Bandewar wrote:
>> This driver is very similar to the macvlan driver except that it
>> uses L3 on the frame to determine the logical interface while
>> functioning as packet dispatcher. It inherits L2 of the master
>> device hence the packets on wire will have the same L2 for all
>> the packets originating from all virtual devices off of the same
>> master device.
>>
>> This driver was developed keeping the namespace use-case in
>> mind. Hence most of the examples given here take that as the
>> base setup where main-device belongs to the default-ns and
>> virtual devices are assigned to the additional namespaces.
>>
>> The device operates in two different modes and the difference
>> in these two modes in primarily in the TX side.
>>
>> (a) L2 mode : In this mode, the device behaves as a L2 device.
>> TX processing upto L2 happens on the stack of the virtual device
>> associated with (namespace). Packets are switched after that
>> into the main device (default-ns) and queued for xmit.
>>
>> RX processing is simple and all multicast, broadcast (if
>> applicable), and unicast belonging to the address(es) are
>> delivered to the virtual devices.
>>
>> (b) L3 mode : In this mode, the device behaves like a L3 device.
>> TX processing upto L3 happens on the stack of the virtual device
>> associated with (namespace). Packets are switched to the
>> main-device (default-ns) for the L2 processing. Hence the routing
>> table of the default-ns will be used in this mode.
>>
>> RX processins is somewhat similar to the L2 mode except that in
>> this mode only Unicast packets are delivered to the virtual device
>> while main-dev will handle all other packets.
>>
>> The devices can be added using the "ip" command from the iproute2
>> package -
>>
>>       ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ]
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Cc: Maciej Żenczykowski <maze@google.com>
>> Cc: Laurent Chavey <chavey@google.com>
>> Cc: Tim Hockin <thockin@google.com>
>> Cc: Brandon Philips <brandon.philips@coreos.com>
>> Cc: Pavel Emelianov <xemul@parallels.com>
>
> Acked-by: /me on the general idea. We use this device of type in Parallels
> heavily for several reasons -- not to generate too many MAC-s from one host
> and to "enforce" the IP address for a container. I have a comment about the
> latter below.
>
>
>> +static void *ipvlan_get_L3_hdr(struct sk_buff *skb, int *type)
>> +{
>> +     void *lyr3h = NULL;
>> +
>> +     switch (skb->protocol) {
>> +     case htons(ETH_P_ARP): {
>> +             struct arphdr *arph;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr))))
>> +                     return NULL;
>> +
>> +             arph = arp_hdr(skb);
>> +             *type = IPVL_ARP;
>> +             lyr3h = arph;
>> +             break;
>> +     }
>> +
>> +     case htons(ETH_P_IP): {
>> +             u32 pktlen;
>> +             struct iphdr *ip4h;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct iphdr))))
>> +                     return NULL;
>> +
>> +             ip4h = ip_hdr(skb);
>> +             pktlen = ntohs(ip4h->tot_len);
>> +             if (ip4h->ihl < 5 || ip4h->version != 4)
>> +                     return NULL;
>> +             if (skb->len < pktlen || pktlen < (ip4h->ihl * 4))
>> +                     return NULL;
>> +
>> +             *type = IPVL_IPV4;
>> +             lyr3h = ip4h;
>> +             break;
>> +     }
>> +     case htons(ETH_P_IPV6): {
>> +             struct ipv6hdr *ip6h;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct iphdr))))
>
> Misprint -- should be sizeof(struct ipv6hdr)
>
Good catch, will correct it!

>> +static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
>> +                        struct nlattr *tb[], struct nlattr *data[])
>> +{
>> +     struct ipvl_dev *ipvlan = netdev_priv(dev);
>> +     struct ipvl_port *port;
>> +     struct net_device *phy_dev;
>> +     int err;
>> +
>> +     ipvlan_dbg(3, "%s[%d]: Entering...\n", __func__, __LINE__);
>> +     if (!tb[IFLA_LINK]) {
>> +             ipvlan_dbg(3, "%s[%d]: Returning -EINVAL...\n",
>> +                        __func__, __LINE__);
>> +             return -EINVAL;
>> +     }
>> +
>> +     phy_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
>> +     if (phy_dev == NULL) {
>> +             ipvlan_dbg(3, "%s[%d]: Returning -ENODEV...\n",
>> +                        __func__, __LINE__);
>> +             return -ENODEV;
>> +     }
>> +
>> +     /* TODO will someone try creating ipvlan-dev on an ipvlan-virtual dev?*/
>> +     if (!ipvlan_dev_master(phy_dev)) {
>> +             err = ipvlan_port_create(phy_dev);
>> +             if (err < 0) {
>> +                     ipvlan_dbg(3, "%s[%d]: Returning error (%d)...\n",
>> +                                __func__, __LINE__, err);
>> +                     return err;
>> +             }
>> +     }
>> +
>> +     port = ipvlan_port_get_rtnl(phy_dev);
>> +     /* Get the mode if specified. */
>> +     if (data && data[IFLA_IPVLAN_MODE])
>> +             port->mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
>
> Should the invalid value be checked here? There are places
> where we BUG() in mode being "unknown".
>
Assuming the calls come over netlink, the ".validate" will be called
before ".newlink", so that would be unnecessary, isn't it?

>> +
>> +     ipvlan->phy_dev = phy_dev;
>> +     ipvlan->dev = dev;
>> +     ipvlan->port = port;
>> +     ipvlan->sfeatures = IPVLAN_FEATURES;
>> +     INIT_LIST_HEAD(&ipvlan->addrs);
>> +     ipvlan->ipv4cnt = 0;
>> +     ipvlan->ipv6cnt = 0;
>
>
>> +static int ipvlan_device_event(struct notifier_block *unused,
>> +                            unsigned long event, void *ptr)
>> +{
>> +     struct net_device *dev = netdev_notifier_info_to_dev(ptr);
>> +     struct ipvl_dev *ipvlan, *next;
>> +     struct ipvl_port *port;
>> +     LIST_HEAD(lst_kill);
>> +
>> +     if (!ipvlan_dev_master(dev))
>> +             return NOTIFY_DONE;
>> +
>> +     port = ipvlan_port_get_rtnl(dev);
>> +
>> +     switch (event) {
>> +     case NETDEV_CHANGE:
>> +             list_for_each_entry(ipvlan, &port->ipvlans, pnode)
>> +                     netif_stacked_transfer_operstate(ipvlan->phy_dev,
>> +                                                      ipvlan->dev);
>> +             break;
>> +
>> +     case NETDEV_UNREGISTER:
>> +             if (dev->reg_state != NETREG_UNREGISTERING)
>> +                     break;
>> +
>> +             list_for_each_entry_safe(ipvlan, next, &port->ipvlans,
>> +                                      pnode)
>> +                     ipvlan->dev->rtnl_link_ops->dellink(ipvlan->dev,
>> +                                                         &lst_kill);
>> +             unregister_netdevice_many(&lst_kill);
>> +             list_del(&lst_kill);
>
> This list_del seems to be excessive.
>
That is correct. Looks like unregister_netdevice_many() does it now.
I'll remove it.

>> +             break;
>> +
>
>> +static int ipvlan_addr4_event(struct notifier_block *unused,
>> +                           unsigned long event, void *ptr)
>> +{
>> +     struct in_ifaddr *if4 = (struct in_ifaddr *)ptr;
>> +     struct net_device *dev = (struct net_device *)if4->ifa_dev->dev;
>> +     struct ipvl_dev *ipvlan = netdev_priv(dev);
>> +     struct in_addr ip4_addr;
>> +
>> +     ipvlan_dbg(3, "%s[%d]: Entering...\n", __func__, __LINE__);
>> +     if (!ipvlan_dev_slave(dev))
>> +             return NOTIFY_DONE;
>> +
>> +     if (!ipvlan || !ipvlan->port)
>> +             return NOTIFY_DONE;
>> +
>> +     switch (event) {
>> +     case NETDEV_UP:
>
> Can it be (in the future) somehow restricted so that net-namespace wouldn't
> be able to assign arbitrary IP address here? One of the reasons for using
> such devices is to enforce the container to use the IP address given from
> the host.
>
Probably this could be a config (sysfs?) entry which would lockup the
config coming from ns when set. So code could look like -
          case NETDEV_UP:
                         if (!restrict_ns_config) {
                            ...
                         }
                         break;

>> +             ip4_addr.s_addr = if4->ifa_address;
>> +             if (ipvlan_add_addr4(ipvlan, &ip4_addr))
>> +                     return NOTIFY_BAD;
>> +             break;
>> +
>> +     case NETDEV_DOWN:
>> +             ip4_addr.s_addr = if4->ifa_address;
>> +             ipvlan_del_addr4(ipvlan, &ip4_addr);
>> +             break;
>> +     }
>> +
>> +     ipvlan_dbg(3, "%s[%d]: Leaving...\n", __func__, __LINE__);
>> +     return NOTIFY_OK;
>> +}
>

^ permalink raw reply

* Re: [PATCH net-next] enic: fix work done in tx napi_poll
From: Florian Fainelli @ 2014-11-12 23:44 UTC (permalink / raw)
  To: Govindarajulu Varadarajan, davem, netdev
  Cc: ssujith, edumazet@google.com >> Eric Dumazet
In-Reply-To: <1415832126-31901-1-git-send-email-_govind@gmx.com>

On 11/12/2014 02:42 PM, Govindarajulu Varadarajan wrote:
> With the commit d75b1ade567 ("net: less interrupt masking in NAPI") napi repoll
> is done only when work_done == budget. In tx napi poll we always return 0.
> So tx napi is not called again and we do not clean up the tx ring.

Good catch, I had exactly the same bug in bcmsysport.c, sounds like
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c could also need a fix.

Thanks!

> 
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
> ---
>  drivers/net/ethernet/cisco/enic/enic_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index 73cf165..5afe360 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
> @@ -1312,9 +1312,10 @@ static int enic_poll_msix_wq(struct napi_struct *napi, int budget)
>  	if (!wq_work_done) {
>  		napi_complete(napi);
>  		vnic_intr_unmask(&enic->intr[intr]);
> +		return 0;
>  	}
>  
> -	return 0;
> +	return budget;
>  }
>  
>  static int enic_poll_msix_rq(struct napi_struct *napi, int budget)
> 

^ permalink raw reply

* [PATCH net-next] net: systemport: fix tx work done in TX napi poll
From: Florian Fainelli @ 2014-11-12 23:40 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, Florian Fainelli

With commit d75b1ade567 ("net: less interrupt masking in NAPI") napi
repoll is done only when work_done == budget. bcm_sysport_tx_poll()
always returns 0 whether or not we completed the poll quantum.

Fix this by returning either 0 when we did complete the TX ring reclaim,
or budget to trigger a repoll.

Fixes: d75b1ade567 ("net: less interrupt masking in NAPI")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 531bb7c57531..3cb241155dac 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -731,9 +731,11 @@ static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget)
 		napi_complete(napi);
 		/* re-enable TX interrupt */
 		intrl2_1_mask_clear(ring->priv, BIT(ring->index));
+
+		return 0;
 	}
 
-	return 0;
+	return budget;
 }
 
 static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv)
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH net-next 1/1] ipvlan: Initial check-in of the IPVLAN driver.
From: Mahesh Bandewar @ 2014-11-12 23:36 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, Eric Dumazet, Maciej Zenczykowski, Laurent Chavey,
	Tim Hockin, David Miller, Brandon Philips, Pavel Emelianov
In-Reply-To: <1415748491.9613.41.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Nov 11, 2014 at 3:28 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2014-11-11 at 14:29 -0800, Mahesh Bandewar wrote:
>
> ...
>
>> +static void *ipvlan_get_L3_hdr(struct sk_buff *skb, int *type)
>> +{
>> +     void *lyr3h = NULL;
>> +
>> +     switch (skb->protocol) {
>> +     case htons(ETH_P_ARP): {
>> +             struct arphdr *arph;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr))))
>> +                     return NULL;
>> +
>> +             arph = arp_hdr(skb);
>> +             *type = IPVL_ARP;
>> +             lyr3h = arph;
>> +             break;
>> +     }
>> +
>> +     case htons(ETH_P_IP): {
>> +             u32 pktlen;
>> +             struct iphdr *ip4h;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct iphdr))))
>> +                     return NULL;
>> +
>> +             ip4h = ip_hdr(skb);
>> +             pktlen = ntohs(ip4h->tot_len);
>> +             if (ip4h->ihl < 5 || ip4h->version != 4)
>> +                     return NULL;
>> +             if (skb->len < pktlen || pktlen < (ip4h->ihl * 4))
>> +                     return NULL;
>> +
>> +             *type = IPVL_IPV4;
>> +             lyr3h = ip4h;
>> +             break;
>> +     }
>> +     case htons(ETH_P_IPV6): {
>> +             struct ipv6hdr *ip6h;
>> +
>> +             if (unlikely(!pskb_may_pull(skb, sizeof(struct iphdr))))
>
>         sizeof(struct ipv6hdr) or sizeof(*ip6h)
>
>> +                     return NULL;
>> +
>> +             ip6h = ipv6_hdr(skb);
>> +             if (ip6h->version != 6)
>> +                     return NULL;
>> +
>> +             *type = IPVL_IPV6;
>> +             lyr3h = ip6h;
>> +             /* Only Neighbour Solicitation pkts need different treatment */
>> +             if (ipv6_addr_any(&ip6h->saddr) &&
>> +                 ip6h->nexthdr == NEXTHDR_ICMP) {
>> +                     /* Get to the ICMPv6 header */
>> +                     *type = IPVL_ICMPV6;
>> +                     lyr3h = ip6h + 1;
>> +             }
>> +             break;
>> +     }
>> +     default:
>> +             return NULL;
>> +     }
>> +
>> +     return lyr3h;
>> +}
>
> ...
>> +static int ipvlan_process_v6_outbound(struct sk_buff *skb)
>> +{
>> +     const struct ipv6hdr *ip6h = ipv6_hdr(skb);
>> +     struct net_device *dev = skb->dev;
>> +     struct dst_entry *dst;
>> +     int err, ret = NET_XMIT_DROP;
>> +     struct flowi6 fl6 = {
>> +             .flowi6_iif = skb->dev->ifindex,
>> +             .daddr = ip6h->daddr,
>> +             .saddr = ip6h->saddr,
>> +             .flowi6_flags = FLOWI_FLAG_ANYSRC,
>> +             .flowlabel = ip6_flowinfo(ip6h),
>> +             .flowi6_mark = skb->mark,
>> +             .flowi6_proto = ip6h->nexthdr,
>> +     };
>> +
>> +     dst = ip6_route_output(dev_net(dev), NULL, &fl6);
>> +     if (IS_ERR(dst)) {
>> +             err = PTR_ERR(dst);
>> +             dst = NULL;
>
> dst = NULL; seems not needed.
>
>> +             goto err;
>> +     }
>> +     skb_dst_drop(skb);
>> +     skb_dst_set(skb, dst);
>> +     err = ip6_local_out(skb);
>> +     if (unlikely(net_xmit_eval(err)))
>> +             dev->stats.tx_errors++;
>> +     else
>> +             ret = NET_XMIT_SUCCESS;
>> +     goto out;
>> +err:
>> +     dev->stats.tx_errors++;
>> +     kfree_skb(skb);
>> +out:
>> +     return ret;
>> +}
> ...
>
>> +static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
>> +                                              struct ipvl_port *port)
>> +{
>> +     struct sk_buff *skb = *pskb;
>> +     struct ethhdr *eth = eth_hdr(skb);
>> +     rx_handler_result_t ret = RX_HANDLER_PASS;
>> +     void *lyr3h;
>> +     int addr_type;
>> +
>> +     /* First Handle multi-cast frames */
>> +     if (is_multicast_ether_addr(eth->h_dest)) {
>> +             /* Pass to virtual devs only if they haven't seen the frame. */
>> +             if (ipvlan_external_frame(skb, port)) {
>> +                     ipvlan_dbg(4, "%s[%d]L2:Mcast Recv:[%s], PROT=[%x]\n",
>> +                                __func__, __LINE__, port->dev->name,
>> +                                ntohs(skb->protocol));
>> +                     ipvlan_multicast_frame(port, skb, NULL, false);
>> +             }
>> +     } else if ((lyr3h = ipvlan_get_L3_hdr(skb, &addr_type)) != NULL) {
>> +             struct ipvl_addr *addr = NULL;
>
>
> = NULL; not needed.
>
>> +
>> +             addr = ipvlan_addr_lookup(port, lyr3h, addr_type, true);
>> +             if (addr) {
>> +                     ipvlan_dbg(4, "%s[%d]L2:Ucast Recv:[%s], PROT=[%x]\n",
>> +                                __func__, __LINE__, addr->master->dev->name,
>> +                                ntohs(skb->protocol));
>> +                     ret = ipvlan_rcv_frame(addr, skb, false);
>> +             }
>> +     }
>> +
>> +     return ret;
>> +}
>> +
>> +rx_handler_result_t ipvlan_handle_frame(struct sk_buff **pskb)
>> +{
>> +     struct sk_buff *skb = *pskb;
>> +     struct ipvl_port *port = ipvlan_port_get_rcu(skb->dev);
>> +
>> +     if (!port)
>> +             goto out;
>> +
>> +     if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr))))
>
> This looks strange.
>
> Here we are sure ethernet header was already pulled by eth_type_trans()
>
>> +             goto out;
>> +
>> +     switch (port->mode) {
>> +     case IPVLAN_MODE_L2:
>> +             return ipvlan_handle_mode_l2(pskb, port);
>> +     case IPVLAN_MODE_L3:
>> +             return ipvlan_handle_mode_l3(pskb, port);
>> +     }
>> +
>> +     /* Should not reach here */
>> +     BUG();
>> +out:
>> +     return RX_HANDLER_PASS;
>> +}
>> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
>> new file mode 100644
>> index 000000000000..e87b6eb01060
>> --- /dev/null
>> +++ b/drivers/net/ipvlan/ipvlan_main.c
>> @@ -0,0 +1,828 @@
>> +/* Copyright (c) 2014 Mahesh Bandewar <maheshb@google.com>
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License as
>> + * published by the Free Software Foundation; either version 2 of
>> + * the License, or (at your option) any later version.
>> + *
>> + */
>> +
>> +
> ...
>
>> +static int ipvlan_add_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr)
>> +{
>> +     struct ipvl_addr *addr = NULL;
>> +
>> +     if (ipvlan_addr_busy(ipvlan, ip6_addr, true)) {
>> +             pr_warn("%s[%d]: Failed IPv6=%x:%x:%x:%x address for %s intf\n",
>> +                     __func__, __LINE__, ip6_addr->s6_addr32[0],
>> +                     ip6_addr->s6_addr32[1], ip6_addr->s6_addr32[2],
>> +                     ip6_addr->s6_addr32[3], ipvlan->dev->name);
>> +             return -EINVAL;
>> +     }
>> +     if ((addr = kzalloc(sizeof(struct ipvl_addr), GFP_ATOMIC)) == NULL)
>
> Why is GFP_ATOMIC used here ?
>
That is correct. I was using some locking during the development and
these are remaining bits from those. I would correct it.
>> +             return -ENOMEM;
>> +
>> +     ipvlan_dbg(1, "%s[%d]: Adding IPv6=%x:%x:%x:%x address for %s intf\n",
>> +                __func__, __LINE__, ip6_addr->s6_addr32[0],
>> +                ip6_addr->s6_addr32[1], ip6_addr->s6_addr32[2],
>> +                ip6_addr->s6_addr32[3], ipvlan->dev->name);
>> +     addr->master = ipvlan;
>> +     memcpy(&addr->ip6addr, ip6_addr, sizeof(struct in6_addr));
>> +     addr->atype = IPVL_IPV6;
>> +     list_add_tail_rcu(&addr->anode, &ipvlan->addrs);
>> +     ipvlan->ipv6cnt++;
>> +     ipvlan_ht_addr_add(ipvlan, addr);
>> +
>> +     return 0;
>> +}
>> +
>> +static void ipvlan_del_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr)
>> +{
>> +     struct ipvl_addr *addr = NULL;
>> +
>> +     if ((addr = ipvlan_ht_addr_lookup(ipvlan->port, ip6_addr, true)) ==NULL)
>> +             return;
>> +
>> +     ipvlan_dbg(1,
>> +                "%s[%d]: Deleting IPv6=%x:%x:%x:%x address for %s intf.\n",
>> +                __func__, __LINE__, ip6_addr->s6_addr32[0],
>> +                ip6_addr->s6_addr32[1], ip6_addr->s6_addr32[2],
>> +                ip6_addr->s6_addr32[3], ipvlan->dev->name);
>> +     /* Delete from the hash-table */
>> +     ipvlan_ht_addr_del(addr, true);
>> +     /* Delete from the logical's addr list */
>> +     list_del_rcu(&addr->anode);
>> +     ipvlan->ipv6cnt--;
>> +     WARN_ON(ipvlan->ipv6cnt < 0);
>> +     kfree_rcu(addr, rcu);
>> +
>> +     return;
>> +}
>> +
>> +static int ipvlan_addr6_event(struct notifier_block *unused,
>> +                           unsigned long event, void *ptr)
>> +{
>> +     struct inet6_ifaddr *if6 = (struct inet6_ifaddr *)ptr;
>> +     struct net_device *dev = (struct net_device *)if6->idev->dev;
>> +     struct ipvl_dev *ipvlan = netdev_priv(dev);
>> +
>> +     ipvlan_dbg(3, "%s[%d]: Entering...\n", __func__, __LINE__);
>> +     if (!ipvlan_dev_slave(dev))
>> +             return NOTIFY_DONE;
>> +
>> +     if (!ipvlan || !ipvlan->port)
>> +             return NOTIFY_DONE;
>> +
>> +     switch (event) {
>> +     case NETDEV_UP:
>> +             if (ipvlan_add_addr6(ipvlan, &if6->addr))
>> +                     return NOTIFY_BAD;
>> +             break;
>> +
>> +     case NETDEV_DOWN:
>> +             ipvlan_del_addr6(ipvlan, &if6->addr);
>> +             break;
>> +     }
>> +
>> +     ipvlan_dbg(3, "%s[%d]: Leaving...\n", __func__, __LINE__);
>> +     return NOTIFY_OK;
>> +}
>> +
>> +static int ipvlan_add_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr)
>> +{
>> +     struct ipvl_addr *addr = NULL;
>> +
>> +     if (ipvlan_addr_busy(ipvlan, ip4_addr, false)) {
>> +             pr_warn("%s[%d]: Failed to add IPv4=%x on %s intf.\n",
>> +                     __func__, __LINE__, ntohl(ip4_addr->s_addr),
>> +                        ipvlan->dev->name);
>> +             return -EINVAL;
>> +     }
>> +     if ((addr = kzalloc(sizeof(struct ipvl_addr), GFP_ATOMIC)) == NULL)
>
> Same issue here ? GFP_KERNEL should be OK.
>
>
>

^ permalink raw reply

* Re: [PATCH] e100: Don't enable WoL by default on Toshiba devices
From: David Miller @ 2014-11-12 23:18 UTC (permalink / raw)
  To: linux; +Cc: e1000-devel, netdev, linux-kernel, jeffrey.t.kirsher
In-Reply-To: <1415832445-9524-1-git-send-email-linux@rainbow-software.org>

From: Ondrej Zary <linux@rainbow-software.org>
Date: Wed, 12 Nov 2014 23:47:25 +0100

> Enabling WoL on some Toshiba laptops (such as Portege R100) causes battery
> drain after shutdown (WoL is active even on battery). These laptops have the
> WoL bit set in EEPROM ID, causing e100 driver to enable WoL by default.
> 
> Check subsystem vendor ID and if it's Toshiba, don't enable WoL by default
> from EEPROM settings.
> 
> Fixes https://bugs.launchpad.net/ubuntu/+source/linux/+bug/110784
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Jeff, are you gonna pick this up?

^ permalink raw reply

* Re: [PATCH] rtlwifi: Add more checks for get_btc_status callback
From: Murilo Opsfelder Araújo @ 2014-11-12 23:03 UTC (permalink / raw)
  To: Larry Finger
  Cc: Mike Galbraith, linux-kernel, linux-wireless, netdev, Chaoming Li,
	John W. Linville, Thadeu Cascardo, 谭杭波
In-Reply-To: <545C0487.1090707@lwfinger.net>

On Thu, Nov 6, 2014 at 9:30 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> On 11/06/2014 04:52 PM, Murilo Opsfelder Araujo wrote:
>>
>> On 11/06/2014 09:40 AM, Murilo Opsfelder Araujo wrote:
>>>
>>> On 11/05/2014 04:12 PM, Larry Finger wrote:
>>>>
>>>> On 11/05/2014 03:16 AM, Mike Galbraith wrote:
>>>>>
>>>>> On Wed, 2014-10-29 at 23:30 -0500, Larry Finger wrote:
>>>>>>
>>>>>> On 10/29/2014 06:28 PM, Murilo Opsfelder Araujo wrote:
>>>>>>>
>>>>>>> This is a complement of commit
>>>>>>> 08054200117a95afc14c3d2ed3a38bf4e345bf78
>>>>>>> "rtlwifi: Add check for get_btc_status callback".
>>>>>>>
>>>>>>> With this patch, next-20141029 at least does not panic with rtl8192se
>>>>>>> device.
>>>>>>>
>>>>>>
>>>>>> This patch is OK, but as noted it is not complete.
>>>>>>
>>>>>> I have patches to fix all the kernel panics for rtl8192se AND
>>>>>> rtl8192ce. There
>>>>>> are missing parts, but I would prefer submitting mine, which would
>>>>>> conflict with
>>>>>> this one. For that reason, NACK for this one, and please apply the
>>>>>> set I am
>>>>>> submitting now.
>>>>>
>>>>>
>>>>> It's all in there now, but my RTL8191SEvB is still dead.  Squabbling
>>>>> with it isn't going all that well either.
>>>>>
>>>>> As soon as 38506ece rtlwifi: rtl_pci: Start modification for new
>>>>> drivers
>>>>> is applied, explosions appear.  Subsequently applying...
>>>>>
>>>>> 08054200 rtlwifi: Add check for get_btc_status callback
>>>>> c0386f15 rtlwifi: rtl8192ce: rtl8192de: rtl8192se: Fix handling for
>>>>> missing get_btc_status
>>>>> 50147969 rtlwifi: rtl8192se: Fix duplicate calls to
>>>>> ieee80211_register_hw()
>>>>> 30c5ccc6 rtlwifi: rtl8192se: Add missing section to read descriptor
>>>>> setting
>>>>> 75a916e1 rtlwifi: rtl8192se: Fix firmware loading
>>>>>
>>>>> ...fixes that mess up, but leaves the interface dead in the same manner
>>>>> as if nothing has been reverted.  So it _seems_ the bustage lurks in
>>>>> 38506ece somewhere.  Too bad it's non-dinky, and written in wifi-ese :)
>>>>
>>>>
>>>> Yes, I am aware that rtl8192se is failing, and now that I am back from
>>>> vacation, I am working on the problem. If you want to use the driver
>>>> with kernel 3.18, clone the repo at
>>>> http://github.com/lwfinger/rtlwifi_new.git and build and install either
>>>> the master or kernel_version branches. Both work.
>>>>
>>>> I am in the process of trying to find what the crucial difference is
>>>> between that repo and the kernel version.
>>>>
>>>> Larry
>>>>
>>>>
>>> I'm sending to everyone so others can jump in as well.
>>>
>>> Here are the steps I've followed.
>>>
>>> Installed and booted my kernel:
>>>
>>> $ sudo dpkg -i
>>> linux-image-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb
>>> linux-headers-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb
>>>
>>> Built modules from Larry's github repository.
>>>
>>> $ cd rtlwifi_new
>>> $ make
>>> $ sudo make install
>>>
>>> $ sudo modprobe -rv rtl8192se
>>> rmmod rtl8192se
>>> rmmod rtl_pci
>>> rmmod rtlwifi
>>> rmmod mac80211
>>> rmmod cfg80211
>>>
>>> The module does not load:
>>>
>>> $ sudo modprobe -v rtl8192se
>>> insmod
>>> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/wireless/cfg80211.ko
>>> insmod
>>> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/mac80211/mac80211.ko
>>> insmod
>>> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtlwifi.ko
>>> insmod
>>> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtl_pci.ko
>>> insmod /lib/modules/3.18.0-rc3-next-20141105-panda/extra/rtl8192se.ko
>>> ERROR: could not insert 'rtl8192se': Invalid argument
>>>
>>> And /var/log/messages showed:
>>>
>>> Nov  5 22:28:01 laptop kernel: [  301.276806] rtl8192se: disagrees about
>>> version of symbol rtl_process_phyinfo
>>> Nov  5 22:28:01 laptop kernel: [  301.276812] rtl8192se: Unknown symbol
>>> rtl_process_phyinfo (err -22)
>>> Nov  5 22:28:01 laptop kernel: [  301.276864] rtl8192se: disagrees about
>>> version of symbol rtl_get_tcb_desc
>>> Nov  5 22:28:01 laptop kernel: [  301.276866] rtl8192se: Unknown symbol
>>> rtl_get_tcb_desc (err -22)
>>>
>>
>> Here is what I did in order to get the rtl8192se from Larry's repo to
>> work:
>>
>> $ cd rtlwifi_new
>> $ make
>>
>> $ sudo modprobe -rv rtl8192se
>> rmmod rtl8192se
>> rmmod rtl_pci
>> rmmod rtlwifi
>> rmmod mac80211
>> rmmod cfg80211
>>
>> $ sudo modprobe -v cfg80211
>> insmod
>> /lib/modules/3.18.0-rc3-next-20141106-panda/kernel/net/wireless/cfg80211.ko
>>
>> $ sudo modprobe -v mac80211
>> insmod
>> /lib/modules/3.18.0-rc3-next-20141106-panda/kernel/net/mac80211/mac80211.ko
>>
>> $ sudo insmod ./rtlwifi.ko
>> $ sudo insmod ./rtl_pci.ko
>> $ sudo insmod ./rtl8192se/rtl8192se.ko
>>
>> Cascardo helped me to investigate this and the issue was that modprobe
>> was loading the core rtl drivers from the next-20141105 and the
>> rtl8192se from Larry's repo.  Thus, rtl8192se didn't have all its
>> required symbols at loading time.
>>
>> Loading the drivers in reverse order using insmod did the trick.
>>
>> Larry, your rtl8192se from rtlwifi_new repository is working pretty
>> fine on my hardware.  I'm looking forward to see that code landing
>> linux 3.18.
>
>
> I am happy that it is working now; however, if you had done "sudo make
> install", the new drivers would have been in the proper directories, and you
> would not have gotten the incorrect symbol errors, or need to use the insmod
> commands that you post.
>
> Larry
>
>
Hello, Larry.

I'd like to let you know that next-20141112 brought my rtl8192se
device back to life.  I didn't need to build rtlwifi_new to be able to
connect to my wifi network.  It worked just fine.

Thank you all.

-- 
Murilo

^ permalink raw reply

* [PATCH] e100: Don't enable WoL by default on Toshiba devices
From: Ondrej Zary @ 2014-11-12 22:47 UTC (permalink / raw)
  To: e1000-devel; +Cc: netdev, Kernel development list

Enabling WoL on some Toshiba laptops (such as Portege R100) causes battery
drain after shutdown (WoL is active even on battery). These laptops have the
WoL bit set in EEPROM ID, causing e100 driver to enable WoL by default.

Check subsystem vendor ID and if it's Toshiba, don't enable WoL by default
from EEPROM settings.

Fixes https://bugs.launchpad.net/ubuntu/+source/linux/+bug/110784

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/net/ethernet/intel/e100.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 781065e..daf8fcc 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2949,9 +2949,12 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		}
 	}
 
-	/* Wol magic packet can be enabled from eeprom */
-	if ((nic->mac >= mac_82558_D101_A4) &&
-	   (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
+	/* Wol magic packet can be enabled from eeprom
+	 * Don't enable WoL by default on Toshiba laptops as it causes battery
+	 * drain after shutdown */
+	if ((pdev->subsystem_vendor != PCI_VENDOR_ID_TOSHIBA) &&
+	    (nic->mac >= mac_82558_D101_A4) &&
+	    (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
 		nic->flags |= wol_magic;
 		device_set_wakeup_enable(&pdev->dev, true);
 	}
-- 
Ondrej Zary

^ permalink raw reply related

* [PATCH net-next] enic: fix work done in tx napi_poll
From: Govindarajulu Varadarajan @ 2014-11-12 22:42 UTC (permalink / raw)
  To: davem, netdev; +Cc: ssujith, Govindarajulu Varadarajan

With the commit d75b1ade567 ("net: less interrupt masking in NAPI") napi repoll
is done only when work_done == budget. In tx napi poll we always return 0.
So tx napi is not called again and we do not clean up the tx ring.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
 drivers/net/ethernet/cisco/enic/enic_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 73cf165..5afe360 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1312,9 +1312,10 @@ static int enic_poll_msix_wq(struct napi_struct *napi, int budget)
 	if (!wq_work_done) {
 		napi_complete(napi);
 		vnic_intr_unmask(&enic->intr[intr]);
+		return 0;
 	}
 
-	return 0;
+	return budget;
 }
 
 static int enic_poll_msix_rq(struct napi_struct *napi, int budget)
-- 
2.1.3

^ permalink raw reply related

* Re
From: ipsc @ 2014-11-12 21:48 UTC (permalink / raw)


Your attention is needed.

^ 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