Commit 36024fcf authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull networking fixes from David Miller:

 1) Don't corrupt xfrm_interface parms before validation, from Nicolas
    Dichtel.

 2) Revert use of usb-wakeup in btusb, from Mario Limonciello.

 3) Block ipv6 packets in bridge netfilter if ipv6 is disabled, from
    Leonardo Bras.

 4) IPS_OFFLOAD not honored in ctnetlink, from Pablo Neira Ayuso.

 5) Missing ULP check in sock_map, from John Fastabend.

 6) Fix receive statistic handling in forcedeth, from Zhu Yanjun.

 7) Fix length of SKB allocated in 6pack driver, from Christophe
    JAILLET.

 8) ip6_route_info_create() returns an error pointer, not NULL. From
    Maciej Żenczykowski.

 9) Only add RDS sock to the hashes after rs_transport is set, from
    Ka-Cheong Poon.

10) Don't double clean TX descriptors in ixgbe, from Ilya Maximets.

11) Presence of transmit IPSEC offload in an SKB is not tested for
    correctly in ixgbe and ixgbevf. From Steffen Klassert and Jeff
    Kirsher.

12) Need rcu_barrier() when register_netdevice() takes one of the
    notifier based failure paths, from Subash Abhinov Kasiviswanathan.

13) Fix leak in sctp_do_bind(), from Mao Wenan.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (72 commits)
  cdc_ether: fix rndis support for Mediatek based smartphones
  sctp: destroy bucket if failed to bind addr
  sctp: remove redundant assignment when call sctp_get_port_local
  sctp: change return type of sctp_get_port_local
  ixgbevf: Fix secpath usage for IPsec Tx offload
  sctp: Fix the link time qualifier of 'sctp_ctrlsock_exit()'
  ixgbe: Fix secpath usage for IPsec TX offload.
  net: qrtr: fix memort leak in qrtr_tun_write_iter
  net: Fix null de-reference of device refcount
  ipv6: Fix the link time qualifier of 'ping_v6_proc_exit_net()'
  tun: fix use-after-free when register netdev failed
  tcp: fix tcp_ecn_withdraw_cwr() to clear TCP_ECN_QUEUE_CWR
  ixgbe: fix double clean of Tx descriptors with xdp
  ixgbe: Prevent u8 wrapping of ITR value to something less than 10us
  mlx4: fix spelling mistake "veify" -> "verify"
  net: hns3: fix spelling mistake "undeflow" -> "underflow"
  net: lmc: fix spelling mistake "runnin" -> "running"
  NFC: st95hf: fix spelling mistake "receieve" -> "receive"
  net/rds: An rds_sock is added too early to the hash table
  mac80211: Do not send Layer 2 Update frame before authorization
  ...
parents 1c4c5e25 4d7ffcf3
...@@ -17699,8 +17699,7 @@ F: include/uapi/linux/dqblk_xfs.h ...@@ -17699,8 +17699,7 @@ F: include/uapi/linux/dqblk_xfs.h
F: include/uapi/linux/fsmap.h F: include/uapi/linux/fsmap.h
XILINX AXI ETHERNET DRIVER XILINX AXI ETHERNET DRIVER
M: Anirudha Sarangi <anirudh@xilinx.com> M: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
M: John Linn <John.Linn@xilinx.com>
S: Maintained S: Maintained
F: drivers/net/ethernet/xilinx/xilinx_axienet* F: drivers/net/ethernet/xilinx/xilinx_axienet*
......
...@@ -337,7 +337,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -337,7 +337,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
usb_free_urb(urb); usb_free_urb(urb);
return 0; return err;
} }
static int bpa10x_set_diag(struct hci_dev *hdev, bool enable) static int bpa10x_set_diag(struct hci_dev *hdev, bool enable)
......
...@@ -384,6 +384,9 @@ static const struct usb_device_id blacklist_table[] = { ...@@ -384,6 +384,9 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x13d3, 0x3526), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3526), .driver_info = BTUSB_REALTEK },
{ USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
/* Additional Realtek 8822CE Bluetooth devices */
{ USB_DEVICE(0x04ca, 0x4005), .driver_info = BTUSB_REALTEK },
/* Silicon Wave based devices */ /* Silicon Wave based devices */
{ USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE }, { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
...@@ -1170,10 +1173,6 @@ static int btusb_open(struct hci_dev *hdev) ...@@ -1170,10 +1173,6 @@ static int btusb_open(struct hci_dev *hdev)
} }
data->intf->needs_remote_wakeup = 1; data->intf->needs_remote_wakeup = 1;
/* device specific wakeup source enabled and required for USB
* remote wakeup while host is suspended
*/
device_wakeup_enable(&data->udev->dev);
if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags)) if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
goto done; goto done;
...@@ -1238,7 +1237,6 @@ static int btusb_close(struct hci_dev *hdev) ...@@ -1238,7 +1237,6 @@ static int btusb_close(struct hci_dev *hdev)
goto failed; goto failed;
data->intf->needs_remote_wakeup = 0; data->intf->needs_remote_wakeup = 0;
device_wakeup_disable(&data->udev->dev);
usb_autopm_put_interface(data->intf); usb_autopm_put_interface(data->intf);
failed: failed:
......
...@@ -309,13 +309,14 @@ static void qca_wq_awake_device(struct work_struct *work) ...@@ -309,13 +309,14 @@ static void qca_wq_awake_device(struct work_struct *work)
ws_awake_device); ws_awake_device);
struct hci_uart *hu = qca->hu; struct hci_uart *hu = qca->hu;
unsigned long retrans_delay; unsigned long retrans_delay;
unsigned long flags;
BT_DBG("hu %p wq awake device", hu); BT_DBG("hu %p wq awake device", hu);
/* Vote for serial clock */ /* Vote for serial clock */
serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu); serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu);
spin_lock(&qca->hci_ibs_lock); spin_lock_irqsave(&qca->hci_ibs_lock, flags);
/* Send wake indication to device */ /* Send wake indication to device */
if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0) if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0)
...@@ -327,7 +328,7 @@ static void qca_wq_awake_device(struct work_struct *work) ...@@ -327,7 +328,7 @@ static void qca_wq_awake_device(struct work_struct *work)
retrans_delay = msecs_to_jiffies(qca->wake_retrans); retrans_delay = msecs_to_jiffies(qca->wake_retrans);
mod_timer(&qca->wake_retrans_timer, jiffies + retrans_delay); mod_timer(&qca->wake_retrans_timer, jiffies + retrans_delay);
spin_unlock(&qca->hci_ibs_lock); spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
/* Actually send the packets */ /* Actually send the packets */
hci_uart_tx_wakeup(hu); hci_uart_tx_wakeup(hu);
...@@ -338,12 +339,13 @@ static void qca_wq_awake_rx(struct work_struct *work) ...@@ -338,12 +339,13 @@ static void qca_wq_awake_rx(struct work_struct *work)
struct qca_data *qca = container_of(work, struct qca_data, struct qca_data *qca = container_of(work, struct qca_data,
ws_awake_rx); ws_awake_rx);
struct hci_uart *hu = qca->hu; struct hci_uart *hu = qca->hu;
unsigned long flags;
BT_DBG("hu %p wq awake rx", hu); BT_DBG("hu %p wq awake rx", hu);
serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu); serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu);
spin_lock(&qca->hci_ibs_lock); spin_lock_irqsave(&qca->hci_ibs_lock, flags);
qca->rx_ibs_state = HCI_IBS_RX_AWAKE; qca->rx_ibs_state = HCI_IBS_RX_AWAKE;
/* Always acknowledge device wake up, /* Always acknowledge device wake up,
...@@ -354,7 +356,7 @@ static void qca_wq_awake_rx(struct work_struct *work) ...@@ -354,7 +356,7 @@ static void qca_wq_awake_rx(struct work_struct *work)
qca->ibs_sent_wacks++; qca->ibs_sent_wacks++;
spin_unlock(&qca->hci_ibs_lock); spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
/* Actually send the packets */ /* Actually send the packets */
hci_uart_tx_wakeup(hu); hci_uart_tx_wakeup(hu);
......
...@@ -688,6 +688,9 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos ...@@ -688,6 +688,9 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
if (!cdev->ap.applid) if (!cdev->ap.applid)
return -ENODEV; return -ENODEV;
if (count < CAPIMSG_BASELEN)
return -EINVAL;
skb = alloc_skb(count, GFP_USER); skb = alloc_skb(count, GFP_USER);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
...@@ -698,7 +701,8 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos ...@@ -698,7 +701,8 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
} }
mlen = CAPIMSG_LEN(skb->data); mlen = CAPIMSG_LEN(skb->data);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
if ((size_t)(mlen + CAPIMSG_DATALEN(skb->data)) != count) { if (count < CAPI_DATA_B3_REQ_LEN ||
(size_t)(mlen + CAPIMSG_DATALEN(skb->data)) != count) {
kfree_skb(skb); kfree_skb(skb);
return -EINVAL; return -EINVAL;
} }
...@@ -711,6 +715,10 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos ...@@ -711,6 +715,10 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
CAPIMSG_SETAPPID(skb->data, cdev->ap.applid); CAPIMSG_SETAPPID(skb->data, cdev->ap.applid);
if (CAPIMSG_CMD(skb->data) == CAPI_DISCONNECT_B3_RESP) { if (CAPIMSG_CMD(skb->data) == CAPI_DISCONNECT_B3_RESP) {
if (count < CAPI_DISCONNECT_B3_RESP_LEN) {
kfree_skb(skb);
return -EINVAL;
}
mutex_lock(&cdev->lock); mutex_lock(&cdev->lock);
capincci_free(cdev, CAPIMSG_NCCI(skb->data)); capincci_free(cdev, CAPIMSG_NCCI(skb->data));
mutex_unlock(&cdev->lock); mutex_unlock(&cdev->lock);
......
...@@ -98,7 +98,7 @@ static const struct hclge_hw_error hclge_igu_egu_tnl_int[] = { ...@@ -98,7 +98,7 @@ static const struct hclge_hw_error hclge_igu_egu_tnl_int[] = {
.reset_level = HNAE3_GLOBAL_RESET }, .reset_level = HNAE3_GLOBAL_RESET },
{ .int_msk = BIT(1), .msg = "rx_stp_fifo_overflow", { .int_msk = BIT(1), .msg = "rx_stp_fifo_overflow",
.reset_level = HNAE3_GLOBAL_RESET }, .reset_level = HNAE3_GLOBAL_RESET },
{ .int_msk = BIT(2), .msg = "rx_stp_fifo_undeflow", { .int_msk = BIT(2), .msg = "rx_stp_fifo_underflow",
.reset_level = HNAE3_GLOBAL_RESET }, .reset_level = HNAE3_GLOBAL_RESET },
{ .int_msk = BIT(3), .msg = "tx_buf_overflow", { .int_msk = BIT(3), .msg = "tx_buf_overflow",
.reset_level = HNAE3_GLOBAL_RESET }, .reset_level = HNAE3_GLOBAL_RESET },
......
...@@ -1984,8 +1984,11 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -1984,8 +1984,11 @@ static void __ibmvnic_reset(struct work_struct *work)
rwi = get_next_rwi(adapter); rwi = get_next_rwi(adapter);
while (rwi) { while (rwi) {
if (adapter->state == VNIC_REMOVING || if (adapter->state == VNIC_REMOVING ||
adapter->state == VNIC_REMOVED) adapter->state == VNIC_REMOVED) {
goto out; kfree(rwi);
rc = EBUSY;
break;
}
if (adapter->force_reset_recovery) { if (adapter->force_reset_recovery) {
adapter->force_reset_recovery = false; adapter->force_reset_recovery = false;
...@@ -2011,7 +2014,7 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -2011,7 +2014,7 @@ static void __ibmvnic_reset(struct work_struct *work)
netdev_dbg(adapter->netdev, "Reset failed\n"); netdev_dbg(adapter->netdev, "Reset failed\n");
free_all_rwi(adapter); free_all_rwi(adapter);
} }
out:
adapter->resetting = false; adapter->resetting = false;
if (we_lock_rtnl) if (we_lock_rtnl)
rtnl_unlock(); rtnl_unlock();
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <net/vxlan.h> #include <net/vxlan.h>
#include <net/mpls.h> #include <net/mpls.h>
#include <net/xdp_sock.h> #include <net/xdp_sock.h>
#include <net/xfrm.h>
#include "ixgbe.h" #include "ixgbe.h"
#include "ixgbe_common.h" #include "ixgbe_common.h"
...@@ -2621,7 +2622,7 @@ adjust_by_size: ...@@ -2621,7 +2622,7 @@ adjust_by_size:
/* 16K ints/sec to 9.2K ints/sec */ /* 16K ints/sec to 9.2K ints/sec */
avg_wire_size *= 15; avg_wire_size *= 15;
avg_wire_size += 11452; avg_wire_size += 11452;
} else if (avg_wire_size <= 1980) { } else if (avg_wire_size < 1968) {
/* 9.2K ints/sec to 8K ints/sec */ /* 9.2K ints/sec to 8K ints/sec */
avg_wire_size *= 5; avg_wire_size *= 5;
avg_wire_size += 22420; avg_wire_size += 22420;
...@@ -2654,6 +2655,8 @@ adjust_by_size: ...@@ -2654,6 +2655,8 @@ adjust_by_size:
case IXGBE_LINK_SPEED_2_5GB_FULL: case IXGBE_LINK_SPEED_2_5GB_FULL:
case IXGBE_LINK_SPEED_1GB_FULL: case IXGBE_LINK_SPEED_1GB_FULL:
case IXGBE_LINK_SPEED_10_FULL: case IXGBE_LINK_SPEED_10_FULL:
if (avg_wire_size > 8064)
avg_wire_size = 8064;
itr += DIV_ROUND_UP(avg_wire_size, itr += DIV_ROUND_UP(avg_wire_size,
IXGBE_ITR_ADAPTIVE_MIN_INC * 64) * IXGBE_ITR_ADAPTIVE_MIN_INC * 64) *
IXGBE_ITR_ADAPTIVE_MIN_INC; IXGBE_ITR_ADAPTIVE_MIN_INC;
...@@ -8695,7 +8698,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, ...@@ -8695,7 +8698,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
#endif /* IXGBE_FCOE */ #endif /* IXGBE_FCOE */
#ifdef CONFIG_IXGBE_IPSEC #ifdef CONFIG_IXGBE_IPSEC
if (secpath_exists(skb) && if (xfrm_offload(skb) &&
!ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx)) !ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx))
goto out_drop; goto out_drop;
#endif #endif
......
...@@ -633,19 +633,17 @@ static void ixgbe_clean_xdp_tx_buffer(struct ixgbe_ring *tx_ring, ...@@ -633,19 +633,17 @@ static void ixgbe_clean_xdp_tx_buffer(struct ixgbe_ring *tx_ring,
bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
struct ixgbe_ring *tx_ring, int napi_budget) struct ixgbe_ring *tx_ring, int napi_budget)
{ {
u16 ntc = tx_ring->next_to_clean, ntu = tx_ring->next_to_use;
unsigned int total_packets = 0, total_bytes = 0; unsigned int total_packets = 0, total_bytes = 0;
u32 i = tx_ring->next_to_clean, xsk_frames = 0;
unsigned int budget = q_vector->tx.work_limit;
struct xdp_umem *umem = tx_ring->xsk_umem; struct xdp_umem *umem = tx_ring->xsk_umem;
union ixgbe_adv_tx_desc *tx_desc; union ixgbe_adv_tx_desc *tx_desc;
struct ixgbe_tx_buffer *tx_bi; struct ixgbe_tx_buffer *tx_bi;
bool xmit_done; u32 xsk_frames = 0;
tx_bi = &tx_ring->tx_buffer_info[i]; tx_bi = &tx_ring->tx_buffer_info[ntc];
tx_desc = IXGBE_TX_DESC(tx_ring, i); tx_desc = IXGBE_TX_DESC(tx_ring, ntc);
i -= tx_ring->count;
do { while (ntc != ntu) {
if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)))
break; break;
...@@ -661,22 +659,18 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, ...@@ -661,22 +659,18 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
tx_bi++; tx_bi++;
tx_desc++; tx_desc++;
i++; ntc++;
if (unlikely(!i)) { if (unlikely(ntc == tx_ring->count)) {
i -= tx_ring->count; ntc = 0;
tx_bi = tx_ring->tx_buffer_info; tx_bi = tx_ring->tx_buffer_info;
tx_desc = IXGBE_TX_DESC(tx_ring, 0); tx_desc = IXGBE_TX_DESC(tx_ring, 0);
} }
/* issue prefetch for next Tx descriptor */ /* issue prefetch for next Tx descriptor */
prefetch(tx_desc); prefetch(tx_desc);
}
/* update budget accounting */ tx_ring->next_to_clean = ntc;
budget--;
} while (likely(budget));
i += tx_ring->count;
tx_ring->next_to_clean = i;
u64_stats_update_begin(&tx_ring->syncp); u64_stats_update_begin(&tx_ring->syncp);
tx_ring->stats.bytes += total_bytes; tx_ring->stats.bytes += total_bytes;
...@@ -688,8 +682,7 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, ...@@ -688,8 +682,7 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
if (xsk_frames) if (xsk_frames)
xsk_umem_complete_tx(umem, xsk_frames); xsk_umem_complete_tx(umem, xsk_frames);
xmit_done = ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit); return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
return budget > 0 && xmit_done;
} }
int ixgbe_xsk_async_xmit(struct net_device *dev, u32 qid) int ixgbe_xsk_async_xmit(struct net_device *dev, u32 qid)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/bpf.h> #include <linux/bpf.h>
#include <linux/bpf_trace.h> #include <linux/bpf_trace.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <net/xfrm.h>
#include "ixgbevf.h" #include "ixgbevf.h"
...@@ -4161,7 +4162,7 @@ static int ixgbevf_xmit_frame_ring(struct sk_buff *skb, ...@@ -4161,7 +4162,7 @@ static int ixgbevf_xmit_frame_ring(struct sk_buff *skb,
first->protocol = vlan_get_protocol(skb); first->protocol = vlan_get_protocol(skb);
#ifdef CONFIG_IXGBEVF_IPSEC #ifdef CONFIG_IXGBEVF_IPSEC
if (secpath_exists(skb) && !ixgbevf_ipsec_tx(tx_ring, first, &ipsec_tx)) if (xfrm_offload(skb) && !ixgbevf_ipsec_tx(tx_ring, first, &ipsec_tx))
goto out_drop; goto out_drop;
#endif #endif
tso = ixgbevf_tso(tx_ring, first, &hdr_len, &ipsec_tx); tso = ixgbevf_tso(tx_ring, first, &hdr_len, &ipsec_tx);
......
...@@ -2240,7 +2240,7 @@ static int mlx4_validate_optimized_steering(struct mlx4_dev *dev) ...@@ -2240,7 +2240,7 @@ static int mlx4_validate_optimized_steering(struct mlx4_dev *dev)
for (i = 1; i <= dev->caps.num_ports; i++) { for (i = 1; i <= dev->caps.num_ports; i++) {
if (mlx4_dev_port(dev, i, &port_cap)) { if (mlx4_dev_port(dev, i, &port_cap)) {
mlx4_err(dev, mlx4_err(dev,
"QUERY_DEV_CAP command failed, can't veify DMFS high rate steering.\n"); "QUERY_DEV_CAP command failed, can't verify DMFS high rate steering.\n");
} else if ((dev->caps.dmfs_high_steer_mode != } else if ((dev->caps.dmfs_high_steer_mode !=
MLX4_STEERING_DMFS_A0_DEFAULT) && MLX4_STEERING_DMFS_A0_DEFAULT) &&
(port_cap.dmfs_optimized_state == (port_cap.dmfs_optimized_state ==
......
...@@ -232,9 +232,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -232,9 +232,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE); laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
if (!laddr) { if (!laddr) {
printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name); pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name);
dev_kfree_skb(skb); dev_kfree_skb_any(skb);
return NETDEV_TX_BUSY; return NETDEV_TX_OK;
} }
sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
......
...@@ -260,9 +260,6 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb) ...@@ -260,9 +260,6 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
type = cmsg_hdr->type; type = cmsg_hdr->type;
switch (type) { switch (type) {
case NFP_FLOWER_CMSG_TYPE_PORT_REIFY:
nfp_flower_cmsg_portreify_rx(app, skb);
break;
case NFP_FLOWER_CMSG_TYPE_PORT_MOD: case NFP_FLOWER_CMSG_TYPE_PORT_MOD:
nfp_flower_cmsg_portmod_rx(app, skb); nfp_flower_cmsg_portmod_rx(app, skb);
break; break;
...@@ -328,8 +325,7 @@ nfp_flower_queue_ctl_msg(struct nfp_app *app, struct sk_buff *skb, int type) ...@@ -328,8 +325,7 @@ nfp_flower_queue_ctl_msg(struct nfp_app *app, struct sk_buff *skb, int type)
struct nfp_flower_priv *priv = app->priv; struct nfp_flower_priv *priv = app->priv;
struct sk_buff_head *skb_head; struct sk_buff_head *skb_head;
if (type == NFP_FLOWER_CMSG_TYPE_PORT_REIFY || if (type == NFP_FLOWER_CMSG_TYPE_PORT_MOD)
type == NFP_FLOWER_CMSG_TYPE_PORT_MOD)
skb_head = &priv->cmsg_skbs_high; skb_head = &priv->cmsg_skbs_high;
else else
skb_head = &priv->cmsg_skbs_low; skb_head = &priv->cmsg_skbs_low;
...@@ -368,6 +364,10 @@ void nfp_flower_cmsg_rx(struct nfp_app *app, struct sk_buff *skb) ...@@ -368,6 +364,10 @@ void nfp_flower_cmsg_rx(struct nfp_app *app, struct sk_buff *skb)
} else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_TUN_NEIGH) { } else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_TUN_NEIGH) {
/* Acks from the NFP that the route is added - ignore. */ /* Acks from the NFP that the route is added - ignore. */
dev_consume_skb_any(skb); dev_consume_skb_any(skb);
} else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_PORT_REIFY) {
/* Handle REIFY acks outside wq to prevent RTNL conflict. */
nfp_flower_cmsg_portreify_rx(app, skb);
dev_consume_skb_any(skb);
} else { } else {
nfp_flower_queue_ctl_msg(app, skb, cmsg_hdr->type); nfp_flower_queue_ctl_msg(app, skb, cmsg_hdr->type);
} }
......
...@@ -713,6 +713,21 @@ struct nv_skb_map { ...@@ -713,6 +713,21 @@ struct nv_skb_map {
struct nv_skb_map *next_tx_ctx; struct nv_skb_map *next_tx_ctx;
}; };
struct nv_txrx_stats {
u64 stat_rx_packets;
u64 stat_rx_bytes; /* not always available in HW */
u64 stat_rx_missed_errors;
u64 stat_rx_dropped;
u64 stat_tx_packets; /* not always available in HW */
u64 stat_tx_bytes;
u64 stat_tx_dropped;
};
#define nv_txrx_stats_inc(member) \
__this_cpu_inc(np->txrx_stats->member)
#define nv_txrx_stats_add(member, count) \
__this_cpu_add(np->txrx_stats->member, (count))
/* /*
* SMP locking: * SMP locking:
* All hardware access under netdev_priv(dev)->lock, except the performance * All hardware access under netdev_priv(dev)->lock, except the performance
...@@ -797,10 +812,7 @@ struct fe_priv { ...@@ -797,10 +812,7 @@ struct fe_priv {
/* RX software stats */ /* RX software stats */
struct u64_stats_sync swstats_rx_syncp; struct u64_stats_sync swstats_rx_syncp;
u64 stat_rx_packets; struct nv_txrx_stats __percpu *txrx_stats;
u64 stat_rx_bytes; /* not always available in HW */
u64 stat_rx_missed_errors;
u64 stat_rx_dropped;
/* media detection workaround. /* media detection workaround.
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
...@@ -826,9 +838,6 @@ struct fe_priv { ...@@ -826,9 +838,6 @@ struct fe_priv {
/* TX software stats */ /* TX software stats */
struct u64_stats_sync swstats_tx_syncp; struct u64_stats_sync swstats_tx_syncp;
u64 stat_tx_packets; /* not always available in HW */
u64 stat_tx_bytes;
u64 stat_tx_dropped;
/* msi/msi-x fields */ /* msi/msi-x fields */
u32 msi_flags; u32 msi_flags;
...@@ -1721,6 +1730,39 @@ static void nv_update_stats(struct net_device *dev) ...@@ -1721,6 +1730,39 @@ static void nv_update_stats(struct net_device *dev)
} }
} }
static void nv_get_stats(int cpu, struct fe_priv *np,
struct rtnl_link_stats64 *storage)
{
struct nv_txrx_stats *src = per_cpu_ptr(np->txrx_stats, cpu);
unsigned int syncp_start;
u64 rx_packets, rx_bytes, rx_dropped, rx_missed_errors;
u64 tx_packets, tx_bytes, tx_dropped;
do {
syncp_start = u64_stats_fetch_begin_irq(&np->swstats_rx_syncp);
rx_packets = src->stat_rx_packets;
rx_bytes = src->stat_rx_bytes;
rx_dropped = src->stat_rx_dropped;
rx_missed_errors = src->stat_rx_missed_errors;
} while (u64_stats_fetch_retry_irq(&np->swstats_rx_syncp, syncp_start));
storage->rx_packets += rx_packets;
storage->rx_bytes += rx_bytes;
storage->rx_dropped += rx_dropped;
storage->rx_missed_errors += rx_missed_errors;
do {
syncp_start = u64_stats_fetch_begin_irq(&np->swstats_tx_syncp);
tx_packets = src->stat_tx_packets;
tx_bytes = src->stat_tx_bytes;
tx_dropped = src->stat_tx_dropped;
} while (u64_stats_fetch_retry_irq(&np->swstats_tx_syncp, syncp_start));
storage->tx_packets += tx_packets;
storage->tx_bytes += tx_bytes;
storage->tx_dropped += tx_dropped;
}
/* /*
* nv_get_stats64: dev->ndo_get_stats64 function * nv_get_stats64: dev->ndo_get_stats64 function
* Get latest stats value from the nic. * Get latest stats value from the nic.
...@@ -1733,7 +1775,7 @@ nv_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *storage) ...@@ -1733,7 +1775,7 @@ nv_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *storage)
__releases(&netdev_priv(dev)->hwstats_lock) __releases(&netdev_priv(dev)->hwstats_lock)
{ {
struct fe_priv *np = netdev_priv(dev); struct fe_priv *np = netdev_priv(dev);
unsigned int syncp_start; int cpu;