svn commit: r331883 - in user/markj/netdump: share/man/man4 sys/dev/mlx4/mlx4_en
Mark Johnston
markj at FreeBSD.org
Mon Apr 2 18:10:42 UTC 2018
Author: markj
Date: Mon Apr 2 18:10:41 2018
New Revision: 331883
URL: https://svnweb.freebsd.org/changeset/base/331883
Log:
Add netdump support to mlx4en(4).
Tested with a MT27520 (ConnectX-3 Pro) adapter.
Modified:
user/markj/netdump/share/man/man4/netdump.4
user/markj/netdump/sys/dev/mlx4/mlx4_en/en.h
user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
Modified: user/markj/netdump/share/man/man4/netdump.4
==============================================================================
--- user/markj/netdump/share/man/man4/netdump.4 Mon Apr 2 16:11:49 2018 (r331882)
+++ user/markj/netdump/share/man/man4/netdump.4 Mon Apr 2 18:10:41 2018 (r331883)
@@ -110,6 +110,7 @@ The following network drivers support netdump:
.Xr em 4 ,
.Xr igb 4 ,
.Xr ix 4 ,
+.Xr mlx4en 4 ,
.Xr re 4 ,
.Xr vtnet 4 .
.Sh SEE ALSO
Modified: user/markj/netdump/sys/dev/mlx4/mlx4_en/en.h
==============================================================================
--- user/markj/netdump/sys/dev/mlx4/mlx4_en/en.h Mon Apr 2 16:11:49 2018 (r331882)
+++ user/markj/netdump/sys/dev/mlx4/mlx4_en/en.h Mon Apr 2 18:10:41 2018 (r331883)
@@ -54,6 +54,7 @@
#include <dev/mlx4/cmd.h>
#include <netinet/tcp_lro.h>
+#include <netinet/netdump/netdump.h>
#include "en_port.h"
#include <dev/mlx4/stats.h>
@@ -814,6 +815,8 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *p
int mlx4_en_process_rx_cq(struct net_device *dev,
struct mlx4_en_cq *cq,
int budget);
+int mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq);
+int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **m);
void mlx4_en_poll_tx_cq(unsigned long data);
void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
int is_tx, int rss, int qpn, int cqn, int user_prio,
Modified: user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Apr 2 16:11:49 2018 (r331882)
+++ user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Apr 2 18:10:41 2018 (r331883)
@@ -53,6 +53,8 @@
#include "en.h"
#include "en_port.h"
+NETDUMP_DEFINE(mlx4_en);
+
static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv);
static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv);
@@ -2298,6 +2300,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int
ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+ NETDUMP_SET(dev, mlx4_en);
+
en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
@@ -2879,3 +2883,52 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
CTLFLAG_RD, &rx_ring->errors, 0, "RX soft errors");
}
}
+
+#ifdef NETDUMP
+static void
+mlx4_en_netdump_init(struct ifnet *dev, int *nrxr)
+{
+ struct mlx4_en_priv *priv;
+
+ priv = if_getsoftc(dev);
+ *nrxr = priv->rx_ring_num;
+}
+
+static void
+mlx4_en_netdump_event(struct ifnet *dev, enum netdump_ev event)
+{
+}
+
+static int
+mlx4_en_netdump_transmit(struct ifnet *dev, struct mbuf *m)
+{
+ struct mlx4_en_priv *priv;
+ int err;
+
+ priv = if_getsoftc(dev);
+ if ((if_getdrvflags(dev) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING || !priv->link_state)
+ return (ENOENT);
+
+ err = mlx4_en_xmit(priv, 0, &m);
+ if (err != 0 && m != NULL)
+ m_freem(m);
+ return (err);
+}
+
+static int
+mlx4_en_netdump_poll(struct ifnet *dev, int count)
+{
+ struct mlx4_en_priv *priv;
+ int i;
+
+ priv = if_getsoftc(dev);
+ if ((if_getdrvflags(dev) & IFF_DRV_RUNNING) == 0 || !priv->link_state)
+ return (ENOENT);
+
+ (void)mlx4_en_process_tx_cq(dev, priv->tx_cq[0]);
+ for (i = 0; i < priv->rx_ring_num; i++)
+ (void)mlx4_en_process_rx_cq(dev, priv->rx_cq[i], 0);
+ return (0);
+}
+#endif /* NETDUMP */
Modified: user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
==============================================================================
--- user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Mon Apr 2 16:11:49 2018 (r331882)
+++ user/markj/netdump/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Mon Apr 2 18:10:41 2018 (r331883)
@@ -356,8 +356,7 @@ mlx4_en_tx_ring_is_full(struct mlx4_en_tx_ring *ring)
return (wqs < (HEADROOM + (2 * MLX4_EN_TX_WQE_MAX_WQEBBS)));
}
-static int mlx4_en_process_tx_cq(struct net_device *dev,
- struct mlx4_en_cq *cq)
+int mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_cq *mcq = &cq->mcq;
@@ -648,7 +647,7 @@ static void mlx4_bf_copy(void __iomem *dst, volatile u
__iowrite64_copy(dst, __DEVOLATILE(void *, src), bytecnt / 8);
}
-static int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
+int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
{
enum {
DS_FACT = TXBB_SIZE / DS_SIZE_ALIGNMENT,
More information about the svn-src-user
mailing list