1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * zfcp device driver 4 * 5 * Definitions for handling diagnostics in the the zfcp device driver. 6 * 7 * Copyright IBM Corp. 2018 8 */ 9 10 #ifndef ZFCP_DIAG_H 11 #define ZFCP_DIAG_H 12 13 #include <linux/spinlock.h> 14 15 #include "zfcp_fsf.h" 16 #include "zfcp_def.h" 17 18 /** 19 * struct zfcp_diag_header - general part of a diagnostic buffer. 20 * @access_lock: lock protecting all the data in this buffer. 21 * @updating: flag showing that an update for this buffer is currently running. 22 * @incomplete: flag showing that the data in @buffer is incomplete. 23 * @timestamp: time in jiffies when the data of this buffer was last captured. 24 * @buffer: implementation-depending data of this buffer 25 * @buffer_size: size of @buffer 26 */ 27 struct zfcp_diag_header { 28 spinlock_t access_lock; 29 30 /* Flags */ 31 u64 updating :1; 32 u64 incomplete :1; 33 34 unsigned long timestamp; 35 36 void *buffer; 37 size_t buffer_size; 38 }; 39 40 /** 41 * struct zfcp_diag_adapter - central storage for all diagnostics concerning an 42 * adapter. 43 * @port_data: data retrieved using exchange port data. 44 * @port_data.header: header with metadata for the cache in @port_data.data. 45 * @port_data.data: cached QTCB Bottom of command exchange port data. 46 */ 47 struct zfcp_diag_adapter { 48 struct { 49 struct zfcp_diag_header header; 50 struct fsf_qtcb_bottom_port data; 51 } port_data; 52 }; 53 54 int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter); 55 void zfcp_diag_adapter_free(struct zfcp_adapter *const adapter); 56 57 void zfcp_diag_update_xdata(struct zfcp_diag_header *const hdr, 58 const void *const data, const bool incomplete); 59 60 #endif /* ZFCP_DIAG_H */ 61