summaryrefslogtreecommitdiffstats
path: root/net/ncsi/internal.h
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-11-15 23:51:59 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-18 00:09:49 -0500
commit8d951a75d022d94a05f5fa74217670a981e8302d (patch)
treed360d9898e404a423779ba2b3ced1a5801515997 /net/ncsi/internal.h
parent2878a2cfe57a5db21844801cf502fe535a3134b2 (diff)
net/ncsi: Configure multi-package, multi-channel modes with failover
This patch extends the ncsi-netlink interface with two new commands and three new attributes to configure multiple packages and/or channels at once, and configure specific failover modes. NCSI_CMD_SET_PACKAGE mask and NCSI_CMD_SET_CHANNEL_MASK set a whitelist of packages or channels allowed to be configured with the NCSI_ATTR_PACKAGE_MASK and NCSI_ATTR_CHANNEL_MASK attributes respectively. If one of these whitelists is set only packages or channels matching the whitelist are considered for the channel queue in ncsi_choose_active_channel(). These commands may also use the NCSI_ATTR_MULTI_FLAG to signal that multiple packages or channels may be configured simultaneously. NCSI hardware arbitration (HWA) must be available in order to enable multi-package mode. Multi-channel mode is always available. If the NCSI_ATTR_CHANNEL_ID attribute is present in the NCSI_CMD_SET_CHANNEL_MASK command the it sets the preferred channel as with the NCSI_CMD_SET_INTERFACE command. The combination of preferred channel and channel whitelist defines a primary channel and the allowed failover channels. If the NCSI_ATTR_MULTI_FLAG attribute is also present then the preferred channel is configured for Tx/Rx and the other channels are enabled only for Rx. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ncsi/internal.h')
-rw-r--r--net/ncsi/internal.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
index bda51cb179fe..9e3642b802c4 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -222,6 +222,10 @@ struct ncsi_package {
222 unsigned int channel_num; /* Number of channels */ 222 unsigned int channel_num; /* Number of channels */
223 struct list_head channels; /* List of chanels */ 223 struct list_head channels; /* List of chanels */
224 struct list_head node; /* Form list of packages */ 224 struct list_head node; /* Form list of packages */
225
226 bool multi_channel; /* Enable multiple channels */
227 u32 channel_whitelist; /* Channels to configure */
228 struct ncsi_channel *preferred_channel; /* Primary channel */
225}; 229};
226 230
227struct ncsi_request { 231struct ncsi_request {
@@ -297,8 +301,6 @@ struct ncsi_dev_priv {
297 unsigned int package_num; /* Number of packages */ 301 unsigned int package_num; /* Number of packages */
298 struct list_head packages; /* List of packages */ 302 struct list_head packages; /* List of packages */
299 struct ncsi_channel *hot_channel; /* Channel was ever active */ 303 struct ncsi_channel *hot_channel; /* Channel was ever active */
300 struct ncsi_package *force_package; /* Force a specific package */
301 struct ncsi_channel *force_channel; /* Force a specific channel */
302 struct ncsi_request requests[256]; /* Request table */ 304 struct ncsi_request requests[256]; /* Request table */
303 unsigned int request_id; /* Last used request ID */ 305 unsigned int request_id; /* Last used request ID */
304#define NCSI_REQ_START_IDX 1 306#define NCSI_REQ_START_IDX 1
@@ -311,6 +313,9 @@ struct ncsi_dev_priv {
311 struct list_head node; /* Form NCSI device list */ 313 struct list_head node; /* Form NCSI device list */
312#define NCSI_MAX_VLAN_VIDS 15 314#define NCSI_MAX_VLAN_VIDS 15
313 struct list_head vlan_vids; /* List of active VLAN IDs */ 315 struct list_head vlan_vids; /* List of active VLAN IDs */
316
317 bool multi_package; /* Enable multiple packages */
318 u32 package_whitelist; /* Packages to configure */
314}; 319};
315 320
316struct ncsi_cmd_arg { 321struct ncsi_cmd_arg {
@@ -364,6 +369,13 @@ struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp,
364void ncsi_free_request(struct ncsi_request *nr); 369void ncsi_free_request(struct ncsi_request *nr);
365struct ncsi_dev *ncsi_find_dev(struct net_device *dev); 370struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
366int ncsi_process_next_channel(struct ncsi_dev_priv *ndp); 371int ncsi_process_next_channel(struct ncsi_dev_priv *ndp);
372bool ncsi_channel_has_link(struct ncsi_channel *channel);
373bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp,
374 struct ncsi_channel *channel);
375int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp,
376 struct ncsi_package *np,
377 struct ncsi_channel *disable,
378 struct ncsi_channel *enable);
367 379
368/* Packet handlers */ 380/* Packet handlers */
369u32 ncsi_calculate_checksum(unsigned char *data, int len); 381u32 ncsi_calculate_checksum(unsigned char *data, int len);