Commit 25cc5a5f authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: code cleanup details

Catch a couple of missing macro name uses, fix a couple
of misspellings, etc.
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent df291e54
...@@ -29,11 +29,9 @@ static void ionic_get_stats_strings(struct ionic_lif *lif, u8 *buf) ...@@ -29,11 +29,9 @@ static void ionic_get_stats_strings(struct ionic_lif *lif, u8 *buf)
static void ionic_get_stats(struct net_device *netdev, static void ionic_get_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *buf) struct ethtool_stats *stats, u64 *buf)
{ {
struct ionic_lif *lif; struct ionic_lif *lif = netdev_priv(netdev);
u32 i; u32 i;
lif = netdev_priv(netdev);
memset(buf, 0, stats->n_stats * sizeof(*buf)); memset(buf, 0, stats->n_stats * sizeof(*buf));
for (i = 0; i < ionic_num_stats_grps; i++) for (i = 0; i < ionic_num_stats_grps; i++)
ionic_stats_groups[i].get_values(lif, &buf); ionic_stats_groups[i].get_values(lif, &buf);
...@@ -264,12 +262,10 @@ static int ionic_set_link_ksettings(struct net_device *netdev, ...@@ -264,12 +262,10 @@ static int ionic_set_link_ksettings(struct net_device *netdev,
const struct ethtool_link_ksettings *ks) const struct ethtool_link_ksettings *ks)
{ {
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
struct ionic_dev *idev = &lif->ionic->idev;
struct ionic *ionic = lif->ionic; struct ionic *ionic = lif->ionic;
struct ionic_dev *idev;
int err = 0; int err = 0;
idev = &lif->ionic->idev;
/* set autoneg */ /* set autoneg */
if (ks->base.autoneg != idev->port_info->config.an_enable) { if (ks->base.autoneg != idev->port_info->config.an_enable) {
mutex_lock(&ionic->dev_cmd_lock); mutex_lock(&ionic->dev_cmd_lock);
......
...@@ -320,7 +320,7 @@ struct ionic_lif_identify_comp { ...@@ -320,7 +320,7 @@ struct ionic_lif_identify_comp {
/** /**
* enum ionic_lif_capability - LIF capabilities * enum ionic_lif_capability - LIF capabilities
* @IONIC_LIF_CAP_ETH: LIF supports Ethernet * @IONIC_LIF_CAP_ETH: LIF supports Ethernet
* @IONIC_LIF_CAP_RDMA: LIF support RDMA * @IONIC_LIF_CAP_RDMA: LIF supports RDMA
*/ */
enum ionic_lif_capability { enum ionic_lif_capability {
IONIC_LIF_CAP_ETH = BIT(0), IONIC_LIF_CAP_ETH = BIT(0),
...@@ -404,7 +404,7 @@ union ionic_lif_config { ...@@ -404,7 +404,7 @@ union ionic_lif_config {
* @max_ucast_filters: Number of perfect unicast addresses supported * @max_ucast_filters: Number of perfect unicast addresses supported
* @max_mcast_filters: Number of perfect multicast addresses supported * @max_mcast_filters: Number of perfect multicast addresses supported
* @min_frame_size: Minimum size of frames to be sent * @min_frame_size: Minimum size of frames to be sent
* @max_frame_size: Maximim size of frames to be sent * @max_frame_size: Maximum size of frames to be sent
* @config: LIF config struct with features, mtu, mac, q counts * @config: LIF config struct with features, mtu, mac, q counts
* *
* @rdma: RDMA identify structure * @rdma: RDMA identify structure
...@@ -692,7 +692,7 @@ enum ionic_txq_desc_opcode { ...@@ -692,7 +692,7 @@ enum ionic_txq_desc_opcode {
* checksums are also updated. * checksums are also updated.
* *
* IONIC_TXQ_DESC_OPCODE_TSO: * IONIC_TXQ_DESC_OPCODE_TSO:
* Device preforms TCP segmentation offload * Device performs TCP segmentation offload
* (TSO). @hdr_len is the number of bytes * (TSO). @hdr_len is the number of bytes
* to the end of TCP header (the offset to * to the end of TCP header (the offset to
* the TCP payload). @mss is the desired * the TCP payload). @mss is the desired
...@@ -982,13 +982,13 @@ struct ionic_rxq_comp { ...@@ -982,13 +982,13 @@ struct ionic_rxq_comp {
}; };
enum ionic_pkt_type { enum ionic_pkt_type {
IONIC_PKT_TYPE_NON_IP = 0x000, IONIC_PKT_TYPE_NON_IP = 0x00,
IONIC_PKT_TYPE_IPV4 = 0x001, IONIC_PKT_TYPE_IPV4 = 0x01,
IONIC_PKT_TYPE_IPV4_TCP = 0x003, IONIC_PKT_TYPE_IPV4_TCP = 0x03,
IONIC_PKT_TYPE_IPV4_UDP = 0x005, IONIC_PKT_TYPE_IPV4_UDP = 0x05,
IONIC_PKT_TYPE_IPV6 = 0x008, IONIC_PKT_TYPE_IPV6 = 0x08,
IONIC_PKT_TYPE_IPV6_TCP = 0x018, IONIC_PKT_TYPE_IPV6_TCP = 0x18,
IONIC_PKT_TYPE_IPV6_UDP = 0x028, IONIC_PKT_TYPE_IPV6_UDP = 0x28,
/* below types are only used if encap offloads are enabled on lif */ /* below types are only used if encap offloads are enabled on lif */
IONIC_PKT_TYPE_ENCAP_NON_IP = 0x40, IONIC_PKT_TYPE_ENCAP_NON_IP = 0x40,
IONIC_PKT_TYPE_ENCAP_IPV4 = 0x41, IONIC_PKT_TYPE_ENCAP_IPV4 = 0x41,
...@@ -1331,7 +1331,7 @@ enum ionic_stats_ctl_cmd { ...@@ -1331,7 +1331,7 @@ enum ionic_stats_ctl_cmd {
* @IONIC_PORT_ATTR_STATE: Port state attribute * @IONIC_PORT_ATTR_STATE: Port state attribute
* @IONIC_PORT_ATTR_SPEED: Port speed attribute * @IONIC_PORT_ATTR_SPEED: Port speed attribute
* @IONIC_PORT_ATTR_MTU: Port MTU attribute * @IONIC_PORT_ATTR_MTU: Port MTU attribute
* @IONIC_PORT_ATTR_AUTONEG: Port autonegotation attribute * @IONIC_PORT_ATTR_AUTONEG: Port autonegotiation attribute
* @IONIC_PORT_ATTR_FEC: Port FEC attribute * @IONIC_PORT_ATTR_FEC: Port FEC attribute
* @IONIC_PORT_ATTR_PAUSE: Port pause attribute * @IONIC_PORT_ATTR_PAUSE: Port pause attribute
* @IONIC_PORT_ATTR_LOOPBACK: Port loopback attribute * @IONIC_PORT_ATTR_LOOPBACK: Port loopback attribute
...@@ -1951,8 +1951,8 @@ enum ionic_qos_sched_type { ...@@ -1951,8 +1951,8 @@ enum ionic_qos_sched_type {
* @pfc_cos: Priority-Flow Control class of service * @pfc_cos: Priority-Flow Control class of service
* @dwrr_weight: QoS class scheduling weight * @dwrr_weight: QoS class scheduling weight
* @strict_rlmt: Rate limit for strict priority scheduling * @strict_rlmt: Rate limit for strict priority scheduling
* @rw_dot1q_pcp: Rewrite dot1q pcp to this value (valid iff F_RW_DOT1Q_PCP) * @rw_dot1q_pcp: Rewrite dot1q pcp to value (valid iff F_RW_DOT1Q_PCP)
* @rw_ip_dscp: Rewrite ip dscp to this value (valid iff F_RW_IP_DSCP) * @rw_ip_dscp: Rewrite ip dscp to value (valid iff F_RW_IP_DSCP)
* @dot1q_pcp: Dot1q pcp value * @dot1q_pcp: Dot1q pcp value
* @ndscp: Number of valid dscp values in the ip_dscp field * @ndscp: Number of valid dscp values in the ip_dscp field
* @ip_dscp: IP dscp values * @ip_dscp: IP dscp values
......
...@@ -124,19 +124,16 @@ static void ionic_link_status_check(struct ionic_lif *lif) ...@@ -124,19 +124,16 @@ static void ionic_link_status_check(struct ionic_lif *lif)
link_up = link_status == IONIC_PORT_OPER_STATUS_UP; link_up = link_status == IONIC_PORT_OPER_STATUS_UP;
if (link_up) { if (link_up) {
if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { if (netdev->flags & IFF_UP && netif_running(netdev)) {
mutex_lock(&lif->queue_lock); mutex_lock(&lif->queue_lock);
ionic_start_queues(lif); ionic_start_queues(lif);
mutex_unlock(&lif->queue_lock); mutex_unlock(&lif->queue_lock);
} }
if (!netif_carrier_ok(netdev)) { if (!netif_carrier_ok(netdev)) {
u32 link_speed;
ionic_port_identify(lif->ionic); ionic_port_identify(lif->ionic);
link_speed = le32_to_cpu(lif->info->status.link_speed);
netdev_info(netdev, "Link up - %d Gbps\n", netdev_info(netdev, "Link up - %d Gbps\n",
link_speed / 1000); le32_to_cpu(lif->info->status.link_speed) / 1000);
netif_carrier_on(netdev); netif_carrier_on(netdev);
} }
} else { } else {
...@@ -145,7 +142,7 @@ static void ionic_link_status_check(struct ionic_lif *lif) ...@@ -145,7 +142,7 @@ static void ionic_link_status_check(struct ionic_lif *lif)
netif_carrier_off(netdev); netif_carrier_off(netdev);
} }
if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { if (netdev->flags & IFF_UP && netif_running(netdev)) {
mutex_lock(&lif->queue_lock); mutex_lock(&lif->queue_lock);
ionic_stop_queues(lif); ionic_stop_queues(lif);
mutex_unlock(&lif->queue_lock); mutex_unlock(&lif->queue_lock);
...@@ -839,7 +836,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq, ...@@ -839,7 +836,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq,
switch (le16_to_cpu(comp->event.ecode)) { switch (le16_to_cpu(comp->event.ecode)) {
case IONIC_EVENT_LINK_CHANGE: case IONIC_EVENT_LINK_CHANGE:
ionic_link_status_check_request(lif, false); ionic_link_status_check_request(lif, CAN_NOT_SLEEP);
break; break;
case IONIC_EVENT_RESET: case IONIC_EVENT_RESET:
work = kzalloc(sizeof(*work), GFP_ATOMIC); work = kzalloc(sizeof(*work), GFP_ATOMIC);
...@@ -1443,7 +1440,7 @@ static int ionic_start_queues_reconfig(struct ionic_lif *lif) ...@@ -1443,7 +1440,7 @@ static int ionic_start_queues_reconfig(struct ionic_lif *lif)
*/ */
err = ionic_txrx_init(lif); err = ionic_txrx_init(lif);
mutex_unlock(&lif->queue_lock); mutex_unlock(&lif->queue_lock);
ionic_link_status_check_request(lif, true); ionic_link_status_check_request(lif, CAN_SLEEP);
netif_device_attach(lif->netdev); netif_device_attach(lif->netdev);
return err; return err;
...@@ -1863,7 +1860,7 @@ static int ionic_open(struct net_device *netdev) ...@@ -1863,7 +1860,7 @@ static int ionic_open(struct net_device *netdev)
err = ionic_txrx_init(lif); err = ionic_txrx_init(lif);
if (err) if (err)
goto err_out; goto err_txrx_free;
err = netif_set_real_num_tx_queues(netdev, lif->nxqs); err = netif_set_real_num_tx_queues(netdev, lif->nxqs);
if (err) if (err)
...@@ -1884,7 +1881,7 @@ static int ionic_open(struct net_device *netdev) ...@@ -1884,7 +1881,7 @@ static int ionic_open(struct net_device *netdev)
err_txrx_deinit: err_txrx_deinit:
ionic_txrx_deinit(lif); ionic_txrx_deinit(lif);
err_out: err_txrx_free:
ionic_txrx_free(lif); ionic_txrx_free(lif);
return err; return err;
} }
...@@ -2356,7 +2353,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, ...@@ -2356,7 +2353,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
swap(lif->nxqs, qparam->nxqs); swap(lif->nxqs, qparam->nxqs);
err_out_reinit_unlock: err_out_reinit_unlock:
/* re-init the queues, but don't loose an error code */ /* re-init the queues, but don't lose an error code */
if (err) if (err)
ionic_start_queues_reconfig(lif); ionic_start_queues_reconfig(lif);
else else
...@@ -2605,7 +2602,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) ...@@ -2605,7 +2602,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
} }
clear_bit(IONIC_LIF_F_FW_RESET, lif->state); clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
ionic_link_status_check_request(lif, true); ionic_link_status_check_request(lif, CAN_SLEEP);
netif_device_attach(lif->netdev); netif_device_attach(lif->netdev);
dev_info(ionic->dev, "FW Up: LIFs restarted\n"); dev_info(ionic->dev, "FW Up: LIFs restarted\n");
...@@ -2976,7 +2973,7 @@ int ionic_lif_register(struct ionic_lif *lif) ...@@ -2976,7 +2973,7 @@ int ionic_lif_register(struct ionic_lif *lif)
return err; return err;
} }
ionic_link_status_check_request(lif, true); ionic_link_status_check_request(lif, CAN_SLEEP);
lif->registered = true; lif->registered = true;
ionic_lif_set_netdev_info(lif); ionic_lif_set_netdev_info(lif);
......
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