summaryrefslogtreecommitdiff
path: root/net/smc/smc_cdc.h
diff options
context:
space:
mode:
authorStefan Raspl <raspl@linux.ibm.com>2018-05-23 16:38:11 +0200
committerDavid S. Miller <davem@davemloft.net>2018-05-23 16:02:35 -0400
commitde8474eb9d50fd47b8c73816f34739dec5e96754 (patch)
tree4d8c4d02508896fefba4c7172162ebf1b8333798 /net/smc/smc_cdc.h
parentb9f227c37071d1115cec791b328b684e2c4ba414 (diff)
downloadlwn-de8474eb9d50fd47b8c73816f34739dec5e96754.tar.gz
lwn-de8474eb9d50fd47b8c73816f34739dec5e96754.zip
net/smc: urgent data support
Add support for out of band data send and receive. Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_cdc.h')
-rw-r--r--net/smc/smc_cdc.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h
index d2012fd22100..f60082fee5b8 100644
--- a/net/smc/smc_cdc.h
+++ b/net/smc/smc_cdc.h
@@ -146,6 +146,19 @@ static inline int smc_curs_diff(unsigned int size,
return max_t(int, 0, (new->count - old->count));
}
+/* calculate cursor difference between old and new - returns negative
+ * value in case old > new
+ */
+static inline int smc_curs_comp(unsigned int size,
+ union smc_host_cursor *old,
+ union smc_host_cursor *new)
+{
+ if (old->wrap > new->wrap ||
+ (old->wrap == new->wrap && old->count > new->count))
+ return -smc_curs_diff(size, new, old);
+ return smc_curs_diff(size, old, new);
+}
+
static inline void smc_host_cursor_to_cdc(union smc_cdc_cursor *peer,
union smc_host_cursor *local,
struct smc_connection *conn)