Commit 09dee69e authored by David S. Miller's avatar David S. Miller

Merge branch 'ionic-updates'

Shannon Nelson says:

====================
ionic updates

This is a set of small updates for the Pensando ionic driver, some
from internal work, some a result of mailing list discussions.

v4 - don't register mgmt device netdev
v3 - changed __attribute__(packed)) to __packed
v2 - removed print from ionic_init_module()
====================
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c8e98343 1fcbebf1
...@@ -12,12 +12,12 @@ struct ionic_lif; ...@@ -12,12 +12,12 @@ struct ionic_lif;
#define IONIC_DRV_NAME "ionic" #define IONIC_DRV_NAME "ionic"
#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver" #define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
#define IONIC_DRV_VERSION "0.20.0-k"
#define PCI_VENDOR_ID_PENSANDO 0x1dd8 #define PCI_VENDOR_ID_PENSANDO 0x1dd8
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002 #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003 #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT 0x1004
#define DEVCMD_TIMEOUT 10 #define DEVCMD_TIMEOUT 10
...@@ -42,6 +42,7 @@ struct ionic { ...@@ -42,6 +42,7 @@ struct ionic {
struct dentry *dentry; struct dentry *dentry;
struct ionic_dev_bar bars[IONIC_BARS_MAX]; struct ionic_dev_bar bars[IONIC_BARS_MAX];
unsigned int num_bars; unsigned int num_bars;
bool is_mgmt_nic;
struct ionic_identity ident; struct ionic_identity ident;
struct list_head lifs; struct list_head lifs;
struct ionic_lif *master_lif; struct ionic_lif *master_lif;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
static const struct pci_device_id ionic_id_table[] = { static const struct pci_device_id ionic_id_table[] = {
{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF) }, { PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF) },
{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF) }, { PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF) },
{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT) },
{ 0, } /* end of table */ { 0, } /* end of table */
}; };
MODULE_DEVICE_TABLE(pci, ionic_id_table); MODULE_DEVICE_TABLE(pci, ionic_id_table);
...@@ -37,6 +38,9 @@ int ionic_bus_alloc_irq_vectors(struct ionic *ionic, unsigned int nintrs) ...@@ -37,6 +38,9 @@ int ionic_bus_alloc_irq_vectors(struct ionic *ionic, unsigned int nintrs)
void ionic_bus_free_irq_vectors(struct ionic *ionic) void ionic_bus_free_irq_vectors(struct ionic *ionic)
{ {
if (!ionic->nintrs)
return;
pci_free_irq_vectors(ionic->pdev); pci_free_irq_vectors(ionic->pdev);
} }
...@@ -221,6 +225,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -221,6 +225,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, ionic); pci_set_drvdata(pdev, ionic);
mutex_init(&ionic->dev_cmd_lock); mutex_init(&ionic->dev_cmd_lock);
ionic->is_mgmt_nic =
ent->device == PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT;
/* Query system for DMA addressing limitation for the device. */ /* Query system for DMA addressing limitation for the device. */
err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IONIC_ADDR_LEN)); err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IONIC_ADDR_LEN));
if (err) { if (err) {
...@@ -245,6 +252,8 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -245,6 +252,8 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
pci_set_master(pdev); pci_set_master(pdev);
if (!ionic->is_mgmt_nic)
pcie_print_link_status(pdev);
err = ionic_map_bars(ionic); err = ionic_map_bars(ionic);
if (err) if (err)
...@@ -346,6 +355,11 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -346,6 +355,11 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ionic_reset(ionic); ionic_reset(ionic);
err_out_teardown: err_out_teardown:
ionic_dev_teardown(ionic); ionic_dev_teardown(ionic);
/* Don't fail the probe for these errors, keep
* the hw interface around for inspection
*/
return 0;
err_out_unmap_bars: err_out_unmap_bars:
ionic_unmap_bars(ionic); ionic_unmap_bars(ionic);
pci_release_regions(pdev); pci_release_regions(pdev);
...@@ -369,11 +383,14 @@ static void ionic_remove(struct pci_dev *pdev) ...@@ -369,11 +383,14 @@ static void ionic_remove(struct pci_dev *pdev)
if (!ionic) if (!ionic)
return; return;
if (ionic->master_lif) {
ionic_devlink_unregister(ionic); ionic_devlink_unregister(ionic);
ionic_lifs_unregister(ionic); ionic_lifs_unregister(ionic);
ionic_lifs_deinit(ionic); ionic_lifs_deinit(ionic);
ionic_lifs_free(ionic); ionic_lifs_free(ionic);
ionic_bus_free_irq_vectors(ionic); ionic_bus_free_irq_vectors(ionic);
}
ionic_port_reset(ionic); ionic_port_reset(ionic);
ionic_reset(ionic); ionic_reset(ionic);
ionic_dev_teardown(ionic); ionic_dev_teardown(ionic);
......
...@@ -82,7 +82,7 @@ int ionic_devlink_register(struct ionic *ionic) ...@@ -82,7 +82,7 @@ int ionic_devlink_register(struct ionic *ionic)
err = devlink_port_register(dl, &ionic->dl_port, 0); err = devlink_port_register(dl, &ionic->dl_port, 0);
if (err) if (err)
dev_err(ionic->dev, "devlink_port_register failed: %d\n", err); dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
else else if (!ionic->is_mgmt_nic)
devlink_port_type_eth_set(&ionic->dl_port, devlink_port_type_eth_set(&ionic->dl_port,
ionic->master_lif->netdev); ionic->master_lif->netdev);
......
...@@ -86,7 +86,6 @@ static void ionic_get_drvinfo(struct net_device *netdev, ...@@ -86,7 +86,6 @@ static void ionic_get_drvinfo(struct net_device *netdev,
struct ionic *ionic = lif->ionic; struct ionic *ionic = lif->ionic;
strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, IONIC_DRV_VERSION, sizeof(drvinfo->version));
strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version, strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version,
sizeof(drvinfo->fw_version)); sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, ionic_bus_info(ionic), strlcpy(drvinfo->bus_info, ionic_bus_info(ionic),
...@@ -440,7 +439,7 @@ static int ionic_set_coalesce(struct net_device *netdev, ...@@ -440,7 +439,7 @@ static int ionic_set_coalesce(struct net_device *netdev,
if (coal != lif->rx_coalesce_hw) { if (coal != lif->rx_coalesce_hw) {
lif->rx_coalesce_hw = coal; lif->rx_coalesce_hw = coal;
if (test_bit(IONIC_LIF_UP, lif->state)) { if (test_bit(IONIC_LIF_F_UP, lif->state)) {
for (i = 0; i < lif->nxqs; i++) { for (i = 0; i < lif->nxqs; i++) {
qcq = lif->rxqcqs[i].qcq; qcq = lif->rxqcqs[i].qcq;
ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, ionic_intr_coal_init(lif->ionic->idev.intr_ctrl,
...@@ -487,11 +486,11 @@ static int ionic_set_ringparam(struct net_device *netdev, ...@@ -487,11 +486,11 @@ static int ionic_set_ringparam(struct net_device *netdev,
ring->rx_pending == lif->nrxq_descs) ring->rx_pending == lif->nrxq_descs)
return 0; return 0;
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET); err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err) if (err)
return err; return err;
running = test_bit(IONIC_LIF_UP, lif->state); running = test_bit(IONIC_LIF_F_UP, lif->state);
if (running) if (running)
ionic_stop(netdev); ionic_stop(netdev);
...@@ -500,7 +499,7 @@ static int ionic_set_ringparam(struct net_device *netdev, ...@@ -500,7 +499,7 @@ static int ionic_set_ringparam(struct net_device *netdev,
if (running) if (running)
ionic_open(netdev); ionic_open(netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state); clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return 0; return 0;
} }
...@@ -531,11 +530,11 @@ static int ionic_set_channels(struct net_device *netdev, ...@@ -531,11 +530,11 @@ static int ionic_set_channels(struct net_device *netdev,
if (ch->combined_count == lif->nxqs) if (ch->combined_count == lif->nxqs)
return 0; return 0;
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET); err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err) if (err)
return err; return err;
running = test_bit(IONIC_LIF_UP, lif->state); running = test_bit(IONIC_LIF_F_UP, lif->state);
if (running) if (running)
ionic_stop(netdev); ionic_stop(netdev);
...@@ -543,7 +542,7 @@ static int ionic_set_channels(struct net_device *netdev, ...@@ -543,7 +542,7 @@ static int ionic_set_channels(struct net_device *netdev,
if (running) if (running)
ionic_open(netdev); ionic_open(netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state); clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return 0; return 0;
} }
...@@ -553,7 +552,7 @@ static u32 ionic_get_priv_flags(struct net_device *netdev) ...@@ -553,7 +552,7 @@ static u32 ionic_get_priv_flags(struct net_device *netdev)
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
u32 priv_flags = 0; u32 priv_flags = 0;
if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) if (test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
priv_flags |= PRIV_F_SW_DBG_STATS; priv_flags |= PRIV_F_SW_DBG_STATS;
return priv_flags; return priv_flags;
...@@ -562,14 +561,10 @@ static u32 ionic_get_priv_flags(struct net_device *netdev) ...@@ -562,14 +561,10 @@ static u32 ionic_get_priv_flags(struct net_device *netdev)
static int ionic_set_priv_flags(struct net_device *netdev, u32 priv_flags) static int ionic_set_priv_flags(struct net_device *netdev, u32 priv_flags)
{ {
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
u32 flags = lif->flags;
clear_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state); clear_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state);
if (priv_flags & PRIV_F_SW_DBG_STATS) if (priv_flags & PRIV_F_SW_DBG_STATS)
set_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state); set_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state);
if (flags != lif->flags)
lif->flags = flags;
return 0; return 0;
} }
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#ifndef _IONIC_IF_H_ #ifndef _IONIC_IF_H_
#define _IONIC_IF_H_ #define _IONIC_IF_H_
#pragma pack(push, 1)
#define IONIC_DEV_INFO_SIGNATURE 0x44455649 /* 'DEVI' */ #define IONIC_DEV_INFO_SIGNATURE 0x44455649 /* 'DEVI' */
#define IONIC_DEV_INFO_VERSION 1 #define IONIC_DEV_INFO_VERSION 1
#define IONIC_IFNAMSIZ 16 #define IONIC_IFNAMSIZ 16
...@@ -366,7 +364,7 @@ union ionic_lif_config { ...@@ -366,7 +364,7 @@ union ionic_lif_config {
u8 rsvd2[2]; u8 rsvd2[2];
__le64 features; __le64 features;
__le32 queue_count[IONIC_QTYPE_MAX]; __le32 queue_count[IONIC_QTYPE_MAX];
}; } __packed;
__le32 words[64]; __le32 words[64];
}; };
...@@ -417,7 +415,7 @@ union ionic_lif_identity { ...@@ -417,7 +415,7 @@ union ionic_lif_identity {
__le32 max_frame_size; __le32 max_frame_size;
u8 rsvd2[106]; u8 rsvd2[106];
union ionic_lif_config config; union ionic_lif_config config;
} eth; } __packed eth;
struct { struct {
u8 version; u8 version;
...@@ -439,8 +437,8 @@ union ionic_lif_identity { ...@@ -439,8 +437,8 @@ union ionic_lif_identity {
struct ionic_lif_logical_qtype rq_qtype; struct ionic_lif_logical_qtype rq_qtype;
struct ionic_lif_logical_qtype cq_qtype; struct ionic_lif_logical_qtype cq_qtype;
struct ionic_lif_logical_qtype eq_qtype; struct ionic_lif_logical_qtype eq_qtype;
} rdma; } __packed rdma;
}; } __packed;
__le32 words[512]; __le32 words[512];
}; };
...@@ -526,7 +524,7 @@ struct ionic_q_init_cmd { ...@@ -526,7 +524,7 @@ struct ionic_q_init_cmd {
__le64 sg_ring_base; __le64 sg_ring_base;
__le32 eq_index; __le32 eq_index;
u8 rsvd2[16]; u8 rsvd2[16];
}; } __packed;
/** /**
* struct ionic_q_init_comp - Queue init command completion * struct ionic_q_init_comp - Queue init command completion
...@@ -1095,7 +1093,7 @@ struct ionic_port_status { ...@@ -1095,7 +1093,7 @@ struct ionic_port_status {
u8 status; u8 status;
u8 rsvd[51]; u8 rsvd[51];
struct ionic_xcvr_status xcvr; struct ionic_xcvr_status xcvr;
}; } __packed;
/** /**
* struct ionic_port_identify_cmd - Port identify command * struct ionic_port_identify_cmd - Port identify command
...@@ -1251,7 +1249,7 @@ struct ionic_port_getattr_comp { ...@@ -1251,7 +1249,7 @@ struct ionic_port_getattr_comp {
u8 pause_type; u8 pause_type;
u8 loopback_mode; u8 loopback_mode;
u8 rsvd2[11]; u8 rsvd2[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -1319,7 +1317,7 @@ struct ionic_dev_setattr_cmd { ...@@ -1319,7 +1317,7 @@ struct ionic_dev_setattr_cmd {
char name[IONIC_IFNAMSIZ]; char name[IONIC_IFNAMSIZ];
__le64 features; __le64 features;
u8 rsvd2[60]; u8 rsvd2[60];
}; } __packed;
}; };
/** /**
...@@ -1334,7 +1332,7 @@ struct ionic_dev_setattr_comp { ...@@ -1334,7 +1332,7 @@ struct ionic_dev_setattr_comp {
union { union {
__le64 features; __le64 features;
u8 rsvd2[11]; u8 rsvd2[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -1361,7 +1359,7 @@ struct ionic_dev_getattr_comp { ...@@ -1361,7 +1359,7 @@ struct ionic_dev_getattr_comp {
union { union {
__le64 features; __le64 features;
u8 rsvd2[11]; u8 rsvd2[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -1426,7 +1424,7 @@ struct ionic_lif_setattr_cmd { ...@@ -1426,7 +1424,7 @@ struct ionic_lif_setattr_cmd {
} rss; } rss;
u8 stats_ctl; u8 stats_ctl;
u8 rsvd[60]; u8 rsvd[60];
}; } __packed;
}; };
/** /**
...@@ -1444,7 +1442,7 @@ struct ionic_lif_setattr_comp { ...@@ -1444,7 +1442,7 @@ struct ionic_lif_setattr_comp {
union { union {
__le64 features; __le64 features;
u8 rsvd2[11]; u8 rsvd2[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -1483,7 +1481,7 @@ struct ionic_lif_getattr_comp { ...@@ -1483,7 +1481,7 @@ struct ionic_lif_getattr_comp {
u8 mac[6]; u8 mac[6];
__le64 features; __le64 features;
u8 rsvd2[11]; u8 rsvd2[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -1688,7 +1686,7 @@ struct ionic_vf_setattr_cmd { ...@@ -1688,7 +1686,7 @@ struct ionic_vf_setattr_cmd {
u8 linkstate; u8 linkstate;
__le64 stats_pa; __le64 stats_pa;
u8 pad[60]; u8 pad[60];
}; } __packed;
}; };
struct ionic_vf_setattr_comp { struct ionic_vf_setattr_comp {
...@@ -1726,7 +1724,7 @@ struct ionic_vf_getattr_comp { ...@@ -1726,7 +1724,7 @@ struct ionic_vf_getattr_comp {
u8 linkstate; u8 linkstate;
__le64 stats_pa; __le64 stats_pa;
u8 pad[11]; u8 pad[11];
}; } __packed;
u8 color; u8 color;
}; };
...@@ -2472,7 +2470,7 @@ union ionic_dev_cmd_regs { ...@@ -2472,7 +2470,7 @@ union ionic_dev_cmd_regs {
union ionic_dev_cmd_comp comp; union ionic_dev_cmd_comp comp;
u8 rsvd[48]; u8 rsvd[48];
u32 data[478]; u32 data[478];
}; } __packed;
u32 words[512]; u32 words[512];
}; };
...@@ -2485,7 +2483,7 @@ union ionic_dev_regs { ...@@ -2485,7 +2483,7 @@ union ionic_dev_regs {
struct { struct {
union ionic_dev_info_regs info; union ionic_dev_info_regs info;
union ionic_dev_cmd_regs devcmd; union ionic_dev_cmd_regs devcmd;
}; } __packed;
__le32 words[1024]; __le32 words[1024];
}; };
...@@ -2575,6 +2573,4 @@ struct ionic_identity { ...@@ -2575,6 +2573,4 @@ struct ionic_identity {
union ionic_qos_identity qos; union ionic_qos_identity qos;
}; };
#pragma pack(pop)
#endif /* _IONIC_IF_H_ */ #endif /* _IONIC_IF_H_ */
...@@ -84,7 +84,7 @@ static void ionic_link_status_check(struct ionic_lif *lif) ...@@ -84,7 +84,7 @@ static void ionic_link_status_check(struct ionic_lif *lif)
netdev_info(netdev, "Link up - %d Gbps\n", netdev_info(netdev, "Link up - %d Gbps\n",
le32_to_cpu(lif->info->status.link_speed) / 1000); le32_to_cpu(lif->info->status.link_speed) / 1000);
if (test_bit(IONIC_LIF_UP, lif->state)) { if (test_bit(IONIC_LIF_F_UP, lif->state)) {
netif_tx_wake_all_queues(lif->netdev); netif_tx_wake_all_queues(lif->netdev);
netif_carrier_on(netdev); netif_carrier_on(netdev);
} }
...@@ -93,12 +93,12 @@ static void ionic_link_status_check(struct ionic_lif *lif) ...@@ -93,12 +93,12 @@ static void ionic_link_status_check(struct ionic_lif *lif)
/* carrier off first to avoid watchdog timeout */ /* carrier off first to avoid watchdog timeout */
netif_carrier_off(netdev); netif_carrier_off(netdev);
if (test_bit(IONIC_LIF_UP, lif->state)) if (test_bit(IONIC_LIF_F_UP, lif->state))
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
} }
link_out: link_out:
clear_bit(IONIC_LIF_LINK_CHECK_REQUESTED, lif->state); clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state);
} }
static void ionic_link_status_check_request(struct ionic_lif *lif) static void ionic_link_status_check_request(struct ionic_lif *lif)
...@@ -106,7 +106,7 @@ static void ionic_link_status_check_request(struct ionic_lif *lif) ...@@ -106,7 +106,7 @@ static void ionic_link_status_check_request(struct ionic_lif *lif)
struct ionic_deferred_work *work; struct ionic_deferred_work *work;
/* we only need one request outstanding at a time */ /* we only need one request outstanding at a time */
if (test_and_set_bit(IONIC_LIF_LINK_CHECK_REQUESTED, lif->state)) if (test_and_set_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state))
return; return;
if (in_interrupt()) { if (in_interrupt()) {
...@@ -424,8 +424,9 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, ...@@ -424,8 +424,9 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
ionic_intr_mask_assert(idev->intr_ctrl, new->intr.index, ionic_intr_mask_assert(idev->intr_ctrl, new->intr.index,
IONIC_INTR_MASK_SET); IONIC_INTR_MASK_SET);
new->intr.cpu = new->intr.index % num_online_cpus(); new->intr.cpu = cpumask_local_spread(new->intr.index,
if (cpu_online(new->intr.cpu)) dev_to_node(dev));
if (new->intr.cpu != -1)
cpumask_set_cpu(new->intr.cpu, cpumask_set_cpu(new->intr.cpu,
&new->intr.affinity_mask); &new->intr.affinity_mask);
} else { } else {
...@@ -1093,6 +1094,7 @@ static int ionic_set_nic_features(struct ionic_lif *lif, ...@@ -1093,6 +1094,7 @@ static int ionic_set_nic_features(struct ionic_lif *lif,
u64 vlan_flags = IONIC_ETH_HW_VLAN_TX_TAG | u64 vlan_flags = IONIC_ETH_HW_VLAN_TX_TAG |
IONIC_ETH_HW_VLAN_RX_STRIP | IONIC_ETH_HW_VLAN_RX_STRIP |
IONIC_ETH_HW_VLAN_RX_FILTER; IONIC_ETH_HW_VLAN_RX_FILTER;
u64 old_hw_features;
int err; int err;
ctx.cmd.lif_setattr.features = ionic_netdev_features_to_nic(features); ctx.cmd.lif_setattr.features = ionic_netdev_features_to_nic(features);
...@@ -1100,9 +1102,13 @@ static int ionic_set_nic_features(struct ionic_lif *lif, ...@@ -1100,9 +1102,13 @@ static int ionic_set_nic_features(struct ionic_lif *lif,
if (err) if (err)
return err; return err;
old_hw_features = lif->hw_features;
lif->hw_features = le64_to_cpu(ctx.cmd.lif_setattr.features & lif->hw_features = le64_to_cpu(ctx.cmd.lif_setattr.features &
ctx.comp.lif_setattr.features); ctx.comp.lif_setattr.features);
if ((old_hw_features ^ lif->hw_features) & IONIC_ETH_HW_RX_HASH)
ionic_lif_rss_config(lif, lif->rss_types, NULL, NULL);
if ((vlan_flags & features) && if ((vlan_flags & features) &&
!(vlan_flags & le64_to_cpu(ctx.comp.lif_setattr.features))) !(vlan_flags & le64_to_cpu(ctx.comp.lif_setattr.features)))
dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, likely in SmartNIC mode\n"); dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, likely in SmartNIC mode\n");
...@@ -1149,6 +1155,10 @@ static int ionic_init_nic_features(struct ionic_lif *lif) ...@@ -1149,6 +1155,10 @@ static int ionic_init_nic_features(struct ionic_lif *lif)
netdev_features_t features; netdev_features_t features;
int err; int err;
/* no netdev features on the management device */
if (lif->ionic->is_mgmt_nic)
return 0;
/* set up what we expect to support by default */ /* set up what we expect to support by default */
features = NETIF_F_HW_VLAN_CTAG_TX | features = NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_RX |
...@@ -1356,13 +1366,15 @@ int ionic_lif_rss_config(struct ionic_lif *lif, const u16 types, ...@@ -1356,13 +1366,15 @@ int ionic_lif_rss_config(struct ionic_lif *lif, const u16 types,
.cmd.lif_setattr = { .cmd.lif_setattr = {
.opcode = IONIC_CMD_LIF_SETATTR, .opcode = IONIC_CMD_LIF_SETATTR,
.attr = IONIC_LIF_ATTR_RSS, .attr = IONIC_LIF_ATTR_RSS,
.rss.types = cpu_to_le16(types),
.rss.addr = cpu_to_le64(lif->rss_ind_tbl_pa), .rss.addr = cpu_to_le64(lif->rss_ind_tbl_pa),
}, },
}; };
unsigned int i, tbl_sz; unsigned int i, tbl_sz;
if (lif->hw_features & IONIC_ETH_HW_RX_HASH) {
lif->rss_types = types; lif->rss_types = types;
ctx.cmd.lif_setattr.rss.types = cpu_to_le16(types);
}
if (key) if (key)
memcpy(lif->rss_hash_key, key, IONIC_RSS_HASH_KEY_SIZE); memcpy(lif->rss_hash_key, key, IONIC_RSS_HASH_KEY_SIZE);
...@@ -1578,7 +1590,7 @@ int ionic_open(struct net_device *netdev) ...@@ -1578,7 +1590,7 @@ int ionic_open(struct net_device *netdev)
netif_set_real_num_tx_queues(netdev, lif->nxqs); netif_set_real_num_tx_queues(netdev, lif->nxqs);
netif_set_real_num_rx_queues(netdev, lif->nxqs); netif_set_real_num_rx_queues(netdev, lif->nxqs);
set_bit(IONIC_LIF_UP, lif->state); set_bit(IONIC_LIF_F_UP, lif->state);
ionic_link_status_check_request(lif); ionic_link_status_check_request(lif);
if (netif_carrier_ok(netdev)) if (netif_carrier_ok(netdev))
...@@ -1598,13 +1610,13 @@ int ionic_stop(struct net_device *netdev) ...@@ -1598,13 +1610,13 @@ int ionic_stop(struct net_device *netdev)
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
int err = 0; int err = 0;
if (!test_bit(IONIC_LIF_UP, lif->state)) { if (!test_bit(IONIC_LIF_F_UP, lif->state)) {
dev_dbg(lif->ionic->dev, "%s: %s state=DOWN\n", dev_dbg(lif->ionic->dev, "%s: %s state=DOWN\n",
__func__, lif->name); __func__, lif->name);
return 0; return 0;
} }
dev_dbg(lif->ionic->dev, "%s: %s state=UP\n", __func__, lif->name); dev_dbg(lif->ionic->dev, "%s: %s state=UP\n", __func__, lif->name);
clear_bit(IONIC_LIF_UP, lif->state); clear_bit(IONIC_LIF_F_UP, lif->state);
/* carrier off before disabling queues to avoid watchdog timeout */ /* carrier off before disabling queues to avoid watchdog timeout */
netif_carrier_off(netdev); netif_carrier_off(netdev);
...@@ -1871,7 +1883,7 @@ int ionic_reset_queues(struct ionic_lif *lif) ...@@ -1871,7 +1883,7 @@ int ionic_reset_queues(struct ionic_lif *lif)
/* Put off the next watchdog timeout */ /* Put off the next watchdog timeout */
netif_trans_update(lif->netdev); netif_trans_update(lif->netdev);
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET); err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err) if (err)
return err; return err;
...@@ -1881,7 +1893,7 @@ int ionic_reset_queues(struct ionic_lif *lif) ...@@ -1881,7 +1893,7 @@ int ionic_reset_queues(struct ionic_lif *lif)
if (!err && running) if (!err && running)
ionic_open(lif->netdev); ionic_open(lif->netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state); clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return err; return err;
} }
...@@ -2048,10 +2060,10 @@ void ionic_lifs_free(struct ionic *ionic) ...@@ -2048,10 +2060,10 @@ void ionic_lifs_free(struct ionic *ionic)
static void ionic_lif_deinit(struct ionic_lif *lif) static void ionic_lif_deinit(struct ionic_lif *lif)
{ {
if (!test_bit(IONIC_LIF_INITED, lif->state)) if (!test_bit(IONIC_LIF_F_INITED, lif->state))
return; return;
clear_bit(IONIC_LIF_INITED, lif->state); clear_bit(IONIC_LIF_F_INITED, lif->state);
ionic_rx_filters_deinit(lif); ionic_rx_filters_deinit(lif);
ionic_lif_rss_deinit(lif); ionic_lif_rss_deinit(lif);
...@@ -2287,7 +2299,7 @@ static int ionic_lif_init(struct ionic_lif *lif) ...@@ -2287,7 +2299,7 @@ static int ionic_lif_init(struct ionic_lif *lif)
lif->rx_copybreak = IONIC_RX_COPYBREAK_DEFAULT; lif->rx_copybreak = IONIC_RX_COPYBREAK_DEFAULT;
set_bit(IONIC_LIF_INITED, lif->state); set_bit(IONIC_LIF_F_INITED, lif->state);
INIT_WORK(&lif->tx_timeout_work, ionic_tx_timeout_work); INIT_WORK(&lif->tx_timeout_work, ionic_tx_timeout_work);
...@@ -2375,6 +2387,12 @@ int ionic_lifs_register(struct ionic *ionic) ...@@ -2375,6 +2387,12 @@ int ionic_lifs_register(struct ionic *ionic)
{ {
int err; int err;
/* the netdev is not registered on the management device, it is
* only used as a vehicle for napi operations on the adminq
*/
if (ionic->is_mgmt_nic)
return 0;
INIT_WORK(&ionic->nb_work, ionic_lif_notify_work); INIT_WORK(&ionic->nb_work, ionic_lif_notify_work);
ionic->nb.notifier_call = ionic_lif_notify; ionic->nb.notifier_call = ionic_lif_notify;
...@@ -2408,6 +2426,9 @@ void ionic_lifs_unregister(struct ionic *ionic) ...@@ -2408,6 +2426,9 @@ void ionic_lifs_unregister(struct ionic *ionic)
* current model, so don't bother searching the * current model, so don't bother searching the
* ionic->lif for candidates to unregister * ionic->lif for candidates to unregister
*/ */
if (!ionic->master_lif)
return;
cancel_work_sync(&ionic->master_lif->deferred.work); cancel_work_sync(&ionic->master_lif->deferred.work);
cancel_work_sync(&ionic->master_lif->tx_timeout_work); cancel_work_sync(&ionic->master_lif->tx_timeout_work);
if (ionic->master_lif->netdev->reg_state == NETREG_REGISTERED) if (ionic->master_lif->netdev->reg_state == NETREG_REGISTERED)
......
...@@ -121,14 +121,14 @@ struct ionic_lif_sw_stats { ...@@ -121,14 +121,14 @@ struct ionic_lif_sw_stats {
}; };
enum ionic_lif_state_flags { enum ionic_lif_state_flags {
IONIC_LIF_INITED, IONIC_LIF_F_INITED,
IONIC_LIF_SW_DEBUG_STATS, IONIC_LIF_F_SW_DEBUG_STATS,
IONIC_LIF_UP, IONIC_LIF_F_UP,
IONIC_LIF_LINK_CHECK_REQUESTED, IONIC_LIF_F_LINK_CHECK_REQUESTED,
IONIC_LIF_QUEUE_RESET, IONIC_LIF_F_QUEUE_RESET,
/* leave this as last */ /* leave this as last */
IONIC_LIF_STATE_SIZE IONIC_LIF_F_STATE_SIZE
}; };
#define IONIC_LIF_NAME_MAX_SZ 32 #define IONIC_LIF_NAME_MAX_SZ 32
...@@ -136,7 +136,7 @@ struct ionic_lif { ...@@ -136,7 +136,7 @@ struct ionic_lif {
char name[IONIC_LIF_NAME_MAX_SZ]; char name[IONIC_LIF_NAME_MAX_SZ];
struct list_head list; struct list_head list;
struct net_device *netdev; struct net_device *netdev;
DECLARE_BITMAP(state, IONIC_LIF_STATE_SIZE); DECLARE_BITMAP(state, IONIC_LIF_F_STATE_SIZE);
struct ionic *ionic; struct ionic *ionic;
bool registered; bool registered;
unsigned int index; unsigned int index;
...@@ -179,7 +179,6 @@ struct ionic_lif { ...@@ -179,7 +179,6 @@ struct ionic_lif {
u32 rx_coalesce_usecs; /* what the user asked for */ u32 rx_coalesce_usecs; /* what the user asked for */
u32 rx_coalesce_hw; /* what the hw is using */ u32 rx_coalesce_hw; /* what the hw is using */
u32 flags;
struct work_struct tx_timeout_work; struct work_struct tx_timeout_work;
}; };
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/vermagic.h>
#include "ionic.h" #include "ionic.h"
#include "ionic_bus.h" #include "ionic_bus.h"
...@@ -15,7 +16,6 @@ ...@@ -15,7 +16,6 @@
MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION); MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION);
MODULE_AUTHOR("Pensando Systems, Inc"); MODULE_AUTHOR("Pensando Systems, Inc");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(IONIC_DRV_VERSION);
static const char *ionic_error_to_str(enum ionic_status_code code) static const char *ionic_error_to_str(enum ionic_status_code code)
{ {
...@@ -414,7 +414,7 @@ int ionic_identify(struct ionic *ionic) ...@@ -414,7 +414,7 @@ int ionic_identify(struct ionic *ionic)
memset(ident, 0, sizeof(*ident)); memset(ident, 0, sizeof(*ident));
ident->drv.os_type = cpu_to_le32(IONIC_OS_TYPE_LINUX); ident->drv.os_type = cpu_to_le32(IONIC_OS_TYPE_LINUX);
strncpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION, strncpy(ident->drv.driver_ver_str, UTS_RELEASE,
sizeof(ident->drv.driver_ver_str) - 1); sizeof(ident->drv.driver_ver_str) - 1);
mutex_lock(&ionic->dev_cmd_lock); mutex_lock(&ionic->dev_cmd_lock);
...@@ -558,8 +558,6 @@ int ionic_port_reset(struct ionic *ionic) ...@@ -558,8 +558,6 @@ int ionic_port_reset(struct ionic *ionic)
static int __init ionic_init_module(void) static int __init ionic_init_module(void)
{ {
pr_info("%s %s, ver %s\n",
IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION);
ionic_debugfs_create(); ionic_debugfs_create();
return ionic_bus_register_driver(); return ionic_bus_register_driver();
} }
......
...@@ -118,8 +118,8 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif) ...@@ -118,8 +118,8 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif)
/* rx stats */ /* rx stats */
total += MAX_Q(lif) * IONIC_NUM_RX_STATS; total += MAX_Q(lif) * IONIC_NUM_RX_STATS;
if (test_bit(IONIC_LIF_UP, lif->state) && if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
/* tx debug stats */ /* tx debug stats */
total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS + total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS +
IONIC_NUM_TX_Q_STATS + IONIC_NUM_TX_Q_STATS +
...@@ -151,8 +151,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) ...@@ -151,8 +151,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
*buf += ETH_GSTRING_LEN; *buf += ETH_GSTRING_LEN;
} }
if (test_bit(IONIC_LIF_UP, lif->state) && if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
snprintf(*buf, ETH_GSTRING_LEN, snprintf(*buf, ETH_GSTRING_LEN,
"txq_%d_%s", "txq_%d_%s",
...@@ -190,8 +190,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) ...@@ -190,8 +190,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
*buf += ETH_GSTRING_LEN; *buf += ETH_GSTRING_LEN;
} }
if (test_bit(IONIC_LIF_UP, lif->state) && if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
snprintf(*buf, ETH_GSTRING_LEN, snprintf(*buf, ETH_GSTRING_LEN,
"rxq_%d_cq_%s", "rxq_%d_cq_%s",
...@@ -247,8 +247,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) ...@@ -247,8 +247,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)
(*buf)++; (*buf)++;
} }
if (test_bit(IONIC_LIF_UP, lif->state) && if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
txqcq = lif_to_txqcq(lif, q_num); txqcq = lif_to_txqcq(lif, q_num);
for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
**buf = IONIC_READ_STAT64(&txqcq->q, **buf = IONIC_READ_STAT64(&txqcq->q,
...@@ -281,8 +281,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) ...@@ -281,8 +281,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)
(*buf)++; (*buf)++;
} }
if (test_bit(IONIC_LIF_UP, lif->state) && if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
rxqcq = lif_to_rxqcq(lif, q_num); rxqcq = lif_to_rxqcq(lif, q_num);
for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
**buf = IONIC_READ_STAT64(&rxqcq->cq, **buf = IONIC_READ_STAT64(&rxqcq->cq,
......
...@@ -158,7 +158,7 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_desc_info *desc_i ...@@ -158,7 +158,7 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_desc_info *desc_i
} }
/* no packet processing while resetting */ /* no packet processing while resetting */
if (unlikely(test_bit(IONIC_LIF_QUEUE_RESET, q->lif->state))) { if (unlikely(test_bit(IONIC_LIF_F_QUEUE_RESET, q->lif->state))) {
stats->dropped++; stats->dropped++;
return; return;
} }
...@@ -1023,7 +1023,7 @@ netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1023,7 +1023,7 @@ netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev)
int ndescs; int ndescs;
int err; int err;
if (unlikely(!test_bit(IONIC_LIF_UP, lif->state))) { if (unlikely(!test_bit(IONIC_LIF_F_UP, lif->state))) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment