* Re: [PATCH V3 2/2] vhost: handle polling errors
From: Michael S. Tsirkin @ 2013-01-14 9:17 UTC (permalink / raw)
To: Jason Wang; +Cc: kvm, eric.dumazet, netdev, linux-kernel, virtualization, davem
In-Reply-To: <50F3B5D6.4070405@redhat.com>
On Mon, Jan 14, 2013 at 03:37:58PM +0800, Jason Wang wrote:
> On 01/14/2013 02:57 PM, Michael S. Tsirkin wrote:
> > On Mon, Jan 14, 2013 at 10:59:02AM +0800, Jason Wang wrote:
> >> On 01/13/2013 07:10 PM, Michael S. Tsirkin wrote:
> >>> On Mon, Jan 07, 2013 at 11:04:32PM +0800, Jason Wang wrote:
> >>>> On 01/07/2013 10:55 PM, Michael S. Tsirkin wrote:
> >>>>> On Mon, Jan 07, 2013 at 12:38:17PM +0800, Jason Wang wrote:
> >>>>>> On 01/06/2013 09:22 PM, Michael S. Tsirkin wrote:
> >>>>>>> On Sun, Jan 06, 2013 at 03:18:38PM +0800, Jason Wang wrote:
> >>>>>>>> Polling errors were ignored by vhost/vhost_net, this may lead to crash when
> >>>>>>>> trying to remove vhost from waitqueue when after the polling is failed. Solve
> >>>>>>>> this problem by:
> >>>>>>>>
> >>>>>>>> - checking the poll->wqh before trying to remove from waitqueue
> >>>>>>>> - report an error when poll() returns a POLLERR in vhost_start_poll()
> >>>>>>>> - report an error when vhost_start_poll() fails in
> >>>>>>>> vhost_vring_ioctl()/vhost_net_set_backend() which is used to notify the
> >>>>>>>> failure to userspace.
> >>>>>>>> - report an error in the data path in vhost_net when meet polling errors.
> >>>>>>>>
> >>>>>>>> After those changes, we can safely drop the tx polling state in vhost_net since
> >>>>>>>> it was replaced by the checking of poll->wqh.
> >>>>>>>>
> >>>>>>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
> >>>>>>>> ---
> >>>>>>>> drivers/vhost/net.c | 74 ++++++++++++++++--------------------------------
> >>>>>>>> drivers/vhost/vhost.c | 31 +++++++++++++++-----
> >>>>>>>> drivers/vhost/vhost.h | 2 +-
> >>>>>>>> 3 files changed, 49 insertions(+), 58 deletions(-)
> >>>>>>>>
> >>>>>>>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> >>>>>>>> index d10ad6f..125c1e5 100644
> >>>>>>>> --- a/drivers/vhost/net.c
> >>>>>>>> +++ b/drivers/vhost/net.c
> >>>>>>>> @@ -64,20 +64,10 @@ enum {
> >>>>>>>> VHOST_NET_VQ_MAX = 2,
> >>>>>>>> };
> >>>>>>>>
> >>>>>>>> -enum vhost_net_poll_state {
> >>>>>>>> - VHOST_NET_POLL_DISABLED = 0,
> >>>>>>>> - VHOST_NET_POLL_STARTED = 1,
> >>>>>>>> - VHOST_NET_POLL_STOPPED = 2,
> >>>>>>>> -};
> >>>>>>>> -
> >>>>>>>> struct vhost_net {
> >>>>>>>> struct vhost_dev dev;
> >>>>>>>> struct vhost_virtqueue vqs[VHOST_NET_VQ_MAX];
> >>>>>>>> struct vhost_poll poll[VHOST_NET_VQ_MAX];
> >>>>>>>> - /* Tells us whether we are polling a socket for TX.
> >>>>>>>> - * We only do this when socket buffer fills up.
> >>>>>>>> - * Protected by tx vq lock. */
> >>>>>>>> - enum vhost_net_poll_state tx_poll_state;
> >>>>>>>> /* Number of TX recently submitted.
> >>>>>>>> * Protected by tx vq lock. */
> >>>>>>>> unsigned tx_packets;
> >>>>>>>> @@ -155,24 +145,6 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to,
> >>>>>>>> }
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> -/* Caller must have TX VQ lock */
> >>>>>>>> -static void tx_poll_stop(struct vhost_net *net)
> >>>>>>>> -{
> >>>>>>>> - if (likely(net->tx_poll_state != VHOST_NET_POLL_STARTED))
> >>>>>>>> - return;
> >>>>>>>> - vhost_poll_stop(net->poll + VHOST_NET_VQ_TX);
> >>>>>>>> - net->tx_poll_state = VHOST_NET_POLL_STOPPED;
> >>>>>>>> -}
> >>>>>>>> -
> >>>>>>>> -/* Caller must have TX VQ lock */
> >>>>>>>> -static void tx_poll_start(struct vhost_net *net, struct socket *sock)
> >>>>>>>> -{
> >>>>>>>> - if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED))
> >>>>>>>> - return;
> >>>>>>>> - vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);
> >>>>>>>> - net->tx_poll_state = VHOST_NET_POLL_STARTED;
> >>>>>>>> -}
> >>>>>>>> -
> >>>>>>>> /* In case of DMA done not in order in lower device driver for some reason.
> >>>>>>>> * upend_idx is used to track end of used idx, done_idx is used to track head
> >>>>>>>> * of used idx. Once lower device DMA done contiguously, we will signal KVM
> >>>>>>>> @@ -227,6 +199,7 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
> >>>>>>>> static void handle_tx(struct vhost_net *net)
> >>>>>>>> {
> >>>>>>>> struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX];
> >>>>>>>> + struct vhost_poll *poll = net->poll + VHOST_NET_VQ_TX;
> >>>>>>>> unsigned out, in, s;
> >>>>>>>> int head;
> >>>>>>>> struct msghdr msg = {
> >>>>>>>> @@ -252,7 +225,8 @@ static void handle_tx(struct vhost_net *net)
> >>>>>>>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
> >>>>>>>> if (wmem >= sock->sk->sk_sndbuf) {
> >>>>>>>> mutex_lock(&vq->mutex);
> >>>>>>>> - tx_poll_start(net, sock);
> >>>>>>>> + if (vhost_poll_start(poll, sock->file))
> >>>>>>>> + vq_err(vq, "Fail to start TX polling\n");
> >>>>>>> s/Fail/Failed/
> >>>>>>>
> >>>>>>> A question though: how can this happen? Could you clarify please?
> >>>>>>> Maybe we can find a way to prevent this error?
> >>>>>> Two conditions I think this can happen:
> >>>>>>
> >>>>>> 1) a buggy userspace disable a queue through TUNSETQUEUE
> >>>>>> 2) the net device were gone
> >>>>>>
> >>>>>> For 1, looks like we can delay the disabling until the refcnt goes to
> >>>>>> zero. For 2 may needs more changes.
> >>>>> I'd expect keeping a socket reference would prevent both issues.
> >>>>> Doesn't it?
> >>>> Doesn't work for 2 I think, the socket didn't hold a refcnt of the
> >>>> device, so the device can go away at anytime. Although we can change
> >>>> this, but it's the behaviour before multiqueue support.
> >>> Hmm there's one scenario that does seem to
> >>> trigger this: queue can get disabled
> >>> and then poll fails.
> >>>
> >>> Is this the only issue?
> >> Another one I think we can trigger is:
> >>
> >> - start vhost thread
> >> - do ip link del link dev tap0 to delete the tap device
> >>
> >> In this case, the netdevice is unregistered but the file/socket still exist.
> > Yes but in this case poll_wait is called so apparently no issue
> > with existing code? We only have an issue if poll_wait is
> > not called right?
>
> Right.
> > Maybe the simplest fix is to invoke poll_wait before
> > checking if (!tun) ?
>
> True, but we this depends on the assumption that each kind of backend
> must make sure poll_wait() is called in .poll(). And we need to change
> macvtap_poll() as well. And we'd better also pass those polling errors
> to notify user about this wrong state.
For macvtap at least, I agree checking at the time where backend is set
makes sense, since the error can be reported to user.
Checking during vring operation can't properly be reported.
So my suggestion is to make polling of disable queue in tun
simply work, and check wqh when backend is set to handle
the macvtap case.
Makes sense?
> >
> >>>>>> Not sure it's worth to do this work,
> >>>>>> maybe a warning is enough just like other failure.
> >>>>> With other failures, you normally can correct the error then
> >>>>> kick to have it restart. This is soomething thagt would not
> >>>>> work here.
> >>>> If userspace is wrote correctly, (e.g passing a fd with correct state)
> >>>> it can also be corrected.
> >>>>>>>> mutex_unlock(&vq->mutex);
> >>>>>>>> return;
> >>>>>>>> }
> >>>>>>>> @@ -261,7 +235,7 @@ static void handle_tx(struct vhost_net *net)
> >>>>>>>> vhost_disable_notify(&net->dev, vq);
> >>>>>>>>
> >>>>>>>> if (wmem < sock->sk->sk_sndbuf / 2)
> >>>>>>>> - tx_poll_stop(net);
> >>>>>>>> + vhost_poll_stop(poll);
> >>>>>>>> hdr_size = vq->vhost_hlen;
> >>>>>>>> zcopy = vq->ubufs;
> >>>>>>>>
> >>>>>>>> @@ -283,8 +257,10 @@ static void handle_tx(struct vhost_net *net)
> >>>>>>>>
> >>>>>>>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
> >>>>>>>> if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
> >>>>>>>> - tx_poll_start(net, sock);
> >>>>>>>> - set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> >>>>>>>> + if (vhost_poll_start(poll, sock->file))
> >>>>>>>> + vq_err(vq, "Fail to start TX polling\n");
> >>>>>>>> + else
> >>>>>>>> + set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> >>>>>>>> break;
> >>>>>>>> }
> >>>>>>>> /* If more outstanding DMAs, queue the work.
> >>>>>>>> @@ -294,8 +270,10 @@ static void handle_tx(struct vhost_net *net)
> >>>>>>>> (vq->upend_idx - vq->done_idx) :
> >>>>>>>> (vq->upend_idx + UIO_MAXIOV - vq->done_idx);
> >>>>>>>> if (unlikely(num_pends > VHOST_MAX_PEND)) {
> >>>>>>>> - tx_poll_start(net, sock);
> >>>>>>>> - set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> >>>>>>>> + if (vhost_poll_start(poll, sock->file))
> >>>>>>>> + vq_err(vq, "Fail to start TX polling\n");
> >>>>>>>> + else
> >>>>>>>> + set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> >>>>>>>> break;
> >>>>>>>> }
> >>>>>>>> if (unlikely(vhost_enable_notify(&net->dev, vq))) {
> >>>>>>>> @@ -360,7 +338,8 @@ static void handle_tx(struct vhost_net *net)
> >>>>>>>> }
> >>>>>>>> vhost_discard_vq_desc(vq, 1);
> >>>>>>>> if (err == -EAGAIN || err == -ENOBUFS)
> >>>>>>>> - tx_poll_start(net, sock);
> >>>>>>>> + if (vhost_poll_start(poll, sock->file))
> >>>>>>>> + vq_err(vq, "Fail to start TX polling\n");
> >>>>>>>> break;
> >>>>>>>> }
> >>>>>>>> if (err != len)
> >>>>>>>> @@ -623,7 +602,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> >>>>>>>>
> >>>>>>>> vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
> >>>>>>>> vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
> >>>>>>>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
> >>>>>>>>
> >>>>>>>> f->private_data = n;
> >>>>>>>>
> >>>>>>>> @@ -633,29 +611,25 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> >>>>>>>> static void vhost_net_disable_vq(struct vhost_net *n,
> >>>>>>>> struct vhost_virtqueue *vq)
> >>>>>>>> {
> >>>>>>>> + struct vhost_poll *poll = n->poll + (vq - n->vqs);
> >>>>>>>> +
> >>>>>>>> if (!vq->private_data)
> >>>>>>>> return;
> >>>>>>>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
> >>>>>>>> - tx_poll_stop(n);
> >>>>>>>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
> >>>>>>>> - } else
> >>>>>>>> - vhost_poll_stop(n->poll + VHOST_NET_VQ_RX);
> >>>>>>>> + vhost_poll_stop(poll);
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> -static void vhost_net_enable_vq(struct vhost_net *n,
> >>>>>>>> +static int vhost_net_enable_vq(struct vhost_net *n,
> >>>>>>>> struct vhost_virtqueue *vq)
> >>>>>>>> {
> >>>>>>>> struct socket *sock;
> >>>>>>>> + struct vhost_poll *poll = n->poll + (vq - n->vqs);
> >>>>>>>>
> >>>>>>>> sock = rcu_dereference_protected(vq->private_data,
> >>>>>>>> lockdep_is_held(&vq->mutex));
> >>>>>>>> if (!sock)
> >>>>>>>> - return;
> >>>>>>>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
> >>>>>>>> - n->tx_poll_state = VHOST_NET_POLL_STOPPED;
> >>>>>>>> - tx_poll_start(n, sock);
> >>>>>>>> - } else
> >>>>>>>> - vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file);
> >>>>>>>> + return 0;
> >>>>>>>> +
> >>>>>>>> + return vhost_poll_start(poll, sock->file);
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> static struct socket *vhost_net_stop_vq(struct vhost_net *n,
> >>>>>>>> @@ -833,7 +807,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
> >>>>>>>> r = vhost_init_used(vq);
> >>>>>>>> if (r)
> >>>>>>>> goto err_used;
> >>>>>>>> - vhost_net_enable_vq(n, vq);
> >>>>>>>> + r = vhost_net_enable_vq(n, vq);
> >>>>>>>> + if (r)
> >>>>>>>> + goto err_used;
> >>>>>>>>
> >>>>>>>> oldubufs = vq->ubufs;
> >>>>>>>> vq->ubufs = ubufs;
> >>>>>>>> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> >>>>>>>> index 34389f7..5c7a466 100644
> >>>>>>>> --- a/drivers/vhost/vhost.c
> >>>>>>>> +++ b/drivers/vhost/vhost.c
> >>>>>>>> @@ -77,26 +77,41 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
> >>>>>>>> init_poll_funcptr(&poll->table, vhost_poll_func);
> >>>>>>>> poll->mask = mask;
> >>>>>>>> poll->dev = dev;
> >>>>>>>> + poll->wqh = NULL;
> >>>>>>>>
> >>>>>>>> vhost_work_init(&poll->work, fn);
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> +/* Stop polling a file. After this function returns, it becomes safe to drop the
> >>>>>>>> + * file reference. You must also flush afterwards. */
> >>>>>>>> +void vhost_poll_stop(struct vhost_poll *poll)
> >>>>>>>> +{
> >>>>>>>> + if (poll->wqh) {
> >>>>>>>> + remove_wait_queue(poll->wqh, &poll->wait);
> >>>>>>>> + poll->wqh = NULL;
> >>>>>>>> + }
> >>>>>>>> +}
> >>>>>>>> +
> >>>>>>>> /* Start polling a file. We add ourselves to file's wait queue. The caller must
> >>>>>>>> * keep a reference to a file until after vhost_poll_stop is called. */
> >>>>>>>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file)
> >>>>>>>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file)
> >>>>>>>> {
> >>>>>>>> unsigned long mask;
> >>>>>>>> + int ret = 0;
> >>>>>>>> +
> >>>>>>>> + if (poll->wqh)
> >>>>>>>> + return -EBUSY;
> >>>>>>>>
> >>>>>>> I think this should return success: we are already polling.
> >>>>>>> Otherwise this would trigger a bug below I think.
> >>>>>> Ok.
> >>>>>>>> mask = file->f_op->poll(file, &poll->table);
> >>>>>>>> if (mask)
> >>>>>>>> vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask);
> >>>>>>>> -}
> >>>>>>>>
> >>>>>>>> -/* Stop polling a file. After this function returns, it becomes safe to drop the
> >>>>>>>> - * file reference. You must also flush afterwards. */
> >>>>>>>> -void vhost_poll_stop(struct vhost_poll *poll)
> >>>>>>>> -{
> >>>>>>>> - remove_wait_queue(poll->wqh, &poll->wait);
> >>>>>>>> + if (mask & POLLERR) {
> >>>>>>>> + ret = -EINVAL;
> >>>>>>>> + vhost_poll_stop(poll);
> >>>>>>>> + }
> >>>>>>>> +
> >>>>>>>> + return ret;
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
> >>>>>>>> @@ -792,7 +807,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
> >>>>>>>> fput(filep);
> >>>>>>>>
> >>>>>>>> if (pollstart && vq->handle_kick)
> >>>>>>>> - vhost_poll_start(&vq->poll, vq->kick);
> >>>>>>>> + r = vhost_poll_start(&vq->poll, vq->kick);
> >>>>>>>>
> >>>>>>>> mutex_unlock(&vq->mutex);
> >>>>>>>>
> >>>>>>>> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> >>>>>>>> index 2639c58..17261e2 100644
> >>>>>>>> --- a/drivers/vhost/vhost.h
> >>>>>>>> +++ b/drivers/vhost/vhost.h
> >>>>>>>> @@ -42,7 +42,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
> >>>>>>>>
> >>>>>>>> void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
> >>>>>>>> unsigned long mask, struct vhost_dev *dev);
> >>>>>>>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file);
> >>>>>>>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file);
> >>>>>>>> void vhost_poll_stop(struct vhost_poll *poll);
> >>>>>>>> void vhost_poll_flush(struct vhost_poll *poll);
> >>>>>>>> void vhost_poll_queue(struct vhost_poll *poll);
> >>>>>>>> --
> >>>>>>>> 1.7.1
> >>>>>>> --
> >>>>>>> To unsubscribe from this list: send the line "unsubscribe netdev" in
> >>>>>>> the body of a message to majordomo@vger.kernel.org
> >>>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>>> --
> >>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
> >>>>> the body of a message to majordomo@vger.kernel.org
> >>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>> --
> >>> To unsubscribe from this list: send the line "unsubscribe kvm" in
> >>> the body of a message to majordomo@vger.kernel.org
> >>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v2 1/1 net-next] net: fec: enable pause frame to improve rx prefomance for 1G network
From: Frank Li @ 2013-01-14 8:49 UTC (permalink / raw)
To: lznuaa, shawn.guo, B38611, davem, linux-arm-kernel, netdev,
bhutchings
Cc: s.hauer, Frank Li
The limition of imx6 internal bus cause fec can't achieve 1G perfomance.
There will be many packages lost because FIFO over run.
This patch enable pause frame flow control.
Before this patch
iperf -s -i 1
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 10.192.242.153 port 5001 connected with 10.192.242.94 port 49773
[ ID] Interval Transfer Bandwidth
[ 4] 0.0- 1.0 sec 6.35 MBytes 53.3 Mbits/sec
[ 4] 1.0- 2.0 sec 3.39 MBytes 28.5 Mbits/sec
[ 4] 2.0- 3.0 sec 2.63 MBytes 22.1 Mbits/sec
[ 4] 3.0- 4.0 sec 1.10 MBytes 9.23 Mbits/sec
ifconfig
RX packets:46195 errors:1859 dropped:1 overruns:1859 frame:1859
After this patch
iperf -s -i 1
[ 4] local 10.192.242.153 port 5001 connected with 10.192.242.94 port 49757
[ ID] Interval Transfer Bandwidth
[ 4] 0.0- 1.0 sec 49.8 MBytes 418 Mbits/sec
[ 4] 1.0- 2.0 sec 50.1 MBytes 420 Mbits/sec
[ 4] 2.0- 3.0 sec 47.5 MBytes 399 Mbits/sec
[ 4] 3.0- 4.0 sec 45.9 MBytes 385 Mbits/sec
[ 4] 4.0- 5.0 sec 44.8 MBytes 376 Mbits/sec
ifconfig
RX packets:2348454 errors:0 dropped:16 overruns:0 frame:0
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
Change from V1 to V2
* using pause_setparam to enable/disable pause frame
* default enable pause frame auto negotiation
drivers/net/ethernet/freescale/fec.c | 89 +++++++++++++++++++++++++++++++++-
drivers/net/ethernet/freescale/fec.h | 5 ++
2 files changed, 93 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 6dc2094..ea30c26 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -68,6 +68,14 @@
#define DRIVER_NAME "fec"
+/* Pause frame feild and FIFO threshold */
+#define FEC_ENET_FCE (1 << 5)
+#define FEC_ENET_RSEM_V 0x84
+#define FEC_ENET_RSFL_V 16
+#define FEC_ENET_RAEM_V 0x8
+#define FEC_ENET_RAFL_V 0x8
+#define FEC_ENET_OPD_V 0xFFF0
+
/* Controller is ENET-MAC */
#define FEC_QUIRK_ENET_MAC (1 << 0)
/* Controller needs driver to swap frame */
@@ -193,6 +201,9 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
/* Transmitter timeout */
#define TX_TIMEOUT (2 * HZ)
+#define FEC_PAUSE_FLAG_AUTONEG 0x1
+#define FEC_PAUSE_FLAG_ENABLE 0x2
+
static int mii_cnt;
static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int is_ex)
@@ -470,6 +481,26 @@ fec_restart(struct net_device *ndev, int duplex)
}
#endif
}
+
+ /* enable pause frame*/
+ if ((fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) ||
+ ((fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) &&
+ fep->phy_dev && fep->phy_dev->pause)) {
+
+ rcntl |= FEC_ENET_FCE;
+
+ /* set FIFO thresh hold parameter to reduce overrun */
+ writel(FEC_ENET_RSEM_V, fep->hwp + FEC_R_FIFO_RSEM);
+ writel(FEC_ENET_RSFL_V, fep->hwp + FEC_R_FIFO_RSFL);
+ writel(FEC_ENET_RAEM_V, fep->hwp + FEC_R_FIFO_RAEM);
+ writel(FEC_ENET_RAFL_V, fep->hwp + FEC_R_FIFO_RAFL);
+
+ /* OPD */
+ writel(FEC_ENET_OPD_V, fep->hwp + FEC_OPD);
+ } else {
+ rcntl &= ~FEC_ENET_FCE;
+ }
+
writel(rcntl, fep->hwp + FEC_R_CNTRL);
if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
@@ -1016,8 +1047,10 @@ static int fec_enet_mii_probe(struct net_device *ndev)
}
/* mask with MAC supported features */
- if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT)
+ if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT) {
phy_dev->supported &= PHY_GBIT_FEATURES;
+ phy_dev->supported |= SUPPORTED_Pause;
+ }
else
phy_dev->supported &= PHY_BASIC_FEATURES;
@@ -1203,7 +1236,56 @@ static int fec_enet_get_ts_info(struct net_device *ndev,
}
}
+static void fec_enet_get_pauseparam(struct net_device *ndev,
+ struct ethtool_pauseparam *pause)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+
+ pause->autoneg = (fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) != 0;
+ pause->tx_pause = (fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) != 0;
+ pause->rx_pause = pause->tx_pause;
+
+}
+
+static int fec_enet_set_pauseparam(struct net_device *ndev,
+ struct ethtool_pauseparam *pause)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+
+ if (pause->tx_pause != pause->rx_pause) {
+ netdev_info(ndev,
+ "hardware only support enable/disable both tx and rx");
+ return -EINVAL;
+ }
+
+ fep->pause_flag = 0;
+
+ /* tx pause must be same as rx pause */
+ fep->pause_flag |= pause->rx_pause ? FEC_PAUSE_FLAG_ENABLE : 0;
+ fep->pause_flag |= pause->autoneg ? FEC_PAUSE_FLAG_AUTONEG : 0;
+
+ if (pause->rx_pause || pause->autoneg) {
+ fep->phy_dev->supported |= ADVERTISED_Pause;
+ fep->phy_dev->advertising |= ADVERTISED_Pause;
+ } else {
+ fep->phy_dev->supported &= ~ADVERTISED_Pause;
+ fep->phy_dev->advertising &= ~ADVERTISED_Pause;
+ }
+
+ if (pause->autoneg) {
+ if (netif_running(ndev))
+ fec_stop(ndev);
+ phy_start_aneg(fep->phy_dev);
+ }
+ if (netif_running(ndev))
+ fec_restart(ndev, 0);
+
+ return 0;
+}
+
static const struct ethtool_ops fec_enet_ethtool_ops = {
+ .get_pauseparam = fec_enet_get_pauseparam,
+ .set_pauseparam = fec_enet_set_pauseparam,
.get_settings = fec_enet_get_settings,
.set_settings = fec_enet_set_settings,
.get_drvinfo = fec_enet_get_drvinfo,
@@ -1643,6 +1725,11 @@ fec_probe(struct platform_device *pdev)
/* setup board info structure */
fep = netdev_priv(ndev);
+ /* default enable pause frame auto negotiation */
+ if (pdev->id_entry &&
+ (pdev->id_entry->driver_data & FEC_QUIRK_HAS_GBIT))
+ fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
+
fep->hwp = ioremap(r->start, resource_size(r));
fep->pdev = pdev;
fep->dev_id = dev_id++;
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 4862394..2ebedaf 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -48,6 +48,10 @@
#define FEC_R_DES_START 0x180 /* Receive descriptor ring */
#define FEC_X_DES_START 0x184 /* Transmit descriptor ring */
#define FEC_R_BUFF_SIZE 0x188 /* Maximum receive buff size */
+#define FEC_R_FIFO_RSFL 0x190 /* Receive FIFO section full threshold */
+#define FEC_R_FIFO_RSEM 0x194 /* Receive FIFO section empty threshold */
+#define FEC_R_FIFO_RAEM 0x198 /* Receive FIFO almost empty threshold */
+#define FEC_R_FIFO_RAFL 0x19c /* Receive FIFO almost full threshold */
#define FEC_MIIGSK_CFGR 0x300 /* MIIGSK Configuration reg */
#define FEC_MIIGSK_ENR 0x308 /* MIIGSK Enable reg */
@@ -243,6 +247,7 @@ struct fec_enet_private {
struct completion mdio_done;
int irq[FEC_IRQ_NUM];
int bufdesc_ex;
+ int pause_flag;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_caps;
--
1.7.1
^ permalink raw reply related
* Information needed on the kernel version which supports ----
From: Sandeepa C S @ 2013-01-14 9:55 UTC (permalink / raw)
To: vyasevic, shemminger, mst, netdev, stephen, bridge,
shmulik.ladkani, davem, mst, netdev, stephen, bridge,
shmulik.ladkani, davem, Satyanarayana Reddy M (D&D)
Dear All,
We are trying to add vlan support for the IGMP snooping feature in the
kernel version 2.6.39
But from the below thread discussion we understood that vlan support is
already in the bridge.
http://www.spinics.net/lists/netdev/msg221800.html
Could you please let us know the below informations,
1) On what kernel version the VLAN support for multicast groups is being
done
2)On what flavors it is supported, is it available with Debian
3)How can we get/download the supported patch files for reference.
--
Thanks & Regards,
Sandeepa cs.
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
^ permalink raw reply
* Re: [Patch net-next] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-14 9:58 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, David S. Miller
In-Reply-To: <20130114091543.GA1620@minipsycho.orion>
On Mon, 2013-01-14 at 10:15 +0100, Jiri Pirko wrote:
> Mon, Jan 14, 2013 at 09:55:08AM CET, amwang@redhat.com wrote:
> >From: Cong Wang <amwang@redhat.com>
> >
> >This patch fixes the following warning:
> >
> >[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
> >[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
> >[ 72.019582] Call Trace:
> >[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
> >[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
> >[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
> >[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
> >[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
> >[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
> >[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
> >[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
> >[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
> >
> >by holding the rtnl_lock. And as we just want test if the device
> >has any upper device, so I think netdev_has_any_upper_dev() is enough.
> >
> >Cc: Jiri Pirko <jiri@resnulli.us>
> >Cc: David S. Miller <davem@davemloft.net>
> >Signed-off-by: Cong Wang <amwang@redhat.com>
> >
> >---
> >diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> >index 9f05067..dd28cdd 100644
> >--- a/net/core/netpoll.c
> >+++ b/net/core/netpoll.c
> >@@ -1055,7 +1055,9 @@ int netpoll_setup(struct netpoll *np)
> > return -ENODEV;
> > }
> >
> >- if (netdev_master_upper_dev_get(ndev)) {
> >+ rtnl_lock();
> >+ if (netdev_has_any_upper_dev(ndev)) {
>
>
> This would prevent from using dev with for example vlan dev attached to
> it. Is it desirable? I suppose not.
No, it should not. I didn't notice netdev_has_any_upper_dev() could
prevent the device under vlan, I will keep
netdev_master_upper_dev_get().
>
> Also I think in this situation, netdev_master_upper_dev_get_rcu() would
> be probably better to use. Not sure though.
>
Yes, as we only read it.
Thanks!
^ permalink raw reply
* Machine hang using YeAH Advanced TCP Congestion Control algorithm as default under P2P load
From: Roger Ricardo Moore @ 2013-01-14 10:19 UTC (permalink / raw)
To: netdev
I decided to test out the YeAH Advance TCP Congestion Control algorithm
- setting it as my default (patched kernel to achieve this)
I found that on 2 different machines (i386/Pentium M/radeon/e1000 and
amd64/Core2Duo/i915/e1000e) I experienced a complete machine hang after
~5-10 minutes using a P2P client (aMule) - i.e. multiple connections
with clients over the internet, both in and out of the machine.
There was no kernel OOPS just an unrecoverable freeze with no response
to any input. Each time it required the machine to be turned off and
rebooted to regain control.
I tested the machines using stress (CPU, I/O, VM and HDD) to eliminate
other possible causes of a machine hang after time but this failed to
replicate the problem. I even copied GBs of files over my local network
using SCP and this too failed to demonstrate the problem (I presume a
TCP congestion control has negligible impact in such circumstances)
I found that reverting back to CONFIG_TCP_CONG_ADVANCED=n (and this
CUBIC w/ Reno fallback) solved my problem.
I hope this information is useful to you in solving the problems with
this feature.
Regards
Roger
^ permalink raw reply
* [Patch net-next v2] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-14 10:24 UTC (permalink / raw)
To: netdev; +Cc: Jiri Pirko, David S. Miller, Cong Wang
From: Cong Wang <amwang@redhat.com>
This patch fixes the following warning:
[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
[ 72.019582] Call Trace:
[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
Just hold RCU read lock and call netdev_master_upper_dev_get_rcu(),
as suggested by Jiri.
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 9f05067..6d56b57 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -1055,11 +1055,15 @@ int netpoll_setup(struct netpoll *np)
return -ENODEV;
}
- if (netdev_master_upper_dev_get(ndev)) {
+ rcu_read_lock();
+ /* We permit devices with VLAN attached to */
+ if (netdev_master_upper_dev_get_rcu(ndev)) {
+ rcu_read_unlock();
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
err = -EBUSY;
goto put;
}
+ rcu_read_unlock();
if (!netif_running(ndev)) {
unsigned long atmost, atleast;
^ permalink raw reply related
* Re: [Patch net-next v2] netpoll: fix a rtnl lock assertion failure
From: Jiri Pirko @ 2013-01-14 10:32 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller
In-Reply-To: <1358159054-21951-1-git-send-email-amwang@redhat.com>
Mon, Jan 14, 2013 at 11:24:14AM CET, amwang@redhat.com wrote:
>From: Cong Wang <amwang@redhat.com>
>
>This patch fixes the following warning:
>
>[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
>[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
>[ 72.019582] Call Trace:
>[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
>[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
>[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
>[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
>[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
>[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
>[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
>[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
>[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
>
>Just hold RCU read lock and call netdev_master_upper_dev_get_rcu(),
>as suggested by Jiri.
>
>Cc: Jiri Pirko <jiri@resnulli.us>
>Cc: David S. Miller <davem@davemloft.net>
>Signed-off-by: Cong Wang <amwang@redhat.com>
>
>---
>diff --git a/net/core/netpoll.c b/net/core/netpoll.c
>index 9f05067..6d56b57 100644
>--- a/net/core/netpoll.c
>+++ b/net/core/netpoll.c
>@@ -1055,11 +1055,15 @@ int netpoll_setup(struct netpoll *np)
> return -ENODEV;
> }
>
>- if (netdev_master_upper_dev_get(ndev)) {
>+ rcu_read_lock();
>+ /* We permit devices with VLAN attached to */
I think that this comment might be misleading. Master upper is not set
not only for VLAN but for macvlan (and in future possibly for others) as well.
Apart from this, the patch looks good to me.
>+ if (netdev_master_upper_dev_get_rcu(ndev)) {
>+ rcu_read_unlock();
> np_err(np, "%s is a slave device, aborting\n", np->dev_name);
> err = -EBUSY;
> goto put;
> }
>+ rcu_read_unlock();
>
> if (!netif_running(ndev)) {
> unsigned long atmost, atleast;
^ permalink raw reply
* Re: [Patch net-next v2] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-14 10:42 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, David S. Miller
In-Reply-To: <20130114103201.GA1633@minipsycho.brq.redhat.com>
On Mon, 2013-01-14 at 11:32 +0100, Jiri Pirko wrote:
> Mon, Jan 14, 2013 at 11:24:14AM CET, amwang@redhat.com wrote:
> >From: Cong Wang <amwang@redhat.com>
> >
> >This patch fixes the following warning:
> >
> >[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
> >[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
> >[ 72.019582] Call Trace:
> >[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
> >[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
> >[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
> >[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
> >[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
> >[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
> >[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
> >[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
> >[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
> >
> >Just hold RCU read lock and call netdev_master_upper_dev_get_rcu(),
> >as suggested by Jiri.
> >
> >Cc: Jiri Pirko <jiri@resnulli.us>
> >Cc: David S. Miller <davem@davemloft.net>
> >Signed-off-by: Cong Wang <amwang@redhat.com>
> >
> >---
> >diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> >index 9f05067..6d56b57 100644
> >--- a/net/core/netpoll.c
> >+++ b/net/core/netpoll.c
> >@@ -1055,11 +1055,15 @@ int netpoll_setup(struct netpoll *np)
> > return -ENODEV;
> > }
> >
> >- if (netdev_master_upper_dev_get(ndev)) {
> >+ rcu_read_lock();
> >+ /* We permit devices with VLAN attached to */
>
> I think that this comment might be misleading. Master upper is not set
> not only for VLAN but for macvlan (and in future possibly for others) as well.
>
OK, I will remove it.
^ permalink raw reply
* [Patch net-next v3] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-14 10:43 UTC (permalink / raw)
To: netdev; +Cc: Jiri Pirko, David S. Miller, Cong Wang
From: Cong Wang <amwang@redhat.com>
This patch fixes the following warning:
[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
[ 72.019582] Call Trace:
[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
Just hold RCU read lock and call netdev_master_upper_dev_get_rcu(),
as suggested by Jiri.
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 9f05067..5d1f856 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -1055,11 +1055,14 @@ int netpoll_setup(struct netpoll *np)
return -ENODEV;
}
- if (netdev_master_upper_dev_get(ndev)) {
+ rcu_read_lock();
+ if (netdev_master_upper_dev_get_rcu(ndev)) {
+ rcu_read_unlock();
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
err = -EBUSY;
goto put;
}
+ rcu_read_unlock();
if (!netif_running(ndev)) {
unsigned long atmost, atleast;
^ permalink raw reply related
* Re: [PATCH] mm: compaction: Partially revert capture of suitable high-order page
From: Mel Gorman @ 2013-01-14 10:49 UTC (permalink / raw)
To: Simon Jeons
Cc: Andrew Morton, Eric Wong, Eric Dumazet, Rik van Riel, Minchan Kim,
Linus Torvalds, linux-mm, netdev, linux-kernel
In-Reply-To: <1358046453.1518.1.camel@kernel.cn.ibm.com>
On Sat, Jan 12, 2013 at 09:07:33PM -0600, Simon Jeons wrote:
> On Fri, 2013-01-11 at 09:27 +0000, Mel Gorman wrote:
> > Eric Wong reported on 3.7 and 3.8-rc2 that ppoll() got stuck when waiting
> > for POLLIN on a local TCP socket. It was easier to trigger if there was disk
> > IO and dirty pages at the same time and he bisected it to commit 1fb3f8ca
> > "mm: compaction: capture a suitable high-order page immediately when it
> > is made available".
> >
> > The intention of that patch was to improve high-order allocations under
> > memory pressure after changes made to reclaim in 3.6 drastically hurt
> > THP allocations but the approach was flawed. For Eric, the problem was
> > that page->pfmemalloc was not being cleared for captured pages leading to
> > a poor interaction with swap-over-NFS support causing the packets to be
> > dropped. However, I identified a few more problems with the patch including
> > the fact that it can increase contention on zone->lock in some cases which
> > could result in async direct compaction being aborted early.
> >
> > In retrospect the capture patch took the wrong approach. What it should
> > have done is mark the pageblock being migrated as MIGRATE_ISOLATE if it
> > was allocating for THP and avoided races that way. While the patch was
>
> Hi Mel,
>
> Mark pageblock being migrated as MIGRATE_ISOLATE if it was allocating
> for THP and avoided races that way is a good idea. But why I can't see
> you do it in this patch?
>
Because it is not what the patch does. Implementing that idea will take
time to do properly and cleanly with no guarantee it'll work well enough
to justify the complexity. Fixing the POLLIN bug was more important.
--
Mel Gorman
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH net-next] net: phy: remove flags argument from phy_{attach,connect,connect_direct}
From: Florian Fainelli @ 2013-01-14 10:52 UTC (permalink / raw)
To: netdev; +Cc: konszert, davem, afleming, linux-kernel, Florian Fainelli
The flags argument of the phy_{attach,connect,connect_direct} functions
is then used to assign a struct phy_device dev_flags with its value.
All callers but the tg3 driver pass the flag 0, which results in the
underlying PHY drivers in drivers/net/phy/ not being able to actually
use any of the flags they would set in dev_flags. This patch gets rid of
the flags argument, and passes phydev->dev_flags to the internal PHY
library call phy_attach_direct() such that drivers which actually modify
a phy device dev_flags get the value preserved for use by the underlying
phy driver.
Acked-by: Kosta Zertsekel <konszert@marvell.com>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since RFC state:
- remove accidentally included include/linux/version.h file
- changed Documentation bits to reflect this change
The following coccinelle script was used for modifying callers:
virtual patch
virtual context
virtual org
virtual report
@@
expression E1, E2, E3, E4;
@@
- phy_attach(E1, E2, E3, E4)
+ phy_attach(E1, E2, E4)
@@
expression E1, E2, E3, E4, E5;
@@
- phy_connect(E1, E2, E3, E4, E5)
+ phy_connect(E1, E2, E3, E5)
@@
expression E1, E2, E3, E4, E5;
@@
- phy_connect_direct(E1, E2, E3, E4, E5)
+ phy_connect_direct(E1, E2, E3, E5)
Documentation/networking/phy.txt | 11 ++++++-----
drivers/net/ethernet/8390/ax88796.c | 2 +-
drivers/net/ethernet/adi/bfin_mac.c | 4 ++--
drivers/net/ethernet/aeroflex/greth.c | 4 +---
drivers/net/ethernet/amd/au1000_eth.c | 4 ++--
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 +-
drivers/net/ethernet/broadcom/sb1250-mac.c | 2 +-
drivers/net/ethernet/broadcom/tg3.c | 4 ++--
drivers/net/ethernet/cadence/macb.c | 2 +-
drivers/net/ethernet/dnet.c | 4 ++--
drivers/net/ethernet/ethoc.c | 4 ++--
drivers/net/ethernet/faraday/ftgmac100.c | 3 +--
drivers/net/ethernet/freescale/fec.c | 2 +-
drivers/net/ethernet/lantiq_etop.c | 4 ++--
drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
drivers/net/ethernet/marvell/pxa168_eth.c | 2 +-
drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
drivers/net/ethernet/rdc/r6040.c | 2 +-
drivers/net/ethernet/renesas/sh_eth.c | 2 +-
drivers/net/ethernet/s6gmac.c | 2 +-
drivers/net/ethernet/smsc/smsc911x.c | 5 ++---
drivers/net/ethernet/smsc/smsc9420.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +--
drivers/net/ethernet/ti/cpmac.c | 4 ++--
drivers/net/ethernet/ti/cpsw.c | 2 +-
drivers/net/ethernet/ti/davinci_emac.c | 2 +-
drivers/net/ethernet/toshiba/tc35815.c | 5 ++---
drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +-
drivers/net/phy/phy_device.c | 15 ++++++---------
drivers/net/usb/ax88172a.c | 2 +-
drivers/of/of_mdio.c | 4 ++--
drivers/staging/et131x/et131x.c | 2 +-
include/linux/phy.h | 6 +++---
net/dsa/slave.c | 2 +-
34 files changed, 56 insertions(+), 64 deletions(-)
diff --git a/Documentation/networking/phy.txt b/Documentation/networking/phy.txt
index 95e5f59..d5b1a39 100644
--- a/Documentation/networking/phy.txt
+++ b/Documentation/networking/phy.txt
@@ -103,7 +103,7 @@ Letting the PHY Abstraction Layer do Everything
Now, to connect, just call this function:
- phydev = phy_connect(dev, phy_name, &adjust_link, flags, interface);
+ phydev = phy_connect(dev, phy_name, &adjust_link, interface);
phydev is a pointer to the phy_device structure which represents the PHY. If
phy_connect is successful, it will return the pointer. dev, here, is the
@@ -113,7 +113,9 @@ Letting the PHY Abstraction Layer do Everything
current state, though the PHY will not yet be truly operational at this
point.
- flags is a u32 which can optionally contain phy-specific flags.
+ PHY-specific flags should be set in phydev->dev_flags prior to the call
+ to phy_connect() such that the underlying PHY driver can check for flags
+ and perform specific operations based on them.
This is useful if the system has put hardware restrictions on
the PHY/controller, of which the PHY needs to be aware.
@@ -185,11 +187,10 @@ Doing it all yourself
start, or disables then frees them for stop.
struct phy_device * phy_attach(struct net_device *dev, const char *phy_id,
- u32 flags, phy_interface_t interface);
+ phy_interface_t interface);
Attaches a network device to a particular PHY, binding the PHY to a generic
- driver if none was found during bus initialization. Passes in
- any phy-specific flags as needed.
+ driver if none was found during bus initialization.
int phy_start_aneg(struct phy_device *phydev);
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index 7eeddf0..cab306a 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -358,7 +358,7 @@ static int ax_mii_probe(struct net_device *dev)
return -ENODEV;
}
- ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change, 0,
+ ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,
PHY_INTERFACE_MODE_MII);
if (ret) {
netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index c7a83f6..a175d0b 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -425,8 +425,8 @@ static int mii_probe(struct net_device *dev, int phy_mode)
return -EINVAL;
}
- phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
- 0, phy_mode);
+ phydev = phy_connect(dev, dev_name(&phydev->dev),
+ &bfin_mac_adjust_link, phy_mode);
if (IS_ERR(phydev)) {
netdev_err(dev, "could not attach PHY\n");
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 480662b..0be2195 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1288,9 +1288,7 @@ static int greth_mdio_probe(struct net_device *dev)
}
ret = phy_connect_direct(dev, phy, &greth_link_change,
- 0, greth->gbit_mac ?
- PHY_INTERFACE_MODE_GMII :
- PHY_INTERFACE_MODE_MII);
+ greth->gbit_mac ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII);
if (ret) {
if (netif_msg_ifup(greth))
dev_err(&dev->dev, "could not attach to PHY\n");
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 65b865a..de774d4 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -437,8 +437,8 @@ static int au1000_mii_probe(struct net_device *dev)
/* now we are supposed to have a proper phydev, to attach to... */
BUG_ON(phydev->attached_dev);
- phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link,
- 0, PHY_INTERFACE_MODE_MII);
+ phydev = phy_connect(dev, dev_name(&phydev->dev),
+ &au1000_adjust_link, PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index d8a1510..f5b6b47 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -799,7 +799,7 @@ static int bcm_enet_open(struct net_device *dev)
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
priv->mii_bus->id, priv->phy_id);
- phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0,
+ phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link,
PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index 3a1c8a3..e9b35da 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -2385,7 +2385,7 @@ static int sbmac_mii_probe(struct net_device *dev)
return -ENXIO;
}
- phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll, 0,
+ phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll,
PHY_INTERFACE_MODE_GMII);
if (IS_ERR(phy_dev)) {
printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 88f2d41..2277491 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2004,8 +2004,8 @@ static int tg3_phy_init(struct tg3 *tp)
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
/* Attach the MAC to the PHY. */
- phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
- phydev->dev_flags, phydev->interface);
+ phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
+ tg3_adjust_link, phydev->interface);
if (IS_ERR(phydev)) {
dev_err(&tp->pdev->dev, "Could not attach to PHY\n");
return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index a9b0830..352190b 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -287,7 +287,7 @@ static int macb_mii_probe(struct net_device *dev)
}
/* attach the mac to the phy */
- ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0,
+ ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
bp->phy_interface);
if (ret) {
netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
index 2c177b3..f3d60eb 100644
--- a/drivers/net/ethernet/dnet.c
+++ b/drivers/net/ethernet/dnet.c
@@ -281,11 +281,11 @@ static int dnet_mii_probe(struct net_device *dev)
/* attach the mac to the phy */
if (bp->capabilities & DNET_HAS_RMII) {
phydev = phy_connect(dev, dev_name(&phydev->dev),
- &dnet_handle_link_change, 0,
+ &dnet_handle_link_change,
PHY_INTERFACE_MODE_RMII);
} else {
phydev = phy_connect(dev, dev_name(&phydev->dev),
- &dnet_handle_link_change, 0,
+ &dnet_handle_link_change,
PHY_INTERFACE_MODE_MII);
}
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index b51c81a..aa47ef9 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -682,8 +682,8 @@ static int ethoc_mdio_probe(struct net_device *dev)
return -ENXIO;
}
- err = phy_connect_direct(dev, phy, ethoc_mdio_poll, 0,
- PHY_INTERFACE_MODE_GMII);
+ err = phy_connect_direct(dev, phy, ethoc_mdio_poll,
+ PHY_INTERFACE_MODE_GMII);
if (err) {
dev_err(&dev->dev, "could not attach to PHY\n");
return err;
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 96454b5..7c361d1 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -858,8 +858,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv)
}
phydev = phy_connect(netdev, dev_name(&phydev->dev),
- &ftgmac100_adjust_link, 0,
- PHY_INTERFACE_MODE_GMII);
+ &ftgmac100_adjust_link, PHY_INTERFACE_MODE_GMII);
if (IS_ERR(phydev)) {
netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name);
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 5f2b4ac..1b7684a 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1008,7 +1008,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
}
snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
- phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0,
+ phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link,
fep->phy_interface);
if (IS_ERR(phy_dev)) {
printk(KERN_ERR "%s: could not attach to PHY\n", ndev->name);
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 8ead46a..6a21274 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -393,8 +393,8 @@ ltq_etop_mdio_probe(struct net_device *dev)
return -ENODEV;
}
- phydev = phy_connect(dev, dev_name(&phydev->dev), <q_etop_mdio_link,
- 0, priv->pldata->mii_mode);
+ phydev = phy_connect(dev, dev_name(&phydev->dev),
+ <q_etop_mdio_link, priv->pldata->mii_mode);
if (IS_ERR(phydev)) {
netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 84c1326..c27b23d8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2789,7 +2789,7 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)
phy_reset(mp);
- phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII);
+ phy_attach(mp->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_GMII);
if (speed == 0) {
phy->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index c7f2fa6..037ed86 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1390,7 +1390,7 @@ static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex)
struct phy_device *phy = pep->phy;
ethernet_phy_reset(pep);
- phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII);
+ phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII);
if (speed == 0) {
phy->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 6fda51e..c4122c8 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -800,7 +800,7 @@ static int lpc_mii_probe(struct net_device *ndev)
else
netdev_info(ndev, "using RMII interface\n");
phydev = phy_connect(ndev, dev_name(&phydev->dev),
- &lpc_handle_link_change, 0,
+ &lpc_handle_link_change,
lpc_phy_interface_mode(&pldat->pdev->dev));
if (IS_ERR(phydev)) {
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index be3616d..34f76e9 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -1042,7 +1042,7 @@ static int r6040_mii_probe(struct net_device *dev)
}
phydev = phy_connect(dev, dev_name(&phydev->dev), &r6040_adjust_link,
- 0, PHY_INTERFACE_MODE_MII);
+ PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
dev_err(&lp->pdev->dev, "could not attach to PHY\n");
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 3d70586..e195c1e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1422,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
/* Try connect to PHY */
phydev = phy_connect(ndev, phy_id, sh_eth_adjust_link,
- 0, mdp->phy_interface);
+ mdp->phy_interface);
if (IS_ERR(phydev)) {
dev_err(&ndev->dev, "phy_connect failed\n");
return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/s6gmac.c b/drivers/net/ethernet/s6gmac.c
index 72fc57d..21683e2 100644
--- a/drivers/net/ethernet/s6gmac.c
+++ b/drivers/net/ethernet/s6gmac.c
@@ -795,7 +795,7 @@ static inline int s6gmac_phy_start(struct net_device *dev)
struct phy_device *p = NULL;
while ((i < PHY_MAX_ADDR) && (!(p = pd->mii.bus->phy_map[i])))
i++;
- p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link, 0,
+ p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link,
PHY_INTERFACE_MODE_RGMII);
if (IS_ERR(p)) {
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 04ff63c..da5cc9a 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -997,9 +997,8 @@ static int smsc911x_mii_probe(struct net_device *dev)
SMSC_TRACE(pdata, probe, "PHY: addr %d, phy_id 0x%08X",
phydev->addr, phydev->phy_id);
- ret = phy_connect_direct(dev, phydev,
- &smsc911x_phy_adjust_link, 0,
- pdata->config.phy_interface);
+ ret = phy_connect_direct(dev, phydev, &smsc911x_phy_adjust_link,
+ pdata->config.phy_interface);
if (ret) {
netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 3c58658..ecfb436 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1179,7 +1179,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
phydev->phy_id);
phydev = phy_connect(dev, dev_name(&phydev->dev),
- smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII);
+ smsc9420_phy_adjust_link, PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
pr_err("%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f07c061..8c65729 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -428,8 +428,7 @@ static int stmmac_init_phy(struct net_device *dev)
priv->plat->phy_addr);
pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id_fmt);
- phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, 0,
- interface);
+ phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, interface);
if (IS_ERR(phydev)) {
pr_err("%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 70d1920..31bbbca 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1172,8 +1172,8 @@ static int cpmac_probe(struct platform_device *pdev)
snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT,
mdio_bus_id, phy_id);
- priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link, 0,
- PHY_INTERFACE_MODE_MII);
+ priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link,
+ PHY_INTERFACE_MODE_MII);
if (IS_ERR(priv->phy)) {
if (netif_msg_drv(priv))
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index bea736b..3772804 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -592,7 +592,7 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
1 << slave_port, 0, ALE_MCAST_FWD_2);
slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
- &cpsw_adjust_link, 0, slave->data->phy_if);
+ &cpsw_adjust_link, slave->data->phy_if);
if (IS_ERR(slave->phy)) {
dev_err(priv->dev, "phy %s not found on slave %d\n",
slave->data->phy_id, slave->slave_num);
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 6621ae3..8478d98 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1599,7 +1599,7 @@ static int emac_dev_open(struct net_device *ndev)
if (priv->phy_id && *priv->phy_id) {
priv->phydev = phy_connect(ndev, priv->phy_id,
- &emac_adjust_link, 0,
+ &emac_adjust_link,
PHY_INTERFACE_MODE_MII);
if (IS_ERR(priv->phydev)) {
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index f16410e..fe25609 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -633,9 +633,8 @@ static int tc_mii_probe(struct net_device *dev)
/* attach the mac to the phy */
phydev = phy_connect(dev, dev_name(&phydev->dev),
- &tc_handle_link_change, 0,
- lp->chiptype == TC35815_TX4939 ?
- PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
+ &tc_handle_link_change,
+ lp->chiptype == TC35815_TX4939 ? PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index a4be1ad..6958a5e 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1451,7 +1451,7 @@ static int eth_init_one(struct platform_device *pdev)
snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
mdio_bus->id, plat->phy);
- port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
+ port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link,
PHY_INTERFACE_MODE_MII);
if (IS_ERR(port->phydev)) {
err = PTR_ERR(port->phydev);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 8af46e8..9930f99 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -416,16 +416,15 @@ static void phy_prepare_link(struct phy_device *phydev,
* @dev: the network device to connect
* @phydev: the pointer to the phy device
* @handler: callback function for state change notifications
- * @flags: PHY device's dev_flags
* @interface: PHY device's interface
*/
int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
- void (*handler)(struct net_device *), u32 flags,
+ void (*handler)(struct net_device *),
phy_interface_t interface)
{
int rc;
- rc = phy_attach_direct(dev, phydev, flags, interface);
+ rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface);
if (rc)
return rc;
@@ -443,7 +442,6 @@ EXPORT_SYMBOL(phy_connect_direct);
* @dev: the network device to connect
* @bus_id: the id string of the PHY device to connect
* @handler: callback function for state change notifications
- * @flags: PHY device's dev_flags
* @interface: PHY device's interface
*
* Description: Convenience function for connecting ethernet
@@ -455,7 +453,7 @@ EXPORT_SYMBOL(phy_connect_direct);
* the desired functionality.
*/
struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
- void (*handler)(struct net_device *), u32 flags,
+ void (*handler)(struct net_device *),
phy_interface_t interface)
{
struct phy_device *phydev;
@@ -471,7 +469,7 @@ struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
}
phydev = to_phy_device(d);
- rc = phy_connect_direct(dev, phydev, handler, flags, interface);
+ rc = phy_connect_direct(dev, phydev, handler, interface);
if (rc)
return ERR_PTR(rc);
@@ -576,14 +574,13 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
* phy_attach - attach a network device to a particular PHY device
* @dev: network device to attach
* @bus_id: Bus ID of PHY device to attach
- * @flags: PHY device's dev_flags
* @interface: PHY device's interface
*
* Description: Same as phy_attach_direct() except that a PHY bus_id
* string is passed instead of a pointer to a struct phy_device.
*/
struct phy_device *phy_attach(struct net_device *dev,
- const char *bus_id, u32 flags, phy_interface_t interface)
+ const char *bus_id, phy_interface_t interface)
{
struct bus_type *bus = &mdio_bus_type;
struct phy_device *phydev;
@@ -599,7 +596,7 @@ struct phy_device *phy_attach(struct net_device *dev,
}
phydev = to_phy_device(d);
- rc = phy_attach_direct(dev, phydev, flags, interface);
+ rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface);
if (rc)
return ERR_PTR(rc);
diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
index c8e0aa8..fdbab72 100644
--- a/drivers/net/usb/ax88172a.c
+++ b/drivers/net/usb/ax88172a.c
@@ -377,7 +377,7 @@ static int ax88172a_reset(struct usbnet *dev)
priv->phydev = phy_connect(dev->net, priv->phy_name,
&ax88172a_adjust_link,
- 0, PHY_INTERFACE_MODE_MII);
+ PHY_INTERFACE_MODE_MII);
if (IS_ERR(priv->phydev)) {
netdev_err(dev->net, "Could not connect to PHY device %s\n",
priv->phy_name);
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 83ca06f..e3a8b22 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -157,7 +157,7 @@ struct phy_device *of_phy_connect(struct net_device *dev,
if (!phy)
return NULL;
- return phy_connect_direct(dev, phy, hndlr, flags, iface) ? NULL : phy;
+ return phy_connect_direct(dev, phy, hndlr, iface) ? NULL : phy;
}
EXPORT_SYMBOL(of_phy_connect);
@@ -194,7 +194,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
sprintf(bus_id, PHY_ID_FMT, "fixed-0", be32_to_cpu(phy_id[0]));
- phy = phy_connect(dev, bus_id, hndlr, 0, iface);
+ phy = phy_connect(dev, bus_id, hndlr, iface);
return IS_ERR(phy) ? NULL : phy;
}
EXPORT_SYMBOL(of_phy_connect_fixed_link);
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index f15059c..a0a30b3 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -3917,7 +3917,7 @@ static int et131x_mii_probe(struct net_device *netdev)
}
phydev = phy_connect(netdev, dev_name(&phydev->dev),
- &et131x_adjust_link, 0, PHY_INTERFACE_MODE_MII);
+ &et131x_adjust_link, PHY_INTERFACE_MODE_MII);
if (IS_ERR(phydev)) {
dev_err(&adapter->pdev->dev, "Could not attach to PHY\n");
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 93b3cf7..33999ad 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -506,13 +506,13 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
int phy_device_register(struct phy_device *phy);
int phy_init_hw(struct phy_device *phydev);
struct phy_device * phy_attach(struct net_device *dev,
- const char *bus_id, u32 flags, phy_interface_t interface);
+ const char *bus_id, phy_interface_t interface);
struct phy_device *phy_find_first(struct mii_bus *bus);
int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
- void (*handler)(struct net_device *), u32 flags,
+ void (*handler)(struct net_device *),
phy_interface_t interface);
struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
- void (*handler)(struct net_device *), u32 flags,
+ void (*handler)(struct net_device *),
phy_interface_t interface);
void phy_disconnect(struct phy_device *phydev);
void phy_detach(struct phy_device *phydev);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index f795b0c..f434558 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -391,7 +391,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
if (p->phy != NULL) {
phy_attach(slave_dev, dev_name(&p->phy->dev),
- 0, PHY_INTERFACE_MODE_GMII);
+ PHY_INTERFACE_MODE_GMII);
p->phy->autoneg = AUTONEG_ENABLE;
p->phy->speed = 0;
--
1.7.10.4
^ permalink raw reply related
* when and where does ep_poll_callback be called ?
From: horseriver @ 2013-01-14 1:11 UTC (permalink / raw)
To: netdev
hi:
I'm studying the epoll module , I can not find ep_poll_callback be called somewhere .
thanks!
^ permalink raw reply
* Re: [Patch net-next v3] netpoll: fix a rtnl lock assertion failure
From: Jiri Pirko @ 2013-01-14 10:54 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller
In-Reply-To: <1358160234-24996-1-git-send-email-amwang@redhat.com>
Mon, Jan 14, 2013 at 11:43:54AM CET, amwang@redhat.com wrote:
>From: Cong Wang <amwang@redhat.com>
>
>This patch fixes the following warning:
>
>[ 72.013864] RTNL: assertion failed at net/core/dev.c (4955)
>[ 72.017758] Pid: 668, comm: netpoll-prep-v6 Not tainted 3.8.0-rc1+ #474
>[ 72.019582] Call Trace:
>[ 72.020295] [<ffffffff8176653d>] netdev_master_upper_dev_get+0x35/0x58
>[ 72.022545] [<ffffffff81784edd>] netpoll_setup+0x61/0x340
>[ 72.024846] [<ffffffff815d837e>] store_enabled+0x82/0xc3
>[ 72.027466] [<ffffffff815d7e51>] netconsole_target_attr_store+0x35/0x37
>[ 72.029348] [<ffffffff811c3479>] configfs_write_file+0xe2/0x10c
>[ 72.030959] [<ffffffff8115d239>] vfs_write+0xaf/0xf6
>[ 72.032359] [<ffffffff81978a05>] ? sysret_check+0x22/0x5d
>[ 72.033824] [<ffffffff8115d453>] sys_write+0x5c/0x84
>[ 72.035328] [<ffffffff819789d9>] system_call_fastpath+0x16/0x1b
>
>Just hold RCU read lock and call netdev_master_upper_dev_get_rcu(),
>as suggested by Jiri.
>
>Cc: Jiri Pirko <jiri@resnulli.us>
>Cc: David S. Miller <davem@davemloft.net>
>Signed-off-by: Cong Wang <amwang@redhat.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
>
>---
>diff --git a/net/core/netpoll.c b/net/core/netpoll.c
>index 9f05067..5d1f856 100644
>--- a/net/core/netpoll.c
>+++ b/net/core/netpoll.c
>@@ -1055,11 +1055,14 @@ int netpoll_setup(struct netpoll *np)
> return -ENODEV;
> }
>
>- if (netdev_master_upper_dev_get(ndev)) {
>+ rcu_read_lock();
>+ if (netdev_master_upper_dev_get_rcu(ndev)) {
>+ rcu_read_unlock();
> np_err(np, "%s is a slave device, aborting\n", np->dev_name);
> err = -EBUSY;
> goto put;
> }
>+ rcu_read_unlock();
>
> if (!netif_running(ndev)) {
> unsigned long atmost, atleast;
Thanks Amerigo.
^ permalink raw reply
* Re: [RFC PATCH v3] cgroup: net_cls: traffic counter based on classification control cgroup
From: Alexey Perevalov @ 2013-01-14 11:25 UTC (permalink / raw)
To: Daniel Wagner; +Cc: cgroups, Glauber Costa, Kyungmin Park, netdev
In-Reply-To: <50F3BD26.6090903@monom.org>
Hi Daniel,
On 01/14/2013 12:09 PM, Daniel Wagner wrote:
> Hi Alexey,
>
> On 11.01.2013 17:59, Alexey Perevalov wrote:
>> I'm sorry for previous email with attachments.
>
> It seems something went wrong with the patch, e.g. indention is wrong
> and also I see '^M$' line endings. I assume you are sending your
> patches through an exchange server which is likely not to work.
Your right I'm behind MS Exchange server. I'll find the way to send
normal patch without modification. Can you accept attachments?
>
>> I would like to represent next version of patch I sent before
>> cgroup: "net_cls: traffic counter based on classification control
>> cgroup"
>>
>> The main idea is the same as was. It keeping counter in control groups,
>> but now uses atomic instead resource_counters.
>
> +#if IS_ENABLED(CONFIG_NET_CLS_COUNTER)
> + if (copied > 0)
> + count_cls_rcv(current, copied, ifindex);
> +#endif
> +
> release_sock(sk);
> return copied;
>
> Normally, distros will enable most config flags. Maybe you could use
> a jump label to reduce the cost for the users which have
> CONFIG_NET_CLS_COUNTER enabled and do not use it?
Do your mean one big macro instead of #if #endif. I don't like #if
#endif in this place too. For example skb_update_prio implemented in
such way.
Or your mean function callback which will be invoked in case of net_cls
loaded? This variant is more flexible. I agree.
>
>> I have a performance measurement for this patch. It was done by lmbench
>> on physical machine.
>> Results are not so representative for 20 tests and some numbers are real
>> weird.
>
> Could you explain in the commit message how your patch is designed? I
> see you are using a RB tree. What's the purpose of it?
The main purpose - it's ability to count network traffic per
application, application groups and application threads. Without huge
overhead in user space. Also keep information about involved network
interface.
For example:
ChatOn application
consumed 100Mb on netinterface0 and 10Mb on netinterface1.
Why it wasn't done on the netfilter layer. Because of patent threat and
big overhead for resolving incoming traffic. At the netfilter layer we
know only source address, and destination address/port. And we need to
make huge work to know to whom it addressed, even we use assumption like
this, destination address for incoming is the same as source address for
outgoing, but it true only for TCP.
In this patch I used already prepared buffer (size of buffer) which
ready in tcp_recvmsg, tcp_read_sock,... functions. For outgoing traffic
I count on the post routing (network interface already defined). But
before netprio changing priority, I didn't test such case.
And here on the post routing in dev_queue_xmit there is no valid current
thread. To find appropriate cgroup by classid and increase counter in it
I use RB tree.
>
>> Daniel Wagner wrote what he is doing something similar, but using
>> namespaces.
>
> I am trying a different approach on this problem using iptables. I am
> playing around with a few patches which allow to install a iptables rule
> which matches on the security context, e.g.
>
> iptables -t mangle -A OUTPUT -m secmark --secctx \
> unconfined_u:unconfined_r:foo_t:s0-s0:c0.c1023 -j MARK --set-mark 1
>
> So far it looks promising, but as I me previous networking experience
> is, that something will not work eventually.
>
>> Proposed by me approach is used in upcoming Tizen release, but little
>> bit different version.
>
> Thanks,
> Daniel
>
>
BR,
Alexey Perevalov
^ permalink raw reply
* Re: Information needed on the kernel version which supports ----
From: Balaji Foss @ 2013-01-14 11:35 UTC (permalink / raw)
To: sandeepacs
Cc: vyasevic, mst, netdev, stephen, bridge, shmulik.ladkani,
shemminger, davem
In-Reply-To: <50F3D5FD.6090608@tataelxsi.co.in>
[-- Attachment #1: Type: text/plain, Size: 2077 bytes --]
>1) On what kernel version the VLAN support for multicast groups is being
>done
Its currently in the net-next tree which would become 3.8
>2)On what flavors it is supported, is it available with Debian
If you want to test those changes right away, you will have to do a git
clone of the net-next repo and test those patches, else wait for the
distributions to package the 3.8 kernel.
>3)How can we get/download the supported patch files for reference.
you will have to make a clone of the net-next repo. For more information
look up tutorials on git.
Cheers,
- Balaji
On Mon, Jan 14, 2013 at 3:25 PM, Sandeepa C S <sandeepacs@tataelxsi.co.in>wrote:
> Dear All,
>
> We are trying to add vlan support for the IGMP snooping feature in the
> kernel version 2.6.39
> But from the below thread discussion we understood that vlan support is
> already in the bridge.
> http://www.spinics.net/lists/**netdev/msg221800.html<http://www.spinics.net/lists/netdev/msg221800.html>
>
> Could you please let us know the below informations,
> 1) On what kernel version the VLAN support for multicast groups is being
> done
> 2)On what flavors it is supported, is it available with Debian
> 3)How can we get/download the supported patch files for reference.
>
> --
> Thanks & Regards,
> Sandeepa cs.
>
> Notice: The information contained in this e-mail message and/or
> attachments to it may contain confidential or privileged information. If
> you are not the intended recipient, any dissemination, use, review,
> distribution, printing or copying of the information contained in this
> e-mail message and/or attachments to it are strictly prohibited. If you
> have received this communication in error, please notify us by reply e-mail
> or telephone and immediately and permanently delete the message and any
> attachments. Thank you
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/**majordomo-info.html<http://vger.kernel.org/majordomo-info.html>
>
[-- Attachment #2: Type: text/html, Size: 2606 bytes --]
^ permalink raw reply
* Re: [RFC PATCH v3] cgroup: net_cls: traffic counter based on classification control cgroup
From: Alexey Perevalov @ 2013-01-14 11:50 UTC (permalink / raw)
To: Daniel Wagner; +Cc: cgroups, Glauber Costa, Kyungmin Park, netdev
In-Reply-To: <50F3BD26.6090903@monom.org>
Hello all,
also I got local benchmark result for 100 test.
It looks more trully
*Local* Communication latencies in microseconds
smaller is better
2p/0K ctxsw Pipe AF Unix UDP RPC/UDP TCP
RPC/TCP TCP conn
Kernel without patch Average values: 3.2809 9.12381
8.2354 16.327 18.825 24.274 22.759 30.64
Kernel with patch Average values: 3.4718 9.61495
8.5778 19.442 19.807 31.835 23.824 30.85
*Local* Communication bandwidths in MB/s bigger
is better
Pipe AF Unix TCP File reread Mmap reread
Bcopy (libc) Bcopy (hand) Mem read Mem write
Kernel without patch Average values: 2119.25 6853.49
3499.27 4421.796 7543.785 6176.899 3483.647
5603.29 6541.38
Kernel with patch Average values: 1966.7 6825.42
3413.67 4426.936 7534.443 6170.924 3481.583
5602.75 6520.42
Performance degradation exists. But I thing it can be solved, for
example, by adding incrementation and searching appropriate cgroup to
delayed timer (add_timer).
On 01/14/2013 12:09 PM, Daniel Wagner wrote:
> Hi Alexey,
>
> On 11.01.2013 17:59, Alexey Perevalov wrote:
>> I'm sorry for previous email with attachments.
>
> It seems something went wrong with the patch, e.g. indention is wrong
> and also I see '^M$' line endings. I assume you are sending your
> patches through an exchange server which is likely not to work.
>
>> I would like to represent next version of patch I sent before
>> cgroup: "net_cls: traffic counter based on classification control
>> cgroup"
>>
>> The main idea is the same as was. It keeping counter in control groups,
>> but now uses atomic instead resource_counters.
>
> +#if IS_ENABLED(CONFIG_NET_CLS_COUNTER)
> + if (copied > 0)
> + count_cls_rcv(current, copied, ifindex);
> +#endif
> +
> release_sock(sk);
> return copied;
>
> Normally, distros will enable most config flags. Maybe you could use
> a jump label to reduce the cost for the users which have
> CONFIG_NET_CLS_COUNTER enabled and do not use it?
>
>> I have a performance measurement for this patch. It was done by lmbench
>> on physical machine.
>> Results are not so representative for 20 tests and some numbers are real
>> weird.
>
> Could you explain in the commit message how your patch is designed? I
> see you are using a RB tree. What's the purpose of it?
>
>> Daniel Wagner wrote what he is doing something similar, but using
>> namespaces.
>
> I am trying a different approach on this problem using iptables. I am
> playing around with a few patches which allow to install a iptables rule
> which matches on the security context, e.g.
>
> iptables -t mangle -A OUTPUT -m secmark --secctx \
> unconfined_u:unconfined_r:foo_t:s0-s0:c0.c1023 -j MARK --set-mark 1
>
> So far it looks promising, but as I me previous networking experience
> is, that something will not work eventually.
>
>> Proposed by me approach is used in upcoming Tizen release, but little
>> bit different version.
>
> Thanks,
> Daniel
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Best regards,
Alexey Perevalov,
Technical Leader,
phone: +7 (495) 797 25 00 ext 3969
e-mail: a.perevalov@samsung.com <mailto:a.perevalov@samsumng.com>
Mobile group, Moscow Samsung Research Center
12 Dvintsev street, building 1
127018, Moscow, Russian Federation
^ permalink raw reply
* [RFC PATCH 1/3] Avoid making inappropriate requests of NETIF_F_V[46]_CSUM devices
From: David Woodhouse @ 2013-01-14 12:10 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 3328 bytes --]
Devices with the NETIF_F_V[46]_CSUM feature(s) are *only* required to
handle checksumming of UDP and TCP.
In netif_skb_features() we attempt to filter out the capabilities which
are inappropriate for the device that the skb will actually be sent
from... but there we assume that NETIF_F_V4_CSUM devices can handle
*all* Legacy IP, and that NETIF_F_V6_CSUM devices can handle *all* IPv6.
This may have been OK in the days when CHECKSUM_PARTIAL packets would
*only* be produced by the local stack, and we knew the local stack
didn't generate them for anything but UDP and TCP. But these days that's
not true. When a tun device receives a packet from userspace with
VIRTIO_NET_HDR_F_NEEDS_CSUM, that translates fairly directly into
setting CHECKSUM_PARTIAL on the resulting skb. Since virtio_net
advertises NETIF_F_HW_CSUM to its guests, we should expect to be asked
to checksum *anything*.
This patch attempts to cope with that by checking skb->csum_offset for
such devices. If that doesn't match the offset for UDP or TCP, then we
don't use hardware checksum. It won't catch 100% of cases, but a full
check of the actual skb contents in the fast path isn't a good idea.
It'll probably do well enough for now.
This expands the check in can_checksum_protocol() to make it more
readable, but doing so shouldn't make the resulting code any *bigger*,
except obviously for the additional checks.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
diff --git a/net/core/dev.c b/net/core/dev.c
index 515473e..f1048b6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2229,22 +2229,39 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features)
return 0;
}
-static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
+static bool can_checksum_protocol(netdev_features_t features, __be16 protocol,
+ __u16 csum_offset)
{
- return ((features & NETIF_F_GEN_CSUM) ||
- ((features & NETIF_F_V4_CSUM) &&
- protocol == htons(ETH_P_IP)) ||
- ((features & NETIF_F_V6_CSUM) &&
- protocol == htons(ETH_P_IPV6)) ||
- ((features & NETIF_F_FCOE_CRC) &&
- protocol == htons(ETH_P_FCOE)));
+ if (features & NETIF_F_GEN_CSUM)
+ return 1;
+
+ if ((features & NETIF_F_FCOE_CRC) && protocol == htons(ETH_P_FCOE))
+ return 1;
+
+ /*
+ * Only allow NETIF_F_V[46]_CSUM for UDP/TCP packets. This is an
+ * overly permissive check, but it's very unlikely to have false
+ * positives in practice, and actually looking in the packet for
+ * a proper confirmation would be very slow.
+ */
+ if (csum_offset != offsetof(struct udphdr, check) &&
+ csum_offset != offsetof(struct tcphdr, check))
+ return 0;
+
+ if ((features & NETIF_F_V4_CSUM) && protocol == htons(ETH_P_IP))
+ return 1;
+
+ if ((features & NETIF_F_V6_CSUM) && protocol == htons(ETH_P_IPV6))
+ return 1;
+
+ return 0;
}
static netdev_features_t harmonize_features(struct sk_buff *skb,
__be16 protocol, netdev_features_t features)
{
if (skb->ip_summed != CHECKSUM_NONE &&
- !can_checksum_protocol(features, protocol)) {
+ !can_checksum_protocol(features, protocol, skb->csum_offset)) {
features &= ~NETIF_F_ALL_CSUM;
features &= ~NETIF_F_SG;
} else if (illegal_highdma(skb->dev, skb)) {
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply related
* [RFC PATCH 2/3] Prepare to allow for hardware checksum of ICMPv6
From: David Woodhouse @ 2013-01-14 12:12 UTC (permalink / raw)
To: netdev
In-Reply-To: <1358165431.27054.62.camel@shinybook.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]
If netif_skb_features() has to filter out non-TCP and non-UDP frames
anyway for devices with limited checksum support, there's no reason we
shouldn't generate them in our *own* stack. This allows ICMPv6 to do
so...
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b4a9fd5..e474df9 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -235,12 +235,19 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struc
icmp6h->icmp6_cksum = 0;
if (skb_queue_len(&sk->sk_write_queue) == 1) {
- skb->csum = csum_partial(icmp6h,
- sizeof(struct icmp6hdr), skb->csum);
- icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
- &fl6->daddr,
- len, fl6->flowi6_proto,
- skb->csum);
+ if (skb->ip_summed == CHECKSUM_PARTIAL) {
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct icmp6hdr, icmp6_cksum);
+ icmp6h->icmp6_cksum = ~csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
+ len, fl6->flowi6_proto, 0);
+ } else {
+ skb->csum = csum_partial(icmp6h,
+ sizeof(struct icmp6hdr), skb->csum);
+ icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
+ &fl6->daddr,
+ len, fl6->flowi6_proto,
+ skb->csum);
+ }
} else {
__wsum tmp_csum = 0;
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply related
* [RFC PATCH 3/3] Use hardware checksum for UDPv6 and ICMPv6
From: David Woodhouse @ 2013-01-14 12:15 UTC (permalink / raw)
To: netdev
In-Reply-To: <1358165431.27054.62.camel@shinybook.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
This actually enables the use of CHECKSUM_PARTIAL for outbound ICMPv6
frames. My check in the driver for non-hw-csum frames was *also*
triggering when I was running 'nc -u' over IPv6, and this appears to fix
that too. Is there a reason it wasn't happening already?
I only see the driver check trigger for ndisc and igmp frames now, and I
don't think we care very much about those?
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5552d13..8a27090 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1370,7 +1370,12 @@ alloc_new_skb:
/*
* Fill in the control structures
*/
- skb->ip_summed = CHECKSUM_NONE;
+ if ((sk->sk_protocol == IPPROTO_ICMPV6 ||
+ sk->sk_protocol == IPPROTO_UDP) &&
+ rt->dst.dev->features & NETIF_F_HW_CSUM)
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ else
+ skb->ip_summed = CHECKSUM_NONE;
skb->csum = 0;
/* reserve for fragmentation and ipsec header */
skb_reserve(skb, hh_len + sizeof(struct frag_hdr) +
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply related
* From Capt Hook Williams.. Please Open Attached Letter For More Details.
From: Capt Hook Williams @ 2013-01-14 12:10 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 2 bytes --]
[-- Attachment #2: LETTER..docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 10451 bytes --]
^ permalink raw reply
* Re: PMTU discovery is broken on kernel 3.7.1 for UDP sockets
From: Steffen Klassert @ 2013-01-14 12:52 UTC (permalink / raw)
To: Yurij M. Plotnikov; +Cc: Ben Hutchings, netdev, Alexandra N. Kossovsky
In-Reply-To: <50F3C153.9030204@oktetlabs.ru>
On Mon, Jan 14, 2013 at 12:26:59PM +0400, Yurij M. Plotnikov wrote:
>
> Could you, please, tell me is there any news about this bug?
>
Currently I'm testing some patches.
I'll contact you when I have something that works,
probably later this week.
^ permalink raw reply
* Re: [PATCH net-next] ifb: dont hard code inet_net use
From: Jamal Hadi Salim @ 2013-01-14 13:13 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Benjamin LaHaise, David Miller, netdev
In-Reply-To: <1358099194.8744.311.camel@edumazet-glaptop>
On 13-01-13 12:46 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> ifb should lookup devices in the appropriate namespace.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
cheers,
jamal
^ permalink raw reply
* [RFC Patch net-next] ipv6: look up neighbours on demand in ip6_finish_output2()
From: Cong Wang @ 2013-01-14 13:35 UTC (permalink / raw)
To: netdev; +Cc: Roland Dreier, David S. Miller, Cong Wang
From: Cong Wang <xiyou.wangcong@gmail.com>
Roland reported that we may use a "stray" neigh entry if someone else
holds a refcount of this entry. Therefore leads to neigh_blackhole().
And David said:
"Another reason we must make ipv6 like ipv4, which looks up neighbours
on demand at packet output time rather than caching them in the route
entries."
Thus, we just follow what IPv4 does, call __ipv6_neigh_lookup_noref()
to avoid using the "stray" neighbour.
Roland, could you test if this could fix your problem? I don't
have the environment.
Reported-by: Roland Dreier <roland@purestorage.com>
Cc: Roland Dreier <roland@purestorage.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 23b3a7c..a5fe1b3 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -148,14 +148,16 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
(p32[3] * hash_rnd[3]));
}
-static inline struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, const void *pkey)
+static inline
+struct neighbour *__ipv6_neigh_lookup_noref(struct neigh_table *tbl,
+ struct net_device *dev,
+ const void *pkey)
{
struct neigh_hash_table *nht;
const u32 *p32 = pkey;
struct neighbour *n;
u32 hash_val;
- rcu_read_lock_bh();
nht = rcu_dereference_bh(tbl->nht);
hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
@@ -165,11 +167,23 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl, str
if (n->dev == dev &&
((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
(n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0) {
- if (!atomic_inc_not_zero(&n->refcnt))
- n = NULL;
break;
}
}
+
+ return n;
+}
+
+static inline
+struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl,
+ struct net_device *dev, const void *pkey)
+{
+ struct neighbour *n;
+
+ rcu_read_lock_bh();
+ n = __ipv6_neigh_lookup_noref(tbl, dev, pkey);
+ if (n && (!atomic_inc_not_zero(&n->refcnt)))
+ n = NULL;
rcu_read_unlock_bh();
return n;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 9250c69..20f2e86 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -89,11 +89,12 @@ static int ip6_finish_output2(struct sk_buff *skb)
struct net_device *dev = dst->dev;
struct neighbour *neigh;
struct rt6_info *rt;
+ const void *daddr = &ipv6_hdr(skb)->daddr;
skb->protocol = htons(ETH_P_IPV6);
skb->dev = dev;
- if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
+ if (ipv6_addr_is_multicast(daddr)) {
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
if (!(dev->flags & IFF_LOOPBACK) && sk_mc_loop(skb->sk) &&
@@ -124,9 +125,17 @@ static int ip6_finish_output2(struct sk_buff *skb)
}
rt = (struct rt6_info *) dst;
- neigh = rt->n;
- if (neigh)
+ rcu_read_lock_bh();
+ if (rt->rt6i_flags & RTF_GATEWAY)
+ daddr = &rt->rt6i_gateway;
+ neigh = __ipv6_neigh_lookup_noref(&nd_tbl, dev, daddr);
+ if (unlikely(!neigh))
+ neigh = __neigh_create(&nd_tbl, daddr, dev, false);
+ if (!IS_ERR(neigh)) {
+ rcu_read_unlock_bh();
return dst_neigh_output(dst, neigh, skb);
+ }
+ rcu_read_unlock_bh();
IP6_INC_STATS_BH(dev_net(dst->dev),
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
^ permalink raw reply related
* Re: Information needed on the kernel version which supports ----
From: Vlad Yasevich @ 2013-01-14 14:56 UTC (permalink / raw)
To: Balaji Foss
Cc: sandeepacs, shemminger, mst, netdev, stephen, bridge,
shmulik.ladkani, davem, Satyanarayana Reddy M (D&D)
In-Reply-To: <CAJ4ZP5T3nw+E+NP_eDZBCt=gqyiviuUoMEjm=7FuWTCDJhBEmQ@mail.gmail.com>
On 01/14/2013 06:35 AM, Balaji Foss wrote:
> >1) On what kernel version the VLAN support for multicast groups is being
>> done
> Its currently in the net-next tree which would become 3.8
I did not see any "Applied" messages from upstream, so I doubt its in
any tree yet. The code is still in development.
-vlad
>
>> 2)On what flavors it is supported, is it available with Debian
>
> If you want to test those changes right away, you will have to do a git
> clone of the net-next repo and test those patches, else wait for the
> distributions to package the 3.8 kernel.
>
>> 3)How can we get/download the supported patch files for reference.
> you will have to make a clone of the net-next repo. For more information
> look up tutorials on git.
>
> Cheers,
> - Balaji
>
> On Mon, Jan 14, 2013 at 3:25 PM, Sandeepa C S <sandeepacs@tataelxsi.co.in>wrote:
>
>> Dear All,
>>
>> We are trying to add vlan support for the IGMP snooping feature in the
>> kernel version 2.6.39
>> But from the below thread discussion we understood that vlan support is
>> already in the bridge.
>> http://www.spinics.net/lists/**netdev/msg221800.html<http://www.spinics.net/lists/netdev/msg221800.html>
>>
>> Could you please let us know the below informations,
>> 1) On what kernel version the VLAN support for multicast groups is being
>> done
>> 2)On what flavors it is supported, is it available with Debian
>> 3)How can we get/download the supported patch files for reference.
>>
>> --
>> Thanks & Regards,
>> Sandeepa cs.
>>
>> Notice: The information contained in this e-mail message and/or
>> attachments to it may contain confidential or privileged information. If
>> you are not the intended recipient, any dissemination, use, review,
>> distribution, printing or copying of the information contained in this
>> e-mail message and/or attachments to it are strictly prohibited. If you
>> have received this communication in error, please notify us by reply e-mail
>> or telephone and immediately and permanently delete the message and any
>> attachments. Thank you
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/**majordomo-info.html<http://vger.kernel.org/majordomo-info.html>
>>
>
^ permalink raw reply
* [PATCH net-next] pkt_sched: namespace aware act_mirred
From: Benjamin LaHaise @ 2013-01-14 15:15 UTC (permalink / raw)
To: David Miller; +Cc: Eric Dumazet, Jamal Hadi Salim, netdev
In-Reply-To: <50F40489.70105@mojatatu.com>
Eric Dumazet pointed out that act_mirred needs to find the current net_ns,
and struct net pointer is not provided in the call chain. His original
patch made use of current->nsproxy->net_ns to find the network namespace,
but this fails to work correctly for userspace code that makes use of
netlink sockets in different network namespaces. Instead, pass the
"struct net *" down along the call chain to where it is needed.
This version removes the ifb changes as Eric has submitted that patch
separately, but is otherwise identical to the previous version.
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
include/net/act_api.h | 12 +++++++++---
include/net/pkt_cls.h | 7 ++++---
include/net/sch_generic.h | 2 +-
net/sched/act_api.c | 18 ++++++++++--------
net/sched/act_csum.c | 2 +-
net/sched/act_gact.c | 5 +++--
net/sched/act_ipt.c | 2 +-
net/sched/act_mirred.c | 7 ++++---
net/sched/act_nat.c | 2 +-
net/sched/act_pedit.c | 5 +++--
net/sched/act_police.c | 5 +++--
net/sched/act_simple.c | 5 +++--
net/sched/act_skbedit.c | 5 +++--
net/sched/cls_api.c | 11 ++++++-----
net/sched/cls_basic.c | 13 +++++++------
net/sched/cls_cgroup.c | 5 +++--
net/sched/cls_flow.c | 4 ++--
net/sched/cls_fw.c | 10 +++++-----
net/sched/cls_route.c | 15 ++++++++-------
net/sched/cls_rsvp.h | 4 ++--
net/sched/cls_tcindex.c | 14 ++++++++------
net/sched/cls_u32.c | 13 +++++++------
22 files changed, 94 insertions(+), 72 deletions(-)
diff --git a/include/net/act_api.h b/include/net/act_api.h
index c739531..112c25c 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -91,7 +91,9 @@ struct tc_action_ops {
int (*dump)(struct sk_buff *, struct tc_action *, int, int);
int (*cleanup)(struct tc_action *, int bind);
int (*lookup)(struct tc_action *, u32);
- int (*init)(struct nlattr *, struct nlattr *, struct tc_action *, int , int);
+ int (*init)(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *act, int ovr,
+ int bind);
int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *);
};
@@ -116,8 +118,12 @@ extern int tcf_register_action(struct tc_action_ops *a);
extern int tcf_unregister_action(struct tc_action_ops *a);
extern void tcf_action_destroy(struct tc_action *a, int bind);
extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res);
-extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
-extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
+extern struct tc_action *tcf_action_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, char *n, int ovr,
+ int bind);
+extern struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
+ struct nlattr *est, char *n, int ovr,
+ int bind);
extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 9fcc680..1317450 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -126,9 +126,10 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
return 0;
}
-extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
- struct nlattr *rate_tlv, struct tcf_exts *exts,
- const struct tcf_ext_map *map);
+extern int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
+ struct nlattr **tb, struct nlattr *rate_tlv,
+ struct tcf_exts *exts,
+ const struct tcf_ext_map *map);
extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
struct tcf_exts *src);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 1540f9c..2d06c2a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -195,7 +195,7 @@ struct tcf_proto_ops {
unsigned long (*get)(struct tcf_proto*, u32 handle);
void (*put)(struct tcf_proto*, unsigned long);
- int (*change)(struct sk_buff *,
+ int (*change)(struct net *net, struct sk_buff *,
struct tcf_proto*, unsigned long,
u32 handle, struct nlattr **,
unsigned long *);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 65d240c..8579c4b 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -485,8 +485,9 @@ errout:
return err;
}
-struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
- char *name, int ovr, int bind)
+struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
+ struct nlattr *est, char *name, int ovr,
+ int bind)
{
struct tc_action *a;
struct tc_action_ops *a_o;
@@ -542,9 +543,9 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
/* backward compatibility for policer */
if (name == NULL)
- err = a_o->init(tb[TCA_ACT_OPTIONS], est, a, ovr, bind);
+ err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, a, ovr, bind);
else
- err = a_o->init(nla, est, a, ovr, bind);
+ err = a_o->init(net, nla, est, a, ovr, bind);
if (err < 0)
goto err_free;
@@ -566,8 +567,9 @@ err_out:
return ERR_PTR(err);
}
-struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est,
- char *name, int ovr, int bind)
+struct tc_action *tcf_action_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, char *name, int ovr,
+ int bind)
{
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
struct tc_action *head = NULL, *act, *act_prev = NULL;
@@ -579,7 +581,7 @@ struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est,
return ERR_PTR(err);
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
- act = tcf_action_init_1(tb[i], est, name, ovr, bind);
+ act = tcf_action_init_1(net, tb[i], est, name, ovr, bind);
if (IS_ERR(act))
goto err;
act->order = i;
@@ -960,7 +962,7 @@ tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
struct tc_action *a;
u32 seq = n->nlmsg_seq;
- act = tcf_action_init(nla, NULL, NULL, ovr, 0);
+ act = tcf_action_init(net, nla, NULL, NULL, ovr, 0);
if (act == NULL)
goto done;
if (IS_ERR(act)) {
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 2c8ad7c..08fa1e8 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -51,7 +51,7 @@ static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
[TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), },
};
-static int tcf_csum_init(struct nlattr *nla, struct nlattr *est,
+static int tcf_csum_init(struct net *n, struct nlattr *nla, struct nlattr *est,
struct tc_action *a, int ovr, int bind)
{
struct nlattr *tb[TCA_CSUM_MAX + 1];
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 05d60859..fd2b3cf 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -58,8 +58,9 @@ static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
[TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
};
-static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_gact_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a,
+ int ovr, int bind)
{
struct nlattr *tb[TCA_GACT_MAX + 1];
struct tc_gact *parm;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 58fb3c7..0fb9e3f 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -102,7 +102,7 @@ static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = {
[TCA_IPT_TARG] = { .len = sizeof(struct xt_entry_target) },
};
-static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est,
+static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est,
struct tc_action *a, int ovr, int bind)
{
struct nlattr *tb[TCA_IPT_MAX + 1];
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 9c0fd0c..5d676ed 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -62,8 +62,9 @@ static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {
[TCA_MIRRED_PARMS] = { .len = sizeof(struct tc_mirred) },
};
-static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_mirred_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a, int ovr,
+ int bind)
{
struct nlattr *tb[TCA_MIRRED_MAX + 1];
struct tc_mirred *parm;
@@ -88,7 +89,7 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est,
return -EINVAL;
}
if (parm->ifindex) {
- dev = __dev_get_by_index(&init_net, parm->ifindex);
+ dev = __dev_get_by_index(net, parm->ifindex);
if (dev == NULL)
return -ENODEV;
switch (dev->type) {
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index b5d029e..876f0ef 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -44,7 +44,7 @@ static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = {
[TCA_NAT_PARMS] = { .len = sizeof(struct tc_nat) },
};
-static int tcf_nat_init(struct nlattr *nla, struct nlattr *est,
+static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
struct tc_action *a, int ovr, int bind)
{
struct nlattr *tb[TCA_NAT_MAX + 1];
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 45c53ab..0c3fadd 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -38,8 +38,9 @@ static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
[TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) },
};
-static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_pedit_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a,
+ int ovr, int bind)
{
struct nlattr *tb[TCA_PEDIT_MAX + 1];
struct tc_pedit *parm;
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index a9de232..8dbd695 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -130,8 +130,9 @@ static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {
[TCA_POLICE_RESULT] = { .type = NLA_U32 },
};
-static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_act_police_locate(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a,
+ int ovr, int bind)
{
unsigned int h;
int ret = 0, err;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 3714f60..7725eb4 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -95,8 +95,9 @@ static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = {
[TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA },
};
-static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_simp_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a,
+ int ovr, int bind)
{
struct nlattr *tb[TCA_DEF_MAX + 1];
struct tc_defact *parm;
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 476e0fa..cb42211 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -67,8 +67,9 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
[TCA_SKBEDIT_MARK] = { .len = sizeof(u32) },
};
-static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est,
- struct tc_action *a, int ovr, int bind)
+static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
+ struct nlattr *est, struct tc_action *a,
+ int ovr, int bind)
{
struct nlattr *tb[TCA_SKBEDIT_MAX + 1];
struct tc_skbedit *parm;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index ff55ed6..964f5e4 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -321,7 +321,7 @@ replay:
}
}
- err = tp->ops->change(skb, tp, cl, t->tcm_handle, tca, &fh);
+ err = tp->ops->change(net, skb, tp, cl, t->tcm_handle, tca, &fh);
if (err == 0) {
if (tp_created) {
spin_lock_bh(root_lock);
@@ -508,7 +508,7 @@ void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts)
}
EXPORT_SYMBOL(tcf_exts_destroy);
-int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
+int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
struct nlattr *rate_tlv, struct tcf_exts *exts,
const struct tcf_ext_map *map)
{
@@ -519,7 +519,7 @@ int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
struct tc_action *act;
if (map->police && tb[map->police]) {
- act = tcf_action_init_1(tb[map->police], rate_tlv,
+ act = tcf_action_init_1(net, tb[map->police], rate_tlv,
"police", TCA_ACT_NOREPLACE,
TCA_ACT_BIND);
if (IS_ERR(act))
@@ -528,8 +528,9 @@ int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
act->type = TCA_OLD_COMPAT;
exts->action = act;
} else if (map->action && tb[map->action]) {
- act = tcf_action_init(tb[map->action], rate_tlv, NULL,
- TCA_ACT_NOREPLACE, TCA_ACT_BIND);
+ act = tcf_action_init(net, tb[map->action], rate_tlv,
+ NULL, TCA_ACT_NOREPLACE,
+ TCA_ACT_BIND);
if (IS_ERR(act))
return PTR_ERR(act);
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 344a11b..d76a35d 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -132,15 +132,16 @@ static const struct nla_policy basic_policy[TCA_BASIC_MAX + 1] = {
[TCA_BASIC_EMATCHES] = { .type = NLA_NESTED },
};
-static int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
- unsigned long base, struct nlattr **tb,
+static int basic_set_parms(struct net *net, struct tcf_proto *tp,
+ struct basic_filter *f, unsigned long base,
+ struct nlattr **tb,
struct nlattr *est)
{
int err = -EINVAL;
struct tcf_exts e;
struct tcf_ematch_tree t;
- err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map);
+ err = tcf_exts_validate(net, tp, tb, est, &e, &basic_ext_map);
if (err < 0)
return err;
@@ -162,7 +163,7 @@ errout:
return err;
}
-static int basic_change(struct sk_buff *in_skb,
+static int basic_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, u32 handle,
struct nlattr **tca, unsigned long *arg)
{
@@ -182,7 +183,7 @@ static int basic_change(struct sk_buff *in_skb,
if (f != NULL) {
if (handle && f->handle != handle)
return -EINVAL;
- return basic_set_parms(tp, f, base, tb, tca[TCA_RATE]);
+ return basic_set_parms(net, tp, f, base, tb, tca[TCA_RATE]);
}
err = -ENOBUFS;
@@ -208,7 +209,7 @@ static int basic_change(struct sk_buff *in_skb,
f->handle = head->hgenerator;
}
- err = basic_set_parms(tp, f, base, tb, tca[TCA_RATE]);
+ err = basic_set_parms(net, tp, f, base, tb, tca[TCA_RATE]);
if (err < 0)
goto errout;
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 6db7855..3a294eb 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -178,7 +178,7 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = {
[TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },
};
-static int cls_cgroup_change(struct sk_buff *in_skb,
+static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle, struct nlattr **tca,
unsigned long *arg)
@@ -215,7 +215,8 @@ static int cls_cgroup_change(struct sk_buff *in_skb,
if (err < 0)
return err;
- err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &cgroup_ext_map);
+ err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e,
+ &cgroup_ext_map);
if (err < 0)
return err;
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index ce82d0c..aa36a8c 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -351,7 +351,7 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = {
[TCA_FLOW_PERTURB] = { .type = NLA_U32 },
};
-static int flow_change(struct sk_buff *in_skb,
+static int flow_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle, struct nlattr **tca,
unsigned long *arg)
@@ -397,7 +397,7 @@ static int flow_change(struct sk_buff *in_skb,
return -EOPNOTSUPP;
}
- err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &flow_ext_map);
+ err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &flow_ext_map);
if (err < 0)
return err;
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 4075a0a..1135d82 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -192,7 +192,7 @@ static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = {
};
static int
-fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
+fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f,
struct nlattr **tb, struct nlattr **tca, unsigned long base)
{
struct fw_head *head = (struct fw_head *)tp->root;
@@ -200,7 +200,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
u32 mask;
int err;
- err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &fw_ext_map);
+ err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &fw_ext_map);
if (err < 0)
return err;
@@ -233,7 +233,7 @@ errout:
return err;
}
-static int fw_change(struct sk_buff *in_skb,
+static int fw_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle,
struct nlattr **tca,
@@ -255,7 +255,7 @@ static int fw_change(struct sk_buff *in_skb,
if (f != NULL) {
if (f->id != handle && handle)
return -EINVAL;
- return fw_change_attrs(tp, f, tb, tca, base);
+ return fw_change_attrs(net, tp, f, tb, tca, base);
}
if (!handle)
@@ -282,7 +282,7 @@ static int fw_change(struct sk_buff *in_skb,
f->id = handle;
- err = fw_change_attrs(tp, f, tb, tca, base);
+ err = fw_change_attrs(net, tp, f, tb, tca, base);
if (err < 0)
goto errout;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index c10d57b..37da567 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -335,9 +335,10 @@ static const struct nla_policy route4_policy[TCA_ROUTE4_MAX + 1] = {
[TCA_ROUTE4_IIF] = { .type = NLA_U32 },
};
-static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
- struct route4_filter *f, u32 handle, struct route4_head *head,
- struct nlattr **tb, struct nlattr *est, int new)
+static int route4_set_parms(struct net *net, struct tcf_proto *tp,
+ unsigned long base, struct route4_filter *f,
+ u32 handle, struct route4_head *head,
+ struct nlattr **tb, struct nlattr *est, int new)
{
int err;
u32 id = 0, to = 0, nhandle = 0x8000;
@@ -346,7 +347,7 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
struct route4_bucket *b;
struct tcf_exts e;
- err = tcf_exts_validate(tp, tb, est, &e, &route_ext_map);
+ err = tcf_exts_validate(net, tp, tb, est, &e, &route_ext_map);
if (err < 0)
return err;
@@ -427,7 +428,7 @@ errout:
return err;
}
-static int route4_change(struct sk_buff *in_skb,
+static int route4_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle,
struct nlattr **tca,
@@ -457,7 +458,7 @@ static int route4_change(struct sk_buff *in_skb,
if (f->bkt)
old_handle = f->handle;
- err = route4_set_parms(tp, base, f, handle, head, tb,
+ err = route4_set_parms(net, tp, base, f, handle, head, tb,
tca[TCA_RATE], 0);
if (err < 0)
return err;
@@ -480,7 +481,7 @@ static int route4_change(struct sk_buff *in_skb,
if (f == NULL)
goto errout;
- err = route4_set_parms(tp, base, f, handle, head, tb,
+ err = route4_set_parms(net, tp, base, f, handle, head, tb,
tca[TCA_RATE], 1);
if (err < 0)
goto errout;
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index 494bbb9..252d8b0 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -416,7 +416,7 @@ static const struct nla_policy rsvp_policy[TCA_RSVP_MAX + 1] = {
[TCA_RSVP_PINFO] = { .len = sizeof(struct tc_rsvp_pinfo) },
};
-static int rsvp_change(struct sk_buff *in_skb,
+static int rsvp_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle,
struct nlattr **tca,
@@ -440,7 +440,7 @@ static int rsvp_change(struct sk_buff *in_skb,
if (err < 0)
return err;
- err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &rsvp_ext_map);
+ err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &rsvp_ext_map);
if (err < 0)
return err;
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index a1293b4..b86535a 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -197,9 +197,10 @@ static const struct nla_policy tcindex_policy[TCA_TCINDEX_MAX + 1] = {
};
static int
-tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
- struct tcindex_data *p, struct tcindex_filter_result *r,
- struct nlattr **tb, struct nlattr *est)
+tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
+ u32 handle, struct tcindex_data *p,
+ struct tcindex_filter_result *r, struct nlattr **tb,
+ struct nlattr *est)
{
int err, balloc = 0;
struct tcindex_filter_result new_filter_result, *old_r = r;
@@ -208,7 +209,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
struct tcindex_filter *f = NULL; /* make gcc behave */
struct tcf_exts e;
- err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map);
+ err = tcf_exts_validate(net, tp, tb, est, &e, &tcindex_ext_map);
if (err < 0)
return err;
@@ -332,7 +333,7 @@ errout:
}
static int
-tcindex_change(struct sk_buff *in_skb,
+tcindex_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, u32 handle,
struct nlattr **tca, unsigned long *arg)
{
@@ -353,7 +354,8 @@ tcindex_change(struct sk_buff *in_skb,
if (err < 0)
return err;
- return tcindex_set_parms(tp, base, handle, p, r, tb, tca[TCA_RATE]);
+ return tcindex_set_parms(net, tp, base, handle, p, r, tb,
+ tca[TCA_RATE]);
}
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index c7c27bc..eb07a1e 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -488,15 +488,15 @@ static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = {
[TCA_U32_MARK] = { .len = sizeof(struct tc_u32_mark) },
};
-static int u32_set_parms(struct tcf_proto *tp, unsigned long base,
- struct tc_u_hnode *ht,
+static int u32_set_parms(struct net *net, struct tcf_proto *tp,
+ unsigned long base, struct tc_u_hnode *ht,
struct tc_u_knode *n, struct nlattr **tb,
struct nlattr *est)
{
int err;
struct tcf_exts e;
- err = tcf_exts_validate(tp, tb, est, &e, &u32_ext_map);
+ err = tcf_exts_validate(net, tp, tb, est, &e, &u32_ext_map);
if (err < 0)
return err;
@@ -544,7 +544,7 @@ errout:
return err;
}
-static int u32_change(struct sk_buff *in_skb,
+static int u32_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, u32 handle,
struct nlattr **tca,
unsigned long *arg)
@@ -570,7 +570,8 @@ static int u32_change(struct sk_buff *in_skb,
if (TC_U32_KEY(n->handle) == 0)
return -EINVAL;
- return u32_set_parms(tp, base, n->ht_up, n, tb, tca[TCA_RATE]);
+ return u32_set_parms(net, tp, base, n->ht_up, n, tb,
+ tca[TCA_RATE]);
}
if (tb[TCA_U32_DIVISOR]) {
@@ -656,7 +657,7 @@ static int u32_change(struct sk_buff *in_skb,
}
#endif
- err = u32_set_parms(tp, base, ht, n, tb, tca[TCA_RATE]);
+ err = u32_set_parms(net, tp, base, ht, n, tb, tca[TCA_RATE]);
if (err == 0) {
struct tc_u_knode **ins;
for (ins = &ht->ht[TC_U32_HASH(handle)]; *ins; ins = &(*ins)->next)
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox