ionic: code cleanup details
authorShannon Nelson <snelson@pensando.io>
Fri, 19 Mar 2021 00:48:04 +0000 (17:48 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Mar 2021 02:16:10 +0000 (19:16 -0700)
Catch a couple of missing macro name uses, fix a couple
of misspellings, etc.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
drivers/net/ethernet/pensando/ionic/ionic_if.h
drivers/net/ethernet/pensando/ionic/ionic_lif.c

index 0832bed..9df4b9d 100644 (file)
@@ -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,
                            struct ethtool_stats *stats, u64 *buf)
 {
-       struct ionic_lif *lif;
+       struct ionic_lif *lif = netdev_priv(netdev);
        u32 i;
 
-       lif = netdev_priv(netdev);
-
        memset(buf, 0, stats->n_stats * sizeof(*buf));
        for (i = 0; i < ionic_num_stats_grps; i++)
                ionic_stats_groups[i].get_values(lif, &buf);
@@ -264,12 +262,10 @@ static int ionic_set_link_ksettings(struct net_device *netdev,
                                    const struct ethtool_link_ksettings *ks)
 {
        struct ionic_lif *lif = netdev_priv(netdev);
+       struct ionic_dev *idev = &lif->ionic->idev;
        struct ionic *ionic = lif->ionic;
-       struct ionic_dev *idev;
        int err = 0;
 
-       idev = &lif->ionic->idev;
-
        /* set autoneg */
        if (ks->base.autoneg != idev->port_info->config.an_enable) {
                mutex_lock(&ionic->dev_cmd_lock);
index 31ccfcd..40bd72b 100644 (file)
@@ -320,7 +320,7 @@ struct ionic_lif_identify_comp {
 /**
  * enum ionic_lif_capability - LIF capabilities
  * @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 {
        IONIC_LIF_CAP_ETH        = BIT(0),
@@ -404,7 +404,7 @@ union ionic_lif_config {
  *     @max_ucast_filters:  Number of perfect unicast addresses supported
  *     @max_mcast_filters:  Number of perfect multicast addresses supported
  *     @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
  *
  * @rdma:                RDMA identify structure
@@ -692,7 +692,7 @@ enum ionic_txq_desc_opcode {
  *                      checksums are also updated.
  *
  *                   IONIC_TXQ_DESC_OPCODE_TSO:
- *                      Device preforms TCP segmentation offload
+ *                      Device performs TCP segmentation offload
  *                      (TSO).  @hdr_len is the number of bytes
  *                      to the end of TCP header (the offset to
  *                      the TCP payload).  @mss is the desired
@@ -982,13 +982,13 @@ struct ionic_rxq_comp {
 };
 
 enum ionic_pkt_type {
-       IONIC_PKT_TYPE_NON_IP     = 0x000,
-       IONIC_PKT_TYPE_IPV4       = 0x001,
-       IONIC_PKT_TYPE_IPV4_TCP   = 0x003,
-       IONIC_PKT_TYPE_IPV4_UDP   = 0x005,
-       IONIC_PKT_TYPE_IPV6       = 0x008,
-       IONIC_PKT_TYPE_IPV6_TCP   = 0x018,
-       IONIC_PKT_TYPE_IPV6_UDP   = 0x028,
+       IONIC_PKT_TYPE_NON_IP           = 0x00,
+       IONIC_PKT_TYPE_IPV4             = 0x01,
+       IONIC_PKT_TYPE_IPV4_TCP         = 0x03,
+       IONIC_PKT_TYPE_IPV4_UDP         = 0x05,
+       IONIC_PKT_TYPE_IPV6             = 0x08,
+       IONIC_PKT_TYPE_IPV6_TCP         = 0x18,
+       IONIC_PKT_TYPE_IPV6_UDP         = 0x28,
        /* below types are only used if encap offloads are enabled on lif */
        IONIC_PKT_TYPE_ENCAP_NON_IP     = 0x40,
        IONIC_PKT_TYPE_ENCAP_IPV4       = 0x41,
@@ -1331,7 +1331,7 @@ enum ionic_stats_ctl_cmd {
  * @IONIC_PORT_ATTR_STATE:      Port state attribute
  * @IONIC_PORT_ATTR_SPEED:      Port speed 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_PAUSE:      Port pause attribute
  * @IONIC_PORT_ATTR_LOOPBACK:   Port loopback attribute
@@ -1951,8 +1951,8 @@ enum ionic_qos_sched_type {
  * @pfc_cos:           Priority-Flow Control class of service
  * @dwrr_weight:       QoS class scheduling weight
  * @strict_rlmt:       Rate limit for strict priority scheduling
- * @rw_dot1q_pcp:      Rewrite dot1q pcp to this value (valid iff F_RW_DOT1Q_PCP)
- * @rw_ip_dscp:                Rewrite ip dscp to this value   (valid iff F_RW_IP_DSCP)
+ * @rw_dot1q_pcp:      Rewrite dot1q pcp to value (valid iff F_RW_DOT1Q_PCP)
+ * @rw_ip_dscp:                Rewrite ip dscp to value (valid iff F_RW_IP_DSCP)
  * @dot1q_pcp:         Dot1q pcp value
  * @ndscp:             Number of valid dscp values in the ip_dscp field
  * @ip_dscp:           IP dscp values
index 48d3c76..7ee6d2d 100644 (file)
@@ -124,19 +124,16 @@ static void ionic_link_status_check(struct ionic_lif *lif)
        link_up = link_status == IONIC_PORT_OPER_STATUS_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);
                        ionic_start_queues(lif);
                        mutex_unlock(&lif->queue_lock);
                }
 
                if (!netif_carrier_ok(netdev)) {
-                       u32 link_speed;
-
                        ionic_port_identify(lif->ionic);
-                       link_speed = le32_to_cpu(lif->info->status.link_speed);
                        netdev_info(netdev, "Link up - %d Gbps\n",
-                                   link_speed / 1000);
+                                   le32_to_cpu(lif->info->status.link_speed) / 1000);
                        netif_carrier_on(netdev);
                }
        } else {
@@ -145,7 +142,7 @@ static void ionic_link_status_check(struct ionic_lif *lif)
                        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);
                        ionic_stop_queues(lif);
                        mutex_unlock(&lif->queue_lock);
@@ -839,7 +836,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq,
 
        switch (le16_to_cpu(comp->event.ecode)) {
        case IONIC_EVENT_LINK_CHANGE:
-               ionic_link_status_check_request(lif, false);
+               ionic_link_status_check_request(lif, CAN_NOT_SLEEP);
                break;
        case IONIC_EVENT_RESET:
                work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -1443,7 +1440,7 @@ static int ionic_start_queues_reconfig(struct ionic_lif *lif)
         */
        err = ionic_txrx_init(lif);
        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);
 
        return err;
@@ -1863,7 +1860,7 @@ static int ionic_open(struct net_device *netdev)
 
        err = ionic_txrx_init(lif);
        if (err)
-               goto err_out;
+               goto err_txrx_free;
 
        err = netif_set_real_num_tx_queues(netdev, lif->nxqs);
        if (err)
@@ -1884,7 +1881,7 @@ static int ionic_open(struct net_device *netdev)
 
 err_txrx_deinit:
        ionic_txrx_deinit(lif);
-err_out:
+err_txrx_free:
        ionic_txrx_free(lif);
        return err;
 }
@@ -2356,7 +2353,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
        swap(lif->nxqs, qparam->nxqs);
 
 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)
                ionic_start_queues_reconfig(lif);
        else
@@ -2605,7 +2602,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
        }
 
        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);
        dev_info(ionic->dev, "FW Up: LIFs restarted\n");
 
@@ -2976,7 +2973,7 @@ int ionic_lif_register(struct ionic_lif *lif)
                return err;
        }
 
-       ionic_link_status_check_request(lif, true);
+       ionic_link_status_check_request(lif, CAN_SLEEP);
        lif->registered = true;
        ionic_lif_set_netdev_info(lif);