liquidio: moved wait_for_pending_requests to octeon_network.h
authorIntiyaz Basha <intiyaz.basha@cavium.com>
Mon, 14 Aug 2017 19:01:31 +0000 (12:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Aug 2017 05:21:39 +0000 (22:21 -0700)
Moving common function wait_for_pending_requests to octeon_network.h

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.h
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cavium/liquidio/octeon_device.h
drivers/net/ethernet/cavium/liquidio/octeon_network.h

index 3f98c7334957ddbe1c12c0c40ec465322fbfe345..2d06097d3f61e1b8cffe0294fd9c2abc3db2ab9a 100644 (file)
@@ -36,8 +36,6 @@ struct octeon_cn23xx_vf {
 
 #define CN23XX_MAILBOX_MSGPARAM_SIZE           6
 
-#define MAX_VF_IP_OP_PENDING_PKT_COUNT         100
-
 void cn23xx_vf_ask_pf_to_do_flr(struct octeon_device *oct);
 
 int cn23xx_octeon_pfvf_handshake(struct octeon_device *oct);
index 8ec0b6d978d2c896d9dbb67a34cb0e0d39b9476e..73b3547bf142c1eb88e2403ea98c82b57686206f 100644 (file)
@@ -275,32 +275,6 @@ static void force_io_queues_off(struct octeon_device *oct)
        }
 }
 
-/**
- * \brief wait for all pending requests to complete
- * @param oct Pointer to Octeon device
- *
- * Called during shutdown sequence
- */
-static int wait_for_pending_requests(struct octeon_device *oct)
-{
-       int i, pcount = 0;
-
-       for (i = 0; i < 100; i++) {
-               pcount =
-                       atomic_read(&oct->response_list
-                               [OCTEON_ORDERED_SC_LIST].pending_req_count);
-               if (pcount)
-                       schedule_timeout_uninterruptible(HZ / 10);
-               else
-                       break;
-       }
-
-       if (pcount)
-               return 1;
-
-       return 0;
-}
-
 /**
  * \brief Cause device to go quiet so it can be safely removed/reset/etc
  * @param oct Pointer to Octeon device
index c6f52f235647b59f7e2f859eea86191c8caadf2c..17623ed1f0faf6ae92dacb76e5a8487884bd7383 100644 (file)
@@ -123,7 +123,7 @@ static int lio_wait_for_oq_pkts(struct octeon_device *oct)
 {
        struct octeon_device_priv *oct_priv =
            (struct octeon_device_priv *)oct->priv;
-       int retry = MAX_VF_IP_OP_PENDING_PKT_COUNT;
+       int retry = MAX_IO_PENDING_PKT_COUNT;
        int pkt_cnt = 0, pending_pkts;
        int i;
 
@@ -147,32 +147,6 @@ static int lio_wait_for_oq_pkts(struct octeon_device *oct)
        return pkt_cnt;
 }
 
-/**
- * \brief wait for all pending requests to complete
- * @param oct Pointer to Octeon device
- *
- * Called during shutdown sequence
- */
-static int wait_for_pending_requests(struct octeon_device *oct)
-{
-       int i, pcount = 0;
-
-       for (i = 0; i < MAX_VF_IP_OP_PENDING_PKT_COUNT; i++) {
-               pcount = atomic_read(
-                   &oct->response_list[OCTEON_ORDERED_SC_LIST]
-                        .pending_req_count);
-               if (pcount)
-                       schedule_timeout_uninterruptible(HZ / 10);
-               else
-                       break;
-       }
-
-       if (pcount)
-               return 1;
-
-       return 0;
-}
-
 /**
  * \brief Cause device to go quiet so it can be safely removed/reset/etc
  * @param oct Pointer to Octeon device
index 2c554729bfe41959fb7b292f5bafab88e9e3e7c0..894af199ddefdd1c7696f228e733552194dbc591 100644 (file)
@@ -571,6 +571,8 @@ struct octeon_device {
 #define CHIP_CONF(oct, TYPE)             \
        (((struct octeon_ ## TYPE  *)((oct)->chip))->conf)
 
+#define MAX_IO_PENDING_PKT_COUNT 100
+
 /*------------------ Function Prototypes ----------------------*/
 
 /** Initialize device list memory */
index ec8504b2942d82caf8537e3ffc092b1a5f8a5e48..043f6e6537316181c410be80973d2d555f06f6c8 100644 (file)
@@ -448,4 +448,30 @@ static inline void ifstate_reset(struct lio *lio, int state_flag)
        atomic_set(&lio->ifstate, (atomic_read(&lio->ifstate) & ~(state_flag)));
 }
 
+/**
+ * \brief wait for all pending requests to complete
+ * @param oct Pointer to Octeon device
+ *
+ * Called during shutdown sequence
+ */
+static inline int wait_for_pending_requests(struct octeon_device *oct)
+{
+       int i, pcount = 0;
+
+       for (i = 0; i < MAX_IO_PENDING_PKT_COUNT; i++) {
+               pcount = atomic_read(
+                   &oct->response_list[OCTEON_ORDERED_SC_LIST]
+                        .pending_req_count);
+               if (pcount)
+                       schedule_timeout_uninterruptible(HZ / 10);
+               else
+                       break;
+       }
+
+       if (pcount)
+               return 1;
+
+       return 0;
+}
+
 #endif