提交 e65ac4d5 编写于 作者: D David S. Miller

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull in the 'net' tree to get CAIF bug fixes upon which
the following set of CAIF feature patches depend.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
...@@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work) ...@@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work)
size_t fifo_occupancy = 0; size_t fifo_occupancy = 0;
/* Wakeup timeout */ /* Wakeup timeout */
dev_err(&cfhsi->ndev->dev, "%s: Timeout.\n", dev_dbg(&cfhsi->ndev->dev, "%s: Timeout.\n",
__func__); __func__);
/* Check FIFO to check if modem has sent something. */ /* Check FIFO to check if modem has sent something. */
WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev,
&fifo_occupancy)); &fifo_occupancy));
dev_err(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", dev_dbg(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n",
__func__, (unsigned) fifo_occupancy); __func__, (unsigned) fifo_occupancy);
/* Check if we misssed the interrupt. */ /* Check if we misssed the interrupt. */
...@@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev) ...@@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev)
static void cfhsi_shutdown(struct cfhsi *cfhsi) static void cfhsi_shutdown(struct cfhsi *cfhsi)
{ {
u8 *tx_buf, *rx_buf; u8 *tx_buf, *rx_buf, *flip_buf;
/* Stop TXing */ /* Stop TXing */
netif_tx_stop_all_queues(cfhsi->ndev); netif_tx_stop_all_queues(cfhsi->ndev);
...@@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) ...@@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
/* Store bufferes: will be freed later. */ /* Store bufferes: will be freed later. */
tx_buf = cfhsi->tx_buf; tx_buf = cfhsi->tx_buf;
rx_buf = cfhsi->rx_buf; rx_buf = cfhsi->rx_buf;
flip_buf = cfhsi->rx_flip_buf;
/* Flush transmit queues. */ /* Flush transmit queues. */
cfhsi_abort_tx(cfhsi); cfhsi_abort_tx(cfhsi);
...@@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) ...@@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
/* Free buffers. */ /* Free buffers. */
kfree(tx_buf); kfree(tx_buf);
kfree(rx_buf); kfree(rx_buf);
kfree(flip_buf);
} }
int cfhsi_remove(struct platform_device *pdev) int cfhsi_remove(struct platform_device *pdev)
......
...@@ -626,16 +626,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -626,16 +626,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
/* This can happen with OOM and indirect buffers. */ /* This can happen with OOM and indirect buffers. */
if (unlikely(capacity < 0)) { if (unlikely(capacity < 0)) {
if (likely(capacity == -ENOMEM)) { if (likely(capacity == -ENOMEM)) {
if (net_ratelimit()) { if (net_ratelimit())
dev_warn(&dev->dev, dev_warn(&dev->dev,
"TX queue failure: out of memory\n"); "TX queue failure: out of memory\n");
} else { } else {
dev->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
if (net_ratelimit()) if (net_ratelimit())
dev_warn(&dev->dev, dev_warn(&dev->dev,
"Unexpected TX queue failure: %d\n", "Unexpected TX queue failure: %d\n",
capacity); capacity);
}
} }
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
kfree_skb(skb); kfree_skb(skb);
......
...@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) ...@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
break; break;
default: default:
kfree_skb(skb);
priv->netdev->stats.rx_errors++; priv->netdev->stats.rx_errors++;
return -EINVAL; return -EINVAL;
} }
...@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (skb->len > priv->netdev->mtu) { if (skb->len > priv->netdev->mtu) {
pr_warn("Size of skb exceeded MTU\n"); pr_warn("Size of skb exceeded MTU\n");
kfree_skb(skb);
dev->stats.tx_errors++; dev->stats.tx_errors++;
return -ENOSPC; return NETDEV_TX_OK;
} }
if (!priv->flowenabled) { if (!priv->flowenabled) {
pr_debug("dropping packets flow off\n"); pr_debug("dropping packets flow off\n");
kfree_skb(skb);
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
return NETDEV_TX_BUSY; return NETDEV_TX_OK;
} }
if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP)
...@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
if (result) { if (result) {
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
return result; return NETDEV_TX_OK;
} }
/* Update statistics. */ /* Update statistics. */
......
...@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier); ...@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier);
* register_netdevice_notifier(). The notifier is unlinked into the * register_netdevice_notifier(). The notifier is unlinked into the
* kernel structures and may then be reused. A negative errno code * kernel structures and may then be reused. A negative errno code
* is returned on a failure. * is returned on a failure.
*
* After unregistering unregister and down device events are synthesized
* for all devices on the device list to the removed notifier to remove
* the need for special case cleanup code.
*/ */
int unregister_netdevice_notifier(struct notifier_block *nb) int unregister_netdevice_notifier(struct notifier_block *nb)
{ {
struct net_device *dev;
struct net *net;
int err; int err;
rtnl_lock(); rtnl_lock();
err = raw_notifier_chain_unregister(&netdev_chain, nb); err = raw_notifier_chain_unregister(&netdev_chain, nb);
if (err)
goto unlock;
for_each_net(net) {
for_each_netdev(net, dev) {
if (dev->flags & IFF_UP) {
nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
nb->notifier_call(nb, NETDEV_DOWN, dev);
}
nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
}
}
unlock:
rtnl_unlock(); rtnl_unlock();
return err; return err;
} }
......
...@@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, ...@@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
/* Addresses to be used by KM for negotiation, if ext is available */ /* Addresses to be used by KM for negotiation, if ext is available */
if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) if (k != NULL && (set_sadb_kmaddress(skb, k) < 0))
return -EINVAL; goto err;
/* selector src */ /* selector src */
set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel);
......
...@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout) ...@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout)
{ {
write_lock_bh(&l2tp_ip_lock); write_lock_bh(&l2tp_ip_lock);
hlist_del_init(&sk->sk_bind_node); hlist_del_init(&sk->sk_bind_node);
hlist_del_init(&sk->sk_node); sk_del_node_init(sk);
write_unlock_bh(&l2tp_ip_lock); write_unlock_bh(&l2tp_ip_lock);
sk_common_release(sk); sk_common_release(sk);
} }
...@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
goto out; goto out;
inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; if (addr->l2tp_addr.s_addr)
inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
inet->inet_saddr = 0; /* Use device */ inet->inet_saddr = 0; /* Use device */
sk_dst_reset(sk); sk_dst_reset(sk);
......
...@@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net) ...@@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net) static void __net_exit phonet_exit_net(struct net *net)
{ {
struct phonet_net *pnn = phonet_pernet(net);
struct net_device *dev;
unsigned i;
rtnl_lock();
for_each_netdev(net, dev)
phonet_device_destroy(dev);
for (i = 0; i < 64; i++) {
dev = pnn->routes.table[i];
if (dev) {
rtm_phonet_notify(RTM_DELROUTE, dev, i);
dev_put(dev);
}
}
rtnl_unlock();
proc_net_remove(net, "phonet"); proc_net_remove(net, "phonet");
} }
...@@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = { ...@@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = {
/* Initialize Phonet devices list */ /* Initialize Phonet devices list */
int __init phonet_device_init(void) int __init phonet_device_init(void)
{ {
int err = register_pernet_device(&phonet_net_ops); int err = register_pernet_subsys(&phonet_net_ops);
if (err) if (err)
return err; return err;
...@@ -377,7 +360,7 @@ void phonet_device_exit(void) ...@@ -377,7 +360,7 @@ void phonet_device_exit(void)
{ {
rtnl_unregister_all(PF_PHONET); rtnl_unregister_all(PF_PHONET);
unregister_netdevice_notifier(&phonet_device_notifier); unregister_netdevice_notifier(&phonet_device_notifier);
unregister_pernet_device(&phonet_net_ops); unregister_pernet_subsys(&phonet_net_ops);
proc_net_remove(&init_net, "pnresource"); proc_net_remove(&init_net, "pnresource");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册