35 #include <linux/module.h>
37 #include <linux/netdevice.h>
38 #include <linux/slab.h>
51 static const char mlx4_en_version[] =
52 DRV_NAME ": Mellanox ConnectX HCA Ethernet driver v"
55 #define MLX4_EN_PARM_INT(X, def_val, desc) \
56 static unsigned int X = def_val;\
57 module_param(X , uint, 0444); \
58 MODULE_PARM_DESC(X, desc);
67 "Enable RSS for incomming UDP traffic or disabled (0)");
71 " Per priority bit mask");
73 " Per priority bit mask");
87 i =
printk(
"%s%s: %s: %pV",
90 i =
printk(
"%s%s: %s: Port %d: %pV",
98 static int mlx4_en_get_profile(
struct mlx4_en_dev *mdev)
106 if (params->
udp_rss && !(mdev->
dev->caps.flags
108 mlx4_warn(mdev,
"UDP RSS is not supported on this device.\n");
112 params->
prof[
i].rx_pause = 1;
113 params->
prof[
i].rx_ppp = pfcrx;
114 params->
prof[
i].tx_pause = 1;
115 params->
prof[
i].tx_ppp = pfctx;
120 params->
prof[
i].rss_rings = 0;
133 static void mlx4_en_event(
struct mlx4_dev *
dev,
void *endev_ptr,
142 if (!mdev->
pndev[port])
144 priv = netdev_priv(mdev->
pndev[port]);
152 mlx4_err(mdev,
"Internal error detected, restarting device\n");
159 mlx4_warn(mdev,
"Unhandled event %d for port %d\n", event,
164 static void mlx4_en_remove(
struct mlx4_dev *dev,
void *endev_ptr)
196 dev_err(&dev->pdev->dev,
"Device struct alloc failed, "
216 mdev->
pdev = dev->pdev;
219 mdev->
LSO_support = !!(dev->caps.flags & (1 << 15));
221 mlx4_warn(mdev,
"LSO not supported, please upgrade to later "
222 "FW version to enable LSO\n");
227 mlx4_err(mdev,
"Failed allocating memory region\n");
231 mlx4_err(mdev,
"Failed enabling memory region\n");
236 err = mlx4_en_get_profile(mdev);
238 mlx4_err(mdev,
"Bad module parameters, aborting.\n");
248 if (!dev->caps.comp_pool) {
252 dev->caps.num_comp_vectors,
256 min_t(
int, dev->caps.comp_pool/
279 mlx4_info(mdev,
"Activating port:%d\n", i);
302 .remove = mlx4_en_remove,
303 .event = mlx4_en_event,
304 .get_dev = mlx4_en_get_netdev,
308 static int __init mlx4_en_init(
void)
313 static void __exit mlx4_en_cleanup(
void)