Skip to content

Commit bdb2748

Browse files
committed
Merge branch 'be2net'
Sathya Perla says: ==================== be2net: patch set Hi Dave, pls consider applying the following patch-set to the net-next tree. It has 5 code/style cleanup patches and 4 patches that add functionality to the driver. Patch 1 moves routines that were not needed to be in be.h to the respective src files, to avoid unnecessary compilation. Patch 2 replaces (1 << x) with BIT(x) macro Patch 3 refactors code that checks if a FW flash file is compatible with the adapter. The code is now refactored into 2 routines, the first one gets the file type from the image file and the 2nd routine checks if the file type is compatible with the adapter. Patch 4 adds compatibility checks for flashing a FW image on the new Skyhawk P2 HW revision. Patch 5 adds support for a new "offset based" flashing scheme, wherein the driver informs the FW of the offset at which each component in the flash file is to be flashed at. This helps flashing components that were previously not recognized by the running FW. Patch 6 simplifies the be_cmd_rx_filter() routine, by passing to it the filter flags already used in the FW cmd, instead of the netdev flags that were converted to the FW-cmd flags. Patch 7 introduces helper routines in be_set_rx_mode() and be_vid_config() to improve code readability. Patch 8 adds processing of port-misconfig async event sent by the FW. Patch 9 removes unnecessary swapping of a field in the TX desc. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 1fd0bdd + f986afc commit bdb2748

5 files changed

Lines changed: 647 additions & 453 deletions

File tree

‎drivers/net/ethernet/emulex/benet/be.h‎

Lines changed: 20 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,6 @@
5959
#define OC_SUBSYS_DEVICE_ID3 0xE612
6060
#define OC_SUBSYS_DEVICE_ID4 0xE652
6161

62-
static inline char *nic_name(struct pci_dev *pdev)
63-
{
64-
switch (pdev->device) {
65-
case OC_DEVICE_ID1:
66-
return OC_NAME;
67-
case OC_DEVICE_ID2:
68-
return OC_NAME_BE;
69-
case OC_DEVICE_ID3:
70-
case OC_DEVICE_ID4:
71-
return OC_NAME_LANCER;
72-
case BE_DEVICE_ID2:
73-
return BE3_NAME;
74-
case OC_DEVICE_ID5:
75-
case OC_DEVICE_ID6:
76-
return OC_NAME_SH;
77-
default:
78-
return BE_NAME;
79-
}
80-
}
81-
8262
/* Number of bytes of an RX frame that are copied to skb->data */
8363
#define BE_HDR_LEN ((u16) 64)
8464
/* allocate extra space to allow tunneling decapsulation without head reallocation */
@@ -381,15 +361,14 @@ enum vf_state {
381361
ASSIGNED = 1
382362
};
383363

384-
#define BE_FLAGS_LINK_STATUS_INIT 1
385-
#define BE_FLAGS_SRIOV_ENABLED (1 << 2)
386-
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
387-
#define BE_FLAGS_VLAN_PROMISC (1 << 4)
388-
#define BE_FLAGS_MCAST_PROMISC (1 << 5)
389-
#define BE_FLAGS_NAPI_ENABLED (1 << 9)
390-
#define BE_FLAGS_QNQ_ASYNC_EVT_RCVD (1 << 11)
391-
#define BE_FLAGS_VXLAN_OFFLOADS (1 << 12)
392-
#define BE_FLAGS_SETUP_DONE (1 << 13)
364+
#define BE_FLAGS_LINK_STATUS_INIT BIT(1)
365+
#define BE_FLAGS_SRIOV_ENABLED BIT(2)
366+
#define BE_FLAGS_WORKER_SCHEDULED BIT(3)
367+
#define BE_FLAGS_NAPI_ENABLED BIT(6)
368+
#define BE_FLAGS_QNQ_ASYNC_EVT_RCVD BIT(7)
369+
#define BE_FLAGS_VXLAN_OFFLOADS BIT(8)
370+
#define BE_FLAGS_SETUP_DONE BIT(9)
371+
#define BE_FLAGS_EVT_INCOMPATIBLE_SFP BIT(10)
393372

394373
#define BE_UC_PMAC_COUNT 30
395374
#define BE_VF_UC_PMAC_COUNT 2
@@ -399,6 +378,8 @@ enum vf_state {
399378
#define LANCER_DELETE_FW_DUMP 0x2
400379

401380
struct phy_info {
381+
/* From SFF-8472 spec */
382+
#define SFP_VENDOR_NAME_LEN 17
402383
u8 transceiver;
403384
u8 autoneg;
404385
u8 fc_autoneg;
@@ -412,6 +393,8 @@ struct phy_info {
412393
u32 advertising;
413394
u32 supported;
414395
u8 cable_type;
396+
u8 vendor_name[SFP_VENDOR_NAME_LEN];
397+
u8 vendor_pn[SFP_VENDOR_NAME_LEN];
415398
};
416399

417400
struct be_resources {
@@ -469,8 +452,6 @@ struct be_adapter {
469452

470453
struct be_drv_stats drv_stats;
471454
struct be_aic_obj aic_obj[MAX_EVT_QS];
472-
u16 vlans_added;
473-
unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)];
474455
u8 vlan_prio_bmap; /* Available Priority BitMap */
475456
u16 recommended_prio; /* Recommended Priority */
476457
struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */
@@ -486,16 +467,23 @@ struct be_adapter {
486467
/* Ethtool knobs and info */
487468
char fw_ver[FW_VER_LEN];
488469
char fw_on_flash[FW_VER_LEN];
470+
471+
/* IFACE filtering fields */
489472
int if_handle; /* Used to configure filtering */
473+
u32 if_flags; /* Interface filtering flags */
490474
u32 *pmac_id; /* MAC addr handle used by BE card */
475+
u32 uc_macs; /* Count of secondary UC MAC programmed */
476+
unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)];
477+
u16 vlans_added;
478+
491479
u32 beacon_state; /* for set_phys_id */
492480

493481
bool eeh_error;
494482
bool fw_timeout;
495483
bool hw_error;
496484

497485
u32 port_num;
498-
bool promiscuous;
486+
char port_name;
499487
u8 mc_type;
500488
u32 function_mode;
501489
u32 function_caps;
@@ -528,7 +516,6 @@ struct be_adapter {
528516
struct phy_info phy;
529517
u8 wol_cap;
530518
bool wol_en;
531-
u32 uc_macs; /* Count of secondary UC MAC programmed */
532519
u16 asic_rev;
533520
u16 qnq_vid;
534521
u32 msg_enable;
@@ -734,19 +721,6 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb)
734721
return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
735722
}
736723

737-
static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
738-
{
739-
u32 addr;
740-
741-
addr = jhash(adapter->netdev->dev_addr, ETH_ALEN, 0);
742-
743-
mac[5] = (u8)(addr & 0xFF);
744-
mac[4] = (u8)((addr >> 8) & 0xFF);
745-
mac[3] = (u8)((addr >> 16) & 0xFF);
746-
/* Use the OUI from the current MAC address */
747-
memcpy(mac, adapter->netdev->dev_addr, 3);
748-
}
749-
750724
static inline bool be_multi_rxq(const struct be_adapter *adapter)
751725
{
752726
return adapter->num_rx_qs > 1;
@@ -769,129 +743,6 @@ static inline void be_clear_all_error(struct be_adapter *adapter)
769743
adapter->fw_timeout = false;
770744
}
771745

772-
static inline bool be_is_wol_excluded(struct be_adapter *adapter)
773-
{
774-
struct pci_dev *pdev = adapter->pdev;
775-
776-
if (!be_physfn(adapter))
777-
return true;
778-
779-
switch (pdev->subsystem_device) {
780-
case OC_SUBSYS_DEVICE_ID1:
781-
case OC_SUBSYS_DEVICE_ID2:
782-
case OC_SUBSYS_DEVICE_ID3:
783-
case OC_SUBSYS_DEVICE_ID4:
784-
return true;
785-
default:
786-
return false;
787-
}
788-
}
789-
790-
static inline int qnq_async_evt_rcvd(struct be_adapter *adapter)
791-
{
792-
return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD;
793-
}
794-
795-
#ifdef CONFIG_NET_RX_BUSY_POLL
796-
static inline bool be_lock_napi(struct be_eq_obj *eqo)
797-
{
798-
bool status = true;
799-
800-
spin_lock(&eqo->lock); /* BH is already disabled */
801-
if (eqo->state & BE_EQ_LOCKED) {
802-
WARN_ON(eqo->state & BE_EQ_NAPI);
803-
eqo->state |= BE_EQ_NAPI_YIELD;
804-
status = false;
805-
} else {
806-
eqo->state = BE_EQ_NAPI;
807-
}
808-
spin_unlock(&eqo->lock);
809-
return status;
810-
}
811-
812-
static inline void be_unlock_napi(struct be_eq_obj *eqo)
813-
{
814-
spin_lock(&eqo->lock); /* BH is already disabled */
815-
816-
WARN_ON(eqo->state & (BE_EQ_POLL | BE_EQ_NAPI_YIELD));
817-
eqo->state = BE_EQ_IDLE;
818-
819-
spin_unlock(&eqo->lock);
820-
}
821-
822-
static inline bool be_lock_busy_poll(struct be_eq_obj *eqo)
823-
{
824-
bool status = true;
825-
826-
spin_lock_bh(&eqo->lock);
827-
if (eqo->state & BE_EQ_LOCKED) {
828-
eqo->state |= BE_EQ_POLL_YIELD;
829-
status = false;
830-
} else {
831-
eqo->state |= BE_EQ_POLL;
832-
}
833-
spin_unlock_bh(&eqo->lock);
834-
return status;
835-
}
836-
837-
static inline void be_unlock_busy_poll(struct be_eq_obj *eqo)
838-
{
839-
spin_lock_bh(&eqo->lock);
840-
841-
WARN_ON(eqo->state & (BE_EQ_NAPI));
842-
eqo->state = BE_EQ_IDLE;
843-
844-
spin_unlock_bh(&eqo->lock);
845-
}
846-
847-
static inline void be_enable_busy_poll(struct be_eq_obj *eqo)
848-
{
849-
spin_lock_init(&eqo->lock);
850-
eqo->state = BE_EQ_IDLE;
851-
}
852-
853-
static inline void be_disable_busy_poll(struct be_eq_obj *eqo)
854-
{
855-
local_bh_disable();
856-
857-
/* It's enough to just acquire napi lock on the eqo to stop
858-
* be_busy_poll() from processing any queueus.
859-
*/
860-
while (!be_lock_napi(eqo))
861-
mdelay(1);
862-
863-
local_bh_enable();
864-
}
865-
866-
#else /* CONFIG_NET_RX_BUSY_POLL */
867-
868-
static inline bool be_lock_napi(struct be_eq_obj *eqo)
869-
{
870-
return true;
871-
}
872-
873-
static inline void be_unlock_napi(struct be_eq_obj *eqo)
874-
{
875-
}
876-
877-
static inline bool be_lock_busy_poll(struct be_eq_obj *eqo)
878-
{
879-
return false;
880-
}
881-
882-
static inline void be_unlock_busy_poll(struct be_eq_obj *eqo)
883-
{
884-
}
885-
886-
static inline void be_enable_busy_poll(struct be_eq_obj *eqo)
887-
{
888-
}
889-
890-
static inline void be_disable_busy_poll(struct be_eq_obj *eqo)
891-
{
892-
}
893-
#endif /* CONFIG_NET_RX_BUSY_POLL */
894-
895746
void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
896747
u16 num_popped);
897748
void be_link_status_update(struct be_adapter *adapter, u8 link_status);
@@ -900,16 +751,6 @@ int be_load_fw(struct be_adapter *adapter, u8 *func);
900751
bool be_is_wol_supported(struct be_adapter *adapter);
901752
bool be_pause_supported(struct be_adapter *adapter);
902753
u32 be_get_fw_log_level(struct be_adapter *adapter);
903-
904-
static inline int fw_major_num(const char *fw_ver)
905-
{
906-
int fw_major = 0;
907-
908-
sscanf(fw_ver, "%d.", &fw_major);
909-
910-
return fw_major;
911-
}
912-
913754
int be_update_queues(struct be_adapter *adapter);
914755
int be_poll(struct napi_struct *napi, int budget);
915756

0 commit comments

Comments
 (0)