Merge tag 'driver-core-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / linux / hyperv.h
index a01c9fd0a3348ed4559f3924055ef58e3b22026f..3b42264333ef86d6eae3e4a8c1692994cdf6e759 100644 (file)
@@ -230,15 +230,19 @@ static inline u32 hv_get_avail_to_write_percent(
  * two 16 bit quantities: major_number. minor_number.
  *
  * 0 . 13 (Windows Server 2008)
- * 1 . 1  (Windows 7)
- * 2 . 4  (Windows 8)
- * 3 . 0  (Windows 8 R2)
+ * 1 . 1  (Windows 7, WS2008 R2)
+ * 2 . 4  (Windows 8, WS2012)
+ * 3 . 0  (Windows 8.1, WS2012 R2)
  * 4 . 0  (Windows 10)
  * 4 . 1  (Windows 10 RS3)
  * 5 . 0  (Newer Windows 10)
  * 5 . 1  (Windows 10 RS4)
  * 5 . 2  (Windows Server 2019, RS5)
  * 5 . 3  (Windows Server 2022)
+ *
+ * The WS2008 and WIN7 versions are listed here for
+ * completeness but are no longer supported in the
+ * Linux kernel.
  */
 
 #define VERSION_WS2008  ((0 << 16) | (13))
@@ -1064,10 +1068,14 @@ u64 vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id,
                             u64 rqst_addr);
 u64 vmbus_request_addr(struct vmbus_channel *channel, u64 trans_id);
 
+static inline bool is_hvsock_offer(const struct vmbus_channel_offer_channel *o)
+{
+       return !!(o->offer.chn_flags & VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
+}
+
 static inline bool is_hvsock_channel(const struct vmbus_channel *c)
 {
-       return !!(c->offermsg.offer.chn_flags &
-                 VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
+       return is_hvsock_offer(&c->offermsg);
 }
 
 static inline bool is_sub_channel(const struct vmbus_channel *c)
@@ -1284,7 +1292,11 @@ struct hv_device {
        u16 device_id;
 
        struct device device;
-       char *driver_override; /* Driver name to force a match */
+       /*
+        * Driver name to force a match.  Do not set directly, because core
+        * frees it.  Use driver_set_override() to set or clear it.
+        */
+       const char *driver_override;
 
        struct vmbus_channel *channel;
        struct kset          *channels_kset;
@@ -1702,55 +1714,28 @@ static inline u32 hv_pkt_len(const struct vmpacket_descriptor *desc)
        return desc->len8 << 3;
 }
 
-struct vmpacket_descriptor *
-hv_pkt_iter_first_raw(struct vmbus_channel *channel);
-
 struct vmpacket_descriptor *
 hv_pkt_iter_first(struct vmbus_channel *channel);
 
 struct vmpacket_descriptor *
 __hv_pkt_iter_next(struct vmbus_channel *channel,
-                  const struct vmpacket_descriptor *pkt,
-                  bool copy);
+                  const struct vmpacket_descriptor *pkt);
 
 void hv_pkt_iter_close(struct vmbus_channel *channel);
 
 static inline struct vmpacket_descriptor *
-hv_pkt_iter_next_pkt(struct vmbus_channel *channel,
-                    const struct vmpacket_descriptor *pkt,
-                    bool copy)
+hv_pkt_iter_next(struct vmbus_channel *channel,
+                const struct vmpacket_descriptor *pkt)
 {
        struct vmpacket_descriptor *nxt;
 
-       nxt = __hv_pkt_iter_next(channel, pkt, copy);
+       nxt = __hv_pkt_iter_next(channel, pkt);
        if (!nxt)
                hv_pkt_iter_close(channel);
 
        return nxt;
 }
 
-/*
- * Get next packet descriptor without copying it out of the ring buffer
- * If at end of list, return NULL and update host.
- */
-static inline struct vmpacket_descriptor *
-hv_pkt_iter_next_raw(struct vmbus_channel *channel,
-                    const struct vmpacket_descriptor *pkt)
-{
-       return hv_pkt_iter_next_pkt(channel, pkt, false);
-}
-
-/*
- * Get next packet descriptor from iterator
- * If at end of list, return NULL and update host.
- */
-static inline struct vmpacket_descriptor *
-hv_pkt_iter_next(struct vmbus_channel *channel,
-                const struct vmpacket_descriptor *pkt)
-{
-       return hv_pkt_iter_next_pkt(channel, pkt, true);
-}
-
 #define foreach_vmbus_pkt(pkt, channel) \
        for (pkt = hv_pkt_iter_first(channel); pkt; \
            pkt = hv_pkt_iter_next(channel, pkt))