Re: [PATCH net-next v2] be2net: log link status
On 04/22/2015 04:07 PM, Joe Perches wrote: On Wed, 2015-04-22 at 15:43 +0200, Ivan Vecera wrote: The driver unlike other drivers does not log link state changes. Why add all the speed stuff, why not add a query instead? I think it'd be simpler to add a line like: status = be_cmd_link_status_query(adapter, speed, status, 0); before emitting speed/link_status The func be_link_status_update() is also called from be_async_link_state_process() and I'm not sure if it is possible to call be_cmd_link_status_query() from its context. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] be2net: log link status
The driver unlike other drivers does not log link state changes. Cc: Sathya Perla sathya.pe...@emulex.com Cc: Subbu Seetharaman subbu.seethara...@emulex.com Cc: Ajit Khaparde ajit.khapa...@emulex.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index fb0bc3c..e349131 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -662,6 +662,8 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status) netif_carrier_on(netdev); else netif_carrier_off(netdev); + + netdev_info(netdev, Link is %s\n, link_status ? Up : Down); } static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb) -- 2.0.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2] be2net: log link status
The driver unlike other drivers does not log link state changes. v2: added current link speed to log message Cc: Sathya Perla sathya.pe...@emulex.com Cc: Subbu Seetharaman subbu.seethara...@emulex.com Cc: Ajit Khaparde ajit.khapa...@emulex.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/emulex/benet/be.h | 3 ++- drivers/net/ethernet/emulex/benet/be_cmds.c| 3 ++- drivers/net/ethernet/emulex/benet/be_ethtool.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c| 20 +++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 1bf1cdc..f5409d9 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h @@ -796,7 +796,8 @@ static inline void be_clear_all_error(struct be_adapter *adapter) void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped); -void be_link_status_update(struct be_adapter *adapter, u8 link_status); +void be_link_status_update(struct be_adapter *adapter, u8 link_status, + u16 speed); void be_parse_stats(struct be_adapter *adapter); int be_load_fw(struct be_adapter *adapter, u8 *func); bool be_is_wol_supported(struct be_adapter *adapter); diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index fb140fa..60381eb 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c @@ -262,7 +262,8 @@ static void be_async_link_state_process(struct be_adapter *adapter, */ if (adapter-flags BE_FLAGS_LINK_STATUS_INIT) be_link_status_update(adapter, - evt-port_link_status LINK_STATUS_MASK); + evt-port_link_status LINK_STATUS_MASK, + 0); } static void be_async_port_misconfig_event_process(struct be_adapter *adapter, diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index b765c24..831db95 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -611,7 +611,7 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) status = be_cmd_link_status_query(adapter, link_speed, link_status, 0); if (!status) - be_link_status_update(adapter, link_status); + be_link_status_update(adapter, link_status, link_speed); ethtool_cmd_speed_set(ecmd, link_speed); status = be_cmd_get_phy_info(adapter); diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index fb0bc3c..d3bfac9 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -649,7 +649,8 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, return stats; } -void be_link_status_update(struct be_adapter *adapter, u8 link_status) +void be_link_status_update(struct be_adapter *adapter, u8 link_status, + u16 speed) { struct net_device *netdev = adapter-netdev; @@ -658,10 +659,18 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status) adapter-flags |= BE_FLAGS_LINK_STATUS_INIT; } - if (link_status) + if (link_status) { + if (speed) + /* Print speed only when it is known */ + netdev_info(netdev, Link is Up at %d Mbps\n, speed); + else + netdev_info(netdev, Link is Up); + netif_carrier_on(netdev); - else + } else { + netdev_info(netdev, Link is Down\n); netif_carrier_off(netdev); + } } static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb) @@ -3241,6 +3250,7 @@ static int be_open(struct net_device *netdev) struct be_eq_obj *eqo; struct be_rx_obj *rxo; struct be_tx_obj *txo; + u16 speed; u8 link_status; int status, i; @@ -3267,9 +3277,9 @@ static int be_open(struct net_device *netdev) } adapter-flags |= BE_FLAGS_NAPI_ENABLED; - status = be_cmd_link_status_query(adapter, NULL, link_status, 0); + status = be_cmd_link_status_query(adapter, speed, link_status, 0); if (!status) - be_link_status_update(adapter, link_status); + be_link_status_update(adapter, link_status, speed); netif_tx_start_all_queues(netdev); be_roce_dev_open(adapter); -- 2.0.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message
Re: [PATCH net-next v2] be2net: log link status
On 04/23/2015 08:31 AM, Sathya Perla wrote: -Original Message- From: Ivan Vecera [mailto:ivec...@redhat.com] The driver unlike other drivers does not log link state changes. v2: added current link speed to log message Ivan, I disagree with the v2 change. I think your original intention was just to log a message when the link goes up or down asynchronously (i.e., without any user intervention.) After alerting the user, if the user wants to know other link properties like speed, duplex etc then the ethtool cmd needs to be used; there is no need to log a message with those details. Yes, this was my original intention... to see these async link events in the system log. In this case the v1 should be used. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2] be2net: log link status
On 04/23/2015 08:31 AM, Sathya Perla wrote: -Original Message- From: Ivan Vecera [mailto:ivec...@redhat.com] The driver unlike other drivers does not log link state changes. v2: added current link speed to log message Ivan, I disagree with the v2 change. I think your original intention was just to log a message when the link goes up or down asynchronously (i.e., without any user intervention.) After alerting the user, if the user wants to know other link properties like speed, duplex etc then the ethtool cmd needs to be used; there is no need to log a message with those details. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Dave, could we apply the v1 WRT Sathya's comment? Thanks, Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2] be2net: log link status
On 04/28/2015 06:44 PM, David Miller wrote: From: Ivan Vecera ivec...@redhat.com Date: Tue, 28 Apr 2015 16:32:37 +0200 On 04/23/2015 08:31 AM, Sathya Perla wrote: -Original Message- From: Ivan Vecera [mailto:ivec...@redhat.com] The driver unlike other drivers does not log link state changes. v2: added current link speed to log message Ivan, I disagree with the v2 change. I think your original intention was just to log a message when the link goes up or down asynchronously (i.e., without any user intervention.) After alerting the user, if the user wants to know other link properties like speed, duplex etc then the ethtool cmd needs to be used; there is no need to log a message with those details. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Dave, could we apply the v1 WRT Sathya's comment? Patches should be resubmitted freshly when people want me to do something like this. Thanks. OK... will repost v1. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v3] be2net: log link status
The driver unlike other drivers does not log link state changes. It's better for an user when asynchronous link states are logged in the system log. v3: Changes from v2 discarded as not necessary Cc: Sathya Perla sathya.pe...@emulex.com Cc: Subbu Seetharaman subbu.seethara...@emulex.com Cc: Ajit Khaparde ajit.khapa...@emulex.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index fb0bc3c..e349131 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -662,6 +662,8 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status) netif_carrier_on(netdev); else netif_carrier_off(netdev); + + netdev_info(netdev, Link is %s\n, link_status ? Up : Down); } static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb) -- 2.0.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
On 06/10/2015 10:29 PM, Joe Perches wrote: On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: Signed-off-by: Ivan Vecera ivec...@redhat.com There should be some indication a few messages have been deleted in the commit log and a reason why too. diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c [] @@ -965,10 +964,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, /* * Force an immediate * Transmit Schedule */ - printk(KERN_INFO bna: %s %d - TXQ_STARTED\n, - bnad-netdev-name, - txq_id); [] @@ -1057,8 +1051,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) txq_id = tcb-id; clear_bit(BNAD_TXQ_TX_STARTED, tcb-flags); netif_stop_subqueue(bnad-netdev, txq_id); - printk(KERN_INFO bna: %s %d TXQ_STOPPED\n, - bnad-netdev-name, txq_id); etc... I'm sorry I have removed them as logging noise. IMHO it is not necessary to log when .probe() and .remove() are called or when TxQ is started or stopped. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 16/19] bna: get rid of private macros for manipulation with lists
Remove macros for manipulation with struct list_head and replace them with standard ones. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c | 10 +- drivers/net/ethernet/brocade/bna/bna.h | 1 - drivers/net/ethernet/brocade/bna/bna_enet.c | 50 ++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 310 +-- drivers/net/ethernet/brocade/bna/cna.h | 56 - 7 files changed, 130 insertions(+), 308 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cee.c b/drivers/net/ethernet/brocade/bna/bfa_cee.c index cf9f395..95bc8b6 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cee.c +++ b/drivers/net/ethernet/brocade/bna/bfa_cee.c @@ -282,7 +282,6 @@ bfa_nw_cee_attach(struct bfa_cee *cee, struct bfa_ioc *ioc, cee-ioc = ioc; bfa_nw_ioc_mbox_regisr(cee-ioc, BFI_MC_CEE, bfa_cee_isr, cee); - bfa_q_qe_init(cee-ioc_notify); bfa_ioc_notify_init(cee-ioc_notify, bfa_cee_notify, cee); bfa_nw_ioc_notify_register(cee-ioc, cee-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 52fc439..dabbb30 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2163,7 +2163,8 @@ bfa_ioc_mbox_poll(struct bfa_ioc *ioc) /** * Enqueue command to firmware. */ - bfa_q_deq(mod-cmd_q, cmd); + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); bfa_ioc_mbox_send(ioc, cmd-msg, sizeof(cmd-msg)); /** @@ -2184,8 +2185,10 @@ bfa_ioc_mbox_flush(struct bfa_ioc *ioc) struct bfa_ioc_mbox_mod *mod = ioc-mbox_mod; struct bfa_mbox_cmd *cmd; - while (!list_empty(mod-cmd_q)) - bfa_q_deq(mod-cmd_q, cmd); + while (!list_empty(mod-cmd_q)) { + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); + } } /** @@ -3231,7 +3234,6 @@ bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) flash-op_busy = 0; bfa_nw_ioc_mbox_regisr(flash-ioc, BFI_MC_FLASH, bfa_flash_intr, flash); - bfa_q_qe_init(flash-ioc_notify); bfa_ioc_notify_init(flash-ioc_notify, bfa_flash_notify, flash); list_add_tail(flash-ioc_notify.qe, flash-ioc-notify_q); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c b/drivers/net/ethernet/brocade/bna/bfa_msgq.c index c07d5b9..9c5bb24 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_msgq.c +++ b/drivers/net/ethernet/brocade/bna/bfa_msgq.c @@ -66,8 +66,9 @@ cmdq_sm_stopped_entry(struct bfa_msgq_cmdq *cmdq) cmdq-offset = 0; cmdq-bytes_to_copy = 0; while (!list_empty(cmdq-pending_q)) { - bfa_q_deq(cmdq-pending_q, cmdq_ent); - bfa_q_qe_init(cmdq_ent-qe); + cmdq_ent = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); + list_del(cmdq_ent-qe); call_cmdq_ent_cbfn(cmdq_ent, BFA_STATUS_FAILED); } } @@ -242,8 +243,8 @@ bfa_msgq_cmdq_ci_update(struct bfa_msgq_cmdq *cmdq, struct bfi_mbmsg *mb) /* Walk through pending list to see if the command can be posted */ while (!list_empty(cmdq-pending_q)) { - cmd = - (struct bfa_msgq_cmd_entry *)bfa_q_first(cmdq-pending_q); + cmd = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); if (ntohs(cmd-msg_hdr-num_entries) = BFA_MSGQ_FREE_CNT(cmdq)) { list_del(cmd-qe); @@ -615,7 +616,6 @@ bfa_msgq_attach(struct bfa_msgq *msgq, struct bfa_ioc *ioc) bfa_msgq_rspq_attach(msgq-rspq, msgq); bfa_nw_ioc_mbox_regisr(msgq-ioc, BFI_MC_MSGQ, bfa_msgq_isr, msgq); - bfa_q_qe_init(msgq-ioc_notify); bfa_ioc_notify_init(msgq-ioc_notify, bfa_msgq_notify, msgq); bfa_nw_ioc_notify_register(msgq-ioc, msgq-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 4f16ee2..66e6e09 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -283,7 +283,6 @@ void bna_hw_stats_get(struct bna *bna); /* APIs for RxF */ struct bna_mac *bna_cam_mod_mac_get(struct list_head *head); -void bna_cam_mod_mac_put(struct list_head *tail, struct bna_mac *mac); struct bna_mcam_handle *bna_mcam_mod_handle_get(struct bna_mcam_mod *mod); void bna_mcam_mod_handle_put(struct bna_mcam_mod *mcam_mod, struct bna_mcam_handle *handle); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index
[PATCH net-next 17/19] bna: use list_for_each_entry where appropriate
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 5 +- drivers/net/ethernet/brocade/bna/bna.h | 41 -- drivers/net/ethernet/brocade/bna/bna_enet.c | 23 -- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 117 +-- 4 files changed, 37 insertions(+), 149 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index dabbb30..2c74beb 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1091,12 +1091,9 @@ static void bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event) { struct bfa_ioc_notify *notify; - struct list_head*qe; - list_for_each(qe, ioc-notify_q) { - notify = (struct bfa_ioc_notify *)qe; + list_for_each_entry(notify, ioc-notify_q, qe) notify-cbfn(notify-cbarg, event); - } } static void diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 66e6e09..dc845b2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -208,28 +208,24 @@ do { \ #define bna_rx_rid_mask(_bna) ((_bna)-rx_mod.rid_mask) #define bna_tx_from_rid(_bna, _rid, _tx) \ -do { \ - struct bna_tx_mod *__tx_mod = (_bna)-tx_mod;\ - struct bna_tx *__tx;\ - struct list_head *qe; \ - _tx = NULL; \ - list_for_each(qe, __tx_mod-tx_active_q) { \ - __tx = (struct bna_tx *)qe; \ - if (__tx-rid == (_rid)) {\ - (_tx) = __tx; \ - break;\ - } \ - } \ +do { \ + struct bna_tx_mod *__tx_mod = (_bna)-tx_mod; \ + struct bna_tx *__tx;\ + _tx = NULL; \ + list_for_each_entry(__tx, __tx_mod-tx_active_q, qe) { \ + if (__tx-rid == (_rid)) { \ + (_tx) = __tx; \ + break; \ + } \ + } \ } while (0) #define bna_rx_from_rid(_bna, _rid, _rx) \ do { \ struct bna_rx_mod *__rx_mod = (_bna)-rx_mod; \ struct bna_rx *__rx;\ - struct list_head *qe; \ _rx = NULL; \ - list_for_each(qe, __rx_mod-rx_active_q) { \ - __rx = (struct bna_rx *)qe; \ + list_for_each_entry(__rx, __rx_mod-rx_active_q, qe) { \ if (__rx-rid == (_rid)) { \ (_rx) = __rx; \ break; \ @@ -249,15 +245,12 @@ do { \ static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr) { - struct bna_mac *mac = NULL; - struct list_head *qe; - list_for_each(qe, q) { - if (ether_addr_equal(((struct bna_mac *)qe)-addr, addr)) { - mac = (struct bna_mac *)qe; - break; - } - } - return mac; + struct bna_mac *mac; + + list_for_each_entry(mac, q, qe) + if (ether_addr_equal(mac-addr, addr)) + return mac; + return NULL; } #define bna_attr(_bna) ((_bna)-ioceth.attr) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index bd8f2c2..05680e0 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1806,17 +1806,6 @@ bna_ucam_mod_init(struct bna_ucam_mod *ucam_mod, struct bna *bna, static void
[PATCH net-next 12/19] bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag
TX_E_PRIO_CHANGE event is never sent for bna_tx so it doesn't need to be handled. After this change bna_tx-flags cannot contain BNA_TX_F_PRIO_CHANGED flag and it can be also eliminated. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 -- drivers/net/ethernet/brocade/bna/bna_types.h | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 896aa82..54ad169 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -2901,7 +2901,6 @@ enum bna_tx_event { TX_E_FAIL = 3, TX_E_STARTED= 4, TX_E_STOPPED= 5, - TX_E_PRIO_CHANGE= 6, TX_E_CLEANUP_DONE = 7, TX_E_BW_UPDATE = 8, }; @@ -2942,9 +2941,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) /* No-op */ break; - case TX_E_PRIO_CHANGE: - break; - case TX_E_BW_UPDATE: /* No-op */ break; @@ -2965,28 +2961,23 @@ bna_tx_sm_start_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_STOP: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stop_wait); break; case TX_E_FAIL: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stopped); break; case TX_E_STARTED: - if (tx-flags (BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED)) { - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | - BNA_TX_F_BW_UPDATED); + if (tx-flags BNA_TX_F_BW_UPDATED) { + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); } else bfa_fsm_set_state(tx, bna_tx_sm_started); break; - case TX_E_PRIO_CHANGE: - tx-flags |= BNA_TX_F_PRIO_CHANGED; - break; - case TX_E_BW_UPDATE: tx-flags |= BNA_TX_F_BW_UPDATED; break; @@ -3028,7 +3019,6 @@ bna_tx_sm_started(struct bna_tx *tx, enum bna_tx_event event) tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); break; @@ -3061,7 +3051,6 @@ bna_tx_sm_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bna_tx_enet_stop(tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3081,7 +3070,6 @@ bna_tx_sm_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_FAIL: - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3119,7 +3107,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_prio_cleanup_wait); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3147,7 +3134,6 @@ bna_tx_sm_prio_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_failed); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 134abf7..e0e797f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -135,7 +135,6 @@ enum bna_tx_type { enum bna_tx_flags { BNA_TX_F_ENET_STARTED = 1, BNA_TX_F_ENABLED= 2, - BNA_TX_F_PRIO_CHANGED = 4, BNA_TX_F_BW_UPDATED = 8, }; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 04/19] bna: get rid of duplicate and unused macros
replaced macros: BNA_MAC_IS_EQUAL - ether_addr_equal BNA_POWER_OF_2 - is_power_of_2 BNA_TO_POWER_OF_2_HIGH - roundup_pow_of_two removed unused macros: bfa_fsm_get_state bfa_ioc_clr_stats bfa_ioc_fetch_stats bfa_ioc_get_alt_ioc_fwstate bfa_ioc_isr_mode_set bfa_ioc_maxfrsize bfa_ioc_mbox_cmd_pending bfa_ioc_ownership_reset bfa_ioc_rx_bbcredit bfa_ioc_state_disabled bfa_sm_cmp_state bfa_sm_get_state bfa_sm_send_event bfa_sm_set_state bfa_sm_state_decl BFA_STRING_32 BFI_ADAPTER_IS_{PROTO,TTV,UNSUPP) BFI_IOC_ENDIAN_SIG BNA_{C,RX,TX}Q_PAGE_INDEX_MAX BNA_{C,RX,TX}Q_PAGE_INDEX_MAX_SHIFT BNA_{C,RX,TX}Q_QPGE_PTR_GET BNA_IOC_TIMER_FREQ BNA_MESSAGE_SIZE BNA_QE_INDX_2_PTR BNA_QE_INDX_RANGE BNA_Q_GET_{C,P}I BNA_Q_{C,P}I_ADD BNA_Q_FREE_COUNT BNA_Q_IN_USE_COUNT BNA_TO_POWER_OF_2 containing_rec Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 drivers/net/ethernet/brocade/bna/bfa_defs.h | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 14 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 13 --- drivers/net/ethernet/brocade/bna/bfi.h | 8 -- drivers/net/ethernet/brocade/bna/bna.h | 105 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 13 ++- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 4 +- 8 files changed, 9 insertions(+), 163 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cs.h b/drivers/net/ethernet/brocade/bna/bfa_cs.h index af25d8e..1d11d66 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_cs.h @@ -28,19 +28,6 @@ typedef void (*bfa_sm_t)(void *sm, int event); -/* oc - object class eg. bfa_ioc - * st - state, eg. reset - * otype - object type, eg. struct bfa_ioc - * etype - object type, eg. enum ioc_event - */ -#define bfa_sm_state_decl(oc, st, otype, etype)\ - static void oc ## _sm_ ## st(otype * fsm, etype event) - -#define bfa_sm_set_state(_sm, _state) ((_sm)-sm = (bfa_sm_t)(_state)) -#define bfa_sm_send_event(_sm, _event) ((_sm)-sm((_sm), (_event))) -#define bfa_sm_get_state(_sm) ((_sm)-sm) -#define bfa_sm_cmp_state(_sm, _state) ((_sm)-sm == (bfa_sm_t)(_state)) - /* For converting from state machine function to state encoding. */ struct bfa_sm_table { bfa_sm_tsm; /*! state machine function */ @@ -67,7 +54,6 @@ typedef void (*bfa_fsm_t)(void *fsm, int event); } while (0) #define bfa_fsm_send_event(_fsm, _event) ((_fsm)-fsm((_fsm), (_event))) -#define bfa_fsm_get_state(_fsm)((_fsm)-fsm) #define bfa_fsm_cmp_state(_fsm, _state) \ ((_fsm)-fsm == (bfa_fsm_t)(_state)) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 6827d91..d152b3f 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -24,7 +24,6 @@ #include bfa_defs_status.h #include bfa_defs_mfg_comm.h -#define BFA_STRING_32 32 #define BFA_VERSION_LEN 64 /* -- adapter definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 82c95f8..29e0428 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -23,14 +23,6 @@ /* IOC local definitions */ -#define bfa_ioc_state_disabled(__sm) \ - (((__sm) == BFI_IOC_UNINIT) || \ -((__sm) == BFI_IOC_INITING) || \ -((__sm) == BFI_IOC_HWINIT) || \ -((__sm) == BFI_IOC_DISABLED) ||\ -((__sm) == BFI_IOC_FAIL) ||\ -((__sm) == BFI_IOC_CFG_DISABLED)) - /* Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details. */ #define bfa_ioc_firmware_lock(__ioc) \ @@ -57,12 +49,6 @@ ((__ioc)-ioc_hwif-ioc_get_fwstate(__ioc)) #define bfa_ioc_set_alt_ioc_fwstate(__ioc, __fwstate) \ ((__ioc)-ioc_hwif-ioc_set_alt_fwstate(__ioc, __fwstate)) -#define bfa_ioc_get_alt_ioc_fwstate(__ioc) \ - ((__ioc)-ioc_hwif-ioc_get_alt_fwstate(__ioc)) - -#define bfa_ioc_mbox_cmd_pending(__ioc)\ - (!list_empty(((__ioc)-mbox_mod.cmd_q)) || \ - readl((__ioc)-ioc_regs.hfn_mbox_cmd)) static bool bfa_nw_auto_recover = true; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b37bc16..b6ad2c5 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -232,12 +232,6 @@ struct bfa_ioc_hwif { #define bfa_ioc_asic_gen(__ioc)((__ioc)-asic_gen) #define bfa_ioc_is_default(__ioc) \ (bfa_ioc_pcifn(__ioc
[PATCH net-next 05/19] bna: use BIT(x) instead of (1 x)
Signed-off-by: Ivan Vecera ivec...@redhat.com --- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 66 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c| 4 +- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 +++ 6 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 679a503..16090fd 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -75,7 +75,7 @@ enum { CB_GPIO_FC4P2 = (4), /*! 4G 2port FC card */ CB_GPIO_FC4P1 = (5), /*! 4G 1port FC card */ CB_GPIO_DFLY= (6), /*! 8G 2port FC mezzanine card */ - CB_GPIO_PROTO = (1 7) /*! 8G 2port FC prototypes */ + CB_GPIO_PROTO = BIT(7)/*! 8G 2port FC prototypes */ }; #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index 2e72445..4247d8a 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c @@ -24,7 +24,7 @@ #include bfa_defs.h #define bfa_ioc_ct_sync_pos(__ioc) \ - ((u32) (1 bfa_ioc_pcifn(__ioc))) + ((u32)BIT(bfa_ioc_pcifn(__ioc))) #define BFA_IOC_SYNC_REQD_SH 16 #define bfa_ioc_ct_get_sync_ackd(__val) (__val 0x) #define bfa_ioc_ct_clear_sync_ackd(__val) (__val 0x) diff --git a/drivers/net/ethernet/brocade/bna/bfi_enet.h b/drivers/net/ethernet/brocade/bna/bfi_enet.h index fad3a12..d7be7ea8 100644 --- a/drivers/net/ethernet/brocade/bna/bfi_enet.h +++ b/drivers/net/ethernet/brocade/bna/bfi_enet.h @@ -68,13 +68,13 @@ union bfi_addr_be_u { #define BFI_ENET_TXQ_WI_EXTENSION (0x104) /* Extension WI */ /* TxQ Entry Control Flags */ -#define BFI_ENET_TXQ_WI_CF_FCOE_CRC(1 8) -#define BFI_ENET_TXQ_WI_CF_IPID_MODE (1 5) -#define BFI_ENET_TXQ_WI_CF_INS_PRIO(1 4) -#define BFI_ENET_TXQ_WI_CF_INS_VLAN(1 3) -#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM (1 2) -#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM (1 1) -#define BFI_ENET_TXQ_WI_CF_IP_CKSUM(1 0) +#define BFI_ENET_TXQ_WI_CF_FCOE_CRCBIT(8) +#define BFI_ENET_TXQ_WI_CF_IPID_MODE BIT(5) +#define BFI_ENET_TXQ_WI_CF_INS_PRIOBIT(4) +#define BFI_ENET_TXQ_WI_CF_INS_VLANBIT(3) +#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM BIT(2) +#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM BIT(1) +#define BFI_ENET_TXQ_WI_CF_IP_CKSUMBIT(0) struct bfi_enet_txq_wi_base { u8 reserved; @@ -122,32 +122,32 @@ struct bfi_enet_rxq_entry { /* R X C O M P L E T I O N Q U E U E D E F I N E S */ /* CQ Entry Flags */ -#defineBFI_ENET_CQ_EF_MAC_ERROR(1 0) -#defineBFI_ENET_CQ_EF_FCS_ERROR(1 1) -#defineBFI_ENET_CQ_EF_TOO_LONG (1 2) -#defineBFI_ENET_CQ_EF_FC_CRC_OK(1 3) +#define BFI_ENET_CQ_EF_MAC_ERROR BIT(0) +#define BFI_ENET_CQ_EF_FCS_ERROR BIT(1) +#define BFI_ENET_CQ_EF_TOO_LONGBIT(2) +#define BFI_ENET_CQ_EF_FC_CRC_OK BIT(3) -#defineBFI_ENET_CQ_EF_RSVD1(1 4) -#defineBFI_ENET_CQ_EF_L4_CKSUM_OK (1 5) -#defineBFI_ENET_CQ_EF_L3_CKSUM_OK (1 6) -#defineBFI_ENET_CQ_EF_HDS_HEADER (1 7) +#define BFI_ENET_CQ_EF_RSVD1 BIT(4) +#define BFI_ENET_CQ_EF_L4_CKSUM_OK BIT(5) +#define BFI_ENET_CQ_EF_L3_CKSUM_OK BIT(6) +#define BFI_ENET_CQ_EF_HDS_HEADER BIT(7) -#defineBFI_ENET_CQ_EF_UDP (1 8) -#defineBFI_ENET_CQ_EF_TCP (1 9) -#defineBFI_ENET_CQ_EF_IP_OPTIONS (1 10) -#defineBFI_ENET_CQ_EF_IPV6 (1 11) +#define BFI_ENET_CQ_EF_UDP BIT(8) +#define BFI_ENET_CQ_EF_TCP BIT(9) +#define BFI_ENET_CQ_EF_IP_OPTIONS BIT(10) +#define BFI_ENET_CQ_EF_IPV6BIT(11) -#defineBFI_ENET_CQ_EF_IPV4 (1 12) -#defineBFI_ENET_CQ_EF_VLAN (1 13) -#defineBFI_ENET_CQ_EF_RSS (1 14) -#defineBFI_ENET_CQ_EF_RSVD2(1 15) +#define BFI_ENET_CQ_EF_IPV4BIT(12) +#define BFI_ENET_CQ_EF_VLANBIT(13) +#define BFI_ENET_CQ_EF_RSS BIT(14) +#define BFI_ENET_CQ_EF_RSVD2 BIT(15) -#defineBFI_ENET_CQ_EF_MCAST_MATCH (1 16) -#defineBFI_ENET_CQ_EF_MCAST(1 17) -#define BFI_ENET_CQ_EF_BCAST (1 18) -#defineBFI_ENET_CQ_EF_REMOTE (1 19) +#define
[PATCH net-next 06/19] bna: remove unused cbfn parameter
removed: bna_rx_ucast_add bna_rx_ucast_del simplified: bna_enet_pause_config bna_rx_mcast_delall bna_rx_mcast_listset bna_rx_mode_set bna_rx_ucast_listset bna_rx_ucast_set Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 24 + drivers/net/ethernet/brocade/bna/bna_enet.c | 5 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 35 +++-- drivers/net/ethernet/brocade/bna/bnad.c | 18 ++--- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 2 +- 5 files changed, 25 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 130010d..0962e54 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -386,30 +386,19 @@ void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo); void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]); void bna_rx_dim_update(struct bna_ccb *ccb); enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac); enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist); enum bna_cb_status bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac, void (*cbfn)(struct bnad *, struct bna_rx *)); enum bna_cb_status -bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac); void -bna_rx_mcast_delall(struct bna_rx *rx, - void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_delall(struct bna_rx *rx); enum bna_cb_status bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode, - enum bna_rxmode bitmask, - void (*cbfn)(struct bnad *, struct bna_rx *)); + enum bna_rxmode bitmask); void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id); void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id); void bna_rx_vlanfilter_enable(struct bna_rx *rx); @@ -429,8 +418,7 @@ void bna_enet_enable(struct bna_enet *enet); void bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void (*cbfn)(void *)); void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)); + struct bna_pause_config *pause_config); void bna_enet_mtu_set(struct bna_enet *enet, int mtu, void (*cbfn)(struct bnad *)); void bna_enet_perm_mac_get(struct bna_enet *enet, u8 *mac); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index 54902ce..b8de17b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1308,13 +1308,10 @@ bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)) + struct bna_pause_config *pause_config) { enet-pause_config = *pause_config; - enet-pause_cbfn = cbfn; - bfa_fsm_send_event(enet, ENET_E_PAUSE_CFG); } diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 2c85f72..16d36df 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -863,8 +863,7 @@ bna_rxf_fail(struct bna_rxf *rxf) } enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac) { struct bna_rxf *rxf = rx-rxf; @@ -878,7 +877,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; - rxf-cam_fltr_cbfn = cbfn; + rxf-cam_fltr_cbfn = NULL; rxf-cam_fltr_cbarg = rx-bna-bnad; bfa_fsm_send_event(rxf, RXF_E_CONFIG); @@ -917,8 +916,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, } enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_listset(struct bna_rx *rx, int
[PATCH net-next 11/19] bna: remove paused from bna_rx_config and flags from bna_rxf
The bna_rx_config struct member paused can be removed as it is never written and as it cannot have non-zero value the bna_rxf struct member flags also cannot have BNA_RXF_F_PAUSED value and is always zero. So the flags member can be removed as well as bna_rxf_flags enum and the code-paths that needs to have non-zero bna_rxf-flags. This clean-up makes bna_rxf_sm_paused state unsed and can be also removed. --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 36 +--- drivers/net/ethernet/brocade/bna/bna_types.h | 6 - 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index ccf48a1..896aa82 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -59,8 +59,6 @@ static int bna_rxf_allmulti_cfg_reset(struct bna_rxf *rxf, bfa_fsm_state_decl(bna_rxf, stopped, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, paused, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, @@ -79,11 +77,7 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) { switch (event) { case RXF_E_START: - if (rxf-flags BNA_RXF_F_PAUSED) { - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - call_rxf_start_cbfn(rxf); - } else - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); + bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; case RXF_E_STOP: @@ -104,29 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) } static void -bna_rxf_sm_paused_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_STOP: - case RXF_E_FAIL: - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_CONFIG: - call_rxf_cam_fltr_cbfn(rxf); - break; - - default: - bfa_sm_fault(event); - } -} - -static void bna_rxf_sm_cfg_wait_entry(struct bna_rxf *rxf) { if (!bna_rxf_cfg_apply(rxf)) { @@ -679,9 +650,6 @@ bna_rxf_init(struct bna_rxf *rxf, INIT_LIST_HEAD(rxf-mcast_active_q); INIT_LIST_HEAD(rxf-mcast_handle_q); - if (q_config-paused) - rxf-flags |= BNA_RXF_F_PAUSED; - rxf-rit = (u8 *) res_info[BNA_RX_RES_MEM_T_RIT].res_u.mem_info.mdl[0].kva; bna_rit_init(rxf, q_config-num_paths); @@ -742,8 +710,6 @@ bna_rxf_uninit(struct bna_rxf *rxf) rxf-rss_pending = 0; rxf-vlan_strip_pending = false; - rxf-flags = 0; - rxf-rx = NULL; } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index e56f650..134abf7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -182,10 +182,6 @@ enum bna_rx_mod_flags { BNA_RX_MOD_F_ENET_LOOPBACK = 2, }; -enum bna_rxf_flags { - BNA_RXF_F_PAUSED= 1, -}; - enum bna_rxf_event { RXF_E_START = 1, RXF_E_STOP = 2, @@ -668,7 +664,6 @@ struct bna_rx_config { enum bna_rx_type rx_type; int num_paths; enum bna_rxp_type rxp_type; - int paused; int coalescing_timeo; /* * Small/Large (or Header/Data) buffer size to be configured @@ -713,7 +708,6 @@ struct bna_rxp { /* RxF structure (hardware Rx Function) */ struct bna_rxf { bfa_fsm_t fsm; - enum bna_rxf_flags flags; struct bfa_msgq_cmd_entry msgq_cmd; union { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 09/19] bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 13 - drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 16 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 27f75d7..471e74d 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -3000,16 +3000,6 @@ do { \ } \ } while (0) -#define call_tx_prio_change_cbfn(tx) \ -do { \ - if ((tx)-prio_change_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_tx *); \ - cbfn = (tx)-prio_change_cbfn; \ - (tx)-prio_change_cbfn = NULL; \ - cbfn((tx)-bna-bnad, (tx));\ - } \ -} while (0) - static void bna_tx_mod_cb_tx_stopped(void *tx_mod, struct bna_tx *tx); static void bna_bfi_tx_enet_start(struct bna_tx *tx); static void bna_tx_enet_stop(struct bna_tx *tx); @@ -3062,7 +3052,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) break; case TX_E_PRIO_CHANGE: - call_tx_prio_change_cbfn(tx); break; case TX_E_BW_UPDATE: @@ -3232,7 +3221,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) case TX_E_FAIL: bfa_fsm_set_state(tx, bna_tx_sm_failed); - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; @@ -3253,7 +3241,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) static void bna_tx_sm_prio_cleanup_wait_entry(struct bna_tx *tx) { - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 96a02f2..095bd63 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -495,9 +495,6 @@ struct bna_tx { void (*stop_cbfn)(void *arg, struct bna_tx *tx); void*stop_cbarg; - /* callback for bna_tx_prio_set() */ - void (*prio_change_cbfn)(struct bnad *bnad, struct bna_tx *tx); - struct bfa_msgq_cmd_entry msgq_cmd; union { struct bfi_enet_tx_cfg_req cfg_req; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 01/19] bna: use ether_addr_copy instead of memcpy
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 12 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 14 ++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 8ab3a5f..30d5e7f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -876,7 +876,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, bfa_q_qe_init(rxf-ucast_pending_mac-qe); } - memcpy(rxf-ucast_pending_mac-addr, ucmac, ETH_ALEN); + ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; rxf-cam_fltr_cbfn = cbfn; rxf-cam_fltr_cbarg = rx-bna-bnad; @@ -905,7 +905,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, if (mac == NULL) return BNA_CB_MCAST_LIST_FULL; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, addr, ETH_ALEN); + ether_addr_copy(mac-addr, addr); list_add_tail(mac-qe, rxf-mcast_pending_add_q); rxf-cam_fltr_cbfn = cbfn; @@ -955,7 +955,7 @@ bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; } @@ -1026,7 +1026,7 @@ bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; @@ -1149,8 +1149,8 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf) /* Set default unicast MAC */ if (rxf-ucast_pending_set) { rxf-ucast_pending_set = 0; - memcpy(rxf-ucast_active_mac.addr, - rxf-ucast_pending_mac-addr, ETH_ALEN); + ether_addr_copy(rxf-ucast_active_mac.addr, + rxf-ucast_pending_mac-addr); rxf-ucast_active_set = 1; bna_bfi_ucast_req(rxf, rxf-ucast_active_mac, BFI_ENET_H2I_MAC_UCAST_SET_REQ); diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index caae6cb..bb87c11 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -875,9 +875,9 @@ bnad_set_netdev_perm_addr(struct bnad *bnad) { struct net_device *netdev = bnad-netdev; - memcpy(netdev-perm_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-perm_addr, bnad-perm_addr.mac); if (is_zero_ether_addr(netdev-dev_addr)) - memcpy(netdev-dev_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-dev_addr, bnad-perm_addr.mac); } /* Control Path Handlers */ @@ -1862,8 +1862,7 @@ bnad_netdev_mc_list_get(struct net_device *netdev, u8 *mc_list) struct netdev_hw_addr *mc_addr; netdev_for_each_mc_addr(mc_addr, netdev) { - memcpy(mc_list[i * ETH_ALEN], mc_addr-addr[0], - ETH_ALEN); + ether_addr_copy(mc_list[i * ETH_ALEN], mc_addr-addr[0]); i++; } } @@ -3141,8 +3140,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad) entry = 0; netdev_for_each_uc_addr(ha, netdev) { - memcpy(mac_list[entry * ETH_ALEN], - ha-addr[0], ETH_ALEN); + ether_addr_copy(mac_list[entry * ETH_ALEN], ha-addr[0]); entry++; } @@ -3183,7 +3181,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad) if (mac_list == NULL) goto mode_allmulti; - memcpy(mac_list[0], bnad_bcast_addr[0], ETH_ALEN); + ether_addr_copy(mac_list[0], bnad_bcast_addr[0]); /* copy rest of the MCAST addresses */ bnad_netdev_mc_list_get(netdev, mac_list); @@ -3260,7 +3258,7 @@ bnad_set_mac_address(struct net_device *netdev, void *mac_addr) err = bnad_mac_addr_set_locked(bnad, sa-sa_data); if (!err) - memcpy(netdev-dev_addr, sa-sa_data, netdev-addr_len); + ether_addr_copy(netdev-dev_addr, sa-sa_data); spin_unlock_irqrestore(bnad-bna_lock, flags); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 10/19] bna: remove RXF_E_PAUSE and RXF_E_RESUME events
RXF_E_PAUSE RXF_E_RESUME events are never sent for bna_rxf object so they needn't to be handled. The bna_rxf's state bna_rxf_sm_fltr_clr_wait and function bna_rxf_fltr_clear are unused after this so remove them also. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 75 drivers/net/ethernet/brocade/bna/bna_types.h | 2 - 2 files changed, 77 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 471e74d..ccf48a1 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -46,7 +46,6 @@ do { \ static int bna_rxf_cfg_apply(struct bna_rxf *rxf); static void bna_rxf_cfg_reset(struct bna_rxf *rxf); -static int bna_rxf_fltr_clear(struct bna_rxf *rxf); static int bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_promisc_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_allmulti_cfg_apply(struct bna_rxf *rxf); @@ -66,8 +65,6 @@ bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, fltr_clr_wait, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, last_resp_wait, struct bna_rxf, enum bna_rxf_event); @@ -101,14 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - break; - - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - break; - default: bfa_sm_fault(event); } @@ -132,11 +121,6 @@ bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); - break; - default: bfa_sm_fault(event); } @@ -170,12 +154,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) /* No-op */ break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_start_cbfn(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - case RXF_E_FW_RESP: if (!bna_rxf_cfg_apply(rxf)) { /* No more pending config updates */ @@ -209,40 +187,6 @@ bna_rxf_sm_started(struct bna_rxf *rxf, enum bna_rxf_event event) bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - if (!bna_rxf_fltr_clear(rxf)) - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - else - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - - default: - bfa_sm_fault(event); - } -} - -static void -bna_rxf_sm_fltr_clr_wait_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_FAIL: - bna_rxf_cfg_reset(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_FW_RESP: - if (!bna_rxf_fltr_clear(rxf)) { - /* No more pending CAM entries to clear */ - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - } - break; - default: bfa_sm_fault(event); } @@ -652,25 +596,6 @@ bna_rxf_cfg_apply(struct bna_rxf *rxf) return 0; } -/* Only software reset */ -static int -bna_rxf_fltr_clear(struct bna_rxf *rxf) -{ - if (bna_rxf_ucast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_mcast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_promisc_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_allmulti_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - return 0; -} - static void bna_rxf_cfg_reset(struct bna_rxf *rxf) { diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 095bd63..e56f650 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -191,8 +191,6 @@ enum bna_rxf_event { RXF_E_STOP = 2, RXF_E_FAIL = 3
[PATCH net-next 08/19] bna: remove oper_state_cbfn from struct bna_rxf
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 15 --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 6 -- drivers/net/ethernet/brocade/bna/bna_types.h | 4 3 files changed, 25 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 0962e54..4f16ee2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -119,21 +119,6 @@ do { \ } \ } while (0) -#definecall_rxf_pause_cbfn(rxf) \ -do { \ - if ((rxf)-oper_state_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_rx *); \ - struct bnad *cbarg; \ - cbfn = (rxf)-oper_state_cbfn; \ - cbarg = (rxf)-oper_state_cbarg;\ - (rxf)-oper_state_cbfn = NULL; \ - (rxf)-oper_state_cbarg = NULL; \ - cbfn(cbarg, rxf-rx); \ - } \ -} while (0) - -#definecall_rxf_resume_cbfn(rxf) call_rxf_pause_cbfn(rxf) - #define is_xxx_enable(mode, bitmask, xxx) ((bitmask xxx) (mode xxx)) #define is_xxx_disable(mode, bitmask, xxx) ((bitmask xxx) !(mode xxx)) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 16d36df..27f75d7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -103,12 +103,10 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) case RXF_E_PAUSE: rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_pause_cbfn(rxf); break; case RXF_E_RESUME: rxf-flags = ~BNA_RXF_F_PAUSED; - call_rxf_resume_cbfn(rxf); break; default: @@ -119,7 +117,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) static void bna_rxf_sm_paused_entry(struct bna_rxf *rxf) { - call_rxf_pause_cbfn(rxf); } static void @@ -166,7 +163,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) bna_rxf_cfg_reset(rxf); call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; @@ -197,7 +193,6 @@ bna_rxf_sm_started_entry(struct bna_rxf *rxf) { call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); } static void @@ -238,7 +233,6 @@ bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) switch (event) { case RXF_E_FAIL: bna_rxf_cfg_reset(rxf); - call_rxf_pause_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index a50ee99..96a02f2 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -739,10 +739,6 @@ struct bna_rxf { void (*stop_cbfn) (struct bna_rx *rx); struct bna_rx *stop_cbarg; - /* callback for bna_rx_receive_pause() / bna_rx_receive_resume() */ - void (*oper_state_cbfn) (struct bnad *bnad, struct bna_rx *rx); - struct bnad *oper_state_cbarg; - /** * callback for: * bna_rxf_ucast_set() -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 02/19] bna: get rid of mac_t
The patch converts mac_t type to widely used 'u8 [ETH_ALEN]'. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h | 4 ++-- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 2 +- drivers/net/ethernet/brocade/bna/bfi.h | 6 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h | 6 +++--- drivers/net/ethernet/brocade/bna/bna.h | 4 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c | 4 ++-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 4 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 10 +- drivers/net/ethernet/brocade/bna/bnad.h | 2 +- drivers/net/ethernet/brocade/bna/cna.h | 6 -- 12 files changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 3bfd9da..f55887b 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -55,7 +55,7 @@ struct bfa_adapter_attr { charoptrom_ver[BFA_VERSION_LEN]; charos_type[BFA_ADAPTER_OS_TYPE_LEN]; struct bfa_mfg_vpd vpd; - struct mac mac; + u8 mac[ETH_ALEN]; u8 nports; u8 max_speed; @@ -211,7 +211,7 @@ struct bfa_mfg_block { charsupplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)]; charsupplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)]; charsupplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)]; - mac_t mfg_mac;/* base mac address */ + u8 mfg_mac[ETH_ALEN]; /* base mac address */ u8 num_mac;/* number of mac addresses */ u8 rsv2; u32 card_type; /* card type */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index a37326d..ce0b228 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -188,7 +188,7 @@ struct bfa_cee_attr { u8 error_reason; struct bfa_cee_lldp_cfg lldp_remote; struct bfa_cee_dcbx_cfg dcbx_remote; - mac_t src_mac; + u8 src_mac[ETH_ALEN]; u8 link_speed; u8 nw_priority; u8 filler[2]; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 68f3c13..82c95f8 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2796,7 +2796,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc *ioc, ad_attr-prototype = 0; ad_attr-pwwn = bfa_ioc_get_pwwn(ioc); - ad_attr-mac = bfa_nw_ioc_get_mac(ioc); + bfa_nw_ioc_get_mac(ioc, ad_attr-mac); ad_attr-pcie_gen = ioc_attr-pcie_gen; ad_attr-pcie_lanes = ioc_attr-pcie_lanes; @@ -2942,10 +2942,10 @@ bfa_ioc_get_pwwn(struct bfa_ioc *ioc) return ioc-attr-pwwn; } -mac_t -bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) +void +bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac) { - return ioc-attr-mac; + ether_addr_copy(mac, ioc-attr-mac); } /* Firmware failure detected. Start recovery actions. */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index effb715..b37bc16 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -309,7 +309,7 @@ void bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); bool bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); -mac_t bfa_nw_ioc_get_mac(struct bfa_ioc *ioc); +void bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac); void bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave); int bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen); int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 2bcde40..63645ac 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -189,14 +189,14 @@ struct bfi_ioc_getattr_req { struct bfi_ioc_attr { u64 mfg_pwwn; /*! Mfg port wwn */ u64 mfg_nwwn; /*! Mfg node wwn */ - mac_t mfg_mac;/*! Mfg mac */ + u8 mfg_mac[ETH_ALEN]; /*! Mfg mac*/ u8 port_mode; /* enum bfi_port_mode */ u8 rsvd_a; u64 pwwn; u64 nwwn; - mac_t mac;/*! PBC or Mfg mac
[PATCH net-next 13/19] bna: correct comparisons/assignments to bool
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 29e0428..52fc439 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1373,7 +1373,7 @@ static enum bfi_ioc_img_ver_cmp bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, struct bfi_ioc_image_hdr *fwhdr_to_cmp) { - if (bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp) == false) + if (!bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp)) return BFI_IOC_IMG_VER_INCOMP; if (fwhdr_to_cmp-fwver.patch base_fwhdr-fwver.patch) @@ -1384,7 +1384,7 @@ bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, /* GA takes priority over internal builds of the same patch stream. * At this point major minor maint and patch numbers are same. */ - if (fwhdr_is_ga(base_fwhdr) == true) + if (fwhdr_is_ga(base_fwhdr)) if (fwhdr_is_ga(fwhdr_to_cmp)) return BFI_IOC_IMG_VER_SAME; else @@ -2209,7 +2209,7 @@ bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 soff, u32 sz) /* * Hold semaphore to serialize pll init and fwtrc. */ - if (bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg) == 0) + if (!bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg)) return 1; writel(pgnum, ioc-ioc_regs.host_page_num_fn); @@ -2264,7 +2264,7 @@ bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc) int tlen; if (ioc-dbg_fwsave_once) { - ioc-dbg_fwsave_once = 0; + ioc-dbg_fwsave_once = false; if (ioc-dbg_fwsave_len) { tlen = ioc-dbg_fwsave_len; bfa_nw_ioc_debug_fwtrc(ioc, ioc-dbg_fwsave, tlen); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 00/19] bna: clean-up
The patches clean the bna driver. Ivan Vecera (19): bna: use ether_addr_copy instead of memcpy bna: get rid of mac_t bna: replace pragma(pack) with attribute __packed bna: get rid of duplicate and unused macros bna: use BIT(x) instead of (1 x) bna: remove unused cbfn parameter bna: remove pause_cbfn from struct bna_enet bna: remove oper_state_cbfn from struct bna_rxf bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx bna: remove RXF_E_PAUSE and RXF_E_RESUME events bna: remove paused from bna_rx_config and flags from bna_rxf bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag bna: correct comparisons/assignments to bool bna: use memdup_user to copy userspace buffers bna: remove useless pointer assignment bna: get rid of private macros for manipulation with lists bna: use list_for_each_entry where appropriate bna: fix timeout API argument type bna: use netdev_* and dev_* instead of printk and pr_* drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 - drivers/net/ethernet/brocade/bna/bfa_defs.h| 11 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 16 +- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 8 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 61 +- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 23 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c| 10 +- drivers/net/ethernet/brocade/bna/bfi.h | 84 ++- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 176 +++--- drivers/net/ethernet/brocade/bna/bna.h | 186 +- drivers/net/ethernet/brocade/bna/bna_enet.c| 101 +--- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 665 + drivers/net/ethernet/brocade/bna/bna_types.h | 19 - drivers/net/ethernet/brocade/bna/bnad.c| 93 ++- drivers/net/ethernet/brocade/bna/bnad.h| 2 +- drivers/net/ethernet/brocade/bna/bnad_debugfs.c| 61 +- drivers/net/ethernet/brocade/bna/bnad_ethtool.c| 15 +- drivers/net/ethernet/brocade/bna/cna.h | 62 -- drivers/net/ethernet/brocade/bna/cna_fwimg.c | 2 +- 23 files changed, 487 insertions(+), 1225 deletions(-) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 03/19] bna: replace pragma(pack) with attribute __packed
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h| 6 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 14 +-- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 6 +- drivers/net/ethernet/brocade/bna/bfi.h | 70 +++--- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h| 104 ++--- 6 files changed, 103 insertions(+), 127 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index f55887b..6827d91 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -187,8 +187,6 @@ enum { #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE20 #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 -#pragma pack(1) - /* BFA adapter manufacturing block definition. * * All numerical fields are in big-endian format. @@ -227,9 +225,7 @@ struct bfa_mfg_block { charinitial_mode[8]; /* initial mode: hba/cna/nic */ u8 rsv4[84]; u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /* md5 checksum */ -}; - -#pragma pack() +} __packed; /* -- pci definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index ce0b228..f048887 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -109,8 +109,6 @@ union bfa_port_stats_u { struct bfa_port_eth_stats eth; }; -#pragma pack(1) - #define BFA_CEE_LLDP_MAX_STRING_LEN (128) #define BFA_CEE_DCBX_MAX_PRIORITY (8) #define BFA_CEE_DCBX_MAX_PGID (8) @@ -133,7 +131,7 @@ struct bfa_cee_lldp_str { u8 len; u8 rsvd[2]; u8 value[BFA_CEE_LLDP_MAX_STRING_LEN]; -}; +} __packed; /* LLDP parameters */ struct bfa_cee_lldp_cfg { @@ -145,7 +143,7 @@ struct bfa_cee_lldp_cfg { struct bfa_cee_lldp_str mgmt_addr; u16 time_to_live; u16 enabled_system_cap; -}; +} __packed; enum bfa_cee_dcbx_version { DCBX_PROTOCOL_PRECEE= 1, @@ -171,7 +169,7 @@ struct bfa_cee_dcbx_cfg { u8 lls_fcoe; /* FCoE Logical Link Status */ u8 lls_lan; /* LAN Logical Link Status */ u8 rsvd[2]; -}; +} __packed; /* CEE status */ /* Making this to tri-state for the benefit of port list command */ @@ -192,7 +190,7 @@ struct bfa_cee_attr { u8 link_speed; u8 nw_priority; u8 filler[2]; -}; +} __packed; /* LLDP/DCBX/CEE Statistics */ struct bfa_cee_stats { @@ -214,8 +212,6 @@ struct bfa_cee_stats { u32 cee_status_up; /*! CEE status up */ u32 cee_hw_cfg_changed; /*! CEE hw cfg changed */ u32 cee_rx_invalid_cfg; /*! CEE invalid cfg */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_CNA_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 7a45cd0..679a503 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -59,8 +59,6 @@ enum { BFA_MFG_TYPE_INVALID = 0,/*! Invalid card type */ }; -#pragma pack(1) - /* Check if Mezz card */ #define bfa_mfg_is_mezz(type) (( \ (type) == BFA_MFG_TYPE_JAYHAWK || \ @@ -148,8 +146,6 @@ struct bfa_mfg_vpd { u8 len;/*! vpd data length excluding header */ u8 rsv; u8 data[BFA_MFG_VPD_LEN]; /*! vpd data */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_MFG_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 63645ac..3e97077 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -21,8 +21,6 @@ #include bfa_defs.h -#pragma pack(1) - /* BFI FW image type */ #defineBFI_FLASH_CHUNK_SZ 256 /*! Flash chunk size */ #defineBFI_FLASH_CHUNK_SZ_WORDS(BFI_FLASH_CHUNK_SZ/sizeof(u32)) @@ -36,10 +34,10 @@ struct bfi_mhdr { struct { u8 qid; u8 fn_lpu; /*! msg destination*/ - } h2i; + } __packed h2i; u16 i2htok; /*! token in msgs to host */ - } mtag; -}; + } __packed mtag; +} __packed; #define bfi_fn_lpu(__fn, __lpu)((__fn) 1 | (__lpu)) #define bfi_mhdr_2_fn(_mh) ((_mh)-mtag.h2i.fn_lpu 1) @@ -75,14 +73,14 @@ union bfi_addr_u { struct { u32 addr_lo; u32 addr_hi; - } a32; -}; + } __packed a32; +} __packed; /* Generic DMA addr-len pair. */ struct bfi_alen { union bfi_addr_ual_addr;/* DMA
[PATCH net-next 07/19] bna: remove pause_cbfn from struct bna_enet
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_enet.c | 15 --- drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 18 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index b8de17b..dc9f73b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -884,16 +884,6 @@ do { \ } \ } while (0) -#define call_enet_pause_cbfn(enet) \ -do { \ - if ((enet)-pause_cbfn) { \ - void (*cbfn)(struct bnad *);\ - cbfn = (enet)-pause_cbfn; \ - (enet)-pause_cbfn = NULL; \ - cbfn((enet)-bna-bnad);\ - } \ -} while (0) - #define call_enet_mtu_cbfn(enet) \ do { \ if ((enet)-mtu_cbfn) { \ @@ -925,7 +915,6 @@ bfa_fsm_state_decl(bna_enet, chld_stop_wait, struct bna_enet, static void bna_enet_sm_stopped_entry(struct bna_enet *enet) { - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); call_enet_stop_cbfn(enet); } @@ -947,7 +936,6 @@ bna_enet_sm_stopped(struct bna_enet *enet, enum bna_enet_event event) break; case ENET_E_PAUSE_CFG: - call_enet_pause_cbfn(enet); break; case ENET_E_MTU_CFG: @@ -1039,7 +1027,6 @@ bna_enet_sm_started_entry(struct bna_enet *enet) * NOTE: Do not call bna_enet_chld_start() here, since it will be * inadvertently called during cfg_wait-started transition as well */ - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); } @@ -1211,8 +1198,6 @@ bna_enet_init(struct bna_enet *enet, struct bna *bna) enet-stop_cbfn = NULL; enet-stop_cbarg = NULL; - enet-pause_cbfn = NULL; - enet-mtu_cbfn = NULL; bfa_fsm_set_state(enet, bna_enet_sm_stopped); diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index d0a7a56..a50ee99 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -362,9 +362,6 @@ struct bna_enet { void (*stop_cbfn)(void *); void*stop_cbarg; - /* Callback for bna_enet_pause_config() */ - void (*pause_cbfn)(struct bnad *); - /* Callback for bna_enet_mtu_set() */ void (*mtu_cbfn)(struct bnad *); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 46 + drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 34 -- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 9 ++--- drivers/net/ethernet/brocade/bna/cna_fwimg.c| 2 +- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ddda6f1..d9e0f81 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -945,8 +945,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, if (link_up) { if (!netif_carrier_ok(bnad-netdev)) { uint tx_id, tcb_id; - printk(KERN_WARNING bna: %s link up\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link up\n); netif_carrier_on(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); for (tx_id = 0; tx_id bnad-num_tx; tx_id++) { @@ -965,10 +964,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, /* * Force an immediate * Transmit Schedule */ - printk(KERN_INFO bna: %s %d - TXQ_STARTED\n, - bnad-netdev-name, - txq_id); netif_wake_subqueue( bnad-netdev, txq_id); @@ -986,8 +981,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, } } else { if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_WARNING bna: %s link down\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link down\n); netif_carrier_off(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); } @@ -1057,8 +1051,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) txq_id = tcb-id; clear_bit(BNAD_TXQ_TX_STARTED, tcb-flags); netif_stop_subqueue(bnad-netdev, txq_id); - printk(KERN_INFO bna: %s %d TXQ_STOPPED\n, - bnad-netdev-name, txq_id); } } @@ -1081,8 +1073,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) BUG_ON(*(tcb-hw_consumer_index) != 0); if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_INFO bna: %s %d TXQ_STARTED\n, - bnad-netdev-name, txq_id); netif_wake_subqueue(bnad-netdev, txq_id); BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); } @@ -2135,7 +2125,7 @@ bnad_reinit_rx(struct bnad *bnad) current_err = bnad_setup_rx(bnad, rx_id); if (current_err !err) { err = current_err; - pr_err(RXQ:%u setup failed\n, rx_id); + netdev_err(netdev, RXQ:%u setup failed\n, rx_id); } } @@ -2671,8 +2661,9 @@ bnad_enable_msix(struct bnad *bnad) if (ret 0) { goto intx_mode; } else if (ret bnad-msix_num) { - pr_warn(BNA: %d MSI-X vectors allocated %d requested\n, - ret, bnad-msix_num); + dev_warn(bnad-pcidev-dev, +%d MSI-X vectors allocated %d requested\n, +ret, bnad-msix_num); spin_lock_irqsave(bnad-bna_lock, flags); /* ret = #of vectors that we got */ @@ -2694,7 +2685,8 @@ bnad_enable_msix(struct bnad *bnad) return; intx_mode: - pr_warn(BNA: MSI-X enable failed - operating in INTx mode\n); + dev_warn(bnad-pcidev-dev, +MSI-X enable failed - operating in INTx mode\n); kfree(bnad-msix_table); bnad-msix_table = NULL; @@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad, dev_err(pdev-dev, ioremap for bar0 failed\n); return -ENOMEM; } - pr_info(bar0 mapped to %p, len %llu\n, bnad-bar0, - (unsigned long long) bnad-mmio_len); + dev_info(pdev-dev, bar0 mapped to %p, len %llu\n, bnad-bar0, +(unsigned long long) bnad-mmio_len); spin_lock_irqsave(bnad-bna_lock, flags); if (!bnad_msix_disable) @@ -3604,13 +3596,10 @@ bnad_pci_probe(struct pci_dev *pdev, struct bfa_pcidev pcidev_info
[PATCH net-next 18/19] bna: fix timeout API argument type
Timeout functions are defined with 'void *' ptr argument. They should be defined directly with 'struct bfa_ioc *' type to avoid type conversions. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 16 +--- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 8 drivers/net/ethernet/brocade/bna/bnad.c| 8 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 2c74beb..b009fd7 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1895,10 +1895,8 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) } void -bfa_nw_ioc_timeout(void *ioc_arg) +bfa_nw_ioc_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_fsm_send_event(ioc, IOC_E_TIMEOUT); } @@ -1963,10 +1961,9 @@ bfa_ioc_send_getattr(struct bfa_ioc *ioc) } void -bfa_nw_ioc_hb_check(void *cbarg) +bfa_nw_ioc_hb_check(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = cbarg; - u32 hb_count; + u32 hb_count; hb_count = readl(ioc-ioc_regs.heartbeat); if (ioc-hb_count == hb_count) { @@ -2983,9 +2980,8 @@ bfa_iocpf_stop(struct bfa_ioc *ioc) } void -bfa_nw_iocpf_timeout(void *ioc_arg) +bfa_nw_iocpf_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; enum bfa_iocpf_state iocpf_st; iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc-iocpf.fsm); @@ -2997,10 +2993,8 @@ bfa_nw_iocpf_timeout(void *ioc_arg) } void -bfa_nw_iocpf_sem_timeout(void *ioc_arg) +bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_ioc_hw_sem_get(ioc); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b6ad2c5..2c0b4c0 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -304,10 +304,10 @@ int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); /* * Timeout APIs */ -void bfa_nw_ioc_timeout(void *ioc); -void bfa_nw_ioc_hb_check(void *ioc); -void bfa_nw_iocpf_timeout(void *ioc); -void bfa_nw_iocpf_sem_timeout(void *ioc); +void bfa_nw_ioc_timeout(struct bfa_ioc *ioc); +void bfa_nw_ioc_hb_check(struct bfa_ioc *ioc); +void bfa_nw_iocpf_timeout(struct bfa_ioc *ioc); +void bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc); /* * F/W Image Size Chunk diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index aea585b..ddda6f1 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -1702,7 +1702,7 @@ bnad_ioc_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1713,7 +1713,7 @@ bnad_ioc_hb_check(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_hb_check((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_hb_check(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1724,7 +1724,7 @@ bnad_iocpf_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1735,7 +1735,7 @@ bnad_iocpf_sem_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_sem_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_sem_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 14/19] bna: use memdup_user to copy userspace buffers
Patch converts kzalloc-copy_from_user sequence to memdup_user. There is also one useless assignment of NULL to bnad-regdata as it is followed by assignment of kzalloc output. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 27 - 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 72c8955..ad7af5c 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c @@ -321,15 +321,10 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, len); if (rc 2) { @@ -341,7 +336,6 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, kfree(kern_buf); kfree(bnad-regdata); - bnad-regdata = NULL; bnad-reglen = 0; bnad-regdata = kzalloc(len 2, GFP_KERNEL); @@ -388,15 +382,10 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, val); if (rc 2) { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 15/19] bna: remove useless pointer assignment
Pointer cmpl used to iterate through completion entries is updated at the beginning of while loop as well as at the end. The update at the end of the loop is useless. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index e871e27..aea585b 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -724,7 +724,6 @@ next: cmpl-valid = 0; BNA_QE_INDX_INC(ccb-producer_index, ccb-q_depth); } - cmpl = cq[ccb-producer_index]; } napi_gro_flush(rx_ctrl-napi, false); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 01/19] bna: use ether_addr_copy instead of memcpy
On 06/10/2015 07:57 PM, Joe Perches wrote: On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: Signed-off-by: Ivan Vecera ivec...@redhat.com Have you verified that all of these are __aligned(2)? I haven't, but you should verify that you have in the commit log. I have checked an alignment of all instances and they are all aligned properly... An exception is global variable bnad_bcast_addr, its alignment is 1 according __alignof__ but according generated assembly it is aligned to 2. Anyway I'm going to put __aligned directive for sure. btw: this use looks odd to me: static int bnad_set_mac_address(struct net_device *netdev, void *mac_addr) { int err; struct bnad *bnad = netdev_priv(netdev); struct sockaddr *sa = (struct sockaddr *)mac_addr; unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); err = bnad_mac_addr_set_locked(bnad, sa-sa_data); as it casts what seems to be a mac address to a sockaddr and uses a different offset for sa-sa_data than the mac_addr passed. and the mac_addr as it's void doesn't need a cast. No, bnad_set_mac_address() is an implementation of .ndo_set_mac_address() and this is called with pointer to struct sockaddr. The mac_addr name is a little bit confusing. Will post v2. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 02/19] bna: get rid of mac_t
The patch converts mac_t type to widely used 'u8 [ETH_ALEN]'. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h | 4 ++-- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 2 +- drivers/net/ethernet/brocade/bna/bfi.h | 6 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h | 6 +++--- drivers/net/ethernet/brocade/bna/bna.h | 4 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c | 4 ++-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 4 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 10 +- drivers/net/ethernet/brocade/bna/bnad.h | 2 +- drivers/net/ethernet/brocade/bna/cna.h | 6 -- 12 files changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 3bfd9da..f55887b 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -55,7 +55,7 @@ struct bfa_adapter_attr { charoptrom_ver[BFA_VERSION_LEN]; charos_type[BFA_ADAPTER_OS_TYPE_LEN]; struct bfa_mfg_vpd vpd; - struct mac mac; + u8 mac[ETH_ALEN]; u8 nports; u8 max_speed; @@ -211,7 +211,7 @@ struct bfa_mfg_block { charsupplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)]; charsupplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)]; charsupplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)]; - mac_t mfg_mac;/* base mac address */ + u8 mfg_mac[ETH_ALEN]; /* base mac address */ u8 num_mac;/* number of mac addresses */ u8 rsv2; u32 card_type; /* card type */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index a37326d..ce0b228 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -188,7 +188,7 @@ struct bfa_cee_attr { u8 error_reason; struct bfa_cee_lldp_cfg lldp_remote; struct bfa_cee_dcbx_cfg dcbx_remote; - mac_t src_mac; + u8 src_mac[ETH_ALEN]; u8 link_speed; u8 nw_priority; u8 filler[2]; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 68f3c13..82c95f8 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2796,7 +2796,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc *ioc, ad_attr-prototype = 0; ad_attr-pwwn = bfa_ioc_get_pwwn(ioc); - ad_attr-mac = bfa_nw_ioc_get_mac(ioc); + bfa_nw_ioc_get_mac(ioc, ad_attr-mac); ad_attr-pcie_gen = ioc_attr-pcie_gen; ad_attr-pcie_lanes = ioc_attr-pcie_lanes; @@ -2942,10 +2942,10 @@ bfa_ioc_get_pwwn(struct bfa_ioc *ioc) return ioc-attr-pwwn; } -mac_t -bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) +void +bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac) { - return ioc-attr-mac; + ether_addr_copy(mac, ioc-attr-mac); } /* Firmware failure detected. Start recovery actions. */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index effb715..b37bc16 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -309,7 +309,7 @@ void bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); bool bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr); -mac_t bfa_nw_ioc_get_mac(struct bfa_ioc *ioc); +void bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac); void bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave); int bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen); int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 2bcde40..63645ac 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -189,14 +189,14 @@ struct bfi_ioc_getattr_req { struct bfi_ioc_attr { u64 mfg_pwwn; /*! Mfg port wwn */ u64 mfg_nwwn; /*! Mfg node wwn */ - mac_t mfg_mac;/*! Mfg mac */ + u8 mfg_mac[ETH_ALEN]; /*! Mfg mac*/ u8 port_mode; /* enum bfi_port_mode */ u8 rsvd_a; u64 pwwn; u64 nwwn; - mac_t mac;/*! PBC or Mfg mac
[PATCH net-next v2 04/19] bna: get rid of duplicate and unused macros
replaced macros: BNA_MAC_IS_EQUAL - ether_addr_equal BNA_POWER_OF_2 - is_power_of_2 BNA_TO_POWER_OF_2_HIGH - roundup_pow_of_two removed unused macros: bfa_fsm_get_state bfa_ioc_clr_stats bfa_ioc_fetch_stats bfa_ioc_get_alt_ioc_fwstate bfa_ioc_isr_mode_set bfa_ioc_maxfrsize bfa_ioc_mbox_cmd_pending bfa_ioc_ownership_reset bfa_ioc_rx_bbcredit bfa_ioc_state_disabled bfa_sm_cmp_state bfa_sm_get_state bfa_sm_send_event bfa_sm_set_state bfa_sm_state_decl BFA_STRING_32 BFI_ADAPTER_IS_{PROTO,TTV,UNSUPP) BFI_IOC_ENDIAN_SIG BNA_{C,RX,TX}Q_PAGE_INDEX_MAX BNA_{C,RX,TX}Q_PAGE_INDEX_MAX_SHIFT BNA_{C,RX,TX}Q_QPGE_PTR_GET BNA_IOC_TIMER_FREQ BNA_MESSAGE_SIZE BNA_QE_INDX_2_PTR BNA_QE_INDX_RANGE BNA_Q_GET_{C,P}I BNA_Q_{C,P}I_ADD BNA_Q_FREE_COUNT BNA_Q_IN_USE_COUNT BNA_TO_POWER_OF_2 containing_rec Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 drivers/net/ethernet/brocade/bna/bfa_defs.h | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 14 drivers/net/ethernet/brocade/bna/bfa_ioc.h | 13 --- drivers/net/ethernet/brocade/bna/bfi.h | 8 -- drivers/net/ethernet/brocade/bna/bna.h | 105 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 13 ++- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 4 +- 8 files changed, 9 insertions(+), 163 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cs.h b/drivers/net/ethernet/brocade/bna/bfa_cs.h index af25d8e..1d11d66 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_cs.h @@ -28,19 +28,6 @@ typedef void (*bfa_sm_t)(void *sm, int event); -/* oc - object class eg. bfa_ioc - * st - state, eg. reset - * otype - object type, eg. struct bfa_ioc - * etype - object type, eg. enum ioc_event - */ -#define bfa_sm_state_decl(oc, st, otype, etype)\ - static void oc ## _sm_ ## st(otype * fsm, etype event) - -#define bfa_sm_set_state(_sm, _state) ((_sm)-sm = (bfa_sm_t)(_state)) -#define bfa_sm_send_event(_sm, _event) ((_sm)-sm((_sm), (_event))) -#define bfa_sm_get_state(_sm) ((_sm)-sm) -#define bfa_sm_cmp_state(_sm, _state) ((_sm)-sm == (bfa_sm_t)(_state)) - /* For converting from state machine function to state encoding. */ struct bfa_sm_table { bfa_sm_tsm; /*! state machine function */ @@ -67,7 +54,6 @@ typedef void (*bfa_fsm_t)(void *fsm, int event); } while (0) #define bfa_fsm_send_event(_fsm, _event) ((_fsm)-fsm((_fsm), (_event))) -#define bfa_fsm_get_state(_fsm)((_fsm)-fsm) #define bfa_fsm_cmp_state(_fsm, _state) \ ((_fsm)-fsm == (bfa_fsm_t)(_state)) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index 6827d91..d152b3f 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -24,7 +24,6 @@ #include bfa_defs_status.h #include bfa_defs_mfg_comm.h -#define BFA_STRING_32 32 #define BFA_VERSION_LEN 64 /* -- adapter definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 82c95f8..29e0428 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -23,14 +23,6 @@ /* IOC local definitions */ -#define bfa_ioc_state_disabled(__sm) \ - (((__sm) == BFI_IOC_UNINIT) || \ -((__sm) == BFI_IOC_INITING) || \ -((__sm) == BFI_IOC_HWINIT) || \ -((__sm) == BFI_IOC_DISABLED) ||\ -((__sm) == BFI_IOC_FAIL) ||\ -((__sm) == BFI_IOC_CFG_DISABLED)) - /* Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details. */ #define bfa_ioc_firmware_lock(__ioc) \ @@ -57,12 +49,6 @@ ((__ioc)-ioc_hwif-ioc_get_fwstate(__ioc)) #define bfa_ioc_set_alt_ioc_fwstate(__ioc, __fwstate) \ ((__ioc)-ioc_hwif-ioc_set_alt_fwstate(__ioc, __fwstate)) -#define bfa_ioc_get_alt_ioc_fwstate(__ioc) \ - ((__ioc)-ioc_hwif-ioc_get_alt_fwstate(__ioc)) - -#define bfa_ioc_mbox_cmd_pending(__ioc)\ - (!list_empty(((__ioc)-mbox_mod.cmd_q)) || \ - readl((__ioc)-ioc_regs.hfn_mbox_cmd)) static bool bfa_nw_auto_recover = true; diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b37bc16..b6ad2c5 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -232,12 +232,6 @@ struct bfa_ioc_hwif { #define bfa_ioc_asic_gen(__ioc)((__ioc)-asic_gen) #define bfa_ioc_is_default(__ioc) \ (bfa_ioc_pcifn(__ioc
[PATCH net-next v2 09/19] bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 13 - drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 16 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 27f75d7..471e74d 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -3000,16 +3000,6 @@ do { \ } \ } while (0) -#define call_tx_prio_change_cbfn(tx) \ -do { \ - if ((tx)-prio_change_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_tx *); \ - cbfn = (tx)-prio_change_cbfn; \ - (tx)-prio_change_cbfn = NULL; \ - cbfn((tx)-bna-bnad, (tx));\ - } \ -} while (0) - static void bna_tx_mod_cb_tx_stopped(void *tx_mod, struct bna_tx *tx); static void bna_bfi_tx_enet_start(struct bna_tx *tx); static void bna_tx_enet_stop(struct bna_tx *tx); @@ -3062,7 +3052,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) break; case TX_E_PRIO_CHANGE: - call_tx_prio_change_cbfn(tx); break; case TX_E_BW_UPDATE: @@ -3232,7 +3221,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) case TX_E_FAIL: bfa_fsm_set_state(tx, bna_tx_sm_failed); - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; @@ -3253,7 +3241,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) static void bna_tx_sm_prio_cleanup_wait_entry(struct bna_tx *tx) { - call_tx_prio_change_cbfn(tx); tx-tx_cleanup_cbfn(tx-bna-bnad, tx); } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 96a02f2..095bd63 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -495,9 +495,6 @@ struct bna_tx { void (*stop_cbfn)(void *arg, struct bna_tx *tx); void*stop_cbarg; - /* callback for bna_tx_prio_set() */ - void (*prio_change_cbfn)(struct bnad *bnad, struct bna_tx *tx); - struct bfa_msgq_cmd_entry msgq_cmd; union { struct bfi_enet_tx_cfg_req cfg_req; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 11/19] bna: remove paused from bna_rx_config and flags from bna_rxf
The bna_rx_config struct member paused can be removed as it is never written and as it cannot have non-zero value the bna_rxf struct member flags also cannot have BNA_RXF_F_PAUSED value and is always zero. So the flags member can be removed as well as bna_rxf_flags enum and the code-paths that needs to have non-zero bna_rxf-flags. This clean-up makes bna_rxf_sm_paused state unsed and can be also removed. --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 36 +--- drivers/net/ethernet/brocade/bna/bna_types.h | 6 - 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index ccf48a1..896aa82 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -59,8 +59,6 @@ static int bna_rxf_allmulti_cfg_reset(struct bna_rxf *rxf, bfa_fsm_state_decl(bna_rxf, stopped, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, paused, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, @@ -79,11 +77,7 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) { switch (event) { case RXF_E_START: - if (rxf-flags BNA_RXF_F_PAUSED) { - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - call_rxf_start_cbfn(rxf); - } else - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); + bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; case RXF_E_STOP: @@ -104,29 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) } static void -bna_rxf_sm_paused_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_STOP: - case RXF_E_FAIL: - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_CONFIG: - call_rxf_cam_fltr_cbfn(rxf); - break; - - default: - bfa_sm_fault(event); - } -} - -static void bna_rxf_sm_cfg_wait_entry(struct bna_rxf *rxf) { if (!bna_rxf_cfg_apply(rxf)) { @@ -679,9 +650,6 @@ bna_rxf_init(struct bna_rxf *rxf, INIT_LIST_HEAD(rxf-mcast_active_q); INIT_LIST_HEAD(rxf-mcast_handle_q); - if (q_config-paused) - rxf-flags |= BNA_RXF_F_PAUSED; - rxf-rit = (u8 *) res_info[BNA_RX_RES_MEM_T_RIT].res_u.mem_info.mdl[0].kva; bna_rit_init(rxf, q_config-num_paths); @@ -742,8 +710,6 @@ bna_rxf_uninit(struct bna_rxf *rxf) rxf-rss_pending = 0; rxf-vlan_strip_pending = false; - rxf-flags = 0; - rxf-rx = NULL; } diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index e56f650..134abf7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -182,10 +182,6 @@ enum bna_rx_mod_flags { BNA_RX_MOD_F_ENET_LOOPBACK = 2, }; -enum bna_rxf_flags { - BNA_RXF_F_PAUSED= 1, -}; - enum bna_rxf_event { RXF_E_START = 1, RXF_E_STOP = 2, @@ -668,7 +664,6 @@ struct bna_rx_config { enum bna_rx_type rx_type; int num_paths; enum bna_rxp_type rxp_type; - int paused; int coalescing_timeo; /* * Small/Large (or Header/Data) buffer size to be configured @@ -713,7 +708,6 @@ struct bna_rxp { /* RxF structure (hardware Rx Function) */ struct bna_rxf { bfa_fsm_t fsm; - enum bna_rxf_flags flags; struct bfa_msgq_cmd_entry msgq_cmd; union { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 13/19] bna: correct comparisons/assignments to bool
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 29e0428..52fc439 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1373,7 +1373,7 @@ static enum bfi_ioc_img_ver_cmp bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, struct bfi_ioc_image_hdr *fwhdr_to_cmp) { - if (bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp) == false) + if (!bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp)) return BFI_IOC_IMG_VER_INCOMP; if (fwhdr_to_cmp-fwver.patch base_fwhdr-fwver.patch) @@ -1384,7 +1384,7 @@ bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr, /* GA takes priority over internal builds of the same patch stream. * At this point major minor maint and patch numbers are same. */ - if (fwhdr_is_ga(base_fwhdr) == true) + if (fwhdr_is_ga(base_fwhdr)) if (fwhdr_is_ga(fwhdr_to_cmp)) return BFI_IOC_IMG_VER_SAME; else @@ -2209,7 +2209,7 @@ bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 soff, u32 sz) /* * Hold semaphore to serialize pll init and fwtrc. */ - if (bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg) == 0) + if (!bfa_nw_ioc_sem_get(ioc-ioc_regs.ioc_init_sem_reg)) return 1; writel(pgnum, ioc-ioc_regs.host_page_num_fn); @@ -2264,7 +2264,7 @@ bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc) int tlen; if (ioc-dbg_fwsave_once) { - ioc-dbg_fwsave_once = 0; + ioc-dbg_fwsave_once = false; if (ioc-dbg_fwsave_len) { tlen = ioc-dbg_fwsave_len; bfa_nw_ioc_debug_fwtrc(ioc, ioc-dbg_fwsave, tlen); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 07/19] bna: remove pause_cbfn from struct bna_enet
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_enet.c | 15 --- drivers/net/ethernet/brocade/bna/bna_types.h | 3 --- 2 files changed, 18 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index b8de17b..dc9f73b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -884,16 +884,6 @@ do { \ } \ } while (0) -#define call_enet_pause_cbfn(enet) \ -do { \ - if ((enet)-pause_cbfn) { \ - void (*cbfn)(struct bnad *);\ - cbfn = (enet)-pause_cbfn; \ - (enet)-pause_cbfn = NULL; \ - cbfn((enet)-bna-bnad);\ - } \ -} while (0) - #define call_enet_mtu_cbfn(enet) \ do { \ if ((enet)-mtu_cbfn) { \ @@ -925,7 +915,6 @@ bfa_fsm_state_decl(bna_enet, chld_stop_wait, struct bna_enet, static void bna_enet_sm_stopped_entry(struct bna_enet *enet) { - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); call_enet_stop_cbfn(enet); } @@ -947,7 +936,6 @@ bna_enet_sm_stopped(struct bna_enet *enet, enum bna_enet_event event) break; case ENET_E_PAUSE_CFG: - call_enet_pause_cbfn(enet); break; case ENET_E_MTU_CFG: @@ -1039,7 +1027,6 @@ bna_enet_sm_started_entry(struct bna_enet *enet) * NOTE: Do not call bna_enet_chld_start() here, since it will be * inadvertently called during cfg_wait-started transition as well */ - call_enet_pause_cbfn(enet); call_enet_mtu_cbfn(enet); } @@ -1211,8 +1198,6 @@ bna_enet_init(struct bna_enet *enet, struct bna *bna) enet-stop_cbfn = NULL; enet-stop_cbarg = NULL; - enet-pause_cbfn = NULL; - enet-mtu_cbfn = NULL; bfa_fsm_set_state(enet, bna_enet_sm_stopped); diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index d0a7a56..a50ee99 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -362,9 +362,6 @@ struct bna_enet { void (*stop_cbfn)(void *); void*stop_cbarg; - /* Callback for bna_enet_pause_config() */ - void (*pause_cbfn)(struct bnad *); - /* Callback for bna_enet_mtu_set() */ void (*mtu_cbfn)(struct bnad *); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 10/19] bna: remove RXF_E_PAUSE and RXF_E_RESUME events
RXF_E_PAUSE RXF_E_RESUME events are never sent for bna_rxf object so they needn't to be handled. The bna_rxf's state bna_rxf_sm_fltr_clr_wait and function bna_rxf_fltr_clear are unused after this so remove them also. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 75 drivers/net/ethernet/brocade/bna/bna_types.h | 2 - 2 files changed, 77 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 471e74d..ccf48a1 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -46,7 +46,6 @@ do { \ static int bna_rxf_cfg_apply(struct bna_rxf *rxf); static void bna_rxf_cfg_reset(struct bna_rxf *rxf); -static int bna_rxf_fltr_clear(struct bna_rxf *rxf); static int bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_promisc_cfg_apply(struct bna_rxf *rxf); static int bna_rxf_allmulti_cfg_apply(struct bna_rxf *rxf); @@ -66,8 +65,6 @@ bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf, enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf, enum bna_rxf_event); -bfa_fsm_state_decl(bna_rxf, fltr_clr_wait, struct bna_rxf, - enum bna_rxf_event); bfa_fsm_state_decl(bna_rxf, last_resp_wait, struct bna_rxf, enum bna_rxf_event); @@ -101,14 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - break; - - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - break; - default: bfa_sm_fault(event); } @@ -132,11 +121,6 @@ bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event) call_rxf_cam_fltr_cbfn(rxf); break; - case RXF_E_RESUME: - rxf-flags = ~BNA_RXF_F_PAUSED; - bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); - break; - default: bfa_sm_fault(event); } @@ -170,12 +154,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) /* No-op */ break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_start_cbfn(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - case RXF_E_FW_RESP: if (!bna_rxf_cfg_apply(rxf)) { /* No more pending config updates */ @@ -209,40 +187,6 @@ bna_rxf_sm_started(struct bna_rxf *rxf, enum bna_rxf_event event) bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait); break; - case RXF_E_PAUSE: - rxf-flags |= BNA_RXF_F_PAUSED; - if (!bna_rxf_fltr_clear(rxf)) - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - else - bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait); - break; - - default: - bfa_sm_fault(event); - } -} - -static void -bna_rxf_sm_fltr_clr_wait_entry(struct bna_rxf *rxf) -{ -} - -static void -bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) -{ - switch (event) { - case RXF_E_FAIL: - bna_rxf_cfg_reset(rxf); - bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); - break; - - case RXF_E_FW_RESP: - if (!bna_rxf_fltr_clear(rxf)) { - /* No more pending CAM entries to clear */ - bfa_fsm_set_state(rxf, bna_rxf_sm_paused); - } - break; - default: bfa_sm_fault(event); } @@ -652,25 +596,6 @@ bna_rxf_cfg_apply(struct bna_rxf *rxf) return 0; } -/* Only software reset */ -static int -bna_rxf_fltr_clear(struct bna_rxf *rxf) -{ - if (bna_rxf_ucast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_mcast_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_promisc_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - if (bna_rxf_allmulti_cfg_reset(rxf, BNA_HARD_CLEANUP)) - return 1; - - return 0; -} - static void bna_rxf_cfg_reset(struct bna_rxf *rxf) { diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 095bd63..e56f650 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -191,8 +191,6 @@ enum bna_rxf_event { RXF_E_STOP = 2, RXF_E_FAIL = 3
[PATCH net-next v2 03/19] bna: replace pragma(pack) with attribute __packed
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_defs.h| 6 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 14 +-- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 6 +- drivers/net/ethernet/brocade/bna/bfi.h | 70 +++--- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +++--- drivers/net/ethernet/brocade/bna/bfi_enet.h| 104 ++--- 6 files changed, 103 insertions(+), 127 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h index f55887b..6827d91 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h @@ -187,8 +187,6 @@ enum { #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE20 #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 -#pragma pack(1) - /* BFA adapter manufacturing block definition. * * All numerical fields are in big-endian format. @@ -227,9 +225,7 @@ struct bfa_mfg_block { charinitial_mode[8]; /* initial mode: hba/cna/nic */ u8 rsv4[84]; u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /* md5 checksum */ -}; - -#pragma pack() +} __packed; /* -- pci definitions */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h index ce0b228..f048887 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h @@ -109,8 +109,6 @@ union bfa_port_stats_u { struct bfa_port_eth_stats eth; }; -#pragma pack(1) - #define BFA_CEE_LLDP_MAX_STRING_LEN (128) #define BFA_CEE_DCBX_MAX_PRIORITY (8) #define BFA_CEE_DCBX_MAX_PGID (8) @@ -133,7 +131,7 @@ struct bfa_cee_lldp_str { u8 len; u8 rsvd[2]; u8 value[BFA_CEE_LLDP_MAX_STRING_LEN]; -}; +} __packed; /* LLDP parameters */ struct bfa_cee_lldp_cfg { @@ -145,7 +143,7 @@ struct bfa_cee_lldp_cfg { struct bfa_cee_lldp_str mgmt_addr; u16 time_to_live; u16 enabled_system_cap; -}; +} __packed; enum bfa_cee_dcbx_version { DCBX_PROTOCOL_PRECEE= 1, @@ -171,7 +169,7 @@ struct bfa_cee_dcbx_cfg { u8 lls_fcoe; /* FCoE Logical Link Status */ u8 lls_lan; /* LAN Logical Link Status */ u8 rsvd[2]; -}; +} __packed; /* CEE status */ /* Making this to tri-state for the benefit of port list command */ @@ -192,7 +190,7 @@ struct bfa_cee_attr { u8 link_speed; u8 nw_priority; u8 filler[2]; -}; +} __packed; /* LLDP/DCBX/CEE Statistics */ struct bfa_cee_stats { @@ -214,8 +212,6 @@ struct bfa_cee_stats { u32 cee_status_up; /*! CEE status up */ u32 cee_hw_cfg_changed; /*! CEE hw cfg changed */ u32 cee_rx_invalid_cfg; /*! CEE invalid cfg */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_CNA_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 7a45cd0..679a503 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -59,8 +59,6 @@ enum { BFA_MFG_TYPE_INVALID = 0,/*! Invalid card type */ }; -#pragma pack(1) - /* Check if Mezz card */ #define bfa_mfg_is_mezz(type) (( \ (type) == BFA_MFG_TYPE_JAYHAWK || \ @@ -148,8 +146,6 @@ struct bfa_mfg_vpd { u8 len;/*! vpd data length excluding header */ u8 rsv; u8 data[BFA_MFG_VPD_LEN]; /*! vpd data */ -}; - -#pragma pack() +} __packed; #endif /* __BFA_DEFS_MFG_H__ */ diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h index 63645ac..3e97077 100644 --- a/drivers/net/ethernet/brocade/bna/bfi.h +++ b/drivers/net/ethernet/brocade/bna/bfi.h @@ -21,8 +21,6 @@ #include bfa_defs.h -#pragma pack(1) - /* BFI FW image type */ #defineBFI_FLASH_CHUNK_SZ 256 /*! Flash chunk size */ #defineBFI_FLASH_CHUNK_SZ_WORDS(BFI_FLASH_CHUNK_SZ/sizeof(u32)) @@ -36,10 +34,10 @@ struct bfi_mhdr { struct { u8 qid; u8 fn_lpu; /*! msg destination*/ - } h2i; + } __packed h2i; u16 i2htok; /*! token in msgs to host */ - } mtag; -}; + } __packed mtag; +} __packed; #define bfi_fn_lpu(__fn, __lpu)((__fn) 1 | (__lpu)) #define bfi_mhdr_2_fn(_mh) ((_mh)-mtag.h2i.fn_lpu 1) @@ -75,14 +73,14 @@ union bfi_addr_u { struct { u32 addr_lo; u32 addr_hi; - } a32; -}; + } __packed a32; +} __packed; /* Generic DMA addr-len pair. */ struct bfi_alen { union bfi_addr_ual_addr;/* DMA
[PATCH net-next v2 16/19] bna: get rid of private macros for manipulation with lists
Remove macros for manipulation with struct list_head and replace them with standard ones. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c | 10 +- drivers/net/ethernet/brocade/bna/bna.h | 1 - drivers/net/ethernet/brocade/bna/bna_enet.c | 50 ++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 310 +-- drivers/net/ethernet/brocade/bna/cna.h | 56 - 7 files changed, 130 insertions(+), 308 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_cee.c b/drivers/net/ethernet/brocade/bna/bfa_cee.c index cf9f395..95bc8b6 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_cee.c +++ b/drivers/net/ethernet/brocade/bna/bfa_cee.c @@ -282,7 +282,6 @@ bfa_nw_cee_attach(struct bfa_cee *cee, struct bfa_ioc *ioc, cee-ioc = ioc; bfa_nw_ioc_mbox_regisr(cee-ioc, BFI_MC_CEE, bfa_cee_isr, cee); - bfa_q_qe_init(cee-ioc_notify); bfa_ioc_notify_init(cee-ioc_notify, bfa_cee_notify, cee); bfa_nw_ioc_notify_register(cee-ioc, cee-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 52fc439..dabbb30 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2163,7 +2163,8 @@ bfa_ioc_mbox_poll(struct bfa_ioc *ioc) /** * Enqueue command to firmware. */ - bfa_q_deq(mod-cmd_q, cmd); + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); bfa_ioc_mbox_send(ioc, cmd-msg, sizeof(cmd-msg)); /** @@ -2184,8 +2185,10 @@ bfa_ioc_mbox_flush(struct bfa_ioc *ioc) struct bfa_ioc_mbox_mod *mod = ioc-mbox_mod; struct bfa_mbox_cmd *cmd; - while (!list_empty(mod-cmd_q)) - bfa_q_deq(mod-cmd_q, cmd); + while (!list_empty(mod-cmd_q)) { + cmd = list_first_entry(mod-cmd_q, struct bfa_mbox_cmd, qe); + list_del(cmd-qe); + } } /** @@ -3231,7 +3234,6 @@ bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) flash-op_busy = 0; bfa_nw_ioc_mbox_regisr(flash-ioc, BFI_MC_FLASH, bfa_flash_intr, flash); - bfa_q_qe_init(flash-ioc_notify); bfa_ioc_notify_init(flash-ioc_notify, bfa_flash_notify, flash); list_add_tail(flash-ioc_notify.qe, flash-ioc-notify_q); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c b/drivers/net/ethernet/brocade/bna/bfa_msgq.c index c07d5b9..9c5bb24 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_msgq.c +++ b/drivers/net/ethernet/brocade/bna/bfa_msgq.c @@ -66,8 +66,9 @@ cmdq_sm_stopped_entry(struct bfa_msgq_cmdq *cmdq) cmdq-offset = 0; cmdq-bytes_to_copy = 0; while (!list_empty(cmdq-pending_q)) { - bfa_q_deq(cmdq-pending_q, cmdq_ent); - bfa_q_qe_init(cmdq_ent-qe); + cmdq_ent = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); + list_del(cmdq_ent-qe); call_cmdq_ent_cbfn(cmdq_ent, BFA_STATUS_FAILED); } } @@ -242,8 +243,8 @@ bfa_msgq_cmdq_ci_update(struct bfa_msgq_cmdq *cmdq, struct bfi_mbmsg *mb) /* Walk through pending list to see if the command can be posted */ while (!list_empty(cmdq-pending_q)) { - cmd = - (struct bfa_msgq_cmd_entry *)bfa_q_first(cmdq-pending_q); + cmd = list_first_entry(cmdq-pending_q, + struct bfa_msgq_cmd_entry, qe); if (ntohs(cmd-msg_hdr-num_entries) = BFA_MSGQ_FREE_CNT(cmdq)) { list_del(cmd-qe); @@ -615,7 +616,6 @@ bfa_msgq_attach(struct bfa_msgq *msgq, struct bfa_ioc *ioc) bfa_msgq_rspq_attach(msgq-rspq, msgq); bfa_nw_ioc_mbox_regisr(msgq-ioc, BFI_MC_MSGQ, bfa_msgq_isr, msgq); - bfa_q_qe_init(msgq-ioc_notify); bfa_ioc_notify_init(msgq-ioc_notify, bfa_msgq_notify, msgq); bfa_nw_ioc_notify_register(msgq-ioc, msgq-ioc_notify); } diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 4f16ee2..66e6e09 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -283,7 +283,6 @@ void bna_hw_stats_get(struct bna *bna); /* APIs for RxF */ struct bna_mac *bna_cam_mod_mac_get(struct list_head *head); -void bna_cam_mod_mac_put(struct list_head *tail, struct bna_mac *mac); struct bna_mcam_handle *bna_mcam_mod_handle_get(struct bna_mcam_mod *mod); void bna_mcam_mod_handle_put(struct bna_mcam_mod *mcam_mod, struct bna_mcam_handle *handle); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index
[PATCH net-next v2 14/19] bna: use memdup_user to copy userspace buffers
Patch converts kzalloc-copy_from_user sequence to memdup_user. There is also one useless assignment of NULL to bnad-regdata as it is followed by assignment of kzalloc output. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 27 - 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 72c8955..ad7af5c 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c @@ -321,15 +321,10 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, len); if (rc 2) { @@ -341,7 +336,6 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, kfree(kern_buf); kfree(bnad-regdata); - bnad-regdata = NULL; bnad-reglen = 0; bnad-regdata = kzalloc(len 2, GFP_KERNEL); @@ -388,15 +382,10 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, unsigned long flags; void *kern_buf; - /* Allocate memory to store the user space buf */ - kern_buf = kzalloc(nbytes, GFP_KERNEL); - if (!kern_buf) - return -ENOMEM; - - if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { - kfree(kern_buf); - return -ENOMEM; - } + /* Copy the user space buf */ + kern_buf = memdup_user(buf, nbytes); + if (IS_ERR(kern_buf)) + return PTR_ERR(kern_buf); rc = sscanf(kern_buf, %x:%x, addr, val); if (rc 2) { -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 08/19] bna: remove oper_state_cbfn from struct bna_rxf
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 15 --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 6 -- drivers/net/ethernet/brocade/bna/bna_types.h | 4 3 files changed, 25 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 0962e54..4f16ee2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -119,21 +119,6 @@ do { \ } \ } while (0) -#definecall_rxf_pause_cbfn(rxf) \ -do { \ - if ((rxf)-oper_state_cbfn) { \ - void (*cbfn)(struct bnad *, struct bna_rx *); \ - struct bnad *cbarg; \ - cbfn = (rxf)-oper_state_cbfn; \ - cbarg = (rxf)-oper_state_cbarg;\ - (rxf)-oper_state_cbfn = NULL; \ - (rxf)-oper_state_cbarg = NULL; \ - cbfn(cbarg, rxf-rx); \ - } \ -} while (0) - -#definecall_rxf_resume_cbfn(rxf) call_rxf_pause_cbfn(rxf) - #define is_xxx_enable(mode, bitmask, xxx) ((bitmask xxx) (mode xxx)) #define is_xxx_disable(mode, bitmask, xxx) ((bitmask xxx) !(mode xxx)) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 16d36df..27f75d7 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -103,12 +103,10 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) case RXF_E_PAUSE: rxf-flags |= BNA_RXF_F_PAUSED; - call_rxf_pause_cbfn(rxf); break; case RXF_E_RESUME: rxf-flags = ~BNA_RXF_F_PAUSED; - call_rxf_resume_cbfn(rxf); break; default: @@ -119,7 +117,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event event) static void bna_rxf_sm_paused_entry(struct bna_rxf *rxf) { - call_rxf_pause_cbfn(rxf); } static void @@ -166,7 +163,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event event) bna_rxf_cfg_reset(rxf); call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; @@ -197,7 +193,6 @@ bna_rxf_sm_started_entry(struct bna_rxf *rxf) { call_rxf_start_cbfn(rxf); call_rxf_cam_fltr_cbfn(rxf); - call_rxf_resume_cbfn(rxf); } static void @@ -238,7 +233,6 @@ bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event) switch (event) { case RXF_E_FAIL: bna_rxf_cfg_reset(rxf); - call_rxf_pause_cbfn(rxf); bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index a50ee99..96a02f2 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -739,10 +739,6 @@ struct bna_rxf { void (*stop_cbfn) (struct bna_rx *rx); struct bna_rx *stop_cbarg; - /* callback for bna_rx_receive_pause() / bna_rx_receive_resume() */ - void (*oper_state_cbfn) (struct bnad *bnad, struct bna_rx *rx); - struct bnad *oper_state_cbarg; - /** * callback for: * bna_rxf_ucast_set() -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 17/19] bna: use list_for_each_entry where appropriate
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 5 +- drivers/net/ethernet/brocade/bna/bna.h | 41 -- drivers/net/ethernet/brocade/bna/bna_enet.c | 23 -- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 117 +-- 4 files changed, 37 insertions(+), 149 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index dabbb30..2c74beb 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1091,12 +1091,9 @@ static void bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event) { struct bfa_ioc_notify *notify; - struct list_head*qe; - list_for_each(qe, ioc-notify_q) { - notify = (struct bfa_ioc_notify *)qe; + list_for_each_entry(notify, ioc-notify_q, qe) notify-cbfn(notify-cbarg, event); - } } static void diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 66e6e09..dc845b2 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -208,28 +208,24 @@ do { \ #define bna_rx_rid_mask(_bna) ((_bna)-rx_mod.rid_mask) #define bna_tx_from_rid(_bna, _rid, _tx) \ -do { \ - struct bna_tx_mod *__tx_mod = (_bna)-tx_mod;\ - struct bna_tx *__tx;\ - struct list_head *qe; \ - _tx = NULL; \ - list_for_each(qe, __tx_mod-tx_active_q) { \ - __tx = (struct bna_tx *)qe; \ - if (__tx-rid == (_rid)) {\ - (_tx) = __tx; \ - break;\ - } \ - } \ +do { \ + struct bna_tx_mod *__tx_mod = (_bna)-tx_mod; \ + struct bna_tx *__tx;\ + _tx = NULL; \ + list_for_each_entry(__tx, __tx_mod-tx_active_q, qe) { \ + if (__tx-rid == (_rid)) { \ + (_tx) = __tx; \ + break; \ + } \ + } \ } while (0) #define bna_rx_from_rid(_bna, _rid, _rx) \ do { \ struct bna_rx_mod *__rx_mod = (_bna)-rx_mod; \ struct bna_rx *__rx;\ - struct list_head *qe; \ _rx = NULL; \ - list_for_each(qe, __rx_mod-rx_active_q) { \ - __rx = (struct bna_rx *)qe; \ + list_for_each_entry(__rx, __rx_mod-rx_active_q, qe) { \ if (__rx-rid == (_rid)) { \ (_rx) = __rx; \ break; \ @@ -249,15 +245,12 @@ do { \ static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr) { - struct bna_mac *mac = NULL; - struct list_head *qe; - list_for_each(qe, q) { - if (ether_addr_equal(((struct bna_mac *)qe)-addr, addr)) { - mac = (struct bna_mac *)qe; - break; - } - } - return mac; + struct bna_mac *mac; + + list_for_each_entry(mac, q, qe) + if (ether_addr_equal(mac-addr, addr)) + return mac; + return NULL; } #define bna_attr(_bna) ((_bna)-ioceth.attr) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index bd8f2c2..05680e0 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1806,17 +1806,6 @@ bna_ucam_mod_init(struct bna_ucam_mod *ucam_mod, struct bna *bna, static void
[PATCH net-next v2 01/19] bna: use ether_addr_copy instead of memcpy
Parameters of all ether_addr_copy instances were checked for proper alignment. Alignment of bnad_bcast_addr is forced to 2 as the implicit alignment is 1. I have also renamed address parameter of bnad_set_mac_address() to addr. The name mac_addr was a little bit confusing as the real parameter is struct sockaddr *. v2: added __aligned directive to bnad_bcast_addr, renamed parameter of bnad_set_mac_address() (thx j...@perches.com) Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 12 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 22 ++ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 8ab3a5f..30d5e7f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -876,7 +876,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, bfa_q_qe_init(rxf-ucast_pending_mac-qe); } - memcpy(rxf-ucast_pending_mac-addr, ucmac, ETH_ALEN); + ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; rxf-cam_fltr_cbfn = cbfn; rxf-cam_fltr_cbarg = rx-bna-bnad; @@ -905,7 +905,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, if (mac == NULL) return BNA_CB_MCAST_LIST_FULL; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, addr, ETH_ALEN); + ether_addr_copy(mac-addr, addr); list_add_tail(mac-qe, rxf-mcast_pending_add_q); rxf-cam_fltr_cbfn = cbfn; @@ -955,7 +955,7 @@ bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; } @@ -1026,7 +1026,7 @@ bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist, if (mac == NULL) goto err_return; bfa_q_qe_init(mac-qe); - memcpy(mac-addr, mcaddr, ETH_ALEN); + ether_addr_copy(mac-addr, mcaddr); list_add_tail(mac-qe, list_head); mcaddr += ETH_ALEN; @@ -1149,8 +1149,8 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf) /* Set default unicast MAC */ if (rxf-ucast_pending_set) { rxf-ucast_pending_set = 0; - memcpy(rxf-ucast_active_mac.addr, - rxf-ucast_pending_mac-addr, ETH_ALEN); + ether_addr_copy(rxf-ucast_active_mac.addr, + rxf-ucast_pending_mac-addr); rxf-ucast_active_set = 1; bna_bfi_ucast_req(rxf, rxf-ucast_active_mac, BFI_ENET_H2I_MAC_UCAST_SET_REQ); diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index caae6cb..3e7c092 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -57,7 +57,8 @@ static u32 bnad_rxqs_per_cq = 2; static u32 bna_id; static struct mutex bnad_list_mutex; static LIST_HEAD(bnad_list); -static const u8 bnad_bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +static const u8 bnad_bcast_addr[] __aligned(2) = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* * Local MACROS @@ -875,9 +876,9 @@ bnad_set_netdev_perm_addr(struct bnad *bnad) { struct net_device *netdev = bnad-netdev; - memcpy(netdev-perm_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-perm_addr, bnad-perm_addr.mac); if (is_zero_ether_addr(netdev-dev_addr)) - memcpy(netdev-dev_addr, bnad-perm_addr, netdev-addr_len); + ether_addr_copy(netdev-dev_addr, bnad-perm_addr.mac); } /* Control Path Handlers */ @@ -1862,8 +1863,7 @@ bnad_netdev_mc_list_get(struct net_device *netdev, u8 *mc_list) struct netdev_hw_addr *mc_addr; netdev_for_each_mc_addr(mc_addr, netdev) { - memcpy(mc_list[i * ETH_ALEN], mc_addr-addr[0], - ETH_ALEN); + ether_addr_copy(mc_list[i * ETH_ALEN], mc_addr-addr[0]); i++; } } @@ -3141,8 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad) entry = 0; netdev_for_each_uc_addr(ha, netdev) { - memcpy(mac_list[entry * ETH_ALEN], - ha-addr[0], ETH_ALEN); + ether_addr_copy(mac_list[entry * ETH_ALEN], ha-addr[0]); entry++; } @@ -3183,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad) if (mac_list == NULL) goto mode_allmulti; - memcpy(mac_list[0], bnad_bcast_addr[0], ETH_ALEN); + ether_addr_copy
[PATCH net-next v2 12/19] bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag
TX_E_PRIO_CHANGE event is never sent for bna_tx so it doesn't need to be handled. After this change bna_tx-flags cannot contain BNA_TX_F_PRIO_CHANGED flag and it can be also eliminated. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 -- drivers/net/ethernet/brocade/bna/bna_types.h | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 896aa82..54ad169 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -2901,7 +2901,6 @@ enum bna_tx_event { TX_E_FAIL = 3, TX_E_STARTED= 4, TX_E_STOPPED= 5, - TX_E_PRIO_CHANGE= 6, TX_E_CLEANUP_DONE = 7, TX_E_BW_UPDATE = 8, }; @@ -2942,9 +2941,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event event) /* No-op */ break; - case TX_E_PRIO_CHANGE: - break; - case TX_E_BW_UPDATE: /* No-op */ break; @@ -2965,28 +2961,23 @@ bna_tx_sm_start_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_STOP: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stop_wait); break; case TX_E_FAIL: - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED); + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_stopped); break; case TX_E_STARTED: - if (tx-flags (BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED)) { - tx-flags = ~(BNA_TX_F_PRIO_CHANGED | - BNA_TX_F_BW_UPDATED); + if (tx-flags BNA_TX_F_BW_UPDATED) { + tx-flags = ~BNA_TX_F_BW_UPDATED; bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); } else bfa_fsm_set_state(tx, bna_tx_sm_started); break; - case TX_E_PRIO_CHANGE: - tx-flags |= BNA_TX_F_PRIO_CHANGED; - break; - case TX_E_BW_UPDATE: tx-flags |= BNA_TX_F_BW_UPDATED; break; @@ -3028,7 +3019,6 @@ bna_tx_sm_started(struct bna_tx *tx, enum bna_tx_event event) tx-tx_cleanup_cbfn(tx-bna-bnad, tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait); break; @@ -3061,7 +3051,6 @@ bna_tx_sm_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bna_tx_enet_stop(tx); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3081,7 +3070,6 @@ bna_tx_sm_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) { switch (event) { case TX_E_FAIL: - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3119,7 +3107,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_prio_cleanup_wait); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; @@ -3147,7 +3134,6 @@ bna_tx_sm_prio_cleanup_wait(struct bna_tx *tx, enum bna_tx_event event) bfa_fsm_set_state(tx, bna_tx_sm_failed); break; - case TX_E_PRIO_CHANGE: case TX_E_BW_UPDATE: /* No-op */ break; diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 134abf7..e0e797f 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -135,7 +135,6 @@ enum bna_tx_type { enum bna_tx_flags { BNA_TX_F_ENET_STARTED = 1, BNA_TX_F_ENABLED= 2, - BNA_TX_F_PRIO_CHANGED = 4, BNA_TX_F_BW_UPDATED = 8, }; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 15/19] bna: remove useless pointer assignment
Pointer cmpl used to iterate through completion entries is updated at the beginning of while loop as well as at the end. The update at the end of the loop is useless. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 0f833e4..fc97428 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -725,7 +725,6 @@ next: cmpl-valid = 0; BNA_QE_INDX_INC(ccb-producer_index, ccb-q_depth); } - cmpl = cq[ccb-producer_index]; } napi_gro_flush(rx_ctrl-napi, false); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
...and remove some of them. It is not necessary to log when .probe() and .remove() are called or when TxQ is started or stopped. Also log level of some of them was changed to more appropriate one (link up/down, firmware loading failure. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 46 + drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 34 -- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 9 ++--- drivers/net/ethernet/brocade/bna/cna_fwimg.c| 2 +- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 4542eb2..6be31ae 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -946,8 +946,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, if (link_up) { if (!netif_carrier_ok(bnad-netdev)) { uint tx_id, tcb_id; - printk(KERN_WARNING bna: %s link up\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link up\n); netif_carrier_on(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); for (tx_id = 0; tx_id bnad-num_tx; tx_id++) { @@ -966,10 +965,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, /* * Force an immediate * Transmit Schedule */ - printk(KERN_INFO bna: %s %d - TXQ_STARTED\n, - bnad-netdev-name, - txq_id); netif_wake_subqueue( bnad-netdev, txq_id); @@ -987,8 +982,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, } } else { if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_WARNING bna: %s link down\n, - bnad-netdev-name); + netdev_info(bnad-netdev, link down\n); netif_carrier_off(bnad-netdev); BNAD_UPDATE_CTR(bnad, link_toggle); } @@ -1058,8 +1052,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) txq_id = tcb-id; clear_bit(BNAD_TXQ_TX_STARTED, tcb-flags); netif_stop_subqueue(bnad-netdev, txq_id); - printk(KERN_INFO bna: %s %d TXQ_STOPPED\n, - bnad-netdev-name, txq_id); } } @@ -1082,8 +1074,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) BUG_ON(*(tcb-hw_consumer_index) != 0); if (netif_carrier_ok(bnad-netdev)) { - printk(KERN_INFO bna: %s %d TXQ_STARTED\n, - bnad-netdev-name, txq_id); netif_wake_subqueue(bnad-netdev, txq_id); BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); } @@ -2136,7 +2126,7 @@ bnad_reinit_rx(struct bnad *bnad) current_err = bnad_setup_rx(bnad, rx_id); if (current_err !err) { err = current_err; - pr_err(RXQ:%u setup failed\n, rx_id); + netdev_err(netdev, RXQ:%u setup failed\n, rx_id); } } @@ -2672,8 +2662,9 @@ bnad_enable_msix(struct bnad *bnad) if (ret 0) { goto intx_mode; } else if (ret bnad-msix_num) { - pr_warn(BNA: %d MSI-X vectors allocated %d requested\n, - ret, bnad-msix_num); + dev_warn(bnad-pcidev-dev, +%d MSI-X vectors allocated %d requested\n, +ret, bnad-msix_num); spin_lock_irqsave(bnad-bna_lock, flags); /* ret = #of vectors that we got */ @@ -2695,7 +2686,8 @@ bnad_enable_msix(struct bnad *bnad) return; intx_mode: - pr_warn(BNA: MSI-X enable failed - operating in INTx mode\n); + dev_warn(bnad-pcidev-dev, +MSI-X enable failed - operating in INTx mode\n); kfree(bnad-msix_table); bnad-msix_table = NULL; @@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad, dev_err(pdev-dev, ioremap for bar0 failed\n); return -ENOMEM; } - pr_info(bar0 mapped to %p, len %llu\n, bnad-bar0, - (unsigned long long) bnad-mmio_len); + dev_info(pdev-dev, bar0 mapped to %p, len %llu\n, bnad-bar0
[PATCH net-next v2 18/19] bna: fix timeout API argument type
Timeout functions are defined with 'void *' ptr argument. They should be defined directly with 'struct bfa_ioc *' type to avoid type conversions. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 16 +--- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 8 drivers/net/ethernet/brocade/bna/bnad.c| 8 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 2c74beb..b009fd7 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1895,10 +1895,8 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) } void -bfa_nw_ioc_timeout(void *ioc_arg) +bfa_nw_ioc_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_fsm_send_event(ioc, IOC_E_TIMEOUT); } @@ -1963,10 +1961,9 @@ bfa_ioc_send_getattr(struct bfa_ioc *ioc) } void -bfa_nw_ioc_hb_check(void *cbarg) +bfa_nw_ioc_hb_check(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = cbarg; - u32 hb_count; + u32 hb_count; hb_count = readl(ioc-ioc_regs.heartbeat); if (ioc-hb_count == hb_count) { @@ -2983,9 +2980,8 @@ bfa_iocpf_stop(struct bfa_ioc *ioc) } void -bfa_nw_iocpf_timeout(void *ioc_arg) +bfa_nw_iocpf_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; enum bfa_iocpf_state iocpf_st; iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc-iocpf.fsm); @@ -2997,10 +2993,8 @@ bfa_nw_iocpf_timeout(void *ioc_arg) } void -bfa_nw_iocpf_sem_timeout(void *ioc_arg) +bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc) { - struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg; - bfa_ioc_hw_sem_get(ioc); } diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index b6ad2c5..2c0b4c0 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h @@ -304,10 +304,10 @@ int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen); /* * Timeout APIs */ -void bfa_nw_ioc_timeout(void *ioc); -void bfa_nw_ioc_hb_check(void *ioc); -void bfa_nw_iocpf_timeout(void *ioc); -void bfa_nw_iocpf_sem_timeout(void *ioc); +void bfa_nw_ioc_timeout(struct bfa_ioc *ioc); +void bfa_nw_ioc_hb_check(struct bfa_ioc *ioc); +void bfa_nw_iocpf_timeout(struct bfa_ioc *ioc); +void bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc); /* * F/W Image Size Chunk diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index fc97428..4542eb2 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -1703,7 +1703,7 @@ bnad_ioc_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1714,7 +1714,7 @@ bnad_ioc_hb_check(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_ioc_hb_check((void *) bnad-bna.ioceth.ioc); + bfa_nw_ioc_hb_check(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1725,7 +1725,7 @@ bnad_iocpf_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } @@ -1736,7 +1736,7 @@ bnad_iocpf_sem_timeout(unsigned long data) unsigned long flags; spin_lock_irqsave(bnad-bna_lock, flags); - bfa_nw_iocpf_sem_timeout((void *) bnad-bna.ioceth.ioc); + bfa_nw_iocpf_sem_timeout(bnad-bna.ioceth.ioc); spin_unlock_irqrestore(bnad-bna_lock, flags); } -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 06/19] bna: remove unused cbfn parameter
removed: bna_rx_ucast_add bna_rx_ucast_del simplified: bna_enet_pause_config bna_rx_mcast_delall bna_rx_mcast_listset bna_rx_mode_set bna_rx_ucast_listset bna_rx_ucast_set Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 24 + drivers/net/ethernet/brocade/bna/bna_enet.c | 5 +--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 35 +++-- drivers/net/ethernet/brocade/bna/bnad.c | 18 ++--- drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 2 +- 5 files changed, 25 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 130010d..0962e54 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -386,30 +386,19 @@ void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo); void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]); void bna_rx_dim_update(struct bna_ccb *ccb); enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac); enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist); enum bna_cb_status bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac, void (*cbfn)(struct bnad *, struct bna_rx *)); enum bna_cb_status -bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac); void -bna_rx_mcast_delall(struct bna_rx *rx, - void (*cbfn)(struct bnad *, struct bna_rx *)); +bna_rx_mcast_delall(struct bna_rx *rx); enum bna_cb_status bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode, - enum bna_rxmode bitmask, - void (*cbfn)(struct bnad *, struct bna_rx *)); + enum bna_rxmode bitmask); void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id); void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id); void bna_rx_vlanfilter_enable(struct bna_rx *rx); @@ -429,8 +418,7 @@ void bna_enet_enable(struct bna_enet *enet); void bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void (*cbfn)(void *)); void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)); + struct bna_pause_config *pause_config); void bna_enet_mtu_set(struct bna_enet *enet, int mtu, void (*cbfn)(struct bnad *)); void bna_enet_perm_mac_get(struct bna_enet *enet, u8 *mac); diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index 54902ce..b8de17b 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -1308,13 +1308,10 @@ bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type, void bna_enet_pause_config(struct bna_enet *enet, - struct bna_pause_config *pause_config, - void (*cbfn)(struct bnad *)) + struct bna_pause_config *pause_config) { enet-pause_config = *pause_config; - enet-pause_cbfn = cbfn; - bfa_fsm_send_event(enet, ENET_E_PAUSE_CFG); } diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 2c85f72..16d36df 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -863,8 +863,7 @@ bna_rxf_fail(struct bna_rxf *rxf) } enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac) { struct bna_rxf *rxf = rx-rxf; @@ -878,7 +877,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac, ether_addr_copy(rxf-ucast_pending_mac-addr, ucmac); rxf-ucast_pending_set = 1; - rxf-cam_fltr_cbfn = cbfn; + rxf-cam_fltr_cbfn = NULL; rxf-cam_fltr_cbarg = rx-bna-bnad; bfa_fsm_send_event(rxf, RXF_E_CONFIG); @@ -917,8 +916,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, } enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist, -void (*cbfn)(struct bnad *, struct bna_rx *)) +bna_rx_ucast_listset(struct bna_rx *rx, int
[PATCH net-next v2 05/19] bna: use BIT(x) instead of (1 x)
Signed-off-by: Ivan Vecera ivec...@redhat.com --- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 66 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c| 4 +- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 +++ 6 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 679a503..16090fd 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -75,7 +75,7 @@ enum { CB_GPIO_FC4P2 = (4), /*! 4G 2port FC card */ CB_GPIO_FC4P1 = (5), /*! 4G 1port FC card */ CB_GPIO_DFLY= (6), /*! 8G 2port FC mezzanine card */ - CB_GPIO_PROTO = (1 7) /*! 8G 2port FC prototypes */ + CB_GPIO_PROTO = BIT(7)/*! 8G 2port FC prototypes */ }; #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index 2e72445..4247d8a 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c @@ -24,7 +24,7 @@ #include bfa_defs.h #define bfa_ioc_ct_sync_pos(__ioc) \ - ((u32) (1 bfa_ioc_pcifn(__ioc))) + ((u32)BIT(bfa_ioc_pcifn(__ioc))) #define BFA_IOC_SYNC_REQD_SH 16 #define bfa_ioc_ct_get_sync_ackd(__val) (__val 0x) #define bfa_ioc_ct_clear_sync_ackd(__val) (__val 0x) diff --git a/drivers/net/ethernet/brocade/bna/bfi_enet.h b/drivers/net/ethernet/brocade/bna/bfi_enet.h index fad3a12..d7be7ea8 100644 --- a/drivers/net/ethernet/brocade/bna/bfi_enet.h +++ b/drivers/net/ethernet/brocade/bna/bfi_enet.h @@ -68,13 +68,13 @@ union bfi_addr_be_u { #define BFI_ENET_TXQ_WI_EXTENSION (0x104) /* Extension WI */ /* TxQ Entry Control Flags */ -#define BFI_ENET_TXQ_WI_CF_FCOE_CRC(1 8) -#define BFI_ENET_TXQ_WI_CF_IPID_MODE (1 5) -#define BFI_ENET_TXQ_WI_CF_INS_PRIO(1 4) -#define BFI_ENET_TXQ_WI_CF_INS_VLAN(1 3) -#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM (1 2) -#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM (1 1) -#define BFI_ENET_TXQ_WI_CF_IP_CKSUM(1 0) +#define BFI_ENET_TXQ_WI_CF_FCOE_CRCBIT(8) +#define BFI_ENET_TXQ_WI_CF_IPID_MODE BIT(5) +#define BFI_ENET_TXQ_WI_CF_INS_PRIOBIT(4) +#define BFI_ENET_TXQ_WI_CF_INS_VLANBIT(3) +#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM BIT(2) +#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM BIT(1) +#define BFI_ENET_TXQ_WI_CF_IP_CKSUMBIT(0) struct bfi_enet_txq_wi_base { u8 reserved; @@ -122,32 +122,32 @@ struct bfi_enet_rxq_entry { /* R X C O M P L E T I O N Q U E U E D E F I N E S */ /* CQ Entry Flags */ -#defineBFI_ENET_CQ_EF_MAC_ERROR(1 0) -#defineBFI_ENET_CQ_EF_FCS_ERROR(1 1) -#defineBFI_ENET_CQ_EF_TOO_LONG (1 2) -#defineBFI_ENET_CQ_EF_FC_CRC_OK(1 3) +#define BFI_ENET_CQ_EF_MAC_ERROR BIT(0) +#define BFI_ENET_CQ_EF_FCS_ERROR BIT(1) +#define BFI_ENET_CQ_EF_TOO_LONGBIT(2) +#define BFI_ENET_CQ_EF_FC_CRC_OK BIT(3) -#defineBFI_ENET_CQ_EF_RSVD1(1 4) -#defineBFI_ENET_CQ_EF_L4_CKSUM_OK (1 5) -#defineBFI_ENET_CQ_EF_L3_CKSUM_OK (1 6) -#defineBFI_ENET_CQ_EF_HDS_HEADER (1 7) +#define BFI_ENET_CQ_EF_RSVD1 BIT(4) +#define BFI_ENET_CQ_EF_L4_CKSUM_OK BIT(5) +#define BFI_ENET_CQ_EF_L3_CKSUM_OK BIT(6) +#define BFI_ENET_CQ_EF_HDS_HEADER BIT(7) -#defineBFI_ENET_CQ_EF_UDP (1 8) -#defineBFI_ENET_CQ_EF_TCP (1 9) -#defineBFI_ENET_CQ_EF_IP_OPTIONS (1 10) -#defineBFI_ENET_CQ_EF_IPV6 (1 11) +#define BFI_ENET_CQ_EF_UDP BIT(8) +#define BFI_ENET_CQ_EF_TCP BIT(9) +#define BFI_ENET_CQ_EF_IP_OPTIONS BIT(10) +#define BFI_ENET_CQ_EF_IPV6BIT(11) -#defineBFI_ENET_CQ_EF_IPV4 (1 12) -#defineBFI_ENET_CQ_EF_VLAN (1 13) -#defineBFI_ENET_CQ_EF_RSS (1 14) -#defineBFI_ENET_CQ_EF_RSVD2(1 15) +#define BFI_ENET_CQ_EF_IPV4BIT(12) +#define BFI_ENET_CQ_EF_VLANBIT(13) +#define BFI_ENET_CQ_EF_RSS BIT(14) +#define BFI_ENET_CQ_EF_RSVD2 BIT(15) -#defineBFI_ENET_CQ_EF_MCAST_MATCH (1 16) -#defineBFI_ENET_CQ_EF_MCAST(1 17) -#define BFI_ENET_CQ_EF_BCAST (1 18) -#defineBFI_ENET_CQ_EF_REMOTE (1 19) +#define
[PATCH net-next v2 00/19] bna: clean-up
The patches clean the bna driver. v2: changes comments requested by Joe Ivan Vecera (19): bna: use ether_addr_copy instead of memcpy bna: get rid of mac_t bna: replace pragma(pack) with attribute __packed bna: get rid of duplicate and unused macros bna: use BIT(x) instead of (1 x) bna: remove unused cbfn parameter bna: remove pause_cbfn from struct bna_enet bna: remove oper_state_cbfn from struct bna_rxf bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx bna: remove RXF_E_PAUSE and RXF_E_RESUME events bna: remove paused from bna_rx_config and flags from bna_rxf bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag bna: correct comparisons/assignments to bool bna: use memdup_user to copy userspace buffers bna: remove useless pointer assignment bna: get rid of private macros for manipulation with lists bna: use list_for_each_entry where appropriate bna: fix timeout API argument type bna: use netdev_* and dev_* instead of printk and pr_* drivers/net/ethernet/brocade/bna/bfa_cee.c | 1 - drivers/net/ethernet/brocade/bna/bfa_cs.h | 14 - drivers/net/ethernet/brocade/bna/bfa_defs.h| 11 +- drivers/net/ethernet/brocade/bna/bfa_defs_cna.h| 16 +- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 8 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 61 +- drivers/net/ethernet/brocade/bna/bfa_ioc.h | 23 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 2 +- drivers/net/ethernet/brocade/bna/bfa_msgq.c| 10 +- drivers/net/ethernet/brocade/bna/bfi.h | 84 ++- drivers/net/ethernet/brocade/bna/bfi_cna.h | 30 +- drivers/net/ethernet/brocade/bna/bfi_enet.h| 176 +++--- drivers/net/ethernet/brocade/bna/bna.h | 186 +- drivers/net/ethernet/brocade/bna/bna_enet.c| 101 +--- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 665 + drivers/net/ethernet/brocade/bna/bna_types.h | 19 - drivers/net/ethernet/brocade/bna/bnad.c| 101 ++-- drivers/net/ethernet/brocade/bna/bnad.h| 2 +- drivers/net/ethernet/brocade/bna/bnad_debugfs.c| 61 +- drivers/net/ethernet/brocade/bna/bnad_ethtool.c| 15 +- drivers/net/ethernet/brocade/bna/cna.h | 62 -- drivers/net/ethernet/brocade/bna/cna_fwimg.c | 2 +- 23 files changed, 491 insertions(+), 1229 deletions(-) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 0/3] bna: clean-up 2
Next round of cleaning patches. Ivan Vecera (3): bna: remove unnecessary cast of BIT value bna: make pointers to read-only inputs const bna: remove superfluous parentheses .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 101 ++--- drivers/net/ethernet/brocade/bna/bna.h | 19 ++-- drivers/net/ethernet/brocade/bna/bna_enet.c| 4 +- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 18 ++-- drivers/net/ethernet/brocade/bna/bnad.c| 18 ++-- drivers/net/ethernet/brocade/bna/bnad.h| 2 +- drivers/net/ethernet/brocade/bna/bnad_debugfs.c| 6 +- 9 files changed, 89 insertions(+), 91 deletions(-) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 3/3] bna: remove superfluous parentheses
Signed-off-by: Ivan Vecera ivec...@redhat.com --- .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h | 2 +- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +-- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 98 +++--- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 4 +- drivers/net/ethernet/brocade/bna/bnad.c| 12 +-- drivers/net/ethernet/brocade/bna/bnad_debugfs.c| 6 +- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 16090fd..7e17451 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -84,7 +84,7 @@ do { \ (prop) |= BFI_ADAPTER_PROTO;\ (gpio) = ~CB_GPIO_PROTO; \ } \ - switch ((gpio)) { \ + switch (gpio) { \ case CB_GPIO_TTV: \ (prop) |= BFI_ADAPTER_TTV; \ case CB_GPIO_DFLY: \ diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index b009fd7..b7a0f78 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1304,7 +1304,7 @@ bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr) for (i = 0; i (sizeof(struct bfi_ioc_image_hdr) / sizeof(u32)); i++) { fwsig[i] = - swab32(readl((loff) + (ioc-ioc_regs.smem_page_start))); + swab32(readl(loff + ioc-ioc_regs.smem_page_start)); loff += sizeof(u32); } } @@ -1675,7 +1675,7 @@ bfa_raw_sem_get(void __iomem *bar) { int locked; - locked = readl((bar + FLASH_SEM_LOCK_REG)); + locked = readl(bar + FLASH_SEM_LOCK_REG); return !locked; } @@ -2049,8 +2049,8 @@ bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, /** * write smem */ - writel((swab32(fwimg[BFA_IOC_FLASH_OFFSET_IN_CHUNK(i)])), - ((ioc-ioc_regs.smem_page_start) + (loff))); + writel(swab32(fwimg[BFA_IOC_FLASH_OFFSET_IN_CHUNK(i)]), + ioc-ioc_regs.smem_page_start + loff); loff += sizeof(u32); @@ -2213,7 +2213,7 @@ bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 soff, u32 sz) len = sz/sizeof(u32); for (i = 0; i len; i++) { - r32 = swab32(readl((loff) + (ioc-ioc_regs.smem_page_start))); + r32 = swab32(readl(loff + ioc-ioc_regs.smem_page_start)); buf[i] = be32_to_cpu(r32); loff += sizeof(u32); diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index 8d5c239..74e5ed5 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c @@ -535,7 +535,7 @@ bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc) { u32 r32 = readl(ioc-ioc_regs.ioc_fail_sync); - writel((r32 | bfa_ioc_ct_sync_pos(ioc)), ioc-ioc_regs.ioc_fail_sync); + writel(r32 | bfa_ioc_ct_sync_pos(ioc), ioc-ioc_regs.ioc_fail_sync); } static bool @@ -666,7 +666,7 @@ bfa_ioc_ct_pll_init(void __iomem *rb, enum bfi_asic_mode asic_mode) writel(__PMM_1T_RESET_P, (rb + PMM_1T_RESET_REG_P0)); writel(__PMM_1T_RESET_P, (rb + PMM_1T_RESET_REG_P1)); } - r32 = readl((rb + PSS_CTL_REG)); + r32 = readl(rb + PSS_CTL_REG); r32 = ~__PSS_LMEM_RESET; writel(r32, (rb + PSS_CTL_REG)); udelay(1000); @@ -677,7 +677,7 @@ bfa_ioc_ct_pll_init(void __iomem *rb, enum bfi_asic_mode asic_mode) writel(__EDRAM_BISTR_START, (rb + MBIST_CTL_REG)); udelay(1000); - r32 = readl((rb + MBIST_STAT_REG)); + r32 = readl(rb + MBIST_STAT_REG); writel(0, (rb + MBIST_CTL_REG)); return BFA_STATUS_OK; } @@ -690,7 +690,7 @@ bfa_ioc_ct2_sclk_init(void __iomem *rb) /* * put s_clk PLL and PLL FSM in reset */ - r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); + r32 = readl(rb + CT2_APP_PLL_SCLK_CTL_REG); r32 = ~(__APP_PLL_SCLK_ENABLE | __APP_PLL_SCLK_LRESETN); r32 |= (__APP_PLL_SCLK_ENARST | __APP_PLL_SCLK_BYPASS | __APP_PLL_SCLK_LOGIC_SOFT_RESET); @@ -700,28 +700,28 @@ bfa_ioc_ct2_sclk_init(void __iomem *rb) * Ignore mode and program for the max clock (which is FC16) * Firmware/NFC will do the PLL init appropriately
[PATCH net-next 1/3] bna: remove unnecessary cast of BIT value
BIT value is already unsigned so casting is not necessary. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 3 +-- drivers/net/ethernet/brocade/bna/bna_enet.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index 4247d8a..8d5c239 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c @@ -23,8 +23,7 @@ #include bfi_reg.h #include bfa_defs.h -#define bfa_ioc_ct_sync_pos(__ioc) \ - ((u32)BIT(bfa_ioc_pcifn(__ioc))) +#define bfa_ioc_ct_sync_pos(__ioc) BIT(bfa_ioc_pcifn(__ioc)) #define BFA_IOC_SYNC_REQD_SH 16 #define bfa_ioc_ct_get_sync_ackd(__val) (__val 0x) #define bfa_ioc_ct_clear_sync_ackd(__val) (__val 0x) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index 05680e0..4e5c387 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -207,7 +207,7 @@ bna_bfi_stats_get_rsp(struct bna *bna, struct bfi_msgq_mhdr *msghdr) for (i = 0; i BFI_ENET_CFG_MAX; i++) { stats_dst = (u64 *)(bna-stats.hw_stats.rxf_stats[i]); memset(stats_dst, 0, sizeof(struct bfi_enet_stats_rxf)); - if (rx_enet_mask ((u32)BIT(i))) { + if (rx_enet_mask BIT(i)) { int k; count = sizeof(struct bfi_enet_stats_rxf) / sizeof(u64); @@ -222,7 +222,7 @@ bna_bfi_stats_get_rsp(struct bna *bna, struct bfi_msgq_mhdr *msghdr) for (i = 0; i BFI_ENET_CFG_MAX; i++) { stats_dst = (u64 *)(bna-stats.hw_stats.txf_stats[i]); memset(stats_dst, 0, sizeof(struct bfi_enet_stats_txf)); - if (tx_enet_mask ((u32)BIT(i))) { + if (tx_enet_mask BIT(i)) { int k; count = sizeof(struct bfi_enet_stats_txf) / sizeof(u64); -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 2/3] bna: make pointers to read-only inputs const
Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bna.h | 19 +-- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 14 +++--- drivers/net/ethernet/brocade/bna/bnad.c | 6 +++--- drivers/net/ethernet/brocade/bna/bnad.h | 2 +- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index dc845b2..006dcad 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h @@ -243,7 +243,7 @@ do { \ /* Inline functions */ -static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr) +static inline struct bna_mac *bna_mac_find(struct list_head *q, const u8 *addr) { struct bna_mac *mac; @@ -362,15 +362,14 @@ void bna_rx_cleanup_complete(struct bna_rx *rx); void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo); void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]); void bna_rx_dim_update(struct bna_ccb *ccb); -enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac); -enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist); -enum bna_cb_status -bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac, -void (*cbfn)(struct bnad *, struct bna_rx *)); -enum bna_cb_status -bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac); +enum bna_cb_status bna_rx_ucast_set(struct bna_rx *rx, const u8 *ucmac); +enum bna_cb_status bna_rx_ucast_listset(struct bna_rx *rx, int count, + const u8 *uclist); +enum bna_cb_status bna_rx_mcast_add(struct bna_rx *rx, const u8 *mcmac, + void (*cbfn)(struct bnad *, +struct bna_rx *)); +enum bna_cb_status bna_rx_mcast_listset(struct bna_rx *rx, int count, + const u8 *mcmac); void bna_rx_mcast_delall(struct bna_rx *rx); enum bna_cb_status diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 64eb8c4..33f5e55 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -353,7 +353,7 @@ bna_bfi_rss_enable(struct bna_rxf *rxf) /* This function gets the multicast MAC that has already been added to CAM */ static struct bna_mac * -bna_rxf_mcmac_get(struct bna_rxf *rxf, u8 *mac_addr) +bna_rxf_mcmac_get(struct bna_rxf *rxf, const u8 *mac_addr) { struct bna_mac *mac; @@ -729,7 +729,7 @@ bna_rxf_fail(struct bna_rxf *rxf) } enum bna_cb_status -bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac) +bna_rx_ucast_set(struct bna_rx *rx, const u8 *ucmac) { struct bna_rxf *rxf = rx-rxf; @@ -751,7 +751,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac) } enum bna_cb_status -bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, +bna_rx_mcast_add(struct bna_rx *rx, const u8 *addr, void (*cbfn)(struct bnad *, struct bna_rx *)) { struct bna_rxf *rxf = rx-rxf; @@ -780,12 +780,12 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr, } enum bna_cb_status -bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist) +bna_rx_ucast_listset(struct bna_rx *rx, int count, const u8 *uclist) { struct bna_ucam_mod *ucam_mod = rx-bna-ucam_mod; struct bna_rxf *rxf = rx-rxf; struct list_head list_head; - u8 *mcaddr; + const u8 *mcaddr; struct bna_mac *mac, *del_mac; int i; @@ -838,12 +838,12 @@ err_return: } enum bna_cb_status -bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist) +bna_rx_mcast_listset(struct bna_rx *rx, int count, const u8 *mclist) { struct bna_mcam_mod *mcam_mod = rx-bna-mcam_mod; struct bna_rxf *rxf = rx-rxf; struct list_head list_head; - u8 *mcaddr; + const u8 *mcaddr; struct bna_mac *mac, *del_mac; int i; diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 6be31ae..85c1470 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -2327,7 +2327,7 @@ bnad_rx_coalescing_timeo_set(struct bnad *bnad) * Called with bnad-bna_lock held */ int -bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr) +bnad_mac_addr_set_locked(struct bnad *bnad, const u8 *mac_addr) { int ret; @@ -2356,8 +2356,8 @@ bnad_enable_default_bcast(struct bnad *bnad) init_completion(bnad-bnad_completions.mcast_comp); spin_lock_irqsave(bnad-bna_lock, flags); - ret = bna_rx_mcast_add(rx_info-rx, (u8 *)bnad_bcast_addr, - bnad_cb_rx_mcast_add); + ret = bna_rx_mcast_add(rx_info-rx, bnad_bcast_addr, + bnad_cb_rx_mcast_add
Re: [PATCH net-next v2 05/19] bna: use BIT(x) instead of (1 x)
On 06/12/2015 03:30 PM, David Laight wrote: From: Ivan Vecera ... diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h index 679a503..16090fd 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h +++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h @@ -75,7 +75,7 @@ enum { CB_GPIO_FC4P2 = (4), /*! 4G 2port FC card*/ CB_GPIO_FC4P1 = (5), /*! 4G 1port FC card*/ CB_GPIO_DFLY= (6), /*! 8G 2port FC mezzanine card */ - CB_GPIO_PROTO = (1 7)/*! 8G 2port FC prototypes */ + CB_GPIO_PROTO = BIT(7)/*! 8G 2port FC prototypes */ That doesn't look like a BIT() value to me, just a large number. Should the release driver even have support for the prototype hardware? Why not? Does prototype HW need special driver? The CB_GPIO_PROTO is an indication and you can have e.g. (CB_GPIO_FC4P1 | CB_GPIO_PROTO) as 4G 1 port FC prototype card. ... - if (rx_enet_mask ((u32)(1 i))) { + if (rx_enet_mask ((u32)BIT(i))) { The (u32) cast looks superfluous. There are also too many (). Will fix. ... - int bit = (1 (vlan_id BFI_VLAN_WORD_MASK)); + int bit = BIT((vlan_id BFI_VLAN_WORD_MASK)); Too many () The same... David -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net 3/3] bna: fix soft lock-up during firmware initialization failure
Bug in the driver initialization causes soft-lockup if firmware initialization timeout is reached. Polling function bfa_ioc_poll_fwinit() incorrectly calls bfa_nw_iocpf_timeout() when the timeout is reached. The problem is that bfa_nw_iocpf_timeout() calls again bfa_ioc_poll_fwinit()... etc. The bfa_ioc_poll_fwinit() should directly send timeout event for iocpf and the same should be done if firmware download into HW fails. Cc: Rasesh Mody rasesh.m...@qlogic.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 594a2ab..68f3c13 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -2414,7 +2414,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, enum bfi_fwboot_type boot_type, if (status == BFA_STATUS_OK) bfa_ioc_lpu_start(ioc); else - bfa_nw_iocpf_timeout(ioc); + bfa_fsm_send_event(ioc-iocpf, IOCPF_E_TIMEOUT); return status; } @@ -3029,7 +3029,7 @@ bfa_ioc_poll_fwinit(struct bfa_ioc *ioc) } if (ioc-iocpf.poll_time = BFA_IOC_TOV) { - bfa_nw_iocpf_timeout(ioc); + bfa_fsm_send_event(ioc-iocpf, IOCPF_E_TIMEOUT); } else { ioc-iocpf.poll_time += BFA_IOC_POLL_TOV; mod_timer(ioc-iocpf_timer, jiffies + -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net 2/3] bna: remove unreasonable iocpf timer start
Driver starts iocpf timer prior bnad_ioceth_enable() call and this is unreasonable. This piece of code probably originates from Brocade/Qlogic out-of-box driver during initial import into upstream. This driver uses only one timer and queue to implement multiple timers and this timer is started at this place. The upstream driver uses multiple timers instead of this. Cc: Rasesh Mody rasesh.m...@qlogic.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 37072a8..caae6cb 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -3701,10 +3701,6 @@ bnad_pci_probe(struct pci_dev *pdev, setup_timer(bnad-bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout, ((unsigned long)bnad)); - /* Now start the timer before calling IOC */ - mod_timer(bnad-bna.ioceth.ioc.iocpf_timer, - jiffies + msecs_to_jiffies(BNA_IOC_TIMER_FREQ)); - /* * Start the chip * If the call back comes with error, we bail out. -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net 0/3] bna: misc bugfixes
These patches fix several bugs found during device initialization debugging. Cc: Rasesh Mody rasesh.m...@qlogic.com Ivan Vecera (3): bna: fix firmware loading on big-endian machines bna: remove unreasonable iocpf timer start bna: fix soft lock-up during firmware initialization failure drivers/net/ethernet/brocade/bna/bfa_ioc.c | 4 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 4 drivers/net/ethernet/brocade/bna/cna_fwimg.c | 7 +++ 3 files changed, 9 insertions(+), 6 deletions(-) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net 1/3] bna: fix firmware loading on big-endian machines
Firmware required by bna is stored in appropriate files as sequence of LE32 integers. After loading by request_firmware() they need to be byte-swapped on big-endian arches. Without this conversion the NIC is unusable on big-endian machines. Cc: Rasesh Mody rasesh.m...@qlogic.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/cna_fwimg.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/brocade/bna/cna_fwimg.c b/drivers/net/ethernet/brocade/bna/cna_fwimg.c index ebf462d..badea36 100644 --- a/drivers/net/ethernet/brocade/bna/cna_fwimg.c +++ b/drivers/net/ethernet/brocade/bna/cna_fwimg.c @@ -30,6 +30,7 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image, u32 *bfi_image_size, char *fw_name) { const struct firmware *fw; + u32 n; if (request_firmware(fw, fw_name, pdev-dev)) { pr_alert(Can't locate firmware %s\n, fw_name); @@ -40,6 +41,12 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image, *bfi_image_size = fw-size/sizeof(u32); bfi_fw = fw; + /* Convert loaded firmware to host order as it is stored in file +* as sequence of LE32 integers. +*/ + for (n = 0; n *bfi_image_size; n++) + le32_to_cpus(*bfi_image + n); + return *bfi_image; error: return NULL; -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] r8169: Add tx_buf_sz and rx_buf_coef on rtl_cfg_info
On 17.8.2015 13:10, Corcodel Marian wrote: Put rx_buf_sz on rtl_cfg_info structure and add new parameter rx_buf_coef.Param rx_buf_sz may be different by nic's and same rx_buf_coef On RTL 8101 series rx_buf_coef is not equal with rx_buf_sz. Add --whitespace=warn on git Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 6882eab..fecb7c9 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -344,7 +344,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); -static int rx_buf_sz = 16383; +//static int rx_buf_sz = 16383; static int use_dac; static struct { u32 msg_enable; @@ -784,6 +784,8 @@ struct rtl8169_private { u16 cp_cmd; u16 event_slow; +u16 rx_buf_sz; +u16 rx_buf_coef; struct mdio_ops { void (*write)(struct rtl8169_private *, int, int); @@ -5321,7 +5323,7 @@ static void rtl_hw_start_8169(struct net_device *dev) RTL_W8(EarlyTxThres, NoEarlyTx); - rtl_set_rx_max_size(ioaddr, rx_buf_sz); + rtl_set_rx_max_size(ioaddr, tp-rx_buf_sz); if (tp-mac_version == RTL_GIGA_MAC_VER_01 || tp-mac_version == RTL_GIGA_MAC_VER_02 || @@ -6229,7 +6231,7 @@ static void rtl_hw_start_8168(struct net_device *dev) RTL_W8(MaxTxPacketSize, TxPacketMax); - rtl_set_rx_max_size(ioaddr, rx_buf_sz); + rtl_set_rx_max_size(ioaddr, tp-rx_buf_sz); tp-cp_cmd |= RTL_R16(CPlusCmd) | PktCntrDisable | INTT_1; @@ -6523,7 +6525,7 @@ static void rtl_hw_start_8101(struct net_device *dev) RTL_W8(MaxTxPacketSize, TxPacketMax); - rtl_set_rx_max_size(ioaddr, rx_buf_sz); + rtl_set_rx_max_size(ioaddr, tp-rx_buf_sz); tp-cp_cmd = ~R810X_CPCMD_QUIRK_MASK; RTL_W16(CPlusCmd, tp-cp_cmd); @@ -6609,7 +6611,7 @@ static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) static void rtl8169_free_rx_databuff(struct rtl8169_private *tp, void **data_buff, struct RxDesc *desc) { - dma_unmap_single(tp-pci_dev-dev, le64_to_cpu(desc-addr), rx_buf_sz, + dma_unmap_single(tp-pci_dev-dev, le64_to_cpu(desc-addr), tp-rx_buf_sz, DMA_FROM_DEVICE); kfree(*data_buff); @@ -6617,21 +6619,22 @@ static void rtl8169_free_rx_databuff(struct rtl8169_private *tp, rtl8169_make_unusable_by_asic(desc); } -static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz) +static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz, +u32 rx_buf_coef) { u32 eor = le32_to_cpu(desc-opts1) RingEnd; /* Force memory writes to complete before releasing descriptor */ dma_wmb(); - desc-opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz); + desc-opts1 = cpu_to_le32(DescOwn | eor | (rx_buf_sz rx_buf_coef)); } static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, - u32 rx_buf_sz) + u32 rx_buf_sz, u32 rx_buf_coef) { desc-addr = cpu_to_le64(mapping); - rtl8169_mark_to_asic(desc, rx_buf_sz); + rtl8169_mark_to_asic(desc, rx_buf_sz, rx_buf_coef); } static inline void *rtl8169_align(void *data) @@ -6648,18 +6651,18 @@ static struct sk_buff *rtl8169_alloc_rx_data(struct rtl8169_private *tp, struct net_device *dev = tp-dev; int node = dev-dev.parent ? dev_to_node(dev-dev.parent) : -1; - data = kmalloc_node(rx_buf_sz, GFP_KERNEL, node); + data = kmalloc_node(tp-rx_buf_sz, GFP_KERNEL, node); if (!data) return NULL; if (rtl8169_align(data) != data) { kfree(data); - data = kmalloc_node(rx_buf_sz + 15, GFP_KERNEL, node); + data = kmalloc_node(tp-rx_buf_sz + 15, GFP_KERNEL, node); if (!data) return NULL; } - mapping = dma_map_single(d, rtl8169_align(data), rx_buf_sz, + mapping = dma_map_single(d, rtl8169_align(data), tp-rx_buf_sz, DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(d, mapping))) { if (net_ratelimit()) @@ -6667,7 +6670,7 @@ static struct sk_buff *rtl8169_alloc_rx_data(struct rtl8169_private *tp, goto err_out; } - rtl8169_map_to_asic(desc, mapping, rx_buf_sz); + rtl8169_map_to_asic(desc, mapping, tp-rx_buf_sz, tp-rx_buf_coef); return data; err_out: @@ -6785,7 +6788,8 @@ static void rtl_reset_work(struct rtl8169_private *tp) rtl8169_hw_reset(tp); for (i = 0; i NUM_RX_DESC; i++) - rtl8169_mark_to_asic(tp-RxDescArray + i, rx_buf_sz); + rtl8169_mark_to_asic(tp-RxDescArray
Re: [PATCH net-next]:r8169: Add and modify some parameters
On 17.8.2015 12:26, Corcodel Marian wrote: Set InterFrame Gap time as largest posible for comp. Add InterFrameGap2 bit set on start. Why? Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index eb2d2a4..ea0f327 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -86,7 +86,8 @@ static const int multicast_filter_limit = 32; #define MAX_READ_REQUEST_SHIFT12 #define TX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ -#define InterFrameGap 0x03/* 3 means InterFrameGap = the shortest one */ +#define InterFrameGap 0x02/* 2 means InterFrameGap = the largest one */ +#define InterFrameGap2 0x8 #define R8169_REGS_SIZE 256 #define R8169_NAPI_WEIGHT 64 @@ -5180,7 +5181,7 @@ static void rtl_set_rx_tx_config_registers(struct rtl8169_private *tp) /* Set DMA burst size and Interframe Gap Time */ RTL_W32(TxConfig, (TX_DMA_BURST TxDMAShift) | - (InterFrameGap TxInterFrameGapShift)); + (InterFrameGap TxInterFrameGapShift) | InterFrameGap2); } static void rtl_hw_start(struct net_device *dev) @@ -7470,15 +7471,22 @@ static int rtl8169_poll(struct napi_struct *napi, int budget) u16 enable_mask = RTL_EVENT_NAPI | tp-event_slow; int work_done= 0; u16 status; +int tx_force = 1; status = rtl_get_events(tp); rtl_ack_events(tp, status ~tp-event_slow); - + if (netif_running(dev)) { if (status RTL_EVENT_NAPI_RX) work_done = rtl_rx(dev, tp, (u32) budget); + if (status RTL_EVENT_NAPI_TX) rtl_tx(dev, tp); + else if (tx_force == 1) { +mdelay(10); +rtl_tx(dev, tp); + } +} if (status tp-event_slow) { enable_mask = ~tp-event_slow; Why this piece of code??? This was already rejected. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] r8169:Fill with zero Tx descriptors
On 5.8.2015 12:46, Corcodel Marian wrote: This patch fill with zero Tx descriptors before use.Is only onpart by more patches but is critical.(critical) Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 3df51fa..bf78f94 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -7589,7 +7589,7 @@ static int rtl_open(struct net_device *dev) * Rx and Tx descriptors needs 256 bytes alignment. * dma_alloc_coherent provides more. */ - tp-TxDescArray = dma_alloc_coherent(pdev-dev, R8169_TX_RING_BYTES, + tp-TxDescArray = dma_zalloc_coherent(pdev-dev, R8169_TX_RING_BYTES, tp-TxPhyAddr, GFP_KERNEL); if (!tp-TxDescArray) goto err_pm_runtime_put; Why? Why is zero-filling of tx-ring critical??? Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] bna: fix interrupts storm caused by erroneous packets
The commit e29aa33 bna: Enable Multi Buffer RX moved packets counter increment from the beginning of the NAPI processing loop after the check for erroneous packets so they are never accounted. This counter is used to inform firmware about number of processed completions (packets). As these packets are never acked the firmware fires IRQs for them again and again. Fixes: e29aa33 bna: Enable Multi Buffer RX Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/brocade/bna/bnad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 0612b19..506047c 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -676,6 +676,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) if (!next_cmpl-valid) break; } + packets++; /* TODO: BNA_CQ_EF_LOCAL ? */ if (unlikely(flags (BNA_CQ_EF_MAC_ERROR | @@ -692,7 +693,6 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) else bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len); - packets++; rcb-rxq-rx_packets++; rcb-rxq-rx_bytes += totlen; ccb-bytes_per_intr += totlen; -- 2.4.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] r8169: enforce RX_MULTI_EN on rtl8168ep/8111ep chips
Enforcing this flag in RxConfig for the mentioned chips fixes netdev watchdog issues prepended with AMD IOMMU message(s) like: AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x001d address=0x3000 flags=0x0050] Note that this flag is also set in Realtek's own driver for these chips. Signed-off-by: Ivan Vecera ivec...@redhat.com Tested-by: Alexander Lindqvist alexan...@bitspace.se --- drivers/net/ethernet/realtek/r8169.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 3df51fa..f790f61 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -4875,10 +4875,12 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) case RTL_GIGA_MAC_VER_46: case RTL_GIGA_MAC_VER_47: case RTL_GIGA_MAC_VER_48: + RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); + break; case RTL_GIGA_MAC_VER_49: case RTL_GIGA_MAC_VER_50: case RTL_GIGA_MAC_VER_51: - RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); + RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); break; default: RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST); -- 2.4.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] be2net: avoid vxlan offloading on multichannel configs
VxLAN offloading is not functional if the NIC is running in multichannel mode (UMC, FLEX-10, VNIC...). Enabling this additionally kills whole connectivity through the NIC and the device needs to be down and up to restore it. The firmware should take care about it and does not allow the conversion of interface to tunnel type (be_cmd_manage_iface) or should support VxLAN offloading if multichannel config is enabled. I have tested this on the latest available firmware (10.6.144.21). Result: [root@sm-04 ~]# ip link set enp5s0f0 up[root@sm-04 ~]# ip addr add 172.30.10.50/24 dev enp5s0f0 [root@sm-04 ~]# ping -c 3 172.30.10.254PING 172.30.10.254 (172.30.10.254) 56(84) bytes of data. 64 bytes from 172.30.10.254: icmp_seq=1 ttl=64 time=0.317 ms 64 bytes from 172.30.10.254: icmp_seq=2 ttl=64 time=0.187 ms 64 bytes from 172.30.10.254: icmp_seq=3 ttl=64 time=0.188 ms --- 172.30.10.254 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.187/0.230/0.317/0.063 ms [root@sm-04 ~]# ip link add link enp5s0f0 vxlan10 type vxlan id 10 remote 172.30.10.60 dstport 4789 [root@sm-04 ~]# ip link set vxlan10 up [ 7900.442811] be2net :05:00.0: Enabled VxLAN offloads for UDP port 4789 [ 7900.455722] be2net :05:00.1: Enabled VxLAN offloads for UDP port 4789 [ 7900.468635] be2net :05:00.2: Enabled VxLAN offloads for UDP port 4789 [ 7900.481553] be2net :05:00.3: Enabled VxLAN offloads for UDP port 4789 [root@sm-04 ~]# ping -c 3 172.30.10.254 PING 172.30.10.254 (172.30.10.254) 56(84) bytes of data. --- 172.30.10.254 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 1999ms [root@sm-04 ~]# ip link set vxlan10 down [ 7959.434093] be2net :05:00.0: Disabled VxLAN offloads for UDP port 4789 [ 7959.444792] be2net :05:00.1: Disabled VxLAN offloads for UDP port 4789 [ 7959.455592] be2net :05:00.2: Disabled VxLAN offloads for UDP port 4789 [ 7959.466416] be2net :05:00.3: Disabled VxLAN offloads for UDP port 4789 [root@sm-04 ~]# ip link del vxlan10 [root@sm-04 ~]# ping -c 3 172.30.10.254 PING 172.30.10.254 (172.30.10.254) 56(84) bytes of data. --- 172.30.10.254 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 1999ms [root@sm-04 ~]# ip link set enp5s0f0 down [root@sm-04 ~]# ip link set enp5s0f0 up [ 8071.019003] be2net :05:00.0 enp5s0f0: Link is Up [root@sm-04 ~]# ping -c 3 172.30.10.254 PING 172.30.10.254 (172.30.10.254) 56(84) bytes of data. 64 bytes from 172.30.10.254: icmp_seq=1 ttl=64 time=0.318 ms 64 bytes from 172.30.10.254: icmp_seq=2 ttl=64 time=0.196 ms 64 bytes from 172.30.10.254: icmp_seq=3 ttl=64 time=0.194 ms --- 172.30.10.254 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.194/0.236/0.318/0.057 ms Cc: Sathya Perla sathya.pe...@avagotech.com Cc: Ajit Khaparde ajit.khapa...@avagotech.com Cc: Padmanabh Ratnakar padmanabh.ratna...@avagotech.com Cc: Sriharsha Basavapatna sriharsha.basavapa...@avagotech.com Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/ethernet/emulex/benet/be_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index c28e3bf..6ca693b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -5174,7 +5174,7 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, struct device *dev = adapter-pdev-dev; int status; - if (lancer_chip(adapter) || BEx_chip(adapter)) + if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) return; if (adapter-flags BE_FLAGS_VXLAN_OFFLOADS) { @@ -5221,7 +5221,7 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, { struct be_adapter *adapter = netdev_priv(netdev); - if (lancer_chip(adapter) || BEx_chip(adapter)) + if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) return; if (adapter-vxlan_port != port) -- 2.4.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts
Network header is set with offset ETH_HLEN but it is not true for VLAN (multiple-)tagged and results in checksum issues in lower devices. v2: leave skb-protocol untouched (thx Vlad), comment added v3: moved after skb_probe_transport_header() call (thx Toshiaki) Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/macvtap.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3b933bb..edd7734 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -719,6 +719,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, struct virtio_net_hdr vnet_hdr = { 0 }; int vnet_hdr_len = 0; int copylen = 0; + int depth; bool zerocopy = false; size_t linear; ssize_t n; @@ -804,6 +805,12 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, skb_probe_transport_header(skb, ETH_HLEN); + /* Move network header to the right position for VLAN tagged packets */ + if ((skb-protocol == htons(ETH_P_8021Q) || +skb-protocol == htons(ETH_P_8021AD)) + __vlan_get_protocol(skb, skb-protocol, depth) != 0) + skb_set_network_header(skb, depth); + rcu_read_lock(); vlan = rcu_dereference(q-vlan); /* copy skb_ubuf_info for callback when skb has no error */ -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] macvtap: fix network header pointer for VLAN tagged pkts
Network header is set with offset ETH_HLEN but it is not true for VLAN (multiple-)tagged and results in checksum issues in lower devices. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/macvtap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3b933bb..cdcbab4 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -796,6 +796,12 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, skb_reset_mac_header(skb); skb-protocol = eth_hdr(skb)-h_proto; + if (skb_vlan_tagged(skb)) { + int depth; + skb-protocol = __vlan_get_protocol(skb, skb-protocol, depth); + skb_set_network_header(skb, depth); + } + if (vnet_hdr_len) { err = macvtap_skb_from_vnet_hdr(q, skb, vnet_hdr); if (err) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts
On 07/20/2015 06:42 PM, Vlad Yasevich wrote: On 07/20/2015 11:44 AM, Ivan Vecera wrote: Network header is set with offset ETH_HLEN but it is not true for VLAN (multiple-)tagged and results in checksum issues in lower devices. Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/macvtap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3b933bb..cdcbab4 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -796,6 +796,12 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, skb_reset_mac_header(skb); skb-protocol = eth_hdr(skb)-h_proto; + if (skb_vlan_tagged(skb)) { + int depth; + skb-protocol = __vlan_get_protocol(skb, skb-protocol, depth); I don't think this is right. This would reset the protocol to the encapsulated protocol which isn't really the case since you are not really stripping vlan encapsulations. -vlad Yup, you are right, skb-protocol should be untouched. Will post v2. Ivan -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts
Network header is set with offset ETH_HLEN but it is not true for VLAN (multiple-)tagged and results in checksum issues in lower devices. v2: leave skb-protocol untouched (thx Vlad), comment added Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/macvtap.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3b933bb..b75776b 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -796,6 +796,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, skb_reset_mac_header(skb); skb-protocol = eth_hdr(skb)-h_proto; + /* Move network header to the right position for VLAN tagged packets */ + if (skb_vlan_tagged(skb)) { + int depth; + __vlan_get_protocol(skb, skb-protocol, depth); + skb_set_network_header(skb, depth); + } + if (vnet_hdr_len) { err = macvtap_skb_from_vnet_hdr(q, skb, vnet_hdr); if (err) -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 1/2] be2net: remove unused local rsstable array
Remove rsstable array and its initialization from be_set_rss_hash_opts(). The array became unused after "e255787 be2net: Support for configurable RSS hash key". The initial RSS table is now filled and stored for later usage during Rx queue creation. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_ethtool.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 26b6192..3d8c6c1 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -1064,9 +1064,7 @@ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, static int be_set_rss_hash_opts(struct be_adapter *adapter, struct ethtool_rxnfc *cmd) { - struct be_rx_obj *rxo; - int status = 0, i, j; - u8 rsstable[128]; + int status; u32 rss_flags = adapter->rss_info.rss_flags; if (cmd->data != L3_RSS_FLAGS && @@ -1115,17 +1113,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter, } if (rss_flags == adapter->rss_info.rss_flags) - return status; - - if (be_multi_rxq(adapter)) { - for (j = 0; j < 128; j += adapter->num_rss_qs) { - for_all_rss_queues(adapter, rxo, i) { - if ((j + i) >= 128) - break; - rsstable[j + i] = rxo->rss_id; - } - } - } + return 0; status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable, rss_flags, 128, adapter->rss_info.rss_hkey); -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 2/2] be2net: replace hardcoded values with existing define
Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_ethtool.c | 3 ++- drivers/net/ethernet/emulex/benet/be_main.c| 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 3d8c6c1..2362304 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -1116,7 +1116,8 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter, return 0; status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable, - rss_flags, 128, adapter->rss_info.rss_hkey); + rss_flags, RSS_INDIR_TABLE_LEN, + adapter->rss_info.rss_hkey); if (!status) adapter->rss_info.rss_flags = rss_flags; diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index eb48a97..b6ad029 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3518,7 +3518,7 @@ static int be_rx_qs_create(struct be_adapter *adapter) netdev_rss_key_fill(rss_key, RSS_HASH_KEY_LEN); rc = be_cmd_rss_config(adapter, rss->rsstable, rss->rss_flags, - 128, rss_key); + RSS_INDIR_TABLE_LEN, rss_key); if (rc) { rss->rss_flags = RSS_ENABLE_NONE; return rc; -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] be2net: check properly status in lancer_cmd_get_file_len()
The lancer_cmd_get_file_len() calls lancer_cmd_read_object() to get the current size of registers for ethtool registers dump. The size is stored in data_read but only when the returned status is 0 otherwise it is uninitialized thus random. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index f4cb8e4..26b6192 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -248,6 +248,8 @@ static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name) status = lancer_cmd_read_object(adapter, _len_cmd, 0, 0, file_name, _read, , _status); + if (status) + return 0; return data_read; } -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] be2net: check properly status in lancer_cmd_get_file_len()
On 11/16/2015 09:57 AM, Sathya Perla wrote: On Fri, Nov 13, 2015 at 3:22 PM, Ivan Vecera <ivec...@redhat.com> wrote: The lancer_cmd_get_file_len() calls lancer_cmd_read_object() to get the current size of registers for ethtool registers dump. The size is stored in data_read but only when the returned status is 0 otherwise it is uninitialized thus random. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index f4cb8e4..26b6192 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -248,6 +248,8 @@ static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name) status = lancer_cmd_read_object(adapter, _len_cmd, 0, 0, file_name, _read, , _status); + if (status) + return 0; return data_read; Ivan, unless I'm missing something...I see that "data_read" is initialized to 0 in this routine. So, this routine will return 0 when lancer_cmd_read_object() returns a non-zero status. Yeah, you are right...my bad eyes. I was confused that status is read but not checked... In this case 'status' var can be removed. Ivan -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] drivers/net: get rid of unnecessary initializations in .get_drvinfo()
Many drivers initialize uselessly n_priv_flags, n_stats, testinfo_len, eedump_len & regdump_len fields in their .get_drvinfo() ethtool op. It's not necessary as these fields is filled in ethtool_get_drvinfo(). Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/infiniband/hw/nes/nes_nic.c | 3 --- drivers/net/ethernet/aeroflex/greth.c | 2 -- drivers/net/ethernet/amd/au1000_eth.c | 1 - drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 1 - drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c | 4 drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c | 4 drivers/net/ethernet/atheros/atlx/atl1.c| 1 - drivers/net/ethernet/atheros/atlx/atl2.c| 4 drivers/net/ethernet/broadcom/bcm63xx_enet.c| 2 -- drivers/net/ethernet/broadcom/bcmsysport.c | 1 - drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 4 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 1 - drivers/net/ethernet/dec/tulip/de2104x.c| 1 - drivers/net/ethernet/emulex/benet/be_ethtool.c | 3 --- drivers/net/ethernet/freescale/gianfar_ethtool.c| 2 -- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 2 -- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c| 1 - drivers/net/ethernet/ibm/emac/core.c| 1 - drivers/net/ethernet/intel/e1000/e1000_ethtool.c| 2 -- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 -- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c| 4 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 - drivers/net/ethernet/intel/igb/igb_ethtool.c| 4 drivers/net/ethernet/intel/igbvf/ethtool.c | 2 -- drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c | 3 --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c| 3 --- drivers/net/ethernet/marvell/mv643xx_eth.c | 1 - drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 --- drivers/net/ethernet/neterion/s2io.c| 2 -- drivers/net/ethernet/neterion/vxge/vxge-ethtool.c | 4 drivers/net/ethernet/octeon/octeon_mgmt.c | 4 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c | 1 - drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c | 2 -- drivers/net/ethernet/qlogic/qla3xxx.c | 2 -- drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | 7 --- drivers/net/ethernet/realtek/8139too.c | 1 - drivers/net/ethernet/sun/cassini.c | 3 --- drivers/net/ethernet/tehuti/tehuti.c| 5 - drivers/net/ethernet/ti/cpmac.c | 1 - drivers/net/ethernet/ti/cpsw.c | 1 - drivers/net/ethernet/ti/tlan.c | 1 - drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 1 - drivers/net/fjes/fjes_ethtool.c | 2 -- drivers/net/usb/asix_common.c | 1 - drivers/net/usb/dm9601.c| 1 - drivers/net/usb/mcs7830.c | 1 - drivers/net/usb/sr9800.c| 1 - drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 drivers/net/wireless/ipw2x00/ipw2200.c | 1 - 50 files changed, 110 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 70acda9..6a0bdfa 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c @@ -1325,9 +1325,6 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev, "%u.%u", nesadapter->firmware_version >> 16, nesadapter->firmware_version & 0x00ff); strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); - drvinfo->testinfo_len = 0; - drvinfo->eedump_len = 0; - drvinfo->regdump_len = 0; } diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index ae89de7..20bf55d 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -1141,8 +1141,6 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in strlcpy(info->version, "revision: 1.0", sizeof(info->version)); strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); - info->eedump_len = 0; - info->regdump_len = sizeof(struct greth_regs); } static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/
[PATCH net-next v2] drivers/net: get rid of unnecessary initializations in .get_drvinfo()
Many drivers initialize uselessly n_priv_flags, n_stats, testinfo_len, eedump_len & regdump_len fields in their .get_drvinfo() ethtool op. It's not necessary as these fields is filled in ethtool_get_drvinfo(). v2: removed unused variable Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/infiniband/hw/nes/nes_nic.c | 3 --- drivers/net/ethernet/aeroflex/greth.c | 2 -- drivers/net/ethernet/amd/au1000_eth.c | 1 - drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 1 - drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c | 4 drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c | 4 drivers/net/ethernet/atheros/atlx/atl1.c| 1 - drivers/net/ethernet/atheros/atlx/atl2.c| 4 drivers/net/ethernet/broadcom/bcm63xx_enet.c| 2 -- drivers/net/ethernet/broadcom/bcmsysport.c | 1 - drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 4 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 1 - drivers/net/ethernet/dec/tulip/de2104x.c| 1 - drivers/net/ethernet/emulex/benet/be_ethtool.c | 3 --- drivers/net/ethernet/freescale/gianfar_ethtool.c| 2 -- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 2 -- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c| 1 - drivers/net/ethernet/ibm/emac/core.c| 1 - drivers/net/ethernet/intel/e1000/e1000_ethtool.c| 2 -- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 -- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c| 4 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 - drivers/net/ethernet/intel/igb/igb_ethtool.c| 4 drivers/net/ethernet/intel/igbvf/ethtool.c | 2 -- drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c | 3 --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c| 3 --- drivers/net/ethernet/marvell/mv643xx_eth.c | 1 - drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 --- drivers/net/ethernet/neterion/s2io.c| 2 -- drivers/net/ethernet/neterion/vxge/vxge-ethtool.c | 4 drivers/net/ethernet/octeon/octeon_mgmt.c | 4 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c | 1 - drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c | 2 -- drivers/net/ethernet/qlogic/qla3xxx.c | 2 -- drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | 7 --- drivers/net/ethernet/realtek/8139too.c | 1 - drivers/net/ethernet/sun/cassini.c | 3 --- drivers/net/ethernet/tehuti/tehuti.c| 5 - drivers/net/ethernet/ti/cpmac.c | 1 - drivers/net/ethernet/ti/cpsw.c | 1 - drivers/net/ethernet/ti/tlan.c | 1 - drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 1 - drivers/net/fjes/fjes_ethtool.c | 2 -- drivers/net/usb/asix_common.c | 1 - drivers/net/usb/dm9601.c| 1 - drivers/net/usb/mcs7830.c | 1 - drivers/net/usb/sr9800.c| 2 -- drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 drivers/net/wireless/ipw2x00/ipw2200.c | 1 - 50 files changed, 111 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 70acda9..6a0bdfa 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c @@ -1325,9 +1325,6 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev, "%u.%u", nesadapter->firmware_version >> 16, nesadapter->firmware_version & 0x00ff); strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); - drvinfo->testinfo_len = 0; - drvinfo->eedump_len = 0; - drvinfo->regdump_len = 0; } diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index ae89de7..20bf55d 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -1141,8 +1141,6 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in strlcpy(info->version, "revision: 1.0", sizeof(info->version)); strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); - info->eedump_len = 0; - info->regdump_len = sizeof(struct greth_regs); } static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) diff --git a/drivers/net/ethernet/amd/au1000_eth
[PATCH net-next v3] drivers/net: get rid of unnecessary initializations in .get_drvinfo()
Many drivers initialize uselessly n_priv_flags, n_stats, testinfo_len, eedump_len & regdump_len fields in their .get_drvinfo() ethtool op. It's not necessary as these fields is filled in ethtool_get_drvinfo(). v2: removed unused variable v3: removed another unused variable Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/infiniband/hw/nes/nes_nic.c | 3 --- drivers/net/ethernet/aeroflex/greth.c | 2 -- drivers/net/ethernet/amd/au1000_eth.c | 1 - drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 1 - drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c | 4 drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c | 4 drivers/net/ethernet/atheros/atlx/atl1.c| 1 - drivers/net/ethernet/atheros/atlx/atl2.c| 4 drivers/net/ethernet/broadcom/bcm63xx_enet.c| 2 -- drivers/net/ethernet/broadcom/bcmsysport.c | 1 - drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 4 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 1 - drivers/net/ethernet/dec/tulip/de2104x.c| 1 - drivers/net/ethernet/emulex/benet/be_ethtool.c | 3 --- drivers/net/ethernet/freescale/gianfar_ethtool.c| 2 -- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 2 -- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c| 1 - drivers/net/ethernet/ibm/emac/core.c| 1 - drivers/net/ethernet/intel/e1000/e1000_ethtool.c| 2 -- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 -- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c| 4 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 - drivers/net/ethernet/intel/igb/igb_ethtool.c| 4 drivers/net/ethernet/intel/igbvf/ethtool.c | 2 -- drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c | 3 --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c| 3 --- drivers/net/ethernet/marvell/mv643xx_eth.c | 1 - drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 --- drivers/net/ethernet/neterion/s2io.c| 2 -- drivers/net/ethernet/neterion/vxge/vxge-ethtool.c | 4 drivers/net/ethernet/octeon/octeon_mgmt.c | 4 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c | 1 - drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c | 2 -- drivers/net/ethernet/qlogic/qla3xxx.c | 2 -- drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | 7 --- drivers/net/ethernet/realtek/8139too.c | 1 - drivers/net/ethernet/sun/cassini.c | 3 --- drivers/net/ethernet/tehuti/tehuti.c| 5 - drivers/net/ethernet/ti/cpmac.c | 1 - drivers/net/ethernet/ti/cpsw.c | 1 - drivers/net/ethernet/ti/tlan.c | 1 - drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 1 - drivers/net/fjes/fjes_ethtool.c | 2 -- drivers/net/usb/asix_common.c | 1 - drivers/net/usb/dm9601.c| 1 - drivers/net/usb/mcs7830.c | 1 - drivers/net/usb/sr9800.c| 4 drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 drivers/net/wireless/ipw2x00/ipw2200.c | 1 - 50 files changed, 113 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 70acda9..6a0bdfa 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c @@ -1325,9 +1325,6 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev, "%u.%u", nesadapter->firmware_version >> 16, nesadapter->firmware_version & 0x00ff); strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); - drvinfo->testinfo_len = 0; - drvinfo->eedump_len = 0; - drvinfo->regdump_len = 0; } diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index ae89de7..20bf55d 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -1141,8 +1141,6 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in strlcpy(info->version, "revision: 1.0", sizeof(info->version)); strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); - info->eedump_len = 0; - info->regdump_len = sizeof(struct greth_regs); } static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) diff --git
[PATCH] ethtool: fix typo in man page
Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- ethtool.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethtool.8.in b/ethtool.8.in index ae56293..eeffa70 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -872,7 +872,7 @@ Enables/disables the device support of EEE. Determines whether the device should assert its Tx LPI. .TP .BI advertise \ N -Sets the speeds for which the device should advertise EEE capabiliities. +Sets the speeds for which the device should advertise EEE capabilities. Values are as for .B \-\-change advertise .TP -- 2.4.9 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] bna: check for dma mapping errors
Check for DMA mapping errors, recover from them and register them in ethtool stats like other errors. Cc: Rasesh Mody <rasesh.m...@qlogic.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 2 ++ drivers/net/ethernet/brocade/bna/bna_types.h| 1 + drivers/net/ethernet/brocade/bna/bnad.c | 29 - drivers/net/ethernet/brocade/bna/bnad.h | 2 ++ drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 4 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 5d0753c..04b0d16 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -2400,6 +2400,7 @@ bna_rx_create(struct bna *bna, struct bnad *bnad, q0->rcb->id = 0; q0->rx_packets = q0->rx_bytes = 0; q0->rx_packets_with_error = q0->rxbuf_alloc_failed = 0; + q0->rxbuf_map_failed = 0; bna_rxq_qpt_setup(q0, rxp, dpage_count, PAGE_SIZE, _mem[i], _mem[i], _mem[i]); @@ -2428,6 +2429,7 @@ bna_rx_create(struct bna *bna, struct bnad *bnad, : rx_cfg->q1_buf_size; q1->rx_packets = q1->rx_bytes = 0; q1->rx_packets_with_error = q1->rxbuf_alloc_failed = 0; + q1->rxbuf_map_failed = 0; bna_rxq_qpt_setup(q1, rxp, hpage_count, PAGE_SIZE, _mem[i], _mem[i], diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index e0e797f..c438d03 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -587,6 +587,7 @@ struct bna_rxq { u64 rx_bytes; u64 rx_packets_with_error; u64 rxbuf_alloc_failed; + u64 rxbuf_map_failed; }; /* RxQ pair */ diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 506047c..21a0cfc 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -399,7 +399,13 @@ bnad_rxq_refill_page(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) } dma_addr = dma_map_page(>pcidev->dev, page, page_offset, - unmap_q->map_size, DMA_FROM_DEVICE); + unmap_q->map_size, DMA_FROM_DEVICE); + if (dma_mapping_error(>pcidev->dev, dma_addr)) { + put_page(page); + BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); + rcb->rxq->rxbuf_map_failed++; + goto finishing; + } unmap->page = page; unmap->page_offset = page_offset; @@ -454,8 +460,15 @@ bnad_rxq_refill_skb(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) rcb->rxq->rxbuf_alloc_failed++; goto finishing; } + dma_addr = dma_map_single(>pcidev->dev, skb->data, buff_sz, DMA_FROM_DEVICE); + if (dma_mapping_error(>pcidev->dev, dma_addr)) { + dev_kfree_skb_any(skb); + BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); + rcb->rxq->rxbuf_map_failed++; + goto finishing; + } unmap->skb = skb; dma_unmap_addr_set(>vector, dma_addr, dma_addr); @@ -3025,6 +3038,11 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) unmap = head_unmap; dma_addr = dma_map_single(>pcidev->dev, skb->data, len, DMA_TO_DEVICE); + if (dma_mapping_error(>pcidev->dev, dma_addr)) { + dev_kfree_skb_any(skb); + BNAD_UPDATE_CTR(bnad, tx_skb_map_failed); + return NETDEV_TX_OK; + } BNA_SET_DMA_ADDR(dma_addr, >vector[0].host_addr); txqent->vector[0].length = htons(len); dma_unmap_addr_set(>vectors[0], dma_addr, dma_addr); @@ -3056,6 +3074,15 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) dma_addr = skb_frag_dma_map(>pcidev->dev, frag, 0, size, DMA_TO_DEVICE); + if (dma_mapping_error(>pcidev->dev, dma_addr)) { + /* Undo the changes starting at tcb->producer_index */ + bnad_tx_buff_unmap(bnad, unmap_q, q_depth, +
[PATCH net-next] be2net: remove local variable 'status'
The lancer_cmd_get_file_len() uses lancer_cmd_read_object() to get the current size of registers for ethtool registers dump. Returned status value is stored but not checked. The check itself is not necessary as the data_read output variable is initialized to 0 and status variable can be removed. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_ethtool.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 734f655..d2a5baf 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -241,13 +241,11 @@ static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name) u32 data_read = 0, eof; u8 addn_status; struct be_dma_mem data_len_cmd; - int status; memset(_len_cmd, 0, sizeof(data_len_cmd)); /* data_offset and data_size should be 0 to get reg len */ - status = lancer_cmd_read_object(adapter, _len_cmd, 0, 0, - file_name, _read, , - _status); + lancer_cmd_read_object(adapter, _len_cmd, 0, 0, file_name, + _read, , _status); return data_read; } -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2] team: don't call netdev_change_features under team->lock
The team_device_event() notifier calls team_compute_features() to fix vlan_features under team->lock to protect team->port_list. The problem is that subsequent __team_compute_features() calls netdev_change_features() to propagate vlan_features to upper vlan devices while team->lock is still taken. This can lead to deadlock when NETIF_F_LRO is modified on lower devices or team device itself. Example: The team0 as active backup with eth0 and eth1 NICs. Both eth0 & eth1 are LRO capable and LRO is enabled. Thus LRO is also enabled on team0. The command 'ethtool -K team0 lro off' now hangs due to this deadlock: dev_ethtool() -> ethtool_set_features() -> __netdev_update_features(team) -> netdev_sync_lower_features() -> netdev_update_features(lower_1) -> __netdev_update_features(lower_1) -> netdev_features_change(lower_1) -> call_netdevice_notifiers(...) -> team_device_event(lower_1) -> team_compute_features(team) [TAKES team->lock] -> netdev_change_features(team) -> __netdev_update_features(team) -> netdev_sync_lower_features() -> netdev_update_features(lower_2) -> __netdev_update_features(lower_2) -> netdev_features_change(lower_2) -> call_netdevice_notifiers(...) -> team_device_event(lower_2) -> team_compute_features(team) [DEADLOCK] The bug is present in team from the beginning but it appeared after the commit fd867d5 (net/core: generic support for disabling netdev features down stack) that adds synchronization of features with lower devices. Fixes: fd867d5 (net/core: generic support for disabling netdev features down stack) Cc: Jiri Pirko <j...@resnulli.us> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/team/team.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 718ceea..800a449 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -988,7 +988,7 @@ static void team_port_disable(struct team *team, #define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ NETIF_F_RXCSUM | NETIF_F_ALL_TSO) -static void __team_compute_features(struct team *team) +static void ___team_compute_features(struct team *team) { struct team_port *port; u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL; @@ -1019,15 +1019,20 @@ static void __team_compute_features(struct team *team) team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM)) team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; +} +static void __team_compute_features(struct team *team) +{ + ___team_compute_features(team); netdev_change_features(team->dev); } static void team_compute_features(struct team *team) { mutex_lock(>lock); - __team_compute_features(team); + ___team_compute_features(team); mutex_unlock(>lock); + netdev_change_features(team->dev); } static int team_port_enter(struct team *team, struct team_port *port) -- 2.7.3
[PATCH net-next] be2net: don't report EVB for older chipsets when SR-IOV is disabled
The EVB (virtual bridge) functionality should be disabled on older BE3 and Lancer chips if SR-IOV is disabled in the NIC's BIOS. This setting is identified by the zero value of total VFs reported by the card. The GET_HSW_CONFIG command cannot be used as it is not supported by these older chipset's FW. Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Ajit Khaparde <ajit.khapa...@broadcom.com> Cc: Padmanabh Ratnakar <padmanabh.ratna...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Cc: Somnath Kotur <somnath.ko...@broadcom.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9c1fc9d..886fe95 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4588,6 +4588,8 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, /* BE and Lancer chips support VEB mode only */ if (BEx_chip(adapter) || lancer_chip(adapter)) { + if (!pci_sriov_get_totalvfs(adapter->pdev)) + return 0; hsw_mode = PORT_FWD_TYPE_VEB; } else { status = be_cmd_get_hsw_config(adapter, NULL, 0, -- 2.4.10
Re: [PATCH net-next] be2net: don't report EVB for older chipsets when SR-IOV is disabled
On 11.2.2016 10:56, Sathya Perla wrote: On Wed, Feb 10, 2016 at 1:13 PM, Ivan Vecera <ivec...@redhat.com> wrote: The EVB (virtual bridge) functionality should be disabled on older BE3 and Lancer chips if SR-IOV is disabled in the NIC's BIOS. This setting is identified by the zero value of total VFs reported by the card. The GET_HSW_CONFIG command cannot be used as it is not supported > by these older chipset's FW. .. --- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9c1fc9d..886fe95 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4588,6 +4588,8 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, /* BE and Lancer chips support VEB mode only */ if (BEx_chip(adapter) || lancer_chip(adapter)) { + if (!pci_sriov_get_totalvfs(adapter->pdev)) + return 0; Ivan, could you add a one line comment above this check that says "On BE3/Lancer the VEB is disabled in non-SRIOV profiles". This is to differentiate this behavior from Skyhawk, where the VEB may be enabled even in non-SRIOV profiles, like nPAR... thanks, -Sathya Sure Sathya, will send v2. Ivan
[PATCH net-next v2] be2net: don't report EVB for older chipsets when SR-IOV is disabled
The EVB (virtual bridge) functionality should be disabled on older BE3 and Lancer chips if SR-IOV is disabled in the NIC's BIOS. This setting is identified by the zero value of total VFs reported by the card. The GET_HSW_CONFIG command cannot be used as it is not supported by these older chipset's FW. v2: added the comment Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Ajit Khaparde <ajit.khapa...@broadcom.com> Cc: Padmanabh Ratnakar <padmanabh.ratna...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Cc: Somnath Kotur <somnath.ko...@broadcom.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9c1fc9d..10a0ad5 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4588,6 +4588,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, /* BE and Lancer chips support VEB mode only */ if (BEx_chip(adapter) || lancer_chip(adapter)) { + /* VEB is disabled in non-SR-IOV profiles on BE3/Lancer */ + if (!pci_sriov_get_totalvfs(adapter->pdev)) + return 0; hsw_mode = PORT_FWD_TYPE_VEB; } else { status = be_cmd_get_hsw_config(adapter, NULL, 0, -- 2.4.10
Re: [patch net-next RFC 1/6] Introduce devlink infrastructure
On 3.2.2016 11:47, Jiri Pirko wrote: +struct devlink_ops { + size_t priv_size; + int (*port_type_set)(struct devlink_port *devlink_port, +enum devlink_port_type port_type); +}; It does not make sense to have priv_size member here... If it is necessary it should be placed in struct devlink. Ivan
[PATCH net] bna: fix list corruption
Use list_move_tail() to move MAC address entry from list of pending to list of active entries. Simple list_add_tail() leaves the entry also in the first list, this leads to list corruption. Cc: Rasesh Mody <rasesh.m...@qlogic.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 04b0d16..95bc470 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c @@ -987,7 +987,7 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf) if (!list_empty(>ucast_pending_add_q)) { mac = list_first_entry(>ucast_pending_add_q, struct bna_mac, qe); - list_add_tail(>qe, >ucast_active_q); + list_move_tail(>qe, >ucast_active_q); bna_bfi_ucast_req(rxf, mac, BFI_ENET_H2I_MAC_UCAST_ADD_REQ); return 1; } -- 2.4.10
[PATCH net] be2net: don't {en,dis}able filters on BE3 when transparent tagging is enabled
The FILTMGMT privilege is necessary on BE3 chip to manipulare filters like MC, UC list management, VLAN filter, promisc mode... This privilege is dropped for VFs when transparrent tagging is enabled on them. This prevents to make interface up for such VF because be_enable_if_filters() called from be_open() fails thus be_open() also fails. Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_main.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index f99de36..2e176f6 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3430,7 +3430,8 @@ static int be_close(struct net_device *netdev) if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) return 0; - be_disable_if_filters(adapter); + if (!(BEx_chip(adapter) && be_pvid_tagging_enabled(adapter))) + be_disable_if_filters(adapter); if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { for_all_evt_queues(adapter, eqo, i) { @@ -3571,9 +3572,11 @@ static int be_open(struct net_device *netdev) if (status) goto err; - status = be_enable_if_filters(adapter); - if (status) - goto err; + if (!(BEx_chip(adapter) && be_pvid_tagging_enabled(adapter))) { + status = be_enable_if_filters(adapter); + if (status) + goto err; + } status = be_irq_register(adapter); if (status) -- 2.4.10
Re: [PATCH net] be2net: don't {en,dis}able filters on BE3 when transparent tagging is enabled
On 26.2.2016 12:36, Sathya Perla wrote: On Fri, Feb 26, 2016 at 2:16 PM, Ivan Vecera <ivec...@redhat.com> wrote: The FILTMGMT privilege is necessary on BE3 chip to manipulare filters like MC, UC list management, VLAN filter, promisc mode... This privilege is dropped for VFs when transparrent tagging is enabled on them. This prevents to make interface up for such VF because be_enable_if_filters() called from be_open() fails thus be_open() also fails. Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/emulex/benet/be_main.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index f99de36..2e176f6 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3430,7 +3430,8 @@ static int be_close(struct net_device *netdev) if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) return 0; - be_disable_if_filters(adapter); + if (!(BEx_chip(adapter) && be_pvid_tagging_enabled(adapter))) + be_disable_if_filters(adapter); if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { for_all_evt_queues(adapter, eqo, i) { @@ -3571,9 +3572,11 @@ static int be_open(struct net_device *netdev) if (status) goto err; - status = be_enable_if_filters(adapter); - if (status) - goto err; + if (!(BEx_chip(adapter) && be_pvid_tagging_enabled(adapter))) { + status = be_enable_if_filters(adapter); + if (status) + goto err; Ivan, in the be_enable_if_filters() routine the VF tries to enable the basic filtering flags (not promisc mode etc) via the RX_FILTER cmd, for which the VFs shouldn't need any FILTMGMT privileges. I also don't expect be_cmd_pmac_add() to fail as the PF would have already provisioned the mac-addr for the VF. We should be able to reproduce this first thing Monday morning and see what's wrong. Also, as the privilege rules are same across all chips, any fix must be applicable for all chips that be2net supports. Hi Sathya, if the transparent VLAN tagging is enabled then be_enable_if_filters() will fail and be_open() will also fail. This happens only on BE3 not on Lancer as this does not support SR-IOV. I don't see any problem on Skyhawk. Log from the guest after 'ip link set ... up': [root@bootp-73-131-183 ~]# dmesg | tail -n 20 pci :00:07.0: no hotplug settings from platform be2net :00:07.0: be2net version is 10.6.0.3r be2net :00:07.0: enabling device (0040 -> 0042) be2net :00:07.0: setting latency timer to 64 be2net :00:07.0: FW config: function_mode=0x14003, function_caps=0x4 be2net :00:07.0: VF is not privileged to issue opcode 125-1 be2net :00:07.0: Max: txqs 1, rxqs 1, rss 0, eqs 1, vfs 0 be2net :00:07.0: Max: uc-macs 2, mc-macs 64, vlans 64 alloc irq_desc for 29 on node -1 alloc kstat_irqs on node -1 be2net :00:07.0: irq 29 for MSI/MSI-X be2net :00:07.0: enabled 1 MSI-x vector(s) for NIC be2net :00:07.0: created 1 TX queue(s) be2net :00:07.0: created 1 RX queue(s) be2net :00:07.0: LPVID: 3 be2net :00:07.0: FW version is 10.4.255.25 be2net :00:07.0: HW Flow control - TX:1 RX:1 be2net :00:07.0: Emulex OneConnect(be3): VF port 0 be2net :00:07.0: VF is not privileged to issue opcode 34-1 be2net :00:07.0: VF is not privileged to issue opcode 60-1 The be_open() calls be_enable_if_filters() -> be_cmd_rx_filter(). Command with opcode 34 alias NTWK_RX_FILTER fails thus be_open() also fails and be_close() is called as cleaning-up action. The be_close() calls then be_disable_if_filters() that calls be_cmd_pmac_del() (opcode 60). This also fails. As I has written above under Skyhawk this does not happen... so I has created BE3 specific patch. Ivan
Re: [PATCH net] be2net: don't {en,dis}able filters on BE3 when transparent tagging is enabled
On 26.2.2016 13:44, Sathya Perla wrote: On Fri, Feb 26, 2016 at 5:54 PM, Ivan Vecera <ivec...@redhat.com> wrote: On 26.2.2016 12:36, Sathya Perla wrote: On Fri, Feb 26, 2016 at 2:16 PM, Ivan Vecera <ivec...@redhat.com> wrote: The FILTMGMT privilege is necessary on BE3 chip to manipulare filters like MC, UC list management, VLAN filter, promisc mode... This privilege is dropped for VFs when transparrent tagging is enabled on them. This prevents to make interface up for such VF because be_enable_if_filters() called from be_open() fails thus be_open() also fails. Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Signed-off-by: Ivan Vecera <ivec...@redhat.com> ... Ivan, in the be_enable_if_filters() routine the VF tries to enable the basic filtering flags (not promisc mode etc) via the RX_FILTER cmd, for which the VFs shouldn't need any FILTMGMT privileges. I also don't expect be_cmd_pmac_add() to fail as the PF would have already provisioned the mac-addr for the VF. We should be able to reproduce this first thing Monday morning and see what's wrong. Also, as the privilege rules are same across all chips, any fix must be applicable for all chips that be2net supports. Hi Sathya, if the transparent VLAN tagging is enabled then be_enable_if_filters() will fail and be_open() will also fail. This happens only on BE3 not on Lancer as this does not support SR-IOV. I don't see any problem on Skyhawk. Log from the guest after 'ip link set ... up': [root@bootp-73-131-183 ~]# dmesg | tail -n 20 pci :00:07.0: no hotplug settings from platform be2net :00:07.0: be2net version is 10.6.0.3r be2net :00:07.0: enabling device (0040 -> 0042) be2net :00:07.0: setting latency timer to 64 be2net :00:07.0: FW config: function_mode=0x14003, function_caps=0x4 be2net :00:07.0: VF is not privileged to issue opcode 125-1 be2net :00:07.0: Max: txqs 1, rxqs 1, rss 0, eqs 1, vfs 0 be2net :00:07.0: Max: uc-macs 2, mc-macs 64, vlans 64 alloc irq_desc for 29 on node -1 alloc kstat_irqs on node -1 be2net :00:07.0: irq 29 for MSI/MSI-X be2net :00:07.0: enabled 1 MSI-x vector(s) for NIC be2net :00:07.0: created 1 TX queue(s) be2net :00:07.0: created 1 RX queue(s) be2net :00:07.0: LPVID: 3 be2net :00:07.0: FW version is 10.4.255.25 be2net :00:07.0: HW Flow control - TX:1 RX:1 be2net :00:07.0: Emulex OneConnect(be3): VF port 0 be2net :00:07.0: VF is not privileged to issue opcode 34-1 be2net :00:07.0: VF is not privileged to issue opcode 60-1 The be_open() calls be_enable_if_filters() -> be_cmd_rx_filter(). Command with opcode 34 alias NTWK_RX_FILTER fails thus be_open() also fails and be_close() is called as cleaning-up action. The be_close() calls then be_disable_if_filters() that calls be_cmd_pmac_del() (opcode 60). This also fails. As I has written above under Skyhawk this does not happen... so I has created BE3 specific patch. Ivan, thanks for the dmesg log. I think the root-cause of this issue is the MULTICAST bit in the BE_IF_EN_FLAGS. The FW is not allowing the VF driver's be_cmd_rx_filter(BE_IF_EN_FLAGS) call. In be_enable_if_filters() we are sensitive to this error, but in be_set_rx_mode() we ignore any FW errors. I'll provide an update Monday morningthanks! Should the MULTICAST bit be masked in any be_cmd_rx_filter() call on BE3's VFs if the trans. tagging is enabled? Ivan
Re: [PATCH ethtool] ethtool.c: fix memory leaks
On 18.3.2016 13:24, Ivan Vecera wrote: Memory allocated at several places is not appropriately freed. Signed-off-by: Ivan Vecera <ivec...@redhat.com> Ben, ping. I. --- ethtool.c | 60 +--- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/ethtool.c b/ethtool.c index 0cd0d4f..ca0bf28 100644 --- a/ethtool.c +++ b/ethtool.c @@ -2065,10 +2065,14 @@ static int do_gfeatures(struct cmd_context *ctx) features = get_features(ctx, defs); if (!features) { fprintf(stdout, "no feature info available\n"); + free(defs); return 1; } dump_features(defs, features, NULL); + + free(features); + free(defs); return 0; } @@ -2078,11 +2082,11 @@ static int do_sfeatures(struct cmd_context *ctx) int any_changed = 0, any_mismatch = 0; u32 off_flags_wanted = 0; u32 off_flags_mask = 0; - struct ethtool_sfeatures *efeatures; + struct ethtool_sfeatures *efeatures = NULL; struct cmdline_info *cmdline_features; - struct feature_state *old_state, *new_state; + struct feature_state *old_state = NULL, *new_state = NULL; struct ethtool_value eval; - int err; + int err, retval = 1; int i, j; defs = get_feature_defs(ctx); @@ -2096,7 +2100,7 @@ static int do_sfeatures(struct cmd_context *ctx) sizeof(efeatures->features[0])); if (!efeatures) { perror("Cannot parse arguments"); - return 1; + goto finish; } efeatures->cmd = ETHTOOL_SFEATURES; efeatures->size = FEATURE_BITS_TO_BLOCKS(defs->n_features); @@ -2114,7 +2118,7 @@ static int do_sfeatures(struct cmd_context *ctx) sizeof(cmdline_features[0])); if (!cmdline_features) { perror("Cannot parse arguments"); - return 1; + goto finish; } for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) flag_to_cmdline_info(off_flag_def[i].short_name, @@ -2133,12 +2137,13 @@ static int do_sfeatures(struct cmd_context *ctx) if (!any_changed) { fprintf(stdout, "no features changed\n"); - return 0; + retval = 0; + goto finish; } old_state = get_features(ctx, defs); if (!old_state) - return 1; + goto finish; if (efeatures) { /* For each offload that the user specified, update any @@ -2182,7 +2187,7 @@ static int do_sfeatures(struct cmd_context *ctx) err = send_ioctl(ctx, efeatures); if (err < 0) { perror("Cannot set device feature settings"); - return 1; + goto finish; } } else { for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) { @@ -2197,7 +2202,7 @@ static int do_sfeatures(struct cmd_context *ctx) fprintf(stderr, "Cannot set device %s settings: %m\n", off_flag_def[i].long_name); - return 1; + goto finish; } } } @@ -2211,7 +2216,8 @@ static int do_sfeatures(struct cmd_context *ctx) err = send_ioctl(ctx, ); if (err) { perror("Cannot set device flag settings"); - return 92; + retval = 92; + goto finish; } } } @@ -2219,7 +2225,7 @@ static int do_sfeatures(struct cmd_context *ctx) /* Compare new state with requested state */ new_state = get_features(ctx, defs); if (!new_state) - return 1; + goto finish; any_changed = new_state->off_flags != old_state->off_flags; any_mismatch = (new_state->off_flags != ((old_state->off_flags & ~off_flags_mask) | @@ -2238,13 +2244,19 @@ static int do_sfeatures(struct cmd_context *ctx) if (!any_changed) { fprintf(stderr, "Could not change any device features\n"); - return 1; + goto finish; } printf("Actual changes:\n"); dump_features(defs, new_state, old_state); } -
[PATCH ethtool] ethtool.c: fix memory leaks
Memory allocated at several places is not appropriately freed. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- ethtool.c | 60 +--- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/ethtool.c b/ethtool.c index 0cd0d4f..ca0bf28 100644 --- a/ethtool.c +++ b/ethtool.c @@ -2065,10 +2065,14 @@ static int do_gfeatures(struct cmd_context *ctx) features = get_features(ctx, defs); if (!features) { fprintf(stdout, "no feature info available\n"); + free(defs); return 1; } dump_features(defs, features, NULL); + + free(features); + free(defs); return 0; } @@ -2078,11 +2082,11 @@ static int do_sfeatures(struct cmd_context *ctx) int any_changed = 0, any_mismatch = 0; u32 off_flags_wanted = 0; u32 off_flags_mask = 0; - struct ethtool_sfeatures *efeatures; + struct ethtool_sfeatures *efeatures = NULL; struct cmdline_info *cmdline_features; - struct feature_state *old_state, *new_state; + struct feature_state *old_state = NULL, *new_state = NULL; struct ethtool_value eval; - int err; + int err, retval = 1; int i, j; defs = get_feature_defs(ctx); @@ -2096,7 +2100,7 @@ static int do_sfeatures(struct cmd_context *ctx) sizeof(efeatures->features[0])); if (!efeatures) { perror("Cannot parse arguments"); - return 1; + goto finish; } efeatures->cmd = ETHTOOL_SFEATURES; efeatures->size = FEATURE_BITS_TO_BLOCKS(defs->n_features); @@ -2114,7 +2118,7 @@ static int do_sfeatures(struct cmd_context *ctx) sizeof(cmdline_features[0])); if (!cmdline_features) { perror("Cannot parse arguments"); - return 1; + goto finish; } for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) flag_to_cmdline_info(off_flag_def[i].short_name, @@ -2133,12 +2137,13 @@ static int do_sfeatures(struct cmd_context *ctx) if (!any_changed) { fprintf(stdout, "no features changed\n"); - return 0; + retval = 0; + goto finish; } old_state = get_features(ctx, defs); if (!old_state) - return 1; + goto finish; if (efeatures) { /* For each offload that the user specified, update any @@ -2182,7 +2187,7 @@ static int do_sfeatures(struct cmd_context *ctx) err = send_ioctl(ctx, efeatures); if (err < 0) { perror("Cannot set device feature settings"); - return 1; + goto finish; } } else { for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) { @@ -2197,7 +2202,7 @@ static int do_sfeatures(struct cmd_context *ctx) fprintf(stderr, "Cannot set device %s settings: %m\n", off_flag_def[i].long_name); - return 1; + goto finish; } } } @@ -2211,7 +2216,8 @@ static int do_sfeatures(struct cmd_context *ctx) err = send_ioctl(ctx, ); if (err) { perror("Cannot set device flag settings"); - return 92; + retval = 92; + goto finish; } } } @@ -2219,7 +2225,7 @@ static int do_sfeatures(struct cmd_context *ctx) /* Compare new state with requested state */ new_state = get_features(ctx, defs); if (!new_state) - return 1; + goto finish; any_changed = new_state->off_flags != old_state->off_flags; any_mismatch = (new_state->off_flags != ((old_state->off_flags & ~off_flags_mask) | @@ -2238,13 +2244,19 @@ static int do_sfeatures(struct cmd_context *ctx) if (!any_changed) { fprintf(stderr, "Could not change any device features\n"); - return 1; + goto finish; } printf("Actual changes:\n"); dump_features(defs, new_state, old_state); } - return 0; + retval = 0; +finish: + free(new_state); +
[PATCH net] team: don't call netdev_change_features under team->lock
The team_device_event() notifier calls team_compute_features() to fix vlan_features under team->lock to protect team->port_list. The problem is that subsequent __team_compute_features() calls netdev_change_features() to propagate vlan_features to upper vlan devices while team->lock is still taken. This can lead to deadlock when NETIF_F_LRO is modified on lower devices or team device itself. Example: The team0 as active backup with eth0 and eth1 NICs. Both eth0 & eth1 are LRO capable and LRO is enabled. Thus LRO is also enabled on team0. The command 'ethtool -K team0 lro off' now hangs due to this deadlock: dev_ethtool() -> ethtool_set_features() -> __netdev_update_features(team) -> netdev_sync_lower_features() -> netdev_update_features(lower_1) -> __netdev_update_features(lower_1) -> netdev_features_change(lower_1) -> call_netdevice_notifiers(...) -> team_device_event(lower_1) -> team_compute_features(team) [TAKES team->lock] -> netdev_change_features(team) -> __netdev_update_features(team) -> netdev_sync_lower_features() -> netdev_update_features(lower_2) -> __netdev_update_features(lower_2) -> netdev_features_change(lower_2) -> call_netdevice_notifiers(...) -> team_device_event(lower_2) -> team_compute_features(team) [DEADLOCK] Cc: Jiri Pirko <j...@resnulli.us> Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/team/team.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 718ceea..800a449 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -988,7 +988,7 @@ static void team_port_disable(struct team *team, #define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ NETIF_F_RXCSUM | NETIF_F_ALL_TSO) -static void __team_compute_features(struct team *team) +static void ___team_compute_features(struct team *team) { struct team_port *port; u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL; @@ -1019,15 +1019,20 @@ static void __team_compute_features(struct team *team) team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM)) team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; +} +static void __team_compute_features(struct team *team) +{ + ___team_compute_features(team); netdev_change_features(team->dev); } static void team_compute_features(struct team *team) { mutex_lock(>lock); - __team_compute_features(team); + ___team_compute_features(team); mutex_unlock(>lock); + netdev_change_features(team->dev); } static int team_port_enter(struct team *team, struct team_port *port) -- 2.7.3
Re: [PATCH net-next 2/3] bna: change type of bna_id to atomic_t
On 1.8.2016 16:20, David Laight wrote: From: Ivan Vecera Sent: 29 July 2016 18:53 Change type of bna_id to atomic_t. The bnad_list_mutex is used to prevent a race when bna_id is incremented. After the change the mutex can be removed in the next step. ... -static u32 bna_id; +static atomic_t bna_id; ... bnad_lock_init(bnad); bnad_add_to_list(bnad); + bnad->id = atomic_inc_return(_id) - 1; ... Is the 'id' expected to be unique? Looks like they get reallocated after 2^32 allocates. David I have just converted it to atomic type to eliminate mutex. The id is only used as parameter 'instance' for bfa_nw_flash_{update,read}_part(). There is no documentation in source code regarding this so this is a question to Qlogic. Ivan
Re: [PATCH ethtool] ethtool.c: fix memory leaks
On 26.6.2016 10:59, Ben Hutchings wrote: On Fri, 2016-03-18 at 13:24 +0100, Ivan Vecera wrote: Memory allocated at several places is not appropriately freed. Given that ethtool is not a library or a long-running application - why does that matter? Ben. Because each decently written program should clean up. Sure the kernel will take care about it after exit but we cannot accept the fact that short-running applications can behave like a pig. Ivan
[PATCH net-next 1/3] bna: remove useless linked list
Remove global variable bnad_list and bnad->list_entry that are used as list of bna driver instances. It is not necessary and useless. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/brocade/bna/bnad.c | 3 --- drivers/net/ethernet/brocade/bna/bnad.h | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 771cc26..696bbae 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -56,7 +56,6 @@ MODULE_PARM_DESC(bna_debugfs_enable, "Enables debugfs feature, default=1," static u32 bnad_rxqs_per_cq = 2; static u32 bna_id; static struct mutex bnad_list_mutex; -static LIST_HEAD(bnad_list); static const u8 bnad_bcast_addr[] __aligned(2) = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -80,7 +79,6 @@ static void bnad_add_to_list(struct bnad *bnad) { mutex_lock(_list_mutex); - list_add_tail(>list_entry, _list); bnad->id = bna_id++; mutex_unlock(_list_mutex); } @@ -89,7 +87,6 @@ static void bnad_remove_from_list(struct bnad *bnad) { mutex_lock(_list_mutex); - list_del(>list_entry); mutex_unlock(_list_mutex); } diff --git a/drivers/net/ethernet/brocade/bna/bnad.h b/drivers/net/ethernet/brocade/bna/bnad.h index f4ed816..46f7b84 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.h +++ b/drivers/net/ethernet/brocade/bna/bnad.h @@ -288,7 +288,6 @@ struct bnad_rx_unmap_q { struct bnad { struct net_device *netdev; u32 id; - struct list_headlist_entry; /* Data path */ struct bnad_tx_info tx_info[BNAD_MAX_TX]; -- 2.7.3
[PATCH net-next 2/3] bna: change type of bna_id to atomic_t
Change type of bna_id to atomic_t. The bnad_list_mutex is used to prevent a race when bna_id is incremented. After the change the mutex can be removed in the next step. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/brocade/bna/bnad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 696bbae..2bed050 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -54,7 +54,7 @@ MODULE_PARM_DESC(bna_debugfs_enable, "Enables debugfs feature, default=1," * Global variables */ static u32 bnad_rxqs_per_cq = 2; -static u32 bna_id; +static atomic_t bna_id; static struct mutex bnad_list_mutex; static const u8 bnad_bcast_addr[] __aligned(2) = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -79,7 +79,6 @@ static void bnad_add_to_list(struct bnad *bnad) { mutex_lock(_list_mutex); - bnad->id = bna_id++; mutex_unlock(_list_mutex); } @@ -3651,6 +3650,7 @@ bnad_pci_probe(struct pci_dev *pdev, bnad = netdev_priv(netdev); bnad_lock_init(bnad); bnad_add_to_list(bnad); + bnad->id = atomic_inc_return(_id) - 1; mutex_lock(>conf_mutex); /* -- 2.7.3
[PATCH net-next 3/3] bna: remove global bnad_list_mutex
Remove global bnad_list_mutex as it is not used anymore. This makes bnad_add_to_list() and bnad_remove_from_list() empty so remove them too. Signed-off-by: Ivan Vecera <ivec...@redhat.com> --- drivers/net/ethernet/brocade/bna/bnad.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 2bed050..f9df4b5 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -55,7 +55,6 @@ MODULE_PARM_DESC(bna_debugfs_enable, "Enables debugfs feature, default=1," */ static u32 bnad_rxqs_per_cq = 2; static atomic_t bna_id; -static struct mutex bnad_list_mutex; static const u8 bnad_bcast_addr[] __aligned(2) = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -75,20 +74,6 @@ do { \ (_res_info)->res_u.mem_info.len = (_size); \ } while (0) -static void -bnad_add_to_list(struct bnad *bnad) -{ - mutex_lock(_list_mutex); - mutex_unlock(_list_mutex); -} - -static void -bnad_remove_from_list(struct bnad *bnad) -{ - mutex_lock(_list_mutex); - mutex_unlock(_list_mutex); -} - /* * Reinitialize completions in CQ, once Rx is taken down */ @@ -3569,14 +3554,12 @@ bnad_lock_init(struct bnad *bnad) { spin_lock_init(>bna_lock); mutex_init(>conf_mutex); - mutex_init(_list_mutex); } static void bnad_lock_uninit(struct bnad *bnad) { mutex_destroy(>conf_mutex); - mutex_destroy(_list_mutex); } /* PCI Initialization */ @@ -3649,7 +3632,6 @@ bnad_pci_probe(struct pci_dev *pdev, } bnad = netdev_priv(netdev); bnad_lock_init(bnad); - bnad_add_to_list(bnad); bnad->id = atomic_inc_return(_id) - 1; mutex_lock(>conf_mutex); @@ -3804,7 +3786,6 @@ pci_uninit: bnad_pci_uninit(pdev); unlock_mutex: mutex_unlock(>conf_mutex); - bnad_remove_from_list(bnad); bnad_lock_uninit(bnad); free_netdev(netdev); return err; @@ -3842,7 +3823,6 @@ bnad_pci_remove(struct pci_dev *pdev) bnad_disable_msix(bnad); bnad_pci_uninit(pdev); mutex_unlock(>conf_mutex); - bnad_remove_from_list(bnad); bnad_lock_uninit(bnad); /* Remove the debugfs node for this bnad */ kfree(bnad->regdata); -- 2.7.3
[PATCH net-next 0/3] bna: remove useless global variables
The set removes useless global bnad_list as well as bnad->entry that track a list of driver instances but it is not used anywhere. The associated bnad_list_mutex is removed as well but as it is also used to protect bna_id increment it is necessary to convert bna_id to atomic_t. Signed-off-by: Ivan Vecera <ivec...@redhat.com> drivers/net/ethernet/brocade/bna/bnad.c | 27 ++- drivers/net/ethernet/brocade/bna/bnad.h | 1 - 2 files changed, 2 insertions(+), 26 deletions(-) -- 2.7.3
Re: [PATCH net] be2net: fix initial MAC setting
My apologies for my previous replies... Gmail sent them as HTML emails that are not acceptable for ML... Thanks, Ivan
[PATCH net v2] be2net: fix initial MAC setting
Recent commit 34393529163a ("be2net: fix MAC addr setting on privileged BE3 VFs") allows privileged BE3 VFs to set its MAC address during initialization. Although the initial MAC for such VFs is already programmed by parent PF the subsequent setting performed by VF is OK, but in certain cases (after fresh boot) this command in VF can fail. The MAC should be initialized only when: 1) no MAC is programmed (always except BE3 VFs during first init) 2) programmed MAC is different from requested (e.g. MAC is set when interface is down). In this case the initial MAC programmed by PF needs to be deleted. The adapter->dev_mac contains MAC address currently programmed in HW so it should be zeroed when the MAC is deleted from HW and should not be filled when MAC is set when interface is down in be_mac_addr_set() as no programming is performed in this case. Example of failure without the fix (immediately after fresh boot): # ip link set eth0 up <- eth0 is BE3 PF be2net :01:00.0 eth0: Link is Up # echo 1 > /sys/class/net/eth0/device/sriov_numvfs <- Create 1 VF ... be2net :01:04.0: Emulex OneConnect(be3): VF port 0 # ip link set eth8 up <- eth8 is created privileged VF be2net :01:04.0: opcode 59-1 failed:status 1-76 RTNETLINK answers: Input/output error # echo 0 > /sys/class/net/eth0/device/sriov_numvfs <- Delete VF iommu: Removing device :01:04.0 from group 33 ... # echo 1 > /sys/class/net/eth0/device/sriov_numvfs <- Create it again iommu: Removing device :01:04.0 from group 33 ... # ip link set eth8 up be2net :01:04.0 eth8: Link is Up Initialization is now OK. v2 - Corrected the comment and condition check suggested by Suresh & Harsha Fixes: 34393529163a ("be2net: fix MAC addr setting on privileged BE3 VFs") Cc: Sathya Perla <sathya.pe...@broadcom.com> Cc: Ajit Khaparde <ajit.khapa...@broadcom.com> Cc: Sriharsha Basavapatna <sriharsha.basavapa...@broadcom.com> Cc: Somnath Kotur <somnath.ko...@broadcom.com> Signed-off-by: Ivan Vecera <c...@cera.cz> --- drivers/net/ethernet/emulex/benet/be_main.c | 33 - 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 1a7f8ad7b9c6..cd49a54c538d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -362,8 +362,10 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) status = -EPERM; goto err; } -done: + + /* Remember currently programmed MAC */ ether_addr_copy(adapter->dev_mac, addr->sa_data); +done: ether_addr_copy(netdev->dev_addr, addr->sa_data); dev_info(dev, "MAC address changed to %pM\n", addr->sa_data); return 0; @@ -3618,8 +3620,10 @@ static void be_disable_if_filters(struct be_adapter *adapter) { /* Don't delete MAC on BE3 VFs without FILTMGMT privilege */ if (!BEx_chip(adapter) || !be_virtfn(adapter) || - check_privilege(adapter, BE_PRIV_FILTMGMT)) + check_privilege(adapter, BE_PRIV_FILTMGMT)) { be_dev_mac_del(adapter, adapter->pmac_id[0]); + eth_zero_addr(adapter->dev_mac); + } be_clear_uc_list(adapter); be_clear_mc_list(adapter); @@ -3773,12 +3777,27 @@ static int be_enable_if_filters(struct be_adapter *adapter) if (status) return status; - /* Don't add MAC on BE3 VFs without FILTMGMT privilege */ - if (!BEx_chip(adapter) || !be_virtfn(adapter) || - check_privilege(adapter, BE_PRIV_FILTMGMT)) { + /* Normally this condition usually true as the ->dev_mac is zeroed. +* But on BE3 VFs the initial MAC is pre-programmed by PF and +* subsequent be_dev_mac_add() can fail (after fresh boot) +*/ + if (!ether_addr_equal(adapter->dev_mac, adapter->netdev->dev_addr)) { + int old_pmac_id = -1; + + /* Remember old programmed MAC if any - can happen on BE3 VF */ + if (!is_zero_ether_addr(adapter->dev_mac)) + old_pmac_id = adapter->pmac_id[0]; + status = be_dev_mac_add(adapter, adapter->netdev->dev_addr); if (status) return status; + + /* Delete the old programmed MAC as we successfully programmed +* a new MAC +*/ + if (old_pmac_id >= 0 && old_pmac_id != adapter->pmac_id[0]) + be_dev_mac_del(adapter, old_pmac_id); + ether_addr_copy(adapter->dev_mac, adapter->netdev->dev_addr); } @@ -4552,6 +4571,10 @@ static int be_mac_setup(struct be_adapter *adapter) memcpy(adapter->netdev->
Re: [PATCH net] be2net: fix initial MAC setting
2017-01-31 19:01 GMT+01:00 David Miller: > > > Sriharsha and other Broadcom folks, you must follow-up on Ivan's > explanations and proof of testing. > > It is not acceptable for you to leave this patch's review state in > limbo for days, no matter how complicated or big the patch is. You > must at the very least say what you are doing, and how long it will > take for you to do that before you will be able to fully respond. > > Thank you. Hi Dave, I have some review notes from them but they have not cc-ed netdev mailing list. I'm including their comments: Reply 1: ">> > + >> > + /* Delete old programmed MAC if necessary */ >> > + if (old_pmac_id > 0 && old_pmac_id != >> > adapter->pmac_id[0]) >> > + be_dev_mac_del(adapter, old_pmac_id); >> >> I'm trying to understand why you added the above call to be_dev_mac_del() >> here. >> Since be_close() --> be_disable_if_filters() already does this. >> > It is necessary, see: > > 1) Lets say, we have created BE3 VF... it has programmed MAC1 by PF > 2) This VF is initially down > 3) Lets change its MAC address to MAC2. Because the interface is down then > no programming is done and MAC1 is still active in HW > -> adapter->dev_mac = MAC1 and adapter->netdev->dev_addr = MAC2 > 4) Now we set the interface up and be_enable_if_filters() is executed >-> dev_mac and dev_addr is different. so MAC2 is programmed by > be_dev_mac_add() > 5) Interface is up and has MAC2 as an active MAC > 6) Lets change active MAC to MAC1 >-> this will fail if you didn't delete inital MAC1 at step 4 Ok, so this takes care of the case where we do another set-mac without an intervening interface-down right ? Can you please change the comment to something like this (drop the "if necessary" since I feel it is a distraction). "Delete the old programmed MAC as we successfully programmed a new MAC" Thanks for the fix, we will update you as soon as we are done with all our tests tomorrow." Reply 2: "I am seeing the collision error with the steps mentioned in your previous mail. MAC address will not be deleted when old_mac_id is 0. ZERO (0) is the valid pmac id. So the above check should be >=. Can you please verify again and fix it. Regards, Suresh." So I will submit v2 with corrected comment and condition check. Btw. Suresh, Harsha, next time please always cc netdev mailing list. It is not my responsibility to replicate your emails. Thanks, Ivan
Re: [patch net-next] MAINTAINERS: add Ivan as a switchdev maintainer
Dne 2.2.2017 v 17:05 Jiri Pirko napsal(a): From: Jiri Pirko <j...@mellanox.com> Ivan will be taking care of switchdev code from now on. Signed-off-by: Jiri Pirko <j...@mellanox.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 300d2ec..eacacb2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11908,6 +11908,7 @@ F: include/linux/swiotlb.h SWITCHDEV M: Jiri Pirko <j...@resnulli.us> +M: Ivan Vecera <ivec...@redhat.com> L: netdev@vger.kernel.org S: Supported F: net/switchdev/ Acked-by: Ivan Vecera <ivec...@redhat.com>