internal.h (2ac5e38ea4203852d6e99edd3cf11f044b0a409f) | internal.h (16e8c4ca21a238cdf0355475bf15bd72e92feb8f) |
---|---|
1/* 2 * Copyright Gavin Shan, IBM Corporation 2016. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 59 unchanged lines hidden (view full) --- 68 NCSI_MODE_MAX 69}; 70 71/* OEM Vendor Manufacture ID */ 72#define NCSI_OEM_MFR_MLX_ID 0x8119 73#define NCSI_OEM_MFR_BCM_ID 0x113d 74/* Broadcom specific OEM Command */ 75#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */ | 1/* 2 * Copyright Gavin Shan, IBM Corporation 2016. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 59 unchanged lines hidden (view full) --- 68 NCSI_MODE_MAX 69}; 70 71/* OEM Vendor Manufacture ID */ 72#define NCSI_OEM_MFR_MLX_ID 0x8119 73#define NCSI_OEM_MFR_BCM_ID 0x113d 74/* Broadcom specific OEM Command */ 75#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */ |
76/* Mellanox specific OEM Command */ 77#define NCSI_OEM_MLX_CMD_GMA 0x00 /* CMD ID for Get MAC */ 78#define NCSI_OEM_MLX_CMD_GMA_PARAM 0x1b /* Parameter for GMA */ |
|
76/* OEM Command payload lengths*/ 77#define NCSI_OEM_BCM_CMD_GMA_LEN 12 | 79/* OEM Command payload lengths*/ 80#define NCSI_OEM_BCM_CMD_GMA_LEN 12 |
81#define NCSI_OEM_MLX_CMD_GMA_LEN 8 |
|
78/* Mac address offset in OEM response */ 79#define BCM_MAC_ADDR_OFFSET 28 | 82/* Mac address offset in OEM response */ 83#define BCM_MAC_ADDR_OFFSET 28 |
84#define MLX_MAC_ADDR_OFFSET 8 |
|
80 81 82struct ncsi_channel_version { 83 u32 version; /* Supported BCD encoded NCSI version */ 84 u32 alpha2; /* Supported BCD encoded NCSI version */ 85 u8 fw_name[12]; /* Firware name string */ 86 u32 fw_version; /* Firmware version */ 87 u16 pci_ids[4]; /* PCI identification */ --- 129 unchanged lines hidden (view full) --- 217struct ncsi_package { 218 unsigned char id; /* NCSI 3-bits package ID */ 219 unsigned char uuid[16]; /* UUID */ 220 struct ncsi_dev_priv *ndp; /* NCSI device */ 221 spinlock_t lock; /* Protect the package */ 222 unsigned int channel_num; /* Number of channels */ 223 struct list_head channels; /* List of chanels */ 224 struct list_head node; /* Form list of packages */ | 85 86 87struct ncsi_channel_version { 88 u32 version; /* Supported BCD encoded NCSI version */ 89 u32 alpha2; /* Supported BCD encoded NCSI version */ 90 u8 fw_name[12]; /* Firware name string */ 91 u32 fw_version; /* Firmware version */ 92 u16 pci_ids[4]; /* PCI identification */ --- 129 unchanged lines hidden (view full) --- 222struct ncsi_package { 223 unsigned char id; /* NCSI 3-bits package ID */ 224 unsigned char uuid[16]; /* UUID */ 225 struct ncsi_dev_priv *ndp; /* NCSI device */ 226 spinlock_t lock; /* Protect the package */ 227 unsigned int channel_num; /* Number of channels */ 228 struct list_head channels; /* List of chanels */ 229 struct list_head node; /* Form list of packages */ |
230 231 bool multi_channel; /* Enable multiple channels */ 232 u32 channel_whitelist; /* Channels to configure */ 233 struct ncsi_channel *preferred_channel; /* Primary channel */ |
|
225}; 226 227struct ncsi_request { 228 unsigned char id; /* Request ID - 0 to 255 */ 229 bool used; /* Request that has been assigned */ 230 unsigned int flags; /* NCSI request property */ 231#define NCSI_REQ_FLAG_EVENT_DRIVEN 1 232#define NCSI_REQ_FLAG_NETLINK_DRIVEN 2 --- 49 unchanged lines hidden (view full) --- 282}; 283 284struct ncsi_dev_priv { 285 struct ncsi_dev ndev; /* Associated NCSI device */ 286 unsigned int flags; /* NCSI device flags */ 287#define NCSI_DEV_PROBED 1 /* Finalized NCSI topology */ 288#define NCSI_DEV_HWA 2 /* Enabled HW arbitration */ 289#define NCSI_DEV_RESHUFFLE 4 | 234}; 235 236struct ncsi_request { 237 unsigned char id; /* Request ID - 0 to 255 */ 238 bool used; /* Request that has been assigned */ 239 unsigned int flags; /* NCSI request property */ 240#define NCSI_REQ_FLAG_EVENT_DRIVEN 1 241#define NCSI_REQ_FLAG_NETLINK_DRIVEN 2 --- 49 unchanged lines hidden (view full) --- 291}; 292 293struct ncsi_dev_priv { 294 struct ncsi_dev ndev; /* Associated NCSI device */ 295 unsigned int flags; /* NCSI device flags */ 296#define NCSI_DEV_PROBED 1 /* Finalized NCSI topology */ 297#define NCSI_DEV_HWA 2 /* Enabled HW arbitration */ 298#define NCSI_DEV_RESHUFFLE 4 |
299#define NCSI_DEV_RESET 8 /* Reset state of NC */ |
|
290 unsigned int gma_flag; /* OEM GMA flag */ 291 spinlock_t lock; /* Protect the NCSI device */ 292#if IS_ENABLED(CONFIG_IPV6) 293 unsigned int inet6_addr_num; /* Number of IPv6 addresses */ 294#endif | 300 unsigned int gma_flag; /* OEM GMA flag */ 301 spinlock_t lock; /* Protect the NCSI device */ 302#if IS_ENABLED(CONFIG_IPV6) 303 unsigned int inet6_addr_num; /* Number of IPv6 addresses */ 304#endif |
305 unsigned int package_probe_id;/* Current ID during probe */ |
|
295 unsigned int package_num; /* Number of packages */ 296 struct list_head packages; /* List of packages */ 297 struct ncsi_channel *hot_channel; /* Channel was ever active */ | 306 unsigned int package_num; /* Number of packages */ 307 struct list_head packages; /* List of packages */ 308 struct ncsi_channel *hot_channel; /* Channel was ever active */ |
298 struct ncsi_package *force_package; /* Force a specific package */ 299 struct ncsi_channel *force_channel; /* Force a specific channel */ | |
300 struct ncsi_request requests[256]; /* Request table */ 301 unsigned int request_id; /* Last used request ID */ 302#define NCSI_REQ_START_IDX 1 303 unsigned int pending_req_num; /* Number of pending requests */ 304 struct ncsi_package *active_package; /* Currently handled package */ 305 struct ncsi_channel *active_channel; /* Currently handled channel */ 306 struct list_head channel_queue; /* Config queue of channels */ 307 struct work_struct work; /* For channel management */ 308 struct packet_type ptype; /* NCSI packet Rx handler */ 309 struct list_head node; /* Form NCSI device list */ 310#define NCSI_MAX_VLAN_VIDS 15 311 struct list_head vlan_vids; /* List of active VLAN IDs */ | 309 struct ncsi_request requests[256]; /* Request table */ 310 unsigned int request_id; /* Last used request ID */ 311#define NCSI_REQ_START_IDX 1 312 unsigned int pending_req_num; /* Number of pending requests */ 313 struct ncsi_package *active_package; /* Currently handled package */ 314 struct ncsi_channel *active_channel; /* Currently handled channel */ 315 struct list_head channel_queue; /* Config queue of channels */ 316 struct work_struct work; /* For channel management */ 317 struct packet_type ptype; /* NCSI packet Rx handler */ 318 struct list_head node; /* Form NCSI device list */ 319#define NCSI_MAX_VLAN_VIDS 15 320 struct list_head vlan_vids; /* List of active VLAN IDs */ |
321 322 bool multi_package; /* Enable multiple packages */ 323 u32 package_whitelist; /* Packages to configure */ |
|
312}; 313 314struct ncsi_cmd_arg { 315 struct ncsi_dev_priv *ndp; /* Associated NCSI device */ 316 unsigned char type; /* Command in the NCSI packet */ 317 unsigned char id; /* Request ID (sequence number) */ 318 unsigned char package; /* Destination package ID */ 319 unsigned char channel; /* Detination channel ID or 0x1f */ --- 16 unchanged lines hidden (view full) --- 336#define NCSI_FOR_EACH_DEV(ndp) \ 337 list_for_each_entry_rcu(ndp, &ncsi_dev_list, node) 338#define NCSI_FOR_EACH_PACKAGE(ndp, np) \ 339 list_for_each_entry_rcu(np, &ndp->packages, node) 340#define NCSI_FOR_EACH_CHANNEL(np, nc) \ 341 list_for_each_entry_rcu(nc, &np->channels, node) 342 343/* Resources */ | 324}; 325 326struct ncsi_cmd_arg { 327 struct ncsi_dev_priv *ndp; /* Associated NCSI device */ 328 unsigned char type; /* Command in the NCSI packet */ 329 unsigned char id; /* Request ID (sequence number) */ 330 unsigned char package; /* Destination package ID */ 331 unsigned char channel; /* Detination channel ID or 0x1f */ --- 16 unchanged lines hidden (view full) --- 348#define NCSI_FOR_EACH_DEV(ndp) \ 349 list_for_each_entry_rcu(ndp, &ncsi_dev_list, node) 350#define NCSI_FOR_EACH_PACKAGE(ndp, np) \ 351 list_for_each_entry_rcu(np, &ndp->packages, node) 352#define NCSI_FOR_EACH_CHANNEL(np, nc) \ 353 list_for_each_entry_rcu(nc, &np->channels, node) 354 355/* Resources */ |
356int ncsi_reset_dev(struct ncsi_dev *nd); |
|
344void ncsi_start_channel_monitor(struct ncsi_channel *nc); 345void ncsi_stop_channel_monitor(struct ncsi_channel *nc); 346struct ncsi_channel *ncsi_find_channel(struct ncsi_package *np, 347 unsigned char id); 348struct ncsi_channel *ncsi_add_channel(struct ncsi_package *np, 349 unsigned char id); 350struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp, 351 unsigned char id); --- 4 unchanged lines hidden (view full) --- 356 unsigned char id, 357 struct ncsi_package **np, 358 struct ncsi_channel **nc); 359struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp, 360 unsigned int req_flags); 361void ncsi_free_request(struct ncsi_request *nr); 362struct ncsi_dev *ncsi_find_dev(struct net_device *dev); 363int ncsi_process_next_channel(struct ncsi_dev_priv *ndp); | 357void ncsi_start_channel_monitor(struct ncsi_channel *nc); 358void ncsi_stop_channel_monitor(struct ncsi_channel *nc); 359struct ncsi_channel *ncsi_find_channel(struct ncsi_package *np, 360 unsigned char id); 361struct ncsi_channel *ncsi_add_channel(struct ncsi_package *np, 362 unsigned char id); 363struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp, 364 unsigned char id); --- 4 unchanged lines hidden (view full) --- 369 unsigned char id, 370 struct ncsi_package **np, 371 struct ncsi_channel **nc); 372struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp, 373 unsigned int req_flags); 374void ncsi_free_request(struct ncsi_request *nr); 375struct ncsi_dev *ncsi_find_dev(struct net_device *dev); 376int ncsi_process_next_channel(struct ncsi_dev_priv *ndp); |
377bool ncsi_channel_has_link(struct ncsi_channel *channel); 378bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp, 379 struct ncsi_channel *channel); 380int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp, 381 struct ncsi_package *np, 382 struct ncsi_channel *disable, 383 struct ncsi_channel *enable); |
|
364 365/* Packet handlers */ 366u32 ncsi_calculate_checksum(unsigned char *data, int len); 367int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca); 368int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev, 369 struct packet_type *pt, struct net_device *orig_dev); 370int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb); 371 372#endif /* __NCSI_INTERNAL_H__ */ | 384 385/* Packet handlers */ 386u32 ncsi_calculate_checksum(unsigned char *data, int len); 387int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca); 388int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev, 389 struct packet_type *pt, struct net_device *orig_dev); 390int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb); 391 392#endif /* __NCSI_INTERNAL_H__ */ |