Mechanically convert mlx4(4) to IfAPI
Reviewed by: hselasky, zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37823
This commit is contained in:
parent
04abf87b2a
commit
0b2813768b
@ -392,7 +392,7 @@ struct mlx4_en_cq {
|
||||
struct mlx4_hwq_resources wqres;
|
||||
int ring;
|
||||
spinlock_t lock;
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
/* Per-core Tx cq processing support */
|
||||
struct timer_list timer;
|
||||
int size;
|
||||
@ -452,7 +452,7 @@ struct mlx4_en_dev {
|
||||
struct mlx4_dev *dev;
|
||||
struct pci_dev *pdev;
|
||||
struct mutex state_lock;
|
||||
struct ifnet *pndev[MLX4_MAX_PORTS + 1];
|
||||
if_t pndev[MLX4_MAX_PORTS + 1];
|
||||
u32 port_cnt;
|
||||
bool device_up;
|
||||
struct mlx4_en_profile profile;
|
||||
@ -543,7 +543,7 @@ struct en_port {
|
||||
struct mlx4_en_priv {
|
||||
struct mlx4_en_dev *mdev;
|
||||
struct mlx4_en_port_profile *prof;
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
struct mlx4_en_port_state port_state;
|
||||
spinlock_t stats_lock;
|
||||
@ -662,9 +662,9 @@ struct mlx4_mac_entry {
|
||||
};
|
||||
|
||||
static inline void *
|
||||
mlx4_netdev_priv(const struct ifnet *dev)
|
||||
mlx4_netdev_priv(const if_t dev)
|
||||
{
|
||||
return (dev->if_softc);
|
||||
return (if_getsoftc(dev));
|
||||
}
|
||||
|
||||
static inline struct mlx4_cqe *mlx4_en_get_cqe(u8 *buf, int idx, int cqe_sz)
|
||||
@ -716,7 +716,7 @@ static inline bool mlx4_en_cq_lock_poll(struct mlx4_en_cq *cq)
|
||||
int rc = true;
|
||||
spin_lock_bh(&cq->poll_lock);
|
||||
if ((cq->state & MLX4_CQ_LOCKED)) {
|
||||
struct ifnet *dev = cq->dev;
|
||||
if_t dev = cq->dev;
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring];
|
||||
|
||||
@ -785,12 +785,12 @@ static inline bool mlx4_en_cq_busy_polling(struct mlx4_en_cq *cq)
|
||||
|
||||
#define MLX4_EN_WOL_DO_MODIFY (1ULL << 63)
|
||||
|
||||
void mlx4_en_destroy_netdev(struct ifnet *dev);
|
||||
void mlx4_en_destroy_netdev(if_t dev);
|
||||
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
struct mlx4_en_port_profile *prof);
|
||||
|
||||
int mlx4_en_start_port(struct ifnet *dev);
|
||||
void mlx4_en_stop_port(struct ifnet *dev);
|
||||
int mlx4_en_start_port(if_t dev);
|
||||
void mlx4_en_stop_port(if_t dev);
|
||||
|
||||
void mlx4_en_free_resources(struct mlx4_en_priv *priv);
|
||||
int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
|
||||
@ -806,10 +806,10 @@ int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
|
||||
int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
|
||||
|
||||
void mlx4_en_tx_irq(struct mlx4_cq *mcq);
|
||||
u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb);
|
||||
u16 mlx4_en_select_queue(if_t dev, struct mbuf *mb);
|
||||
|
||||
int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp);
|
||||
int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m);
|
||||
int mlx4_en_transmit(if_t dev, struct mbuf *m);
|
||||
int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
|
||||
struct mlx4_en_tx_ring **pring,
|
||||
u32 size, u16 stride, int node, int queue_idx);
|
||||
@ -821,7 +821,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
|
||||
void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
|
||||
struct mlx4_en_tx_ring *ring);
|
||||
void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev);
|
||||
void mlx4_en_qflush(struct ifnet *dev);
|
||||
void mlx4_en_qflush(if_t dev);
|
||||
|
||||
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
|
||||
struct mlx4_en_rx_ring **pring,
|
||||
@ -833,7 +833,7 @@ void mlx4_en_rx_que(void *context, int pending);
|
||||
int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
|
||||
void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
|
||||
struct mlx4_en_rx_ring *ring);
|
||||
int mlx4_en_process_rx_cq(struct ifnet *dev,
|
||||
int mlx4_en_process_rx_cq(if_t dev,
|
||||
struct mlx4_en_cq *cq,
|
||||
int budget);
|
||||
void mlx4_en_poll_tx_cq(unsigned long data);
|
||||
@ -843,7 +843,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
|
||||
void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event);
|
||||
int mlx4_en_map_buffer(struct mlx4_buf *buf);
|
||||
void mlx4_en_unmap_buffer(struct mlx4_buf *buf);
|
||||
void mlx4_en_calc_rx_buf(struct ifnet *dev);
|
||||
void mlx4_en_calc_rx_buf(if_t dev);
|
||||
|
||||
const u32 *mlx4_en_get_rss_key(struct mlx4_en_priv *priv, u16 *keylen);
|
||||
u8 mlx4_en_get_rss_mask(struct mlx4_en_priv *priv);
|
||||
@ -851,7 +851,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv);
|
||||
void mlx4_en_release_rss_steer(struct mlx4_en_priv *priv);
|
||||
int mlx4_en_create_drop_qp(struct mlx4_en_priv *priv);
|
||||
void mlx4_en_destroy_drop_qp(struct mlx4_en_priv *priv);
|
||||
int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring);
|
||||
int mlx4_en_free_tx_buf(if_t dev, struct mlx4_en_tx_ring *ring);
|
||||
void mlx4_en_rx_irq(struct mlx4_cq *mcq);
|
||||
|
||||
int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv);
|
||||
@ -869,7 +869,7 @@ extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops;
|
||||
extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops;
|
||||
#endif
|
||||
|
||||
int mlx4_en_setup_tc(struct ifnet *dev, u8 up);
|
||||
int mlx4_en_setup_tc(if_t dev, u8 up);
|
||||
|
||||
#ifdef CONFIG_RFS_ACCEL
|
||||
void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv,
|
||||
@ -877,7 +877,7 @@ void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv,
|
||||
#endif
|
||||
|
||||
#define MLX4_EN_NUM_SELF_TEST 5
|
||||
void mlx4_en_ex_selftest(struct ifnet *dev, u32 *flags, u64 *buf);
|
||||
void mlx4_en_ex_selftest(if_t dev, u32 *flags, u64 *buf);
|
||||
void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
|
||||
|
||||
/*
|
||||
@ -889,7 +889,7 @@ void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
|
||||
u64 mlx4_en_get_cqe_ts(struct mlx4_cqe *cqe);
|
||||
|
||||
/* Functions for caching and restoring statistics */
|
||||
int mlx4_en_get_sset_count(struct ifnet *dev, int sset);
|
||||
int mlx4_en_get_sset_count(if_t dev, int sset);
|
||||
void mlx4_en_restore_ethtool_stats(struct mlx4_en_priv *priv,
|
||||
u64 *data);
|
||||
|
||||
@ -932,7 +932,7 @@ enum {
|
||||
{ \
|
||||
if ((priv)->registered) \
|
||||
printk(level "%s: %s: " format, DRV_NAME, \
|
||||
(priv)->dev->if_xname, ## arg); \
|
||||
if_name((priv)->dev), ## arg); \
|
||||
else \
|
||||
printk(level "%s: %s: Port %d: " format, \
|
||||
DRV_NAME, dev_name(&(priv)->mdev->pdev->dev), \
|
||||
|
@ -64,7 +64,7 @@ static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv);
|
||||
static int mlx4_en_low_latency_recv(struct napi_struct *napi)
|
||||
{
|
||||
struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi);
|
||||
struct ifnet *dev = cq->dev;
|
||||
if_t dev = cq->dev;
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring];
|
||||
int done;
|
||||
@ -288,7 +288,7 @@ mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip,
|
||||
}
|
||||
|
||||
static int
|
||||
mlx4_en_filter_rfs(struct ifnet *net_dev, const struct sk_buff *skb,
|
||||
mlx4_en_filter_rfs(if_t net_dev, const struct sk_buff *skb,
|
||||
u16 rxq_index, u32 flow_id)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(net_dev);
|
||||
@ -400,7 +400,7 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid)
|
||||
static void mlx4_en_vlan_rx_add_vid(void *arg, if_t dev, u16 vid)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -427,7 +427,7 @@ static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid)
|
||||
|
||||
}
|
||||
|
||||
static void mlx4_en_vlan_rx_kill_vid(void *arg, struct ifnet *dev, u16 vid)
|
||||
static void mlx4_en_vlan_rx_kill_vid(void *arg, if_t dev, u16 vid)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -558,15 +558,15 @@ static int mlx4_en_get_qp(struct mlx4_en_priv *priv)
|
||||
int index = 0;
|
||||
int err = 0;
|
||||
int *qpn = &priv->base_qpn;
|
||||
u64 mac = mlx4_mac_to_u64(IF_LLADDR(priv->dev));
|
||||
u64 mac = mlx4_mac_to_u64(if_getlladdr(priv->dev));
|
||||
|
||||
en_dbg(DRV, priv, "Registering MAC: %pM for adding\n",
|
||||
IF_LLADDR(priv->dev));
|
||||
if_getlladdr(priv->dev));
|
||||
index = mlx4_register_mac(dev, priv->port, mac);
|
||||
if (index < 0) {
|
||||
err = index;
|
||||
en_err(priv, "Failed adding MAC: %pM\n",
|
||||
IF_LLADDR(priv->dev));
|
||||
if_getlladdr(priv->dev));
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -594,9 +594,9 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv)
|
||||
int qpn = priv->base_qpn;
|
||||
|
||||
if (dev->caps.steering_mode == MLX4_STEERING_MODE_A0) {
|
||||
u64 mac = mlx4_mac_to_u64(IF_LLADDR(priv->dev));
|
||||
u64 mac = mlx4_mac_to_u64(if_getlladdr(priv->dev));
|
||||
en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n",
|
||||
IF_LLADDR(priv->dev));
|
||||
if_getlladdr(priv->dev));
|
||||
mlx4_unregister_mac(dev, priv->port, mac);
|
||||
} else {
|
||||
en_dbg(DRV, priv, "Releasing qp: port %d, qpn %d\n",
|
||||
@ -606,7 +606,7 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
static void mlx4_en_clear_uclist(struct ifnet *dev)
|
||||
static void mlx4_en_clear_uclist(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_addr_list *tmp, *uc_to_del;
|
||||
@ -635,7 +635,7 @@ static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void mlx4_en_cache_uclist(struct ifnet *dev)
|
||||
static void mlx4_en_cache_uclist(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
|
||||
@ -643,7 +643,7 @@ static void mlx4_en_cache_uclist(struct ifnet *dev)
|
||||
if_foreach_lladdr(dev, mlx4_copy_addr, priv);
|
||||
}
|
||||
|
||||
static void mlx4_en_clear_mclist(struct ifnet *dev)
|
||||
static void mlx4_en_clear_mclist(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_addr_list *tmp, *mc_to_del;
|
||||
@ -671,7 +671,7 @@ static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void mlx4_en_cache_mclist(struct ifnet *dev)
|
||||
static void mlx4_en_cache_mclist(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
|
||||
@ -728,7 +728,7 @@ static void update_addr_list_flags(struct mlx4_en_priv *priv,
|
||||
}
|
||||
}
|
||||
|
||||
static void mlx4_en_set_rx_mode(struct ifnet *dev)
|
||||
static void mlx4_en_set_rx_mode(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
|
||||
@ -842,7 +842,7 @@ static void mlx4_en_clear_promisc_mode(struct mlx4_en_priv *priv,
|
||||
}
|
||||
|
||||
static void mlx4_en_do_multicast(struct mlx4_en_priv *priv,
|
||||
struct ifnet *dev,
|
||||
if_t dev,
|
||||
struct mlx4_en_dev *mdev)
|
||||
{
|
||||
struct mlx4_en_addr_list *addr_list, *tmp;
|
||||
@ -854,7 +854,7 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv,
|
||||
* Enable/disable the multicast filter according to
|
||||
* IFF_ALLMULTI and IFF_PROMISC:
|
||||
*/
|
||||
if (dev->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) {
|
||||
if (if_getflags(dev) & (IFF_ALLMULTI | IFF_PROMISC)) {
|
||||
err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
|
||||
0, MLX4_MCAST_DISABLE);
|
||||
if (err)
|
||||
@ -977,7 +977,7 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv,
|
||||
}
|
||||
|
||||
static void mlx4_en_do_unicast(struct mlx4_en_priv *priv,
|
||||
struct ifnet *dev,
|
||||
if_t dev,
|
||||
struct mlx4_en_dev *mdev)
|
||||
{
|
||||
struct mlx4_en_addr_list *addr_list, *tmp;
|
||||
@ -1011,7 +1011,7 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work)
|
||||
struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
|
||||
rx_mode_task);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
struct ifnet *dev = priv->dev;
|
||||
if_t dev = priv->dev;
|
||||
|
||||
mutex_lock(&mdev->state_lock);
|
||||
if (!mdev->device_up) {
|
||||
@ -1026,8 +1026,8 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work)
|
||||
if (priv->port_state.link_state) {
|
||||
priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;
|
||||
/* update netif baudrate */
|
||||
priv->dev->if_baudrate =
|
||||
IF_Mbps(priv->port_state.link_speed);
|
||||
if_setbaudrate(priv->dev,
|
||||
IF_Mbps(priv->port_state.link_speed));
|
||||
/* Important note: the following call for if_link_state_change
|
||||
* is needed for interface up scenario (start port, link state
|
||||
* change) */
|
||||
@ -1040,7 +1040,7 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work)
|
||||
mlx4_en_do_unicast(priv, dev, mdev);
|
||||
|
||||
/* Promsicuous mode: disable all filters */
|
||||
if ((dev->if_flags & IFF_PROMISC) ||
|
||||
if ((if_getflags(dev) & IFF_PROMISC) ||
|
||||
(priv->flags & MLX4_EN_FLAG_FORCE_PROMISC)) {
|
||||
mlx4_en_set_promisc_mode(priv, mdev);
|
||||
} else if (priv->flags & MLX4_EN_FLAG_PROMISC) {
|
||||
@ -1085,7 +1085,7 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)
|
||||
priv->tx_usecs = MLX4_EN_TX_COAL_TIME;
|
||||
en_dbg(INTR, priv, "Default coalesing params for mtu: %u - "
|
||||
"rx_frames:%d rx_usecs:%d\n",
|
||||
(unsigned)priv->dev->if_mtu, priv->rx_frames, priv->rx_usecs);
|
||||
(unsigned)if_getmtu(priv->dev), priv->rx_frames, priv->rx_usecs);
|
||||
|
||||
/* Setup cq moderation params */
|
||||
for (i = 0; i < priv->rx_ring_num; i++) {
|
||||
@ -1236,7 +1236,7 @@ static void mlx4_en_linkstate(struct work_struct *work)
|
||||
en_info(priv, "Link Down\n");
|
||||
if_link_state_change(priv->dev, LINK_STATE_DOWN);
|
||||
/* update netif baudrate */
|
||||
priv->dev->if_baudrate = 0;
|
||||
if_setbaudrate(priv->dev, 0);
|
||||
|
||||
/* make sure the port is up before notifying the OS.
|
||||
* This is tricky since we get here on INIT_PORT and
|
||||
@ -1247,8 +1247,8 @@ static void mlx4_en_linkstate(struct work_struct *work)
|
||||
} else if (priv->port_up && (linkstate == MLX4_DEV_EVENT_PORT_UP)){
|
||||
if (mlx4_en_QUERY_PORT(priv->mdev, priv->port))
|
||||
en_info(priv, "Query port failed\n");
|
||||
priv->dev->if_baudrate =
|
||||
IF_Mbps(priv->port_state.link_speed);
|
||||
if_setbaudrate(priv->dev,
|
||||
IF_Mbps(priv->port_state.link_speed));
|
||||
en_info(priv, "Link Up\n");
|
||||
if_link_state_change(priv->dev, LINK_STATE_UP);
|
||||
}
|
||||
@ -1258,7 +1258,7 @@ static void mlx4_en_linkstate(struct work_struct *work)
|
||||
}
|
||||
|
||||
|
||||
int mlx4_en_start_port(struct ifnet *dev)
|
||||
int mlx4_en_start_port(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -1284,7 +1284,7 @@ int mlx4_en_start_port(struct ifnet *dev)
|
||||
INIT_LIST_HEAD(&priv->ethtool_list);
|
||||
|
||||
/* Calculate Rx buf size */
|
||||
dev->if_mtu = min(dev->if_mtu, priv->max_mtu);
|
||||
if_setmtu(dev, min(if_getmtu(dev), priv->max_mtu));
|
||||
mlx4_en_calc_rx_buf(dev);
|
||||
en_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_mb_size);
|
||||
|
||||
@ -1420,8 +1420,7 @@ int mlx4_en_start_port(struct ifnet *dev)
|
||||
priv->port_up = true;
|
||||
|
||||
/* Enable the queues. */
|
||||
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
dev->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
if_setdrvflagbits(dev, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
mlx4_en_create_debug_files(priv);
|
||||
#endif
|
||||
@ -1451,7 +1450,7 @@ int mlx4_en_start_port(struct ifnet *dev)
|
||||
}
|
||||
|
||||
|
||||
void mlx4_en_stop_port(struct ifnet *dev)
|
||||
void mlx4_en_stop_port(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -1560,7 +1559,7 @@ void mlx4_en_stop_port(struct ifnet *dev)
|
||||
|
||||
callout_stop(&priv->watchdog_timer);
|
||||
|
||||
dev->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
if_setdrvflagbits(dev, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
}
|
||||
|
||||
static void mlx4_en_restart(struct work_struct *work)
|
||||
@ -1568,7 +1567,7 @@ static void mlx4_en_restart(struct work_struct *work)
|
||||
struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
|
||||
watchdog_task);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
struct ifnet *dev = priv->dev;
|
||||
if_t dev = priv->dev;
|
||||
struct mlx4_en_tx_ring *ring;
|
||||
int i;
|
||||
|
||||
@ -1601,7 +1600,7 @@ static void mlx4_en_restart(struct work_struct *work)
|
||||
mutex_unlock(&mdev->state_lock);
|
||||
}
|
||||
|
||||
static void mlx4_en_clear_stats(struct ifnet *dev)
|
||||
static void mlx4_en_clear_stats(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -1635,7 +1634,7 @@ static void mlx4_en_open(void* arg)
|
||||
|
||||
struct mlx4_en_priv *priv;
|
||||
struct mlx4_en_dev *mdev;
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
int err = 0;
|
||||
|
||||
priv = arg;
|
||||
@ -1760,7 +1759,7 @@ struct en_port_attribute en_port_attr_##_name = __ATTR_RO(_name)
|
||||
#define EN_PORT_ATTR(_name, _mode, _show, _store) \
|
||||
struct en_port_attribute en_port_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
|
||||
void mlx4_en_destroy_netdev(struct ifnet *dev)
|
||||
void mlx4_en_destroy_netdev(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -1815,14 +1814,14 @@ void mlx4_en_destroy_netdev(struct ifnet *dev)
|
||||
|
||||
}
|
||||
|
||||
static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu)
|
||||
static int mlx4_en_change_mtu(if_t dev, int new_mtu)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
int err = 0;
|
||||
|
||||
en_dbg(DRV, priv, "Change MTU called - current:%u new:%u\n",
|
||||
(unsigned)dev->if_mtu, (unsigned)new_mtu);
|
||||
(unsigned)if_getmtu(dev), (unsigned)new_mtu);
|
||||
|
||||
if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) {
|
||||
en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu,
|
||||
@ -1830,8 +1829,8 @@ static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu)
|
||||
return -EPERM;
|
||||
}
|
||||
mutex_lock(&mdev->state_lock);
|
||||
dev->if_mtu = new_mtu;
|
||||
if (dev->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
if_setmtu(dev, new_mtu);
|
||||
if (if_getdrvflags(dev) & IFF_DRV_RUNNING) {
|
||||
if (!mdev->device_up) {
|
||||
/* NIC is probably restarting - let watchdog task reset
|
||||
* * the port */
|
||||
@ -1886,11 +1885,11 @@ static int mlx4_en_calc_media(struct mlx4_en_priv *priv)
|
||||
return (active);
|
||||
}
|
||||
|
||||
static void mlx4_en_media_status(struct ifnet *dev, struct ifmediareq *ifmr)
|
||||
static void mlx4_en_media_status(if_t dev, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
|
||||
priv = dev->if_softc;
|
||||
priv = if_getsoftc(dev);
|
||||
ifmr->ifm_status = IFM_AVALID;
|
||||
if (priv->last_link_state != MLX4_DEV_EVENT_PORT_DOWN)
|
||||
ifmr->ifm_status |= IFM_ACTIVE;
|
||||
@ -1899,7 +1898,7 @@ static void mlx4_en_media_status(struct ifnet *dev, struct ifmediareq *ifmr)
|
||||
return;
|
||||
}
|
||||
|
||||
static int mlx4_en_media_change(struct ifnet *dev)
|
||||
static int mlx4_en_media_change(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
struct ifmedia *ifm;
|
||||
@ -1907,7 +1906,7 @@ static int mlx4_en_media_change(struct ifnet *dev)
|
||||
int txpause;
|
||||
int error;
|
||||
|
||||
priv = dev->if_softc;
|
||||
priv = if_getsoftc(dev);
|
||||
ifm = &priv->media;
|
||||
rxpause = txpause = 0;
|
||||
error = 0;
|
||||
@ -1946,7 +1945,7 @@ static int mlx4_en_media_change(struct ifnet *dev)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
static int mlx4_en_ioctl(if_t dev, u_long command, caddr_t data)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
struct mlx4_en_dev *mdev;
|
||||
@ -1960,7 +1959,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
|
||||
error = 0;
|
||||
mask = 0;
|
||||
priv = dev->if_softc;
|
||||
priv = if_getsoftc(dev);
|
||||
|
||||
/* check if detaching */
|
||||
if (priv == NULL || priv->gone != 0)
|
||||
@ -1974,8 +1973,8 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
error = -mlx4_en_change_mtu(dev, ifr->ifr_mtu);
|
||||
break;
|
||||
case SIOCSIFFLAGS:
|
||||
if (dev->if_flags & IFF_UP) {
|
||||
if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) {
|
||||
if (if_getflags(dev) & IFF_UP) {
|
||||
if ((if_getdrvflags(dev) & IFF_DRV_RUNNING) == 0) {
|
||||
mutex_lock(&mdev->state_lock);
|
||||
mlx4_en_start_port(dev);
|
||||
mutex_unlock(&mdev->state_lock);
|
||||
@ -1984,7 +1983,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&mdev->state_lock);
|
||||
if (dev->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
if (if_getdrvflags(dev) & IFF_DRV_RUNNING) {
|
||||
mlx4_en_stop_port(dev);
|
||||
if_link_state_change(dev, LINK_STATE_DOWN);
|
||||
}
|
||||
@ -2001,67 +2000,67 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
break;
|
||||
case SIOCSIFCAP:
|
||||
mutex_lock(&mdev->state_lock);
|
||||
mask = ifr->ifr_reqcap ^ dev->if_capenable;
|
||||
mask = ifr->ifr_reqcap ^ if_getcapenable(dev);
|
||||
if (mask & IFCAP_TXCSUM) {
|
||||
dev->if_capenable ^= IFCAP_TXCSUM;
|
||||
dev->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP);
|
||||
if_togglecapenable(dev, IFCAP_TXCSUM);
|
||||
if_togglehwassist(dev, CSUM_TCP | CSUM_UDP | CSUM_IP);
|
||||
|
||||
if (IFCAP_TSO4 & dev->if_capenable &&
|
||||
!(IFCAP_TXCSUM & dev->if_capenable)) {
|
||||
if (IFCAP_TSO4 & if_getcapenable(dev) &&
|
||||
!(IFCAP_TXCSUM & if_getcapenable(dev))) {
|
||||
mask &= ~IFCAP_TSO4;
|
||||
dev->if_capenable &= ~IFCAP_TSO4;
|
||||
dev->if_hwassist &= ~CSUM_IP_TSO;
|
||||
if_setcapenablebit(dev, 0, IFCAP_TSO4);
|
||||
if_sethwassistbits(dev, 0, CSUM_IP_TSO);
|
||||
if_printf(dev,
|
||||
"tso4 disabled due to -txcsum.\n");
|
||||
}
|
||||
}
|
||||
if (mask & IFCAP_TXCSUM_IPV6) {
|
||||
dev->if_capenable ^= IFCAP_TXCSUM_IPV6;
|
||||
dev->if_hwassist ^= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6);
|
||||
if_togglecapenable(dev, IFCAP_TXCSUM_IPV6);
|
||||
if_togglehwassist(dev, (CSUM_UDP_IPV6 | CSUM_TCP_IPV6));
|
||||
|
||||
if (IFCAP_TSO6 & dev->if_capenable &&
|
||||
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
|
||||
if (IFCAP_TSO6 & if_getcapenable(dev) &&
|
||||
!(IFCAP_TXCSUM_IPV6 & if_getcapenable(dev))) {
|
||||
mask &= ~IFCAP_TSO6;
|
||||
dev->if_capenable &= ~IFCAP_TSO6;
|
||||
dev->if_hwassist &= ~CSUM_IP6_TSO;
|
||||
if_setcapenablebit(dev, 0, IFCAP_TSO6);
|
||||
if_sethwassistbits(dev, 0, CSUM_IP6_TSO);
|
||||
if_printf(dev,
|
||||
"tso6 disabled due to -txcsum6.\n");
|
||||
}
|
||||
}
|
||||
if (mask & IFCAP_RXCSUM)
|
||||
dev->if_capenable ^= IFCAP_RXCSUM;
|
||||
if_togglecapenable(dev, IFCAP_RXCSUM);
|
||||
if (mask & IFCAP_RXCSUM_IPV6)
|
||||
dev->if_capenable ^= IFCAP_RXCSUM_IPV6;
|
||||
if_togglecapenable(dev, IFCAP_RXCSUM_IPV6);
|
||||
|
||||
if (mask & IFCAP_TSO4) {
|
||||
if (!(IFCAP_TSO4 & dev->if_capenable) &&
|
||||
!(IFCAP_TXCSUM & dev->if_capenable)) {
|
||||
if (!(IFCAP_TSO4 & if_getcapenable(dev)) &&
|
||||
!(IFCAP_TXCSUM & if_getcapenable(dev))) {
|
||||
if_printf(dev, "enable txcsum first.\n");
|
||||
error = EAGAIN;
|
||||
goto out;
|
||||
}
|
||||
dev->if_capenable ^= IFCAP_TSO4;
|
||||
dev->if_hwassist ^= CSUM_IP_TSO;
|
||||
if_togglecapenable(dev, IFCAP_TSO4);
|
||||
if_togglehwassist(dev, CSUM_IP_TSO);
|
||||
}
|
||||
if (mask & IFCAP_TSO6) {
|
||||
if (!(IFCAP_TSO6 & dev->if_capenable) &&
|
||||
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
|
||||
if (!(IFCAP_TSO6 & if_getcapenable(dev)) &&
|
||||
!(IFCAP_TXCSUM_IPV6 & if_getcapenable(dev))) {
|
||||
if_printf(dev, "enable txcsum6 first.\n");
|
||||
error = EAGAIN;
|
||||
goto out;
|
||||
}
|
||||
dev->if_capenable ^= IFCAP_TSO6;
|
||||
dev->if_hwassist ^= CSUM_IP6_TSO;
|
||||
if_togglecapenable(dev, IFCAP_TSO6);
|
||||
if_togglehwassist(dev, CSUM_IP6_TSO);
|
||||
}
|
||||
if (mask & IFCAP_LRO)
|
||||
dev->if_capenable ^= IFCAP_LRO;
|
||||
if_togglecapenable(dev, IFCAP_LRO);
|
||||
if (mask & IFCAP_VLAN_HWTAGGING)
|
||||
dev->if_capenable ^= IFCAP_VLAN_HWTAGGING;
|
||||
if_togglecapenable(dev, IFCAP_VLAN_HWTAGGING);
|
||||
if (mask & IFCAP_VLAN_HWFILTER)
|
||||
dev->if_capenable ^= IFCAP_VLAN_HWFILTER;
|
||||
if_togglecapenable(dev, IFCAP_VLAN_HWFILTER);
|
||||
if (mask & IFCAP_WOL_MAGIC)
|
||||
dev->if_capenable ^= IFCAP_WOL_MAGIC;
|
||||
if (dev->if_drv_flags & IFF_DRV_RUNNING)
|
||||
if_togglecapenable(dev, IFCAP_WOL_MAGIC);
|
||||
if (if_getdrvflags(dev) & IFF_DRV_RUNNING)
|
||||
mlx4_en_start_port(dev);
|
||||
out:
|
||||
mutex_unlock(&mdev->state_lock);
|
||||
@ -2135,8 +2134,9 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)
|
||||
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
struct mlx4_en_port_profile *prof)
|
||||
{
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
struct mlx4_en_priv *priv;
|
||||
uint32_t hwassist;
|
||||
uint8_t dev_addr[ETHER_ADDR_LEN];
|
||||
int err;
|
||||
int i;
|
||||
@ -2148,16 +2148,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
kfree(priv);
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->if_softc = priv;
|
||||
if_setsoftc(dev, priv);
|
||||
if_initname(dev, "mlxen", (device_get_unit(
|
||||
mdev->pdev->dev.bsddev) * MLX4_MAX_PORTS) + port - 1);
|
||||
dev->if_mtu = ETHERMTU;
|
||||
dev->if_init = mlx4_en_open;
|
||||
dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
dev->if_ioctl = mlx4_en_ioctl;
|
||||
dev->if_transmit = mlx4_en_transmit;
|
||||
dev->if_qflush = mlx4_en_qflush;
|
||||
dev->if_snd.ifq_maxlen = prof->tx_ring_size;
|
||||
if_setmtu(dev, ETHERMTU);
|
||||
if_setinitfn(dev, mlx4_en_open);
|
||||
if_setflags(dev, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
|
||||
if_setioctlfn(dev, mlx4_en_ioctl);
|
||||
if_settransmitfn(dev, mlx4_en_transmit);
|
||||
if_setqflushfn(dev, mlx4_en_qflush);
|
||||
if_setsendqlen(dev, prof->tx_ring_size);
|
||||
|
||||
/*
|
||||
* Initialize driver private data
|
||||
@ -2251,30 +2251,30 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
/*
|
||||
* Set driver features
|
||||
*/
|
||||
dev->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6;
|
||||
dev->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING;
|
||||
dev->if_capabilities |= IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER;
|
||||
dev->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
|
||||
dev->if_capabilities |= IFCAP_LRO;
|
||||
dev->if_capabilities |= IFCAP_HWSTATS;
|
||||
if_setcapabilitiesbit(dev, IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 |
|
||||
IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
|
||||
IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER |
|
||||
IFCAP_LINKSTATE | IFCAP_JUMBO_MTU |
|
||||
IFCAP_LRO | IFCAP_HWSTATS, 0);
|
||||
|
||||
if (mdev->LSO_support)
|
||||
dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO;
|
||||
if_setcapabilitiesbit(dev, IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO, 0);
|
||||
|
||||
/* set TSO limits so that we don't have to drop TX packets */
|
||||
dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */;
|
||||
dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */;
|
||||
dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE;
|
||||
if_sethwtsomax(dev, MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */);
|
||||
if_sethwtsomaxsegcount(dev, MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */);
|
||||
if_sethwtsomaxsegsize(dev, MLX4_EN_TX_MAX_MBUF_SIZE);
|
||||
|
||||
dev->if_capenable = dev->if_capabilities;
|
||||
if_setcapenable(dev, if_getcapabilities(dev));
|
||||
|
||||
dev->if_hwassist = 0;
|
||||
if (dev->if_capenable & (IFCAP_TSO4 | IFCAP_TSO6))
|
||||
dev->if_hwassist |= CSUM_TSO;
|
||||
if (dev->if_capenable & IFCAP_TXCSUM)
|
||||
dev->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP);
|
||||
if (dev->if_capenable & IFCAP_TXCSUM_IPV6)
|
||||
dev->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6);
|
||||
hwassist = 0;
|
||||
if (if_getcapenable(dev) & (IFCAP_TSO4 | IFCAP_TSO6))
|
||||
hwassist |= CSUM_TSO;
|
||||
if (if_getcapenable(dev) & IFCAP_TXCSUM)
|
||||
hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP);
|
||||
if (if_getcapenable(dev) & IFCAP_TXCSUM_IPV6)
|
||||
hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6);
|
||||
if_sethwassist(dev, hwassist);
|
||||
|
||||
|
||||
/* Register for VLAN events */
|
||||
@ -2315,7 +2315,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
|
||||
|
||||
|
||||
priv->rx_mb_size = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
|
||||
priv->rx_mb_size = if_getmtu(dev) + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
|
||||
err = mlx4_SET_PORT_general(mdev->dev, priv->port,
|
||||
priv->rx_mb_size,
|
||||
prof->tx_pause, prof->tx_ppp,
|
||||
@ -2346,7 +2346,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mlx4_en_set_ring_size(struct ifnet *dev,
|
||||
static int mlx4_en_set_ring_size(if_t dev,
|
||||
int rx_size, int tx_size)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
@ -2420,7 +2420,7 @@ static int mlx4_en_set_tx_ring_size(SYSCTL_HANDLER_ARGS)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int mlx4_en_get_module_info(struct ifnet *dev,
|
||||
static int mlx4_en_get_module_info(if_t dev,
|
||||
struct ethtool_modinfo *modinfo)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
@ -2467,7 +2467,7 @@ static int mlx4_en_get_module_info(struct ifnet *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx4_en_get_module_eeprom(struct ifnet *dev,
|
||||
static int mlx4_en_get_module_eeprom(if_t dev,
|
||||
struct ethtool_eeprom *ee,
|
||||
u8 *data)
|
||||
{
|
||||
@ -2651,7 +2651,7 @@ static int mlx4_en_set_rx_ppp(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv)
|
||||
{
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
struct sysctl_ctx_list *ctx;
|
||||
struct sysctl_oid *node;
|
||||
struct sysctl_oid_list *node_list;
|
||||
@ -2664,7 +2664,7 @@ static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv)
|
||||
|
||||
sysctl_ctx_init(ctx);
|
||||
priv->conf_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
|
||||
OID_AUTO, dev->if_xname, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
|
||||
OID_AUTO, if_name(dev), CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
|
||||
"mlx4 10gig ethernet");
|
||||
node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(priv->conf_sysctl), OID_AUTO,
|
||||
"conf", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Configuration");
|
||||
@ -2892,7 +2892,7 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv)
|
||||
|
||||
#ifdef DEBUGNET
|
||||
static void
|
||||
mlx4_en_debugnet_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize)
|
||||
mlx4_en_debugnet_init(if_t dev, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
|
||||
@ -2905,12 +2905,12 @@ mlx4_en_debugnet_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize)
|
||||
}
|
||||
|
||||
static void
|
||||
mlx4_en_debugnet_event(struct ifnet *dev, enum debugnet_ev event)
|
||||
mlx4_en_debugnet_event(if_t dev, enum debugnet_ev event)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
mlx4_en_debugnet_transmit(struct ifnet *dev, struct mbuf *m)
|
||||
mlx4_en_debugnet_transmit(if_t dev, struct mbuf *m)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
int err;
|
||||
@ -2927,7 +2927,7 @@ mlx4_en_debugnet_transmit(struct ifnet *dev, struct mbuf *m)
|
||||
}
|
||||
|
||||
static int
|
||||
mlx4_en_debugnet_poll(struct ifnet *dev, int count)
|
||||
mlx4_en_debugnet_poll(if_t dev, int count)
|
||||
{
|
||||
struct mlx4_en_priv *priv;
|
||||
|
||||
|
@ -149,7 +149,7 @@ static u64 en_stats_adder(__be64 *start, __be64 *next, int num)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void mlx4_en_fold_software_stats(struct ifnet *dev)
|
||||
static void mlx4_en_fold_software_stats(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
@ -187,7 +187,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
|
||||
struct mlx4_counter tmp_vport_stats;
|
||||
struct mlx4_en_stat_out_mbox *mlx4_en_stats;
|
||||
struct mlx4_en_stat_out_flow_control_mbox *flowstats;
|
||||
struct ifnet *dev = mdev->pndev[port];
|
||||
if_t dev = mdev->pndev[port];
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats;
|
||||
struct mlx4_cmd_mailbox *mailbox;
|
||||
|
@ -43,7 +43,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
|
||||
int user_prio, struct mlx4_qp_context *context)
|
||||
{
|
||||
struct mlx4_en_dev *mdev = priv->mdev;
|
||||
struct ifnet *dev = priv->dev;
|
||||
if_t dev = priv->dev;
|
||||
|
||||
memset(context, 0, sizeof *context);
|
||||
context->flags = cpu_to_be32(7 << 16 | rss << MLX4_RSS_QPC_FLAG_OFFSET);
|
||||
@ -76,7 +76,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
|
||||
context->cqn_send = cpu_to_be32(cqn);
|
||||
context->cqn_recv = cpu_to_be32(cqn);
|
||||
context->db_rec_addr = cpu_to_be64(priv->res.db.dma << 2);
|
||||
if (!(dev->if_capabilities & IFCAP_VLAN_HWCSUM))
|
||||
if (!(if_getcapabilities(dev) & IFCAP_VLAN_HWCSUM))
|
||||
context->param3 |= cpu_to_be32(1 << 30);
|
||||
}
|
||||
|
||||
|
@ -338,14 +338,14 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev)
|
||||
}
|
||||
}
|
||||
|
||||
void mlx4_en_calc_rx_buf(struct ifnet *dev)
|
||||
void mlx4_en_calc_rx_buf(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN +
|
||||
int eff_mtu = if_getmtu(dev) + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN +
|
||||
MLX4_NET_IP_ALIGN;
|
||||
|
||||
if (eff_mtu > MJUM16BYTES) {
|
||||
en_err(priv, "MTU(%u) is too big\n", (unsigned)dev->if_mtu);
|
||||
en_err(priv, "MTU(%u) is too big\n", (unsigned)if_getmtu(dev));
|
||||
eff_mtu = MJUM16BYTES;
|
||||
} else if (eff_mtu > MJUM9BYTES) {
|
||||
eff_mtu = MJUM16BYTES;
|
||||
@ -502,9 +502,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
|
||||
|
||||
#ifdef INET
|
||||
/* Configure lro mngr */
|
||||
if (priv->dev->if_capenable & IFCAP_LRO) {
|
||||
if (if_getcapenable(priv->dev) & IFCAP_LRO) {
|
||||
if (tcp_lro_init(&ring->lro))
|
||||
priv->dev->if_capenable &= ~IFCAP_LRO;
|
||||
if_setcapenablebit(priv->dev, 0, IFCAP_LRO);
|
||||
else
|
||||
ring->lro.ifp = priv->dev;
|
||||
}
|
||||
@ -735,7 +735,7 @@ mlx4_en_rss_hash(__be16 status, int udp_rss)
|
||||
* The following calc ensures that when factor==1, it means we are aligned to 64B
|
||||
* and we get the real cqe data*/
|
||||
#define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor))
|
||||
int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
|
||||
int mlx4_en_process_rx_cq(if_t dev, struct mlx4_en_cq *cq, int budget)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_cqe *cqe;
|
||||
@ -806,7 +806,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
|
||||
mb->m_pkthdr.ether_vtag = be16_to_cpu(cqe->sl_vid);
|
||||
mb->m_flags |= M_VLANTAG;
|
||||
}
|
||||
if (likely(dev->if_capenable &
|
||||
if (likely(if_getcapenable(dev) &
|
||||
(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) &&
|
||||
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&
|
||||
(cqe->checksum == cpu_to_be16(0xffff))) {
|
||||
@ -823,7 +823,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
|
||||
*/
|
||||
#ifdef INET
|
||||
if (mlx4_en_can_lro(cqe->status) &&
|
||||
(dev->if_capenable & IFCAP_LRO)) {
|
||||
(if_getcapenable(dev) & IFCAP_LRO)) {
|
||||
if (ring->lro.lro_cnt != 0 &&
|
||||
tcp_lro_rx(&ring->lro, mb, 0) == 0)
|
||||
goto next;
|
||||
@ -838,7 +838,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
|
||||
}
|
||||
|
||||
/* Push it up the stack */
|
||||
dev->if_input(dev, mb);
|
||||
if_input(dev, mb);
|
||||
|
||||
next:
|
||||
++cons_index;
|
||||
@ -866,7 +866,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
|
||||
/* Rx CQ polling - called by NAPI */
|
||||
static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget)
|
||||
{
|
||||
struct ifnet *dev = cq->dev;
|
||||
if_t dev = cq->dev;
|
||||
struct epoch_tracker et;
|
||||
int done;
|
||||
|
||||
@ -912,7 +912,7 @@ void mlx4_en_rx_que(void *context, int pending)
|
||||
while (mlx4_en_poll_rx_cq(cq, MLX4_EN_RX_BUDGET)
|
||||
== MLX4_EN_RX_BUDGET);
|
||||
NET_EPOCH_EXIT(et);
|
||||
mlx4_en_arm_cq(cq->dev->if_softc, cq);
|
||||
mlx4_en_arm_cq(if_getsoftc(cq->dev), cq);
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,7 +308,7 @@ mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
|
||||
return (tx_info->nr_txbb);
|
||||
}
|
||||
|
||||
int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring)
|
||||
int mlx4_en_free_tx_buf(if_t dev, struct mlx4_en_tx_ring *ring)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
int cnt = 0;
|
||||
@ -344,7 +344,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 ifnet *dev,
|
||||
static int mlx4_en_process_tx_cq(if_t dev,
|
||||
struct mlx4_en_cq *cq)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
@ -604,7 +604,7 @@ static void hashrandom_init(void *arg)
|
||||
}
|
||||
SYSINIT(hashrandom_init, SI_SUB_RANDOM, SI_ORDER_ANY, &hashrandom_init, NULL);
|
||||
|
||||
u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb)
|
||||
u16 mlx4_en_select_queue(if_t dev, struct mbuf *mb)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
u32 rings_p_up = priv->num_tx_rings_p_up;
|
||||
@ -640,7 +640,7 @@ int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
|
||||
volatile struct mlx4_wqe_data_seg *dseg_inline;
|
||||
volatile struct mlx4_en_tx_desc *tx_desc;
|
||||
struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind];
|
||||
struct ifnet *ifp = priv->dev;
|
||||
if_t ifp = priv->dev;
|
||||
struct mlx4_en_tx_info *tx_info;
|
||||
struct mbuf *mb = *mbp;
|
||||
struct mbuf *m;
|
||||
@ -688,7 +688,7 @@ int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
|
||||
dseg = &tx_desc->data;
|
||||
|
||||
/* send a copy of the frame to the BPF listener, if any */
|
||||
if (ifp != NULL && ifp->if_bpf != NULL)
|
||||
if (ifp != NULL && if_getbpf(ifp) != NULL)
|
||||
ETHER_BPF_MTAP(ifp, mb);
|
||||
|
||||
/* get default flags */
|
||||
@ -927,13 +927,13 @@ int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
|
||||
}
|
||||
|
||||
static int
|
||||
mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb)
|
||||
mlx4_en_transmit_locked(if_t ifp, int tx_ind, struct mbuf *mb)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(ifp);
|
||||
struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind];
|
||||
int err = 0;
|
||||
|
||||
if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
|
||||
if (unlikely((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 ||
|
||||
READ_ONCE(priv->port_up) == 0)) {
|
||||
m_freem(mb);
|
||||
return (ENETDOWN);
|
||||
@ -952,7 +952,7 @@ mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb)
|
||||
}
|
||||
|
||||
int
|
||||
mlx4_en_transmit(struct ifnet *dev, struct mbuf *m)
|
||||
mlx4_en_transmit(if_t dev, struct mbuf *m)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
struct mlx4_en_tx_ring *ring;
|
||||
@ -991,7 +991,7 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m)
|
||||
* Flush ring buffers.
|
||||
*/
|
||||
void
|
||||
mlx4_en_qflush(struct ifnet *dev)
|
||||
mlx4_en_qflush(if_t dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
|
||||
|
||||
|
@ -495,7 +495,7 @@ struct mlx4_port_gid_table {
|
||||
|
||||
struct mlx4_ib_iboe {
|
||||
spinlock_t lock;
|
||||
struct ifnet *netdevs[MLX4_MAX_PORTS];
|
||||
if_t netdevs[MLX4_MAX_PORTS];
|
||||
atomic64_t mac[MLX4_MAX_PORTS];
|
||||
struct notifier_block nb;
|
||||
struct mlx4_port_gid_table gids[MLX4_MAX_PORTS];
|
||||
|
@ -98,7 +98,7 @@ static int create_iboe_ah(struct ib_ah *ib_ah, struct ib_ah_attr *ah_attr)
|
||||
eth_zero_addr(ah->av.eth.s_mac);
|
||||
if (gid_attr.ndev) {
|
||||
vlan_tag = rdma_vlan_dev_vlan_id(gid_attr.ndev);
|
||||
memcpy(ah->av.eth.s_mac, IF_LLADDR(gid_attr.ndev), ETH_ALEN);
|
||||
memcpy(ah->av.eth.s_mac, if_getlladdr(gid_attr.ndev), ETH_ALEN);
|
||||
if_rele(gid_attr.ndev);
|
||||
}
|
||||
if (vlan_tag < 0x1000)
|
||||
|
@ -131,10 +131,10 @@ static int num_ib_ports(struct mlx4_dev *dev)
|
||||
return ib_ports;
|
||||
}
|
||||
|
||||
static struct ifnet *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num)
|
||||
static if_t mlx4_ib_get_netdev(struct ib_device *device, u8 port_num)
|
||||
{
|
||||
struct mlx4_ib_dev *ibdev = to_mdev(device);
|
||||
struct ifnet *dev;
|
||||
if_t dev;
|
||||
|
||||
rcu_read_lock();
|
||||
dev = mlx4_get_protocol_dev(ibdev->dev, MLX4_PROT_ETH, port_num);
|
||||
@ -142,11 +142,11 @@ static struct ifnet *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num)
|
||||
#if 0
|
||||
if (dev) {
|
||||
if (mlx4_is_bonded(ibdev->dev)) {
|
||||
struct ifnet *upper = NULL;
|
||||
if_t upper = NULL;
|
||||
|
||||
upper = netdev_master_upper_dev_get_rcu(dev);
|
||||
if (upper) {
|
||||
struct ifnet *active;
|
||||
if_t active;
|
||||
|
||||
active = bond_option_active_slave_get_rcu(mlx4_netdev_priv(upper));
|
||||
if (active)
|
||||
@ -691,7 +691,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
|
||||
|
||||
struct mlx4_ib_dev *mdev = to_mdev(ibdev);
|
||||
struct mlx4_ib_iboe *iboe = &mdev->iboe;
|
||||
struct ifnet *ndev;
|
||||
if_t ndev;
|
||||
enum ib_mtu tmp;
|
||||
struct mlx4_cmd_mailbox *mailbox;
|
||||
int err = 0;
|
||||
@ -1252,7 +1252,7 @@ static void mlx4_ib_delete_counters_table(struct mlx4_ib_dev *ibdev,
|
||||
int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp,
|
||||
union ib_gid *gid)
|
||||
{
|
||||
struct ifnet *ndev;
|
||||
if_t ndev;
|
||||
int ret = 0;
|
||||
|
||||
if (!mqp->port)
|
||||
@ -1868,7 +1868,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
|
||||
struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
|
||||
struct mlx4_dev *dev = mdev->dev;
|
||||
struct mlx4_ib_qp *mqp = to_mqp(ibqp);
|
||||
struct ifnet *ndev;
|
||||
if_t ndev;
|
||||
struct mlx4_ib_gid_entry *ge;
|
||||
struct mlx4_flow_reg_id reg_id = {0, 0};
|
||||
enum mlx4_protocol prot = MLX4_PROT_IB_IPV6;
|
||||
@ -2192,14 +2192,14 @@ static void mlx4_ib_diag_cleanup(struct mlx4_ib_dev *ibdev)
|
||||
|
||||
#define MLX4_IB_INVALID_MAC ((u64)-1)
|
||||
static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev,
|
||||
struct ifnet *dev,
|
||||
if_t dev,
|
||||
int port)
|
||||
{
|
||||
u64 new_smac = 0;
|
||||
u64 release_mac = MLX4_IB_INVALID_MAC;
|
||||
struct mlx4_ib_qp *qp;
|
||||
|
||||
new_smac = mlx4_mac_to_u64(IF_LLADDR(dev));
|
||||
new_smac = mlx4_mac_to_u64(if_getlladdr(dev));
|
||||
|
||||
atomic64_set(&ibdev->iboe.mac[port - 1], new_smac);
|
||||
|
||||
@ -2247,7 +2247,7 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev,
|
||||
}
|
||||
|
||||
static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev,
|
||||
struct ifnet *dev,
|
||||
if_t dev,
|
||||
unsigned long event)
|
||||
|
||||
{
|
||||
@ -2278,7 +2278,7 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev,
|
||||
static int mlx4_ib_netdev_event(struct notifier_block *this,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
struct ifnet *dev = netdev_notifier_info_to_ifp(ptr);
|
||||
if_t dev = netdev_notifier_info_to_ifp(ptr);
|
||||
struct mlx4_ib_dev *ibdev;
|
||||
|
||||
if (dev->if_vnet != &init_net)
|
||||
@ -3014,7 +3014,7 @@ static void handle_bonded_port_state_event(struct work_struct *work)
|
||||
kfree(ew);
|
||||
spin_lock_bh(&ibdev->iboe.lock);
|
||||
for (i = 0; i < MLX4_MAX_PORTS; ++i) {
|
||||
struct ifnet *curr_netdev = ibdev->iboe.netdevs[i];
|
||||
if_t curr_netdev = ibdev->iboe.netdevs[i];
|
||||
enum ib_port_state curr_port_state;
|
||||
|
||||
if (!curr_netdev)
|
||||
|
@ -1790,7 +1790,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
|
||||
status = -ENOENT;
|
||||
if (!status && gid_attr.ndev) {
|
||||
vlan = rdma_vlan_dev_vlan_id(gid_attr.ndev);
|
||||
memcpy(smac, IF_LLADDR(gid_attr.ndev), ETH_ALEN);
|
||||
memcpy(smac, if_getlladdr(gid_attr.ndev), ETH_ALEN);
|
||||
if_rele(gid_attr.ndev);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user