[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 --- 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, RXF_E_CON
[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 --- 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 count, u8
[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 --- 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 --- 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 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 --- 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 --- 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(_
[PATCH net-next 05/19] bna: use BIT(x) instead of (1 << x)
Signed-off-by: Ivan Vecera --- .../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
[PATCH net-next 08/19] bna: remove oper_state_cbfn from struct bna_rxf
Signed-off-by: Ivan Vecera --- 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 --- 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 --- 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 --- 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 addr o
[PATCH net-next 07/19] bna: remove pause_cbfn from struct bna_enet
Signed-off-by: Ivan Vecera --- 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 17/19] bna: use list_for_each_entry where appropriate
Signed-off-by: Ivan Vecera --- 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 bna_ucam_
[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 --- 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
[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 --- 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 --- 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
[PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
Signed-off-by: Ivan Vecera --- 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(str
[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 --- 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
Re: [RFC 00/10] NFS: add AF_VSOCK support to NFS client
On Mon, Jun 08, 2015 at 05:02:47PM -0400, J. Bruce Fields wrote: > On Thu, Jun 04, 2015 at 05:45:43PM +0100, Stefan Hajnoczi wrote: > > The approach in this series > > --- > > AF_VSOCK stream sockets can be used for NFSv4.1 much in the same way as TCP. > > RFC 1831 record fragments divide messages since SOCK_STREAM semantics are > > present. The backchannel shares the connection just like the default TCP > > configuration. > > So the NFSv4 backchannel isn't handled for now, I assume. Right, I did not touch nfs4_callback_up_net(), only nfs41_callback_up_net(). If I'm reading the code right NFSv4 uses a separate listen port for the backchannel instead of sharing the client's socket? This is possible to implement with AF_VSOCK but I have only tested NFSv4.1 so far. Should I go ahead and do this? > And I guess > NFSv2/v3 is out too thanks to rpcbind? Which maybe is fine. Yes, I ignored rpcbind and didn't test NFSv2/v3. > Do we need an IETF draft or similar to document how NFS should work over > AF_VSOCK? I am not familiar with the standards process but I came across a few places where it makes sense to have a standard: * SUNRPC netid for AF_VSOCK (currently "tcp", "udp", and others exist) * The uaddr string format ("vsock:...") * Use of RFC 1831 record fragments (just like TCP) over AF_VSOCK SOCK_STREAM sockets These are all at the SUNRPC level rather than at the NFS protocol level. Any idea who I need to talk to? > NFS developers rely heavily on wireshark (and similar tools) for > debugging. Is that still possible over AF_VSOCK? No, this will require kernel and libpcap patches. Something like drivers/net/nlmon.c is needed for AF_VSOCK. Basically a dummy network interface and code that clones skbs when monitoring is enabled. It's on the TODO list and will be very useful. > > The next step is tackling NFS server. In the meantime, I have tested the > > patches using the nc-vsock netcat-like utility that is available in my Linux > > kernel repo below. > > So by a netcat-like utility, you mean it's proxying between client and a > server so the client thinks the server is communicating over AF_VSOCK > and the server thinks the client is using TCP? (Sorry, I haven't looked > at the code.) Yes, exactly. It works since the TCP and AF_VSOCK streams are almost bit-compatible. I think the difference between the streams occurs when network addresses are transmitted (e.g. SUNRPC netids), but I haven't encountered that with NFSv4.1 and no pnfs or fancy features in use. > Once we have a server and client, how will you recommend testing them? > (Will the server side need to run on real hardware?) I have been testing nfsd on the host and nfs client in a virtual machine. Vice versa should work in the same way. It's also possible to run nfsd in VM #1 and nfs client in VM #2 and use the netcat-like utility on the host to forward the traffic. That way any kernel panic happens in a VM and doesn't bring down the machine. I'll probably begin using this approach when I start nfsd work. > I guess if it works then the main question is whether it's worth > supporting another transport type in order to get the zero-configuration > host<->guest NFS setup. Or whether there's another way to get the same > gains. Thanks! If anyone has suggestions to avoid adding the AF_VSOCK transport I'd be interested to learn about that. Stefan pgppgiWgO1ta0.pgp Description: PGP signature
Re: [PATCH] iwlwifi:dvm:Return false if resume command data is not same size as received packet for the function iwl_resume_status_fn
On Wed, 2015-06-10 at 12:33 -0400, Nicholas Krause wrote: > This makes the function iwl_resume_status_fn return false now if > the received packet of type iwl_rx_packet is not the same size > as the structure pointer, iwl_resume_data's cmd element in order > to signal callers about this error and allow them to handle it > occurrently. > Hm... Did you actually hit this if? I am not sure I really want to wait here (which is what will happen if you return false) when we get an unexpected length? I do not expect anything besides the response I am waiting for since the firmware is handling the GET_STATUS *only* - it just came back from WoWLAN. Bottom line, this is really an error path and I prefer to exit and not wait for the timeout in that case. But I might be missing something? > Signed-off-by: Nicholas Krause > --- > drivers/net/wireless/iwlwifi/dvm/mac80211.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c > b/drivers/net/wireless/iwlwifi/dvm/mac80211.c > index 5abd62e..21e808c 100644 > --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c > +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c > @@ -409,7 +409,7 @@ static bool iwl_resume_status_fn(struct > iwl_notif_wait_data *notif_wait, > > if (iwl_rx_packet_payload_len(pkt) != sizeof(*resume_data->cmd)) { > IWL_ERR(priv, "rx wrong size data\n"); > - return true; > + return false; > } > memcpy(resume_data->cmd, pkt->data, sizeof(*resume_data->cmd)); > resume_data->valid = true;
[PATCH net-next] net: phy: davicom: add IDs for DM9161B and C variants
Add PHY IDs for Davicom DM9161B and DM9161C variants. Tested with a DM9161C on a custom Atmel-based SAM9X25 board in RMII mode. The DM9161B uses the same model id with just the LSB bit of the version id changing (which is masked out). For all intents and purposes they're the same as the DM9161A with an added GPSI mode and better fabrication process. Signed-off-by: Gustavo Zacarias --- drivers/net/phy/davicom.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 0d16c7d..2a32870 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -158,6 +158,18 @@ static struct phy_driver dm91xx_driver[] = { .config_intr= dm9161_config_intr, .driver = { .owner = THIS_MODULE,}, }, { + .phy_id = 0x0181b8b0, + .name = "Davicom DM9161B/C", + .phy_id_mask= 0x0ff0, + .features = PHY_BASIC_FEATURES, + .flags = PHY_HAS_INTERRUPT, + .config_init= dm9161_config_init, + .config_aneg= dm9161_config_aneg, + .read_status= genphy_read_status, + .ack_interrupt = dm9161_ack_interrupt, + .config_intr= dm9161_config_intr, + .driver = { .owner = THIS_MODULE,}, +}, { .phy_id = 0x0181b8a0, .name = "Davicom DM9161A", .phy_id_mask= 0x0ff0, @@ -186,6 +198,7 @@ module_phy_driver(dm91xx_driver); static struct mdio_device_id __maybe_unused davicom_tbl[] = { { 0x0181b880, 0x0ff0 }, + { 0x0181b8b0, 0x0ff0 }, { 0x0181b8a0, 0x0ff0 }, { 0x00181b80, 0x0ff0 }, { } -- 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 v3 net-next 2/2] tcp: add CDG congestion control
CAIA Delay-Gradient (CDG) is a TCP congestion control that modifies the TCP sender in order to [1]: o Use the delay gradient as a congestion signal. o Back off with an average probability that is independent of the RTT. o Coexist with flows that use loss-based congestion control, i.e., flows that are unresponsive to the delay signal. o Tolerate packet loss unrelated to congestion. (Disabled by default.) Its FreeBSD implementation was presented for the ICCRG in July 2012; slides are available at http://www.ietf.org/proceedings/84/iccrg.html Running the experiment scenarios in [1] suggests that our implementation achieves more goodput compared with FreeBSD 10.0 senders, although it also causes more queueing delay for a given backoff factor. The loss tolerance heuristic is disabled by default due to safety concerns for its use in the Internet [2, p. 45-46]. We use a variant of the Hybrid Slow start algorithm in tcp_cubic to reduce the probability of slow start overshoot. [1] D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using delay gradients." In Networking 2011, pages 328-341. Springer, 2011. [2] K.K. Jonassen. "Implementing CAIA Delay-Gradient in Linux." MSc thesis. Department of Informatics, University of Oslo, 2015. Cc: Eric Dumazet Cc: Yuchung Cheng Cc: Stephen Hemminger Cc: Neal Cardwell Cc: David Hayes Cc: Andreas Petlund Cc: Dave Taht Cc: Nicolas Kuhn Signed-off-by: Kenneth Klette Jonassen --- V0: RFC V1: Feedback from Dumazet, Cheng, and Hemminger [3], Shadow window, HyStart. V2: Fix delayed ACK filter, add HyStart knob, remove shadow_wnd clamp [4]. V3: Always keep shadow_wnd, remove ECN handling for now [5]. [1] http://caia.swin.edu.au/cv/dahayes/content/networking2011-cdg-preprint.pdf [2] http://folk.uio.no/kennetkl/jonassen_thesis.pdf [3] http://thread.gmane.org/gmane.linux.network/363729 [4] http://thread.gmane.org/gmane.linux.network/366449 [5] http://thread.gmane.org/gmane.linux.network/366659 --- net/ipv4/Kconfig | 20 +++ net/ipv4/Makefile | 1 + net/ipv4/tcp_cdg.c | 433 + 3 files changed, 454 insertions(+) create mode 100644 net/ipv4/tcp_cdg.c diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index d83071d..6fb3c90 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig @@ -615,6 +615,22 @@ config TCP_CONG_DCTCP For further details see: http://simula.stanford.edu/~alizade/Site/DCTCP_files/dctcp-final.pdf +config TCP_CONG_CDG + tristate "CAIA Delay-Gradient (CDG)" + default n + ---help--- + CAIA Delay-Gradient (CDG) is a TCP congestion control that modifies + the TCP sender in order to: + + o Use the delay gradient as a congestion signal. + o Back off with an average probability that is independent of the RTT. + o Coexist with flows that use loss-based congestion control. + o Tolerate packet loss unrelated to congestion. + + For further details see: + D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using + delay gradients." In Networking 2011. Preprint: http://goo.gl/No3vdg + choice prompt "Default TCP congestion control" default DEFAULT_CUBIC @@ -646,6 +662,9 @@ choice config DEFAULT_DCTCP bool "DCTCP" if TCP_CONG_DCTCP=y + config DEFAULT_CDG + bool "CDG" if TCP_CONG_CDG=y + config DEFAULT_RENO bool "Reno" endchoice @@ -668,6 +687,7 @@ config DEFAULT_TCP_CONG default "veno" if DEFAULT_VENO default "reno" if DEFAULT_RENO default "dctcp" if DEFAULT_DCTCP + default "cdg" if DEFAULT_CDG default "cubic" config TCP_MD5SIG diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index b36236d..efc43f3 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o +obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o obj-$(CONFIG_TCP_CONG_DCTCP) += tcp_dctcp.o obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o diff --git a/net/ipv4/tcp_cdg.c b/net/ipv4/tcp_cdg.c new file mode 100644 index 000..a52ce2d --- /dev/null +++ b/net/ipv4/tcp_cdg.c @@ -0,0 +1,433 @@ +/* + * CAIA Delay-Gradient (CDG) congestion control + * + * This implementation is based on the paper: + * D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using + * delay gradients." In IFIP Networking, pages 328-341. Springer, 2011. + * + * Scavenger traffic (Less-than-Best-Effort) should disable coexistence + * heuristics using parameters use_shadow=0 and use_ineff=0. + * + * Parameters window, backoff_beta, and backoff_factor are crucial for + * throughput and delay. Future work is needed to determine better defaults, + * and to provide guidelines for use in diffe
[PATCH v3 net-next 1/2] tcp: export tcp_enter_cwr()
Upcoming tcp_cdg uses tcp_enter_cwr() to initiate PRR. Export this function so that CDG can be compiled as a module. Cc: Eric Dumazet Cc: Yuchung Cheng Cc: Stephen Hemminger Cc: Neal Cardwell Cc: David Hayes Cc: Andreas Petlund Cc: Dave Taht Cc: Nicolas Kuhn Signed-off-by: Kenneth Klette Jonassen --- V3: rebase --- net/ipv4/tcp_input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 15c4536..d4f76ab 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2552,6 +2552,7 @@ void tcp_enter_cwr(struct sock *sk) tcp_set_ca_state(sk, TCP_CA_CWR); } } +EXPORT_SYMBOL(tcp_enter_cwr); static void tcp_try_keep_open(struct sock *sk) { -- 2.1.0 -- 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] iwlwifi:dvm:Return false if resume command data is not same size as received packet for the function iwl_resume_status_fn
On Wed, 2015-06-10 at 12:58 -0400, Nicholas Krause wrote: > > On June 10, 2015 12:50:45 PM EDT, "Grumbach, Emmanuel" > wrote: > >On Wed, 2015-06-10 at 12:33 -0400, Nicholas Krause wrote: > >> This makes the function iwl_resume_status_fn return false now if > >> the received packet of type iwl_rx_packet is not the same size > >> as the structure pointer, iwl_resume_data's cmd element in order > >> to signal callers about this error and allow them to handle it > >> occurrently. > >> > > > >Hm... Did you actually hit this if? > >I am not sure I really want to wait here (which is what will happen if > >you return false) when we get an unexpected length? I do not expect > >anything besides the response I am waiting for since the firmware is > >handling the GET_STATUS *only* - it just came back from WoWLAN. Bottom > >line, this is really an error path and I prefer to exit and not wait > >for > >the timeout in that case. > >But I might be missing something? > > > Why not wait for the time out? Seems there is no reason not to and in that > case > if the firmware handles this I doubt it will. This goes back to my original question: did you really hit this path? Does the patch solves a real bug you faced? > why is the if statement still here. To get a debug print? :) > Nick > >> Signed-off-by: Nicholas Krause > >> --- > >> drivers/net/wireless/iwlwifi/dvm/mac80211.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c > >b/drivers/net/wireless/iwlwifi/dvm/mac80211.c > >> index 5abd62e..21e808c 100644 > >> --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c > >> +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c > >> @@ -409,7 +409,7 @@ static bool iwl_resume_status_fn(struct > >iwl_notif_wait_data *notif_wait, > >> > >>if (iwl_rx_packet_payload_len(pkt) != sizeof(*resume_data->cmd)) { > >>IWL_ERR(priv, "rx wrong size data\n"); > >> - return true; > >> + return false; > >>} > >>memcpy(resume_data->cmd, pkt->data, sizeof(*resume_data->cmd)); > >>resume_data->valid = true; > N�r��yb�X��ǧv�^�)޺{.n�+���z�^�)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥
[PATCH] net/ps3_gelic: Fix build error with DEBUG
When the DEBUG preprocessor macro is defined the ps3_gelic_net driver build fails due to an undeclared routine gelic_descr_get_status(). This problem was introduced during the code cleanup of commit 6b0c21cede22be1f68f0a632c0ca38008ce1abe7 (net: Fix p3_gelic_net sparse warnings), which re-arranged the ordering of some of the gelic routines. This change just moves the gelic_descr_get_status() routine up in the ps3_gelic_net.c source file. There is no functional change. Fixes build errors like these: drivers/net/ethernet/toshiba/ps3_gelic_net.c: error: implicit declaration of function gelic_descr_get_status Signed-off-by: Geoff Levand --- Dave, please apply. -Geoff The following changes since commit d4a4f75cd8f29cd9464a5a32e9224a91571d6649: Linux 4.1-rc7 (2015-06-07 20:23:50 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-1 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index ac62a5e..79f0ec4 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -102,6 +102,18 @@ static void gelic_card_get_ether_port_status(struct gelic_card *card, } } +/** + * gelic_descr_get_status -- returns the status of a descriptor + * @descr: descriptor to look at + * + * returns the status as in the dmac_cmd_status field of the descriptor + */ +static enum gelic_descr_dma_status +gelic_descr_get_status(struct gelic_descr *descr) +{ + return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK; +} + static int gelic_card_set_link_mode(struct gelic_card *card, int mode) { int status; @@ -278,18 +290,6 @@ void gelic_card_down(struct gelic_card *card) } /** - * gelic_descr_get_status -- returns the status of a descriptor - * @descr: descriptor to look at - * - * returns the status as in the dmac_cmd_status field of the descriptor - */ -static enum gelic_descr_dma_status -gelic_descr_get_status(struct gelic_descr *descr) -{ - return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK; -} - -/** * gelic_card_free_chain - free descriptor chain * @card: card structure * @descr_in: address of desc -- 2.1.0 -- 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 1/3 v2] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 08:57:55AM -0700, Alexander Duyck wrote: > On 06/09/2015 11:47 PM, Andy Gospodarek wrote: > >Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are > >reachable via an interface where carrier is off. No action is taken, > >but additional flags are passed to userspace to indicate carrier status. > > > >This also includes a cleanup to fib_disable_ip to more clearly indicate > >what event made the function call to replace the more cryptic force > >option previously used. > > > >v2: Split out kernel functionality into 2 patches, this patch simply sets and > >clears new nexthop flag RTNH_F_LINKDOWN. > > > >Signed-off-by: Andy Gospodarek > >Signed-off-by: Dinesh Dutt > > > >--- > > include/net/ip_fib.h | 4 +-- > > include/uapi/linux/rtnetlink.h | 1 + > > net/ipv4/fib_frontend.c| 26 +++- > > net/ipv4/fib_semantics.c | 56 > > -- > > 4 files changed, 60 insertions(+), 27 deletions(-) > > > >diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h > >index 54271ed..d1de1b7 100644 > >--- a/include/net/ip_fib.h > >+++ b/include/net/ip_fib.h > >@@ -305,9 +305,9 @@ void fib_flush_external(struct net *net); > > > > /* Exported by fib_semantics.c */ > > int ip_fib_check_default(__be32 gw, struct net_device *dev); > >-int fib_sync_down_dev(struct net_device *dev, int force); > >+int fib_sync_down_dev(struct net_device *dev, int event); > > int fib_sync_down_addr(struct net *net, __be32 local); > >-int fib_sync_up(struct net_device *dev); > >+int fib_sync_up(struct net_device *dev, unsigned int nh_flags); > > void fib_select_multipath(struct fib_result *res); > > > > /* Exported by fib_trie.c */ > >diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h > >index 17fb02f..8dde432 100644 > >--- a/include/uapi/linux/rtnetlink.h > >+++ b/include/uapi/linux/rtnetlink.h > >@@ -338,6 +338,7 @@ struct rtnexthop { > > #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ > > #define RTNH_F_ONLINK 4 /* Gateway is forced on link > > */ > > #define RTNH_F_OFFLOAD 8 /* offloaded route */ > >+#define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ > > So you could probably use some sort of define here to identify which flags > are event based and which are configuration based. Then it makes it easier > to take care of code below such as the nh_comp call. So are you saying something at the top to that would reserve a few bits for whether the kernel can set it, userspace can set it, or both could set it? Seems like overkill to me and a waste of bits -- though maybe there will not be that many nexthop flags. :) > > > /* Macros to handle hexthops */ > > > >diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c > >index 872494e..1e4c646 100644 > >--- a/net/ipv4/fib_frontend.c > >+++ b/net/ipv4/fib_frontend.c > >@@ -1063,9 +1063,9 @@ static void nl_fib_lookup_exit(struct net *net) > > net->ipv4.fibnl = NULL; > > } > > > >-static void fib_disable_ip(struct net_device *dev, int force) > >+static void fib_disable_ip(struct net_device *dev, int event) > > Event should be an unsigned long to match fib_inetaddr_event and avoid any > unnecessary casts or warnings. Fixed in upcoming v3 > > > { > >-if (fib_sync_down_dev(dev, force)) > >+if (fib_sync_down_dev(dev, event)) > > fib_flush(dev_net(dev)); > > rt_cache_flush(dev_net(dev)); > > arp_ifdown(dev); > >@@ -1080,9 +1080,7 @@ static int fib_inetaddr_event(struct notifier_block > >*this, unsigned long event, > > switch (event) { > > case NETDEV_UP: > > fib_add_ifaddr(ifa); > >-#ifdef CONFIG_IP_ROUTE_MULTIPATH > >-fib_sync_up(dev); > >-#endif > >+fib_sync_up(dev, RTNH_F_DEAD); > > atomic_inc(&net->ipv4.dev_addr_genid); > > rt_cache_flush(dev_net(dev)); > > break; > > Shouldn't this bit be left wrapped in CONFIG_IP_ROUTE_MULTIPATH? I thought > RTNH_F_DEAD was only used in that case. I can double-check this one and the one referenced below in fib_netdev_event, but I really struggle to understand why one would not want to be sure that when IFF_UP is set the DEAD flags were definitely going to be cleared before continuing? > > >@@ -1093,7 +1091,7 @@ static int fib_inetaddr_event(struct notifier_block > >*this, unsigned long event, > > /* Last address was deleted from this interface. > > * Disable IP. > > */ > >-fib_disable_ip(dev, 1); > >+fib_disable_ip(dev, event); > > } else { > > rt_cache_flush(dev_net(dev)); > > } > > Aren't you losing information here? The line above this change is a call to > see if ifa_list is NULL. I don't see how that data is being communicated > down to fib_disable_ip. I
Re: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
On Wed, 2015-04-29 at 17:56 +0300, Madalin Bucur wrote: > This introduces the Freescale Data Path Acceleration Architecture > (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, > BMan, PAMU and FMan drivers to deliver Ethernet connectivity on > the Freescale DPAA QorIQ platforms. ... > + /* We're going to store the skb backpointer at the beginning > + * of the data buffer, so we need a privately owned skb > + */ > + > + /* Code borrowed from skb_unshare(). */ > + if (skb_cloned(skb)) { > + struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); > + > + /* Finally, create a contig FD from this skb */ > + skb_to_contig_fd(priv, skb, &fd, countptr, &offset); > + > + kfree_skb(skb); > + skb = nskb; > + /* skb_copy() has now linearized the skbuff. */ > + } > + You know that TCP packets are clones, right ? This code is killing performance. TCP allows the headers part being modified by a driver if needed. You should use skb_header_cloned() instead. -- 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 Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: > Signed-off-by: Ivan Vecera Have you verified that all of these are __aligned(2)? I haven't, but you should verify that you have in the commit log. 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. -- 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: [RFC 00/10] NFS: add AF_VSOCK support to NFS client
On Wed, Jun 10, 2015 at 05:43:15PM +0100, Stefan Hajnoczi wrote: > On Mon, Jun 08, 2015 at 05:02:47PM -0400, J. Bruce Fields wrote: > > On Thu, Jun 04, 2015 at 05:45:43PM +0100, Stefan Hajnoczi wrote: > > > The approach in this series > > > --- > > > AF_VSOCK stream sockets can be used for NFSv4.1 much in the same way as > > > TCP. > > > RFC 1831 record fragments divide messages since SOCK_STREAM semantics are > > > present. The backchannel shares the connection just like the default TCP > > > configuration. > > > > So the NFSv4 backchannel isn't handled for now, I assume. > > Right, I did not touch nfs4_callback_up_net(), only > nfs41_callback_up_net(). > > If I'm reading the code right NFSv4 uses a separate listen port for the > backchannel instead of sharing the client's socket? Right. > This is possible to implement with AF_VSOCK but I have only tested > NFSv4.1 so far. Should I go ahead and do this? Personally I'd make it a lower priority--I don't see why you can't make 4.1 a requirement for the new transport--but I'd be curious what others have to say. > > And I guess > > NFSv2/v3 is out too thanks to rpcbind? Which maybe is fine. > > Yes, I ignored rpcbind and didn't test NFSv2/v3. > > > Do we need an IETF draft or similar to document how NFS should work over > > AF_VSOCK? > > I am not familiar with the standards process but I came across a few > places where it makes sense to have a standard: > > * SUNRPC netid for AF_VSOCK (currently "tcp", "udp", and others exist) > * The uaddr string format ("vsock:...") Off the top of my head I can't remember where else that's used in the protocol other than in setting up the 4.0 callback connection (and in rpcbind). > * Use of RFC 1831 record fragments (just like TCP) over AF_VSOCK >SOCK_STREAM sockets As far as I can tell, 1831 claims to be independent of any transport protocol details: "The RPC protocol can be implemented on several different transport protocols. The RPC protocol does not care how a message is passed from one process to another, but only with specification and interpretation of messages." And: "When RPC messages are passed on top of a byte stream transport protocol (like TCP)" So perhaps there's nothing more to say here. > These are all at the SUNRPC level rather than at the NFS protocol level. > > Any idea who I need to talk to? Anyay, if there is anything to be worked out, nf...@ietf.org is the place to go. --b. -- 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: [RFC net-next 2/3] VRF driver and needed infrastructure
On 06/08/2015 11:35 AM, Shrijeet Mukherjee wrote: From: Shrijeet Mukherjee This driver borrows heavily from IPvlan and teaming drivers. Routing domains (VRF-lite) are created by instantiating a device and enslaving all routed interfaces that participate in the domain. As part of the enslavement, all local routes pointing to enslaved devices are re-pointed to the vrf device, thus forcing outgoing sockets to bind to the vrf to function. Standard FIB rules can then bind the VRF device to tables and regular fib rule processing is followed. Routed traffic through the box, is fwded by using the VRF device as the IIF and following the IIF rule to a table which is mated with the VRF. Locally originated traffic is directed at the VRF device using SO_BINDTODEVICE or cmsg headers. This in turn drops the packet into the xmit function of the vrf driver, which then completes the ip lookup and output. This solution is completely orthogonal to namespaces and allow the L3 equivalent of vlans to exist allowing the routing space to be partitioned. Example use is ip link add vrf0 type vrf table 5 ip link set eth1 master vrf0 ip link set vrf0 up ip rule add iif vrf0 table 5 ip rule add oif vrf0 table 5 TODO: This changeset is for IPv4 only Connected route management can be made much better, but is deferred to user space for now. Signed-off-by: Shrijeet Mukherjee --- drivers/net/Kconfig |6 + drivers/net/Makefile |1 + drivers/net/vrf.c| 654 ++ include/linux/netdevice.h| 10 + include/net/flow.h |1 + include/net/vrf.h| 19 ++ include/uapi/linux/if_link.h |9 + 7 files changed, 700 insertions(+) create mode 100644 drivers/net/vrf.c create mode 100644 include/net/vrf.h diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 019fcef..27a333c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -283,6 +283,12 @@ config NLMON diagnostics, etc. This is mostly intended for developers or support to debug netlink issues. If unsure, say N. +config NET_VRF + tristate "Virtual Routing and Forwarding (Lite)" + ---help--- + This option enables the support for mapping interfaces into VRF's. The + support enables VRF devices + endif # NET_CORE config SUNGEM_PHY diff --git a/drivers/net/Makefile b/drivers/net/Makefile index c12cb22..ca16dd6 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o obj-$(CONFIG_VXLAN) += vxlan.o obj-$(CONFIG_GENEVE) += geneve.o obj-$(CONFIG_NLMON) += nlmon.o +obj-$(CONFIG_NET_VRF) += vrf.o # # Networking Drivers diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c new file mode 100644 index 000..08b3e79 --- /dev/null +++ b/drivers/net/vrf.c @@ -0,0 +1,654 @@ +/* + * vrf.c: device driver to encapsulate a VRF space + * + * Copyright (c) 2015 Cumulus Networks + * + * Based on dummy, team and ipvlan drivers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "vrf" +#define DRV_VERSION"1.0" + +#define vrf_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) +#define vrf_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) + +#define vrf_master_get_rcu(dev) \ + ((struct net_device *)rcu_dereference(dev->rx_handler_data)) + +struct pcpu_dstats { + u64 tx_pkts; + u64 tx_bytes; + u64 tx_drps; + u64 rx_pkts; + u64 rx_bytes; + struct u64_stats_sync syncp; +}; Do you really need a new pcpu_dstats or could you just use pcpu_sw_netstats? I'm just wondering if you are expecting to see that many Tx packets dropped. If not you could probably just move that to the standard netdev stat instead. +struct slave { + struct list_headlist; + struct net_device *dev; + longpriority; +}; + +struct slave_queue { + spinlock_t lock; /* lock for slave insert/delete */ + struct list_headall_slaves; + int num_slaves; + struct net_device *master_dev; +}; + +struct net_vrf { + struct slave_queue queue; + struct fib_table*tb; + u32 tb_id; +}; + +static int is_ip_rx_frame(struct sk_buff *skb) +{ + switch (skb->protocol) { + case htons(ETH_P_IP)
Re: [RFC net-next 3/3] rcv path changes for vrf traffic
On 06/08/2015 11:35 AM, Shrijeet Mukherjee wrote: From: Shrijeet Mukherjee Incoming frames for IP protocol stacks need the IIF to be changed from the actual interface to the VRF device. This allows the IIF rule to be used to select tables (or do regular PBR) This change selects the iif to be the VRF device if it exists and the incoming iif is enslaved to the VRF device. Since VRF aware sockets are always bound to the VRF device this system allows return traffic to find the socket of origin. changes are in the arp_rcv, icmp_rcv and ip_rcv paths Question : I did not wrap the rcv modifications, in CONFIG_NET_VRF as it would create code variations and the vrf_ptr check is there I can make that whole thing modular. Signed-off-by: Shrijeet Mukherjee --- net/ipv4/fib_frontend.c | 14 +++--- net/ipv4/fib_trie.c |7 +-- net/ipv4/icmp.c |6 ++ net/ipv4/route.c|3 ++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 9d4cef4..cf2d584 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -45,6 +45,7 @@ #include #include #include +#include #ifndef CONFIG_IP_MULTIPLE_TABLES @@ -218,15 +219,18 @@ static inline unsigned int __inet_dev_addr_type(struct net *net, struct fib_result res; unsigned int ret = RTN_BROADCAST; struct fib_table *local_table; + int rt_table = RT_TABLE_LOCAL; if (ipv4_is_zeronet(addr) || ipv4_is_lbcast(addr)) return RTN_BROADCAST; if (ipv4_is_multicast(addr)) return RTN_MULTICAST; - rcu_read_lock(); + if (dev && dev->vrf_ptr) + rt_table = dev->vrf_ptr->tb_id; - local_table = fib_get_table(net, RT_TABLE_LOCAL); + rcu_read_lock(); + local_table = fib_get_table(net, rt_table); if (local_table) { ret = RTN_UNICAST; if (!fib_table_lookup(local_table, &fl4, &res, FIB_LOOKUP_NOREF)) { I would prefer it if you left a blank line between rcu_read_lock and the local_table assignment line. It would help to make this patch and the code in general a bit more readable. @@ -309,7 +313,11 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, bool dev_match; fl4.flowi4_oif = 0; - fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX; + if (dev->vrf_ptr) + fl4.flowi4_iif = dev->vrf_ptr ? + dev->vrf_ptr->ifindex : dev->ifindex; + else + fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX; fl4.daddr = src; fl4.saddr = dst; fl4.flowi4_tos = tos; This code is kind of redundant. What is the point of the dev->vfr_ptr ternary operator when you just checked it in the if statement. diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 97fa62d..515ff11 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1409,8 +1409,11 @@ found: if (nh->nh_flags & RTNH_F_DEAD) continue; - if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) - continue; + if (!(flp->flowi4_flags & FLOWI_FLAG_VRFSRC)) { + if (flp->flowi4_oif && + flp->flowi4_oif != nh->nh_oif) + continue; + } if (!(fib_flags & FIB_LOOKUP_NOREF)) atomic_inc(&fi->fib_clntref); You might break this up so that both the flowi4_flags and flowi4_oif checks are in the first if statement, and the != is in the next. I would argue that the flowi4_oif check might be done first as you can avoid having to test for any masks since you are testing for a 0 value. diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index f5203fb..61b7da3 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -96,6 +96,7 @@ #include #include #include +#include /* *Build xmit assembly blocks @@ -420,6 +421,8 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) daddr = icmp_param->replyopts.opt.opt.faddr; } memset(&fl4, 0, sizeof(fl4)); + if (skb->dev && skb->dev->vrf_ptr) + fl4.flowi4_oif = skb->dev->vrf_ptr->ifindex; fl4.daddr = daddr; fl4.saddr = saddr; fl4.flowi4_mark = mark; @@ -458,6 +461,9 @@ static struct rtable *icmp_route_lookup(struct net *net, fl4->flowi4_proto = IPPROTO_ICMP; fl4->fl4_icmp_type = type; fl4->fl4_icmp_code = code; + if (skb_in->dev && skb_in->dev->vrf_ptr) + fl4->flowi4_oif = skb_in->dev->vrf_ptr->ifindex; + security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4)); rt = __ip_route_output_key(net, fl4); if (IS_
Re: [PATCH v3 net-next 1/2] tcp: export tcp_enter_cwr()
On Wed, Jun 10, 2015 at 10:08 AM, Kenneth Klette Jonassen wrote: > > Upcoming tcp_cdg uses tcp_enter_cwr() to initiate PRR. Export this > function so that CDG can be compiled as a module. > > Cc: Eric Dumazet > Cc: Yuchung Cheng > Cc: Stephen Hemminger > Cc: Neal Cardwell > Cc: David Hayes > Cc: Andreas Petlund > Cc: Dave Taht > Cc: Nicolas Kuhn > Signed-off-by: Kenneth Klette Jonassen > --- Acked-by: Yuchung Cheng > V3: rebase > --- > net/ipv4/tcp_input.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 15c4536..d4f76ab 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -2552,6 +2552,7 @@ void tcp_enter_cwr(struct sock *sk) > tcp_set_ca_state(sk, TCP_CA_CWR); > } > } > +EXPORT_SYMBOL(tcp_enter_cwr); > > static void tcp_try_keep_open(struct sock *sk) > { > -- > 2.1.0 > -- 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 v3 net-next 2/2] tcp: add CDG congestion control
On Wed, Jun 10, 2015 at 10:08 AM, Kenneth Klette Jonassen wrote: > CAIA Delay-Gradient (CDG) is a TCP congestion control that modifies > the TCP sender in order to [1]: > > o Use the delay gradient as a congestion signal. > o Back off with an average probability that is independent of the RTT. > o Coexist with flows that use loss-based congestion control, i.e., > flows that are unresponsive to the delay signal. > o Tolerate packet loss unrelated to congestion. (Disabled by default.) > > Its FreeBSD implementation was presented for the ICCRG in July 2012; > slides are available at http://www.ietf.org/proceedings/84/iccrg.html > > Running the experiment scenarios in [1] suggests that our implementation > achieves more goodput compared with FreeBSD 10.0 senders, although it also > causes more queueing delay for a given backoff factor. > > The loss tolerance heuristic is disabled by default due to safety concerns > for its use in the Internet [2, p. 45-46]. > > We use a variant of the Hybrid Slow start algorithm in tcp_cubic to reduce > the probability of slow start overshoot. > > [1] D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using > delay gradients." In Networking 2011, pages 328-341. Springer, 2011. > [2] K.K. Jonassen. "Implementing CAIA Delay-Gradient in Linux." > MSc thesis. Department of Informatics, University of Oslo, 2015. > > Cc: Eric Dumazet > Cc: Yuchung Cheng > Cc: Stephen Hemminger > Cc: Neal Cardwell > Cc: David Hayes > Cc: Andreas Petlund > Cc: Dave Taht > Cc: Nicolas Kuhn > Signed-off-by: Kenneth Klette Jonassen > > --- Acked-by: Yuchung Cheng > V0: RFC > V1: Feedback from Dumazet, Cheng, and Hemminger [3], Shadow window, HyStart. > V2: Fix delayed ACK filter, add HyStart knob, remove shadow_wnd clamp [4]. > V3: Always keep shadow_wnd, remove ECN handling for now [5]. > > [1] http://caia.swin.edu.au/cv/dahayes/content/networking2011-cdg-preprint.pdf > [2] http://folk.uio.no/kennetkl/jonassen_thesis.pdf > [3] http://thread.gmane.org/gmane.linux.network/363729 > [4] http://thread.gmane.org/gmane.linux.network/366449 > [5] http://thread.gmane.org/gmane.linux.network/366659 > --- > net/ipv4/Kconfig | 20 +++ > net/ipv4/Makefile | 1 + > net/ipv4/tcp_cdg.c | 433 > + > 3 files changed, 454 insertions(+) > create mode 100644 net/ipv4/tcp_cdg.c > > diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig > index d83071d..6fb3c90 100644 > --- a/net/ipv4/Kconfig > +++ b/net/ipv4/Kconfig > @@ -615,6 +615,22 @@ config TCP_CONG_DCTCP > For further details see: > http://simula.stanford.edu/~alizade/Site/DCTCP_files/dctcp-final.pdf > > +config TCP_CONG_CDG > + tristate "CAIA Delay-Gradient (CDG)" > + default n > + ---help--- > + CAIA Delay-Gradient (CDG) is a TCP congestion control that modifies > + the TCP sender in order to: > + > + o Use the delay gradient as a congestion signal. > + o Back off with an average probability that is independent of the > RTT. > + o Coexist with flows that use loss-based congestion control. > + o Tolerate packet loss unrelated to congestion. > + > + For further details see: > + D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using > + delay gradients." In Networking 2011. Preprint: http://goo.gl/No3vdg > + > choice > prompt "Default TCP congestion control" > default DEFAULT_CUBIC > @@ -646,6 +662,9 @@ choice > config DEFAULT_DCTCP > bool "DCTCP" if TCP_CONG_DCTCP=y > > + config DEFAULT_CDG > + bool "CDG" if TCP_CONG_CDG=y > + > config DEFAULT_RENO > bool "Reno" > endchoice > @@ -668,6 +687,7 @@ config DEFAULT_TCP_CONG > default "veno" if DEFAULT_VENO > default "reno" if DEFAULT_RENO > default "dctcp" if DEFAULT_DCTCP > + default "cdg" if DEFAULT_CDG > default "cubic" > > config TCP_MD5SIG > diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile > index b36236d..efc43f3 100644 > --- a/net/ipv4/Makefile > +++ b/net/ipv4/Makefile > @@ -42,6 +42,7 @@ obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o > obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o > obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o > obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o > +obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o > obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o > obj-$(CONFIG_TCP_CONG_DCTCP) += tcp_dctcp.o > obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o > diff --git a/net/ipv4/tcp_cdg.c b/net/ipv4/tcp_cdg.c > new file mode 100644 > index 000..a52ce2d > --- /dev/null > +++ b/net/ipv4/tcp_cdg.c > @@ -0,0 +1,433 @@ > +/* > + * CAIA Delay-Gradient (CDG) congestion control > + * > + * This implementation is based on the paper: > + * D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using > + * delay gradients." In IFIP Networking, pages 328-341. Springer, 2011. > + * > +
Re: [PATCH 01/12] fsl/fman: Add the FMan FLIB headers
On Wed, 2015-06-10 at 18:21 +0300, Madalin Bucur wrote: > From: Igal Liberman > > This patch presents the FMan Foundation Libraries (FLIB) headers. > The FMan FLib provides the basic API used by the FMan drivers to > configure and control the FMan hardware. > > Signed-off-by: Igal Liberman > --- > .../ethernet/freescale/fman/flib/common/general.h | 41 ++ > .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 > + > 2 files changed, 650 insertions(+) > create mode 100644 > drivers/net/ethernet/freescale/fman/flib/common/general.h > create mode 100644 > drivers/net/ethernet/freescale/fman/flib/fsl_fman.h Why do we need separate patches just for headers? What does "common" refer to? What does the flib directory mean, in the context of Linux? If someone were to add code to this driver, how do they know if the code should go into the flib directory or not? > > +#define iowrite32be(val, addr) out_be32(&(*addr), val) > +#define ioread32be(addr) in_be32(&(*addr)) iowrite32be()/ioread32be() are already defined for all relevant architectures. Why are you redefining them into something PPC- specific? > +/* do not change! if changed, must be disabled for rev1 ! */ > +#define DEFAULT_HALT_ON_EXTERNAL_ACTIVATION false > +/* do not change! if changed, must be disabled for rev1 ! */ > +#define DEFAULT_HALT_ON_UNRECOVERABLE_ECC_ERROR false rev1 of what chip? -Scott -- 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 2/3 v2] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 09:17:19AM -0700, Alexander Duyck wrote: > > > On 06/09/2015 11:47 PM, Andy Gospodarek wrote: > >This feature is only enabled with the new per-interface or ipv4 global > >sysctls called 'ignore_routes_with_linkdown'. > > > >net.ipv4.conf.all.ignore_routes_with_linkdown = 0 > >net.ipv4.conf.default.ignore_routes_with_linkdown = 0 > >net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 > >... > > > >When the above sysctls are set, will report to userspace that a route is > >dead and will no longer resolve to this nexthop when performing a fib > >lookup. This will signal to userspace that the route will not be > >selected. The signalling of a RTNH_F_DEAD is only passed to userspace > >if the sysctl is enabled and link is down. This was done as without it the > >netlink listeners would have no idea whether or not a nexthop would be > >selected. The kernel only sets RTNH_F_DEAD internally if the inteface has > >IFF_UP cleared. > > > >With the new sysctl set, the following behavior can be observed > >(interface p8p1 is link-down): > > > ># ip route show > >default via 10.0.5.2 dev p9p1 > >10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 > >70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > >80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown > >90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 dead linkdown > >90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 > ># ip route get 90.0.0.1 > >90.0.0.1 via 70.0.0.2 dev p7p1 src 70.0.0.1 > > cache > ># ip route get 80.0.0.1 > >local 80.0.0.1 dev lo src 80.0.0.1 > > cache > ># ip route get 80.0.0.2 > >80.0.0.2 via 10.0.5.2 dev p9p1 src 10.0.5.15 > > cache > > > >While the route does remain in the table (so it can be modified if > >needed rather than being wiped away as it would be if IFF_UP was > >cleared), the proper next-hop is chosen automatically when the link is > >down. Now interface p8p1 is linked-up: > > > ># ip route show > >default via 10.0.5.2 dev p9p1 > >10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 > >70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > >80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 > >90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 > >90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 > >192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 > ># ip route get 90.0.0.1 > >90.0.0.1 via 80.0.0.2 dev p8p1 src 80.0.0.1 > > cache > ># ip route get 80.0.0.1 > >local 80.0.0.1 dev lo src 80.0.0.1 > > cache > ># ip route get 80.0.0.2 > >80.0.0.2 dev p8p1 src 80.0.0.1 > > cache > > > >and the output changes to what one would expect. > > > >If the sysctl is not set, the following output would be expected when > >p8p1 is down: > > > ># ip route show > >default via 10.0.5.2 dev p9p1 > >10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 > >70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > >80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 linkdown > >90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 linkdown > >90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 > > > >Since the dead flag does not appear, there should be no expectation that > >the kernel would skip using this route due to link being down. > > > >v2: Split kernel changes into 2 patches, this actually makes a > >behavioral change if the sysctl is set. Also took suggestion from Alex > >to simplify code by only checking sysctl during fib lookup and > >suggestion from Scott to add a per-interface sysctl. > > > >Signed-off-by: Andy Gospodarek > >Signed-off-by: Dinesh Dutt > >--- > > include/linux/inetdevice.h| 3 +++ > > include/net/fib_rules.h | 3 ++- > > include/net/ip_fib.h | 17 ++--- > > include/uapi/linux/ip.h | 1 + > > include/uapi/linux/sysctl.h | 1 + > > kernel/sysctl_binary.c| 1 + > > net/ipv4/devinet.c| 2 ++ > > net/ipv4/fib_frontend.c | 6 +++--- > > net/ipv4/fib_rules.c | 5 +++-- > > net/ipv4/fib_semantics.c | 28 ++-- > > net/ipv4/fib_trie.c | 7 +++ > > net/ipv4/netfilter/ipt_rpfilter.c | 2 +- > > net/ipv4/route.c | 10 +- > > 13 files changed, 61 insertions(+), 25 deletions(-) [...] > >diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h > >index d1de1b7..854d790 100644 > >--- a/include/net/ip_fib.h > >+++ b/include/net/ip_fib.h > >@@ -266,11 +267,13 @@ static inline int fib_lookup(struct net *net, struct > >flowi4 *flp, > > > > for (err = 0; !err; err = -ENETUNREACH) { > > tb = rcu_dereference_rtnl(net->ipv4.fib_main); > >-if (tb && !fib_table_lookup(tb, flp, res, FIB_LOOKUP_NOREF)) > >+if (tb && !fib_table_lookup(tb, flp, res, > >+flags | FIB_LOOKUP_NOREF)) > > break; > > > > tb = rcu_dereference_rt
Re: [PATCH v3 1/2] sctp: rcu-ify addr_waitq
On Wed, Jun 10, 2015 at 10:31:42AM -0300, Marcelo Ricardo Leitner wrote: > On Tue, Jun 09, 2015 at 04:32:59PM -0300, Marcelo Ricardo Leitner wrote: > > On Tue, Jun 09, 2015 at 07:36:38AM -0400, Neil Horman wrote: > > > On Mon, Jun 08, 2015 at 05:37:05PM +0200, Hannes Frederic Sowa wrote: > > > > On Mo, 2015-06-08 at 11:19 -0400, Neil Horman wrote: > > > > > On Mon, Jun 08, 2015 at 04:59:18PM +0200, Hannes Frederic Sowa wrote: > > > > > > On Mon, Jun 8, 2015, at 16:46, Hannes Frederic Sowa wrote: > > > > > > > Hi Marcelo, > > > > > > > > > > > > > > a few hints on rcuification, sorry I reviewed the code so late: > > > > > > > > > > > > > > On Fri, Jun 5, 2015, at 19:08, mleit...@redhat.com wrote: > > > > > > > > From: Marcelo Ricardo Leitner > > > > > > > > > > > > > > > > That's needed for the next patch, so we break the lock > > > > > > > > inversion between > > > > > > > > netns_sctp->addr_wq_lock and socket lock on > > > > > > > > sctp_addr_wq_timeout_handler(). With this, we can traverse > > > > > > > > addr_waitq > > > > > > > > without taking addr_wq_lock, taking it just for the write > > > > > > > > operations. > > > > > > > > > > > > > > > > Signed-off-by: Marcelo Ricardo Leitner < > > > > > > > > marcelo.leit...@gmail.com> > > > > > > > > --- > > > > > > > > > > > > > > > > Notes: > > > > > > > > v2->v3: > > > > > > > > placed break statement on sctp_free_addr_wq_entry() > > > > > > > > removed unnecessary spin_lock noticed by Neil > > > > > > > > > > > > > > > > include/net/netns/sctp.h | 2 +- > > > > > > > > net/sctp/protocol.c | 80 > > > > > > > > +--- > > > > > > > > 2 files changed, 49 insertions(+), 33 deletions(-) > > > > > > > > > > > > > > > > diff --git a/include/net/netns/sctp.h > > > > > > > > b/include/net/netns/sctp.h > > > > > > > > index > > > > > > > > 3573a81815ad9e0efb6ceb721eb066d3726419f0..9e53412c4ed829e8e4577 > > > > > > > > 7a6d95406d490dbaa75 > > > > > > > > 100644 > > > > > > > > --- a/include/net/netns/sctp.h > > > > > > > > +++ b/include/net/netns/sctp.h > > > > > > > > @@ -28,7 +28,7 @@ struct netns_sctp { > > > > > > > > * It is a list of sctp_sockaddr_entry. > > > > > > > > */ > > > > > > > > struct list_head local_addr_list; > > > > > > > > - struct list_head addr_waitq; > > > > > > > > + struct list_head __rcu addr_waitq; > > > > > > > > struct timer_list addr_wq_timer; > > > > > > > > struct list_head auto_asconf_splist; > > > > > > > > spinlock_t addr_wq_lock; > > > > > > > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > > > > > > > > index > > > > > > > > 53b7acde9aa37bf3d4029c459421564d5270f4c0..9954fb8c9a9455d5ad7a6 > > > > > > > > 27e2d7f9a1fef861fc2 > > > > > > > > 100644 > > > > > > > > --- a/net/sctp/protocol.c > > > > > > > > +++ b/net/sctp/protocol.c > > > > > > > > @@ -593,15 +593,47 @@ static void sctp_v4_ecn_capable(struct > > > > > > > > sock *sk) > > > > > > > > INET_ECN_xmit(sk); > > > > > > > > } > > > > > > > > > > > > > > > > +static void sctp_free_addr_wq(struct net *net) > > > > > > > > +{ > > > > > > > > + struct sctp_sockaddr_entry *addrw; > > > > > > > > + > > > > > > > > + spin_lock_bh(&net->sctp.addr_wq_lock); > > > > > > > > > > > > > > Instead of holding spin_lock_bh you need to hold > > > > > > > rcu_read_lock_bh, so > > > > > > > kfree_rcu does not call free function at once (in theory ;) ). > > > > > > > > > > > > > > > + del_timer(&net->sctp.addr_wq_timer); > > > > > > > > + list_for_each_entry_rcu(addrw, &net->sctp.addr_waitq, > > > > > > > > list) { > > > > > > > > + list_del_rcu(&addrw->list); > > > > > > > > + kfree_rcu(addrw, rcu); > > > > > > > > + } > > > > > > > > + spin_unlock_bh(&net->sctp.addr_wq_lock); > > > > > > > > +} > > > > > > > > + > > > > > > > > +/* As there is no refcnt on sctp_sockaddr_entry, we must check > > > > > > > > inside > > > > > > > > + * the lock if it wasn't removed from addr_waitq already, > > > > > > > > otherwise we > > > > > > > > + * could double-free it. > > > > > > > > + */ > > > > > > > > +static void sctp_free_addr_wq_entry(struct net *net, > > > > > > > > + struct sctp_sockaddr_entry > > > > > > > > *addrw) > > > > > > > > +{ > > > > > > > > + struct sctp_sockaddr_entry *temp; > > > > > > > > + > > > > > > > > + spin_lock_bh(&net->sctp.addr_wq_lock); > > > > > > > > > > > > > > I don't think this spin_lock operation is needed. The del_timer > > > > > > > functions do synchronize themselves. > > > > > > > > > > > > > > > > > > > Sorry, those above two locks are needed, they are not implied by > > > > > > other > > > > > > locks. > > > > > > > > > > > What makes you say that? Multiple contexts can issue mod_timer calls > > > > > on the > > > > > same timer safely no, because of the internal locking? > > >
[PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs
Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug which makes them not release the MDIO line during turn-around time. This gets flagged by the GENET MDIO controller as a read failure, and we fail the read transaction. Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading from and if it is listed in this bitmask, ignore the read failure and proceed with returning the data we read out of the controller. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 420949cc55aa..6bef04e2f735 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -47,7 +47,12 @@ static int bcmgenet_mii_read(struct mii_bus *bus, int phy_id, int location) HZ / 100); ret = bcmgenet_umac_readl(priv, UMAC_MDIO_CMD); - if (ret & MDIO_READ_FAIL) + /* Some broken devices are known not to release the line during +* turn-around, e.g: Broadcom BCM53125 external switches, so check for +* that condition here and ignore the MDIO controller read failure +* indication. +*/ + if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (ret & MDIO_READ_FAIL)) return -EIO; return ret & 0x; -- 2.1.0 -- 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/2] net: broadcom MDIO support for broken turn-around
Hi David, These two patches update the GENET and UniMAC MDIO controllers to deal with PHYs that are known to have a broken turn-around bug (e.g: BCM53125 and others) This utilizes the infrastructure that code recently added to do that in 'net-next'. Note that the changes look nearly identical and I will try to address the MDIO code duplication between GENET and UniMAC in a future patch series. Thanks! Florian Fainelli (2): net: bcmgenet: handle broken turn-around for specific PHYs net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++- drivers/net/phy/mdio-bcm-unimac.c| 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.1.0 -- 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 2/2] net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs
On 10/06/15 12:14, Florian Fainelli wrote: > Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug > which makes them not release the MDIO line during turn-around time. This gets > flagged by the UniMAC MDIO controller as a read failure, and we fail the read > transaction. > > Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading > from and if it is listed in this bitmask, ignore the read failure and > proceed with returning the data we read out of the controller. Scratch that version, it contains an unnecessary include and does not have the same comment as the GENET version, let me resubmit that. > > Signed-off-by: Florian Fainelli > --- > drivers/net/phy/mdio-bcm-unimac.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/phy/mdio-bcm-unimac.c > b/drivers/net/phy/mdio-bcm-unimac.c > index 414fdf1f343f..2237d5554e02 100644 > --- a/drivers/net/phy/mdio-bcm-unimac.c > +++ b/drivers/net/phy/mdio-bcm-unimac.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -81,7 +82,7 @@ static int unimac_mdio_read(struct mii_bus *bus, int > phy_id, int reg) > return -ETIMEDOUT; > > cmd = __raw_readl(priv->base + MDIO_CMD); > - if (cmd & MDIO_READ_FAIL) > + if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) > return -EIO; > > return cmd & 0x; > -- Florian -- 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] net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs
Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug which makes them not release the MDIO line during turn-around time. This gets flagged by the UniMAC MDIO controller as a read failure, and we fail the read transaction. Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading from and if it is listed in this bitmask, ignore the read failure and proceed with returning the data we read out of the controller. Signed-off-by: Florian Fainelli --- drivers/net/phy/mdio-bcm-unimac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c index 414fdf1f343f..2237d5554e02 100644 --- a/drivers/net/phy/mdio-bcm-unimac.c +++ b/drivers/net/phy/mdio-bcm-unimac.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -81,7 +82,7 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) return -ETIMEDOUT; cmd = __raw_readl(priv->base + MDIO_CMD); - if (cmd & MDIO_READ_FAIL) + if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) return -EIO; return cmd & 0x; -- 2.1.0 -- 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 0/2] net: broadcom MDIO support for broken turn-around
Hi David, These two patches update the GENET and UniMAC MDIO controllers to deal with PHYs that are known to have a broken turn-around bug (e.g: BCM53125 and others) This utilizes the infrastructure that code recently added to do that in 'net-next'. Note that the changes look nearly identical and I will try to address the MDIO code duplication between GENET and UniMAC in a future patch series. Thanks! Changes in v2: - remove brcmphy.h include in mdio-bcm-unimac.c - use the same comment as with GENET's MDIO read function Florian Fainelli (2): net: bcmgenet: handle broken turn-around for specific PHYs net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++- drivers/net/phy/mdio-bcm-unimac.c| 8 +++- 2 files changed, 13 insertions(+), 2 deletions(-) -- 2.1.0 -- 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 2/2] net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs
Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug which makes them not release the MDIO line during turn-around time. This gets flagged by the UniMAC MDIO controller as a read failure, and we fail the read transaction. Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading from and if it is listed in this bitmask, ignore the read failure and proceed with returning the data we read out of the controller. Signed-off-by: Florian Fainelli --- drivers/net/phy/mdio-bcm-unimac.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c index 414fdf1f343f..fc7abc50b4f1 100644 --- a/drivers/net/phy/mdio-bcm-unimac.c +++ b/drivers/net/phy/mdio-bcm-unimac.c @@ -81,7 +81,13 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) return -ETIMEDOUT; cmd = __raw_readl(priv->base + MDIO_CMD); - if (cmd & MDIO_READ_FAIL) + + /* Some broken devices are known not to release the line during +* turn-around, e.g: Broadcom BCM53125 external switches, so check for +* that condition here and ignore the MDIO controller read failure +* indication. +*/ + if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) return -EIO; return cmd & 0x; -- 2.1.0 -- 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 1/2] net: bcmgenet: handle broken turn-around for specific PHYs
Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug which makes them not release the MDIO line during turn-around time. This gets flagged by the GENET MDIO controller as a read failure, and we fail the read transaction. Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading from and if it is listed in this bitmask, ignore the read failure and proceed with returning the data we read out of the controller. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 420949cc55aa..6bef04e2f735 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -47,7 +47,12 @@ static int bcmgenet_mii_read(struct mii_bus *bus, int phy_id, int location) HZ / 100); ret = bcmgenet_umac_readl(priv, UMAC_MDIO_CMD); - if (ret & MDIO_READ_FAIL) + /* Some broken devices are known not to release the line during +* turn-around, e.g: Broadcom BCM53125 external switches, so check for +* that condition here and ignore the MDIO controller read failure +* indication. +*/ + if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (ret & MDIO_READ_FAIL)) return -EIO; return ret & 0x; -- 2.1.0 -- 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 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote: > Use kernel.h macro definition. > > Thanks to Julia Lawall for Coccinelle scripting support. [] > diff --git a/drivers/net/wireless/ath/ath5k/phy.c > b/drivers/net/wireless/ath/ath5k/phy.c [] > @@ -1566,17 +1566,13 @@ static s16 > ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah) > { > s16 sort[ATH5K_NF_CAL_HIST_MAX]; > - s16 tmp; > int i, j; > > memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort)); > for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) { > for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) { > - if (sort[j] > sort[j - 1]) { > - tmp = sort[j]; > - sort[j] = sort[j - 1]; > - sort[j - 1] = tmp; > - } > + if (sort[j] > sort[j - 1]) > + swap(sort[j], sort[j]); swap(a, a) doesn't look useful. -- 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 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
> On 10 June 2015 at 21:52 Joe Perches wrote: > > > On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote: > > Use kernel.h macro definition. > > > > Thanks to Julia Lawall for Coccinelle scripting support. > [] > > diff --git a/drivers/net/wireless/ath/ath5k/phy.c > > b/drivers/net/wireless/ath/ath5k/phy.c > [] > > @@ -1566,17 +1566,13 @@ static s16 > >Â ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah) > >Â { > >Â Â Â s16 sort[ATH5K_NF_CAL_HIST_MAX]; > > -Â Â s16 tmp; > >Â Â Â int i, j; > >Â > >Â Â Â memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort)); > >Â Â Â for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) { > >Â Â Â Â Â Â Â for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) { > > -Â Â Â Â Â Â Â Â Â Â if (sort[j] > sort[j - 1]) { > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp = sort[j]; > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â sort[j] = sort[j - 1]; > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â sort[j - 1] = tmp; > > -Â Â Â Â Â Â Â Â Â Â } > > +Â Â Â Â Â Â Â Â Â Â if (sort[j] > sort[j - 1]) > > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â swap(sort[j], sort[j]); > > swap(a, a) doesn't look useful. Thanks a lot Joe, I'll fix this one :) Regards, Fabian > > -- 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 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
On Wed, 10 Jun 2015, Fabian Frederick wrote: > > > > On 10 June 2015 at 21:52 Joe Perches wrote: > > > > > > On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote: > > > Use kernel.h macro definition. > > > > > > Thanks to Julia Lawall for Coccinelle scripting support. > > [] > > > diff --git a/drivers/net/wireless/ath/ath5k/phy.c > > > b/drivers/net/wireless/ath/ath5k/phy.c > > [] > > > @@ -1566,17 +1566,13 @@ static s16 > > >Â ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah) > > >Â { > > >Â Â Â s16 sort[ATH5K_NF_CAL_HIST_MAX]; > > > -Â Â s16 tmp; > > >Â Â Â int i, j; > > >Â > > >Â Â Â memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort)); > > >Â Â Â for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) { > > >Â Â Â Â Â Â Â for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) { > > > -Â Â Â Â Â Â Â Â Â Â if (sort[j] > sort[j - 1]) { > > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp = sort[j]; > > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â sort[j] = sort[j - 1]; > > > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â sort[j - 1] = tmp; > > > -Â Â Â Â Â Â Â Â Â Â } > > > +Â Â Â Â Â Â Â Â Â Â if (sort[j] > sort[j - 1]) > > > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â swap(sort[j], sort[j]); > > > > swap(a, a) doesn't look useful. > Thanks a lot Joe, I'll fix this one :) How did it come out like that? julia > > Regards, > Fabian > > > > >
Re: [PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*
On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote: > Signed-off-by: Ivan Vecera 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... -- 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
/net/mpls/conf/ethX//input duplicate entry
I'm getting this dump_stack when reloading rocker driver. Did some sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER? Steps to repro: load rocker (on system) with rocker device, rmmod rocker, and then modprobe rocker. I doubt this is specific to rocker: and re-registration of a netdev should hit it. I am using UDEV rules to rename kernel's ethX to a different name. Maybe that's what tripped it up? [ 68.587713] sysctl duplicate entry: /net/mpls/conf/eth4//input [ 68.590015] CPU: 0 PID: 2944 Comm: modprobe Not tainted 4.1.0-rc7+ #35 [ 68.591514] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014 [ 68.594401] 88000f521f00 88000f73f848 81443991 0006 [ 68.596885] 88000f73f8a8 811a4d5a 88000f73f8b8 [ 68.599328] 81a9e400 00040020 88000f73f8c8 [ 68.620961] Call Trace: [ 68.621770] [] dump_stack+0x4c/0x65 [ 68.623147] [] __register_sysctl_table+0x414/0x426 [ 68.624659] [] register_net_sysctl+0x10/0x12 [ 68.626052] [] mpls_dev_notify+0xd6/0x26f [ 68.627403] [] ? packet_notifier+0x18c/0x19a [ 68.628821] [] notifier_call_chain+0x3f/0x6c [ 68.630225] [] __raw_notifier_call_chain+0x9/0xb [ 68.631675] [] raw_notifier_call_chain+0xf/0x11 [ 68.633146] [] call_netdevice_notifiers_info+0x4f/0x58 [ 68.634695] [] call_netdevice_notifiers+0x11/0x13 [ 68.636175] [] register_netdevice+0x2f6/0x365 [ 68.637604] [] register_netdev+0x1a/0x27 [ 68.638962] [] rocker_probe+0x94d/0xc20 [rocker] [ 68.640424] [] ? component_bind_all+0x5b/0x190 [ 68.641861] [] local_pci_probe+0x38/0x7e [ 68.643204] [] pci_device_probe+0xce/0xf4 [ 68.644579] [] driver_probe_device+0xcc/0x23d [ 68.646220] [] ? driver_probe_device+0x23d/0x23d [ 68.647679] [] __driver_attach+0x4e/0x6f [ 68.649051] [] bus_for_each_dev+0x5a/0x8c [ 68.650402] [] driver_attach+0x19/0x1b [ 68.651773] [] bus_add_driver+0xf1/0x1d6 [ 68.653305] [] driver_register+0x87/0xbe [ 68.654652] [] __pci_register_driver+0x5d/0x62 [ 68.656087] [] ? 0xa0378000 [ 68.657367] [] rocker_module_init+0x39/0x1000 [rocker] [ 68.658900] [] ? 0xa0378000 [ 68.660178] [] ? 0xa0378000 [ 68.661461] [] do_one_initcall+0xe9/0x186 [ 68.662813] [] ? kmem_cache_alloc_trace+0xee/0x100 [ 68.664316] [] do_init_module+0x5b/0x1ca [ 68.665666] [] load_module+0x1cf2/0x1ee1 [ 68.667002] [] ? __module_get+0x29/0x29 [ 68.668336] [] ? retint_kernel+0x10/0x10 [ 68.669694] [] SyS_init_module+0x113/0x124 [ 68.671062] [] system_call_fastpath+0x12/0x6f -- 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] switchdev: fix BUG when port driver doesn't support set attr op
From: Scott Feldman Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged port does not support switchdec_port_attr_set op. Don't BUG() if -EOPNOTSUPP is returned. Signed-off-by: Scott Feldman Reported-by: Brenden Blanco --- net/switchdev/switchdev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index e008057..99bced4 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct work_struct *work) rtnl_lock(); err = switchdev_port_attr_set(asw->dev, &asw->attr); - BUG_ON(err); + BUG_ON(err && err != -EOPNOTSUPP); rtnl_unlock(); dev_put(asw->dev); -- 1.7.10.4 -- 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] switchdev: fix BUG when port driver doesn't support set attr op
On Wed, Jun 10, 2015 at 01:56:02PM -0700, sfel...@gmail.com wrote: > From: Scott Feldman > > Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged > port does not support switchdec_port_attr_set op. Don't BUG() if > -EOPNOTSUPP is returned. > > Signed-off-by: Scott Feldman > Reported-by: Brenden Blanco Looks good since -EOPNOTSUPP seems to be the safe failure case when switchdev is enabled or not. Acked-by: Andy Gospodarek -- 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] switchdev: fix BUG when port driver doesn't support set attr op
On 6/10/15 2:56 PM, sfel...@gmail.com wrote: From: Scott Feldman Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged port does not support switchdec_port_attr_set op. Don't BUG() if -EOPNOTSUPP is returned. Signed-off-by: Scott Feldman Reported-by: Brenden Blanco --- net/switchdev/switchdev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index e008057..99bced4 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct work_struct *work) rtnl_lock(); err = switchdev_port_attr_set(asw->dev, &asw->attr); - BUG_ON(err); + BUG_ON(err && err != -EOPNOTSUPP); rtnl_unlock(); dev_put(asw->dev); Should that be WARN_ON instead of BUG_ON? -- 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: Weird DHCP related problems with net-next
On Tue, Jun 9, 2015 at 5:12 PM, Florian Fainelli wrote: > I see the problem now, DSA does not implement a port_obj_add callback, > so when net/ipv4/fib_trie.c::switchdev_fib_ipv4_add() gets to call > switchdev_port_obj_add, we return -EOPNOTSUPP, and take the error path > in fib_table_insert thus not inserting the route for this interface. Yup, that's the problem. > Now when I restart the DHCP client, we end-up inserting the default > route which is correct, still figuring out what is different here, > probably the deletion of the routes by the DHCP client script first is > the different condition. After the first failure, ipv4.fib_offload_disabled is set, so the next time switchdev_fib_ipv4_add() just returns 0 and the route is installed. That explains the one-off behavior. > At any rate, since switchdev_fib_ipv4_add() returns something that make > us take an error path in the fib_trie, something like this seems to fix > it for me but I am not well versed enough into the IPv4 routing code to > be 100% confident this is the right fix. Also, there are other callers > of switchdev_port_obj_add() but a quick look seems to make them safe as > they are only called for "offloading" capable hardware. Your fix looks good to me. The other users of switchdev_port_obj_add() want to return -EOPNOTSUPP to user, so it's just this one case for IPv4 fib insert/del where we'll want to treat no support silently. Are you going to resend as patch for net-next, or should I? -- 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] switchdev: fix BUG when port driver doesn't support set attr op
On Wed, Jun 10, 2015 at 2:25 PM, David Ahern wrote: > On 6/10/15 2:56 PM, sfel...@gmail.com wrote: >> >> From: Scott Feldman >> >> Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged >> port does not support switchdec_port_attr_set op. Don't BUG() if >> -EOPNOTSUPP is returned. >> >> Signed-off-by: Scott Feldman >> Reported-by: Brenden Blanco >> --- >> net/switchdev/switchdev.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c >> index e008057..99bced4 100644 >> --- a/net/switchdev/switchdev.c >> +++ b/net/switchdev/switchdev.c >> @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct >> work_struct *work) >> >> rtnl_lock(); >> err = switchdev_port_attr_set(asw->dev, &asw->attr); >> - BUG_ON(err); >> + BUG_ON(err && err != -EOPNOTSUPP); >> rtnl_unlock(); >> >> dev_put(asw->dev); >> > > Should that be WARN_ON instead of BUG_ON? I think I had it as WARN when we were working on the initial patches, but we changed it to BUG_ON because we should only get an error here if the driver screwed something up between PREPARE phase and COMMIT phase, so it should be considered a driver bug which needs fixing. -- 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] switchdev: fix BUG when port driver doesn't support set attr op
On 6/10/15 3:47 PM, Scott Feldman wrote: Should that be WARN_ON instead of BUG_ON? I think I had it as WARN when we were working on the initial patches, but we changed it to BUG_ON because we should only get an error here if the driver screwed something up between PREPARE phase and COMMIT phase, so it should be considered a driver bug which needs fixing. Linus rants from time to time about the prolific use of BUG_ON. e.g., https://lkml.org/lkml/2015/4/28/528 'BUG_ON() is for things where our internal data structures are so corrupted that we don't know what to do, and there's no way to continue. Not for "I want to sprinkle these things around and this should not happen".' 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
Re: [PATCH v3] ipv6: Fix protocol resubmission
On 06/10/2015 10:16 AM, YOSHIFUJI Hideaki wrote: Hi, Josh Hunt wrote: On 06/09/2015 11:24 PM, Hajime Tazaki wrote: Hello Josh, Dave, my mobile ipv6 test on libos failed with this commit. This commit makes a destination option header handling (i.e., ipprot->handler == ipv6_destopt_rcv) failed since ipv6_destopt_rcv() seems to return a positive value to indicate to goto resubmission label. I will look for more detail. -- Hajime Hajime Thanks for the report. I mentioned in an earlier post this might be a problem. Dave, what if we restore the old behavior, but add a new label to handle the case where the decapsulating protocol returns the nexthdr value? Allowing for migration over to this method over time. I've pasted in a patch doing so below. I think it is insufficient because IPv6 stack already uses positive value, 0 and negative values. The other solution I guess is to change how the udp handler works, but I was hoping to keep it behaving the same as v4. xfrm returns different value for IPv4 and IPv6, for example, so udp can do in the same way. And we can use the fact that the size of next header field is 8-bit. Dave Can you please revert this change? commit 0243508edd317ff1fa63b495643a7c192fbfcd92 Author: Josh Hunt Date: Mon Jun 8 12:00:59 2015 -0400 ipv6: Fix protocol resubmission Let me know if you need a patch to do this and I will submit something. I will fix the original issue in the UDP code in another patch. Josh -- 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: /net/mpls/conf/ethX//input duplicate entry
On 6/10/15, 1:43 PM, Scott Feldman wrote: I'm getting this dump_stack when reloading rocker driver. Did some sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER? Steps to repro: load rocker (on system) with rocker device, rmmod rocker, and then modprobe rocker. I doubt this is specific to rocker: and re-registration of a netdev should hit it. I am using UDEV rules to rename kernel's ethX to a different name. Maybe that's what tripped it up? On a quick look, wondering if this is because mpls driver does not seem to do a unregister and re-register sysctl on device name change. diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 7b3f732..ec21a5d 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event, case NETDEV_UNREGISTER: mpls_ifdown(dev); break; + case NETDEV_CHANGENAME: + mpls_ifdown(dev); + if ((dev->type == ARPHRD_ETHER) || + (dev->type == ARPHRD_LOOPBACK)) { + mdev = mpls_add_dev(dev); + if (IS_ERR(mdev)) + return notifier_from_errno(PTR_ERR(mdev)); + } } return NOTIFY_OK; } -- 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] switchdev: fix BUG when port driver doesn't support set attr op
On Wed, Jun 10, 2015 at 2:47 PM, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 2:25 PM, David Ahern wrote: >> On 6/10/15 2:56 PM, sfel...@gmail.com wrote: >>> >>> From: Scott Feldman >>> >>> Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged >>> port does not support switchdec_port_attr_set op. Don't BUG() if >>> -EOPNOTSUPP is returned. >>> >>> Signed-off-by: Scott Feldman >>> Reported-by: Brenden Blanco >>> --- >>> net/switchdev/switchdev.c |2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c >>> index e008057..99bced4 100644 >>> --- a/net/switchdev/switchdev.c >>> +++ b/net/switchdev/switchdev.c >>> @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct >>> work_struct *work) >>> >>> rtnl_lock(); >>> err = switchdev_port_attr_set(asw->dev, &asw->attr); >>> - BUG_ON(err); >>> + BUG_ON(err && err != -EOPNOTSUPP); >>> rtnl_unlock(); >>> >>> dev_put(asw->dev); >>> >> >> Should that be WARN_ON instead of BUG_ON? > > I think I had it as WARN when we were working on the initial patches, > but we changed it to BUG_ON because we should only get an error here > if the driver screwed something up between PREPARE phase and COMMIT > phase, so it should be considered a driver bug which needs fixing. Actually, ignore what I said above. I was confusing this BUG_ON with the one in switchdev_port_attr_set(). Perhaps this BUG_ON() you're commenting on should be WARN(). A driver could return an err in PREPARE phase and that shouldn't be a BUG_ON situation; seems WARN would be better. It the case where the driver returns an err in COMMIT phase but didn't return an err in PREPARE phase we want to BUG_ON(). Maybe that case doesn't justify BUG_ON either, based on the link you posted. Jiri, IIRC, you suggested the BUG_ON(). Does it still sound right based on the point David is raising? -scott -- 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 v6 1/2] Renesas Ethernet AVB driver proper
Ethernet AVB includes an Gigabit Ethernet controller (E-MAC) that is basically compatible with SuperH Gigabit Ethernet E-MAC. Ethernet AVB has a dedicated direct memory access controller (AVB-DMAC) that is a new design compared to the SuperH E-DMAC. The AVB-DMAC is compliant with 3 standards formulated for IEEE 802.1BA: IEEE 802.1AS timing and synchronization protocol, IEEE 802.1Qav real- time transfer, and the IEEE 802.1Qat stream reservation protocol. The driver only supports device tree probing, so the binding document is included in this patch. Based on the original patches by Mitsuhiro Kimura. Signed-off-by: Mitsuhiro Kimura Signed-off-by: Sergei Shtylyov --- This patch is against David Miller's 'net-next.git' repo. Changes in version 6: - switched to also handling the network control RX/TX queues via NAPI; - started calling napi_gro_receive() instead of netif_receive_skb(); - removed NULL checks for the 'quota' parameter to ravb_rx() since now it's always gets called with non-NULL argument; - turned the assignments to the intializers in ravb_interrupt(); - moved ravb_write() call clearing TIS.TFUF interrupt into the code handling this specific interrupt. Changes in version 5: - switched to calling multiqueue APIs, implementing ndo_select_queue() method; - fixed the ring-full check in ravb_start_xmit() and turned it into a "sanity check", adjusting the error message and promoting dev_warn() to dev_err(); - fixed skb_put_padto() failure path to drop the packet; - moved the 'priv->cur_tx' increment after enqueuing the packet in ravb_start_xmit(); - added the ring-full check after the packet gets enqueued in ravb_start_xmit(), moved ravb_tx_free() call from the sanity check to this new code; - moved mmiowb() call after the 'exit' label in ravb_start_xmit(); - removed superfluous netif_tx_disable() call from ravb_set_ringparam(). Changes in version 4: - switched from the bit fields in the descriptor structures to normal fields and masks; - declared 16/32-bit descriptor fields as '__le{16/32}' and started using cpu_to_le{16|32}() and le{16|32}_to_cpu() when accessing them; - started registering/deregistering the PTP driver each time the AVB-DMAC enters/leaves the operation mode instead of navb_{probe|remove}(), and thus removed ravb_ptp_is_config() and also the checks in ravb_ptp_tcr_request(), ravb_ptp_time_write(), and ravb_ptp_update_addend(); - folded ravb_free_dma_buffer() into ravb_ring_free(), clarified the comment to the latter function; was then able to simplify the error cleanup path in ravb_ring_init(); - fixed totally brain damaged ravb_tx_timeout() by first stopping DMA and then calling ravb_ring_free() and moving most of the code into work-queue function, - started calling ravb_ring_init() from ravb_dmac_init(); - started allocating the TX buffers with GPF_KERNEL instead of GPF_ATOMIC; - started checking the result of ravb_wait() where it was previously ignored; - propagated errors from ravb_wait() calls outside ravb_ptp_tcr_request(); - propagated errors from ravb_ptp_tcr_request() calls outside ravb_ptp_time_{read|write}(); - propagated errors from ravb_ptp_time_{read|write}() outside ravb_ptp_adjtime() and ravb_ptp_{get|set}time64(); - switched from using ravb_wait() after setting a bit in the GCCR register to just checking if a bit is zero before setting it in ravb_ptp_time_write(), ravb_ptp_select_counter(), and ravb_ptp_update_addend(); - added check for ravb_ptp_update_compare() failure to ravb_ptp_perout() and propagate the error outside this function; - added mmiowb() calls before releasing the spinlock; - merged the spinlock release code from different *if* statement branches in ravb_ptp_ptp_perout(); - fixed the 'reg' parameter type in ravb_wait(); - fixed the result type for ravb_start_xmit(); - fixed the 'request' parameter type in ravb_ptp_tcr_request(); - added the 'size' local variable in ravb_tx_free(); - fixed TX ring cleanup threshold in ravb_start_xmit(); - fixed kmalloc() error cleanup in ravb_start_xmit(); - fixed ravb_start_xmit() racing with the interrupt handler and NAPI poller by holding spinlock till the end of ravb_start_xmit(); - factored out the GIC interrupt handling into ravb_ptp_interrupt(); - added the 'dma_addr' local variable in ravb_start_xmit(); - switched from '%=' operator to '&=' in ravb_start_xmit(); - changed the format specifier in ravb_tx_timeout(); - removed useless type cast from ravb_rx(); - acquired the spinlock earlier in ravb_poll(); - made ravb_ptp_init() return *void* since its result isn't checked anyway; - removed 'ravb_private::rx_buffer_size' since the RX buffer size should be constant; - removed unused 'ravb_private::edmac_endian'; - expanded update_mac_address() inline at its only call site; - expanded ravb_ptp_cnt_{read|write}() inline at their single call sites; - expanded ravb_ptp_cnt_select_counter() inline at its only call site; - expanded ravb_ptp_update_addend() at its on
[PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver
Ethernet AVB device includes the gPTP timer, so we can implement a PTP clock driver. We're doing that in a separate file, with the main Ethernet driver calling the PTP driver's [de]initialization and interrupt handler functions. Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when that one leaves the operation mode, we have to unregister the PTP clock... :-( Based on the original patches by Masaru Nagai. Signed-off-by: Masaru Nagai Signed-off-by: Sergei Shtylyov --- This patch is against David Miller's 'net-next.git' repo. Changes in version 6: - refreshed the patch. Changes in version 5: - resolved rejects, refreshed the patch. Changes in version 4: - new patch, split from the main Ethernet driver patch. drivers/net/ethernet/renesas/Makefile |2 drivers/net/ethernet/renesas/ravb.c | 33 ++ drivers/net/ethernet/renesas/ravb.h | 26 ++ drivers/net/ethernet/renesas/ravb_ptp.c | 357 4 files changed, 412 insertions(+), 6 deletions(-) Index: net-next/drivers/net/ethernet/renesas/Makefile === --- net-next.orig/drivers/net/ethernet/renesas/Makefile +++ net-next/drivers/net/ethernet/renesas/Makefile @@ -3,4 +3,4 @@ # obj-$(CONFIG_SH_ETH) += sh_eth.o -obj-$(CONFIG_RAVB) += ravb.o +obj-$(CONFIG_RAVB) += ravb.o ravb_ptp.o Index: net-next/drivers/net/ethernet/renesas/ravb.c === --- net-next.orig/drivers/net/ethernet/renesas/ravb.c +++ net-next/drivers/net/ethernet/renesas/ravb.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -41,8 +40,7 @@ NETIF_MSG_RX_ERR | \ NETIF_MSG_TX_ERR) -static int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, -u32 value) +int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, u32 value) { int i; @@ -763,6 +761,9 @@ static irqreturn_t ravb_interrupt(int ir result = IRQ_HANDLED; } + if (iss & ISS_CGIS) + result = ravb_ptp_interrupt(ndev); + mmiowb(); spin_unlock(&priv->lock); return result; @@ -1103,6 +1104,8 @@ static int ravb_set_ringparam(struct net if (netif_running(ndev)) { netif_device_detach(ndev); + /* Stop PTP Clock driver */ + ravb_ptp_stop(ndev); /* Wait for DMA stopping */ error = ravb_stop_dma(ndev); if (error) { @@ -1132,6 +1135,9 @@ static int ravb_set_ringparam(struct net ravb_emac_init(ndev); + /* Initialise PTP Clock driver */ + ravb_ptp_init(ndev, priv->pdev); + netif_device_attach(ndev); } @@ -1141,6 +1147,8 @@ static int ravb_set_ringparam(struct net static int ravb_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) { + struct ravb_private *priv = netdev_priv(ndev); + info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | @@ -1153,7 +1161,7 @@ static int ravb_get_ts_info(struct net_d (1 << HWTSTAMP_FILTER_NONE) | (1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) | (1 << HWTSTAMP_FILTER_ALL); - info->phc_index = -1; + info->phc_index = ptp_clock_index(priv->ptp.clock); return 0; } @@ -1195,15 +1203,21 @@ static int ravb_open(struct net_device * goto out_free_irq; ravb_emac_init(ndev); + /* Initialise PTP Clock driver */ + ravb_ptp_init(ndev, priv->pdev); + netif_tx_start_all_queues(ndev); /* PHY control start */ error = ravb_phy_start(ndev); if (error) - goto out_free_irq; + goto out_ptp_stop; return 0; +out_ptp_stop: + /* Stop PTP Clock driver */ + ravb_ptp_stop(ndev); out_free_irq: free_irq(ndev->irq, ndev); out_napi_off: @@ -1235,6 +1249,9 @@ static void ravb_tx_timeout_work(struct netif_tx_stop_all_queues(ndev); + /* Stop PTP Clock driver */ + ravb_ptp_stop(ndev); + /* Wait for DMA stopping */ ravb_stop_dma(ndev); @@ -1245,6 +1262,9 @@ static void ravb_tx_timeout_work(struct ravb_dmac_init(ndev); ravb_emac_init(ndev); + /* Initialise PTP Clock driver */ + ravb_ptp_init(ndev, priv->pdev); + netif_tx_start_all_queues(ndev); } @@ -1409,6 +1429,9 @@ static int ravb_close(struct net_device ravb_write(ndev, 0, RIC2); ravb_write(ndev, 0, TIC); + /* Stop PTP Clock driver */ + ravb_ptp_stop(ndev); + /* Set the config mode to stop the AVB-DMAC's processes */ if (ravb_stop_dma(ndev) < 0) netdev_err(ndev, Index: net-next/driv
Re: Weird DHCP related problems with net-next
On 10/06/15 14:44, Scott Feldman wrote: > On Tue, Jun 9, 2015 at 5:12 PM, Florian Fainelli wrote: > > >> I see the problem now, DSA does not implement a port_obj_add callback, >> so when net/ipv4/fib_trie.c::switchdev_fib_ipv4_add() gets to call >> switchdev_port_obj_add, we return -EOPNOTSUPP, and take the error path >> in fib_table_insert thus not inserting the route for this interface. > > Yup, that's the problem. > >> Now when I restart the DHCP client, we end-up inserting the default >> route which is correct, still figuring out what is different here, >> probably the deletion of the routes by the DHCP client script first is >> the different condition. > > After the first failure, ipv4.fib_offload_disabled is set, so the next > time switchdev_fib_ipv4_add() just returns 0 and the route is > installed. That explains the one-off behavior. > >> At any rate, since switchdev_fib_ipv4_add() returns something that make >> us take an error path in the fib_trie, something like this seems to fix >> it for me but I am not well versed enough into the IPv4 routing code to >> be 100% confident this is the right fix. Also, there are other callers >> of switchdev_port_obj_add() but a quick look seems to make them safe as >> they are only called for "offloading" capable hardware. > > Your fix looks good to me. The other users of > switchdev_port_obj_add() want to return -EOPNOTSUPP to user, so it's > just this one case for IPv4 fib insert/del where we'll want to treat > no support silently. Are you going to resend as patch for net-next, > or should I? I would prefer if you submitted it since you explained how things are working and now everything makes sense. I will be happy to test it and provide the magic tags ;) -- Florian -- 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 v3] ipv6: Fix protocol resubmission
From: Josh Hunt Date: Wed, 10 Jun 2015 16:57:25 -0500 > Can you please revert this change? > > commit 0243508edd317ff1fa63b495643a7c192fbfcd92 > Author: Josh Hunt > Date: Mon Jun 8 12:00:59 2015 -0400 > > ipv6: Fix protocol resubmission Done, thanks. -- 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: /net/mpls/conf/ethX//input duplicate entry
On Wed, Jun 10, 2015 at 2:58 PM, roopa wrote: > On 6/10/15, 1:43 PM, Scott Feldman wrote: >> >> I'm getting this dump_stack when reloading rocker driver. Did some >> sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER? >> >> Steps to repro: load rocker (on system) with rocker device, rmmod >> rocker, and then modprobe rocker. I doubt this is specific to rocker: >> and re-registration of a netdev should hit it. I am using UDEV rules >> to rename kernel's ethX to a different name. Maybe that's what >> tripped it up? >> > On a quick look, wondering if this is because mpls driver does not seem to > do a unregister and re-register sysctl > on device name change. > > diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c > index 7b3f732..ec21a5d 100644 > --- a/net/mpls/af_mpls.c > +++ b/net/mpls/af_mpls.c > @@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this, > unsigned long event, > case NETDEV_UNREGISTER: > mpls_ifdown(dev); > break; > + case NETDEV_CHANGENAME: > + mpls_ifdown(dev); > + if ((dev->type == ARPHRD_ETHER) || > + (dev->type == ARPHRD_LOOPBACK)) { > + mdev = mpls_add_dev(dev); > + if (IS_ERR(mdev)) > + return notifier_from_errno(PTR_ERR(mdev)); > + } > } > return NOTIFY_OK; > } Roopa, I tested this patch and problem goes away. (It's missing a break statement, BTW). I didn't look into the correctness of the patch, but at first glance it seems liek the right thing to do. Maybe breaking out the renaming portions into sub-functions could keep the work done in NETDEV_CHANGENAME to a minimum. Are you sending official fix? -scott -- 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] switchdev: fix handling for drivers not supporting IPv4 fib add/del ops
From: Scott Feldman If CONFIG_NET_SWITCHDEV is enabled, but port driver does not implement support for IPv4 FIB add/del ops, don't fail route add/del offload operations. Route adds will not be marked as OFFLOAD. Routes will be installed in the kernel FIB, as usual. This was report/fixed by Florian when testing DSA driver with net-next on devices with L2 offload support but no L3 offload support. What he reported was an initial route installed from DHCP client would fail (route not installed to kernel FIB). This was triggering the setting of ipv4.fib_offload_disabled, which would disable route offloading after the first failure. So subsequent attempts to install the route would succeed. There is follow-on work/discussion to address the handling of route install failures, but for now, let's differentiate between no support and failed support. Reported-by: Florian Fainelli Signed-off-by: Scott Feldman --- net/switchdev/switchdev.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 99bced4..28637e9 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -853,7 +853,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, if (!err) fi->fib_flags |= RTNH_F_OFFLOAD; - return err; + return err == -EOPNOTSUPP ? 0 : err; } EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_add); @@ -898,7 +898,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, if (!err) fi->fib_flags &= ~RTNH_F_OFFLOAD; - return err; + return err == -EOPNOTSUPP ? 0 : err; } EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_del); -- 1.7.10.4 -- 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] switchdev: fix handling for drivers not supporting IPv4 fib add/del ops
On 10/06/15 17:04, sfel...@gmail.com wrote: > From: Scott Feldman > > If CONFIG_NET_SWITCHDEV is enabled, but port driver does not implement > support for IPv4 FIB add/del ops, don't fail route add/del offload > operations. Route adds will not be marked as OFFLOAD. Routes will be > installed in the kernel FIB, as usual. > > This was report/fixed by Florian when testing DSA driver with net-next on > devices with L2 offload support but no L3 offload support. What he reported > was an initial route installed from DHCP client would fail (route not > installed to kernel FIB). This was triggering the setting of > ipv4.fib_offload_disabled, which would disable route offloading after the > first failure. So subsequent attempts to install the route would succeed. > > There is follow-on work/discussion to address the handling of route install > failures, but for now, let's differentiate between no support and failed > support. > > Reported-by: Florian Fainelli > Signed-off-by: Scott Feldman Signed-off-by: Florian Fainelli > --- > net/switchdev/switchdev.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c > index 99bced4..28637e9 100644 > --- a/net/switchdev/switchdev.c > +++ b/net/switchdev/switchdev.c > @@ -853,7 +853,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct > fib_info *fi, > if (!err) > fi->fib_flags |= RTNH_F_OFFLOAD; > > - return err; > + return err == -EOPNOTSUPP ? 0 : err; > } > EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_add); > > @@ -898,7 +898,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct > fib_info *fi, > if (!err) > fi->fib_flags &= ~RTNH_F_OFFLOAD; > > - return err; > + return err == -EOPNOTSUPP ? 0 : err; > } > EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_del); > > -- Florian -- 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 next v0] bonding: Display LACP info only to CAP_SYS_ADMIN capable user
Actor and Partner details can be accessed via proc-fs and sys-fs entries. These interfaces are world readable at this moment. The earlier patch-series made the LACP communication secure to avoid nuisance attack from within the same L2 domain but it did not prevent "someone unprivileged" looking at that information on host and perform the same act. This patch essentially avoids spitting those entries if the user in question does not have enough privileges. Signed-off-by: Mahesh Bandewar --- drivers/net/bonding/bond_procfs.c | 101 -- drivers/net/bonding/bond_sysfs.c | 12 ++--- 2 files changed, 59 insertions(+), 54 deletions(-) diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index e7f3047a26df..11fa3bab2fc8 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -135,27 +135,30 @@ static void bond_info_show_master(struct seq_file *seq) bond->params.ad_select); seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", optval->string); - seq_printf(seq, "System priority: %d\n", - BOND_AD_INFO(bond).system.sys_priority); - seq_printf(seq, "System MAC address: %pM\n", - &BOND_AD_INFO(bond).system.sys_mac_addr); - - if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { - seq_printf(seq, "bond %s has no active aggregator\n", - bond->dev->name); - } else { - seq_printf(seq, "Active Aggregator Info:\n"); - - seq_printf(seq, "\tAggregator ID: %d\n", - ad_info.aggregator_id); - seq_printf(seq, "\tNumber of ports: %d\n", - ad_info.ports); - seq_printf(seq, "\tActor Key: %d\n", - ad_info.actor_key); - seq_printf(seq, "\tPartner Key: %d\n", - ad_info.partner_key); - seq_printf(seq, "\tPartner Mac Address: %pM\n", - ad_info.partner_system); + if (capable(CAP_SYS_ADMIN)) { + seq_printf(seq, "System priority: %d\n", + BOND_AD_INFO(bond).system.sys_priority); + seq_printf(seq, "System MAC address: %pM\n", + &BOND_AD_INFO(bond).system.sys_mac_addr); + + if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { + seq_printf(seq, + "bond %s has no active aggregator\n", + bond->dev->name); + } else { + seq_printf(seq, "Active Aggregator Info:\n"); + + seq_printf(seq, "\tAggregator ID: %d\n", + ad_info.aggregator_id); + seq_printf(seq, "\tNumber of ports: %d\n", + ad_info.ports); + seq_printf(seq, "\tActor Key: %d\n", + ad_info.actor_key); + seq_printf(seq, "\tPartner Key: %d\n", + ad_info.partner_key); + seq_printf(seq, "\tPartner Mac Address: %pM\n", + ad_info.partner_system); + } } } } @@ -199,33 +202,35 @@ static void bond_info_show_slave(struct seq_file *seq, seq_printf(seq, "Partner Churned Count: %d\n", port->churn_partner_count); - seq_puts(seq, "details actor lacp pdu:\n"); - seq_printf(seq, "system priority: %d\n", - port->actor_system_priority); - seq_printf(seq, "system mac address: %pM\n", - &port->actor_system); - seq_printf(seq, "port key: %d\n", - port->actor_oper_port_key); - seq_printf(seq, "port priority: %d\n", - port->actor_port_priority); - seq_printf(seq, "port number: %d\n", - port->actor_port_number); - seq_printf(seq, "port state: %d\n", - port->actor_oper_port_state); - - seq_puts(seq, "details partner lacp pdu:\n"); - seq_printf(seq, "system priority: %d\n", -
Re: Problem with patch "make nlmsg_end() and genlmsg_end() void"
On Tue, 2015-06-09 at 17:49 -0700, Eric Dumazet wrote: > > I've added some debugging, and it seems that when it deadlocks, glibc > > doesn't get *any* response to its RTM_GETADDR request. I know we'd get > > ENOBUFS is a *response* was dropped... but what about when the request > > itself is dropped? ... > > Please check that this patch fixes your issue : > > http://patchwork.ozlabs.org/patch/473041/ Looks likely; thanks. I'm running with that patch now. I haven't been able to quickly reproduce the problem on demand, but it usually happens within a day or two. So it'll be a few days at least before I call it a success. -- dwmw2 smime.p7s Description: S/MIME cryptographic signature
Fw: [Bug 99191] New: ARP monitoring with bonding module uses interface alias for ARP request
Begin forwarded message: Date: Fri, 29 May 2015 17:59:33 + From: "bugzilla-dae...@bugzilla.kernel.org" To: "shemmin...@linux-foundation.org" Subject: [Bug 99191] New: ARP monitoring with bonding module uses interface alias for ARP request https://bugzilla.kernel.org/show_bug.cgi?id=99191 Bug ID: 99191 Summary: ARP monitoring with bonding module uses interface alias for ARP request Product: Networking Version: 2.5 Kernel Version: All Hardware: All OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: Other Assignee: shemmin...@linux-foundation.org Reporter: less...@gmail.com Regression: No When using arp_ip_target combined with arp_validate to verify the connectivity status of a bond, the wrong IP address is used as the source of the request if multiple IP aliases are assigned to the bond0. Example 1. bond0 - 10.0.0.5/24 (WAN) bond0:1 - 10.0.1.5/24 (LAN) arp_validate - all arp_ip_target - 10.0.0.1 Expected result: ARP, Request who-has 10.0.0.1 tell 10.0.0.5 Actual result: ARP, Request who-has 10.0.0.1 tell 10.0.1.5 Issue: The Layer 3 switch responsible for replying to the ARP request does not have the local interface of 10.0.1.5 configured, so the ARP request goes unanswered. - My expectation is that the bonding driver would use the primary IP on the bond0 interface, not a secondary IP. The solution being to be able to specify which IP the ARP should originate from in a scenario where bondX has multiple IPs assigned. Mangling the packet in/out using arptables does not achieve the desired effect. -- You are receiving this mail because: You are the assignee for the bug. -- 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 v2] net, swap: Remove a warning and clarify why sk_mem_reclaim is required when deactivating swap
From: Mel Gorman Jeff Layton reported the following; [ 74.232485] [ cut here ] [ 74.233354] WARNING: CPU: 2 PID: 754 at net/core/sock.c:364 sk_clear_memalloc+0x51/0x80() [ 74.234790] Modules linked in: cts rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache xfs libcrc32c snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device nfsd snd_pcm snd_timer snd e1000 ppdev parport_pc joydev parport pvpanic soundcore floppy serio_raw i2c_piix4 pcspkr nfs_acl lockd virtio_balloon acpi_cpufreq auth_rpcgss grace sunrpc qxl drm_kms_helper ttm drm virtio_console virtio_blk virtio_pci ata_generic virtio_ring pata_acpi virtio [ 74.243599] CPU: 2 PID: 754 Comm: swapoff Not tainted 4.1.0-rc6+ #5 [ 74.244635] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 74.245546] 79e69e31 8800d066bde8 8179263d [ 74.246786] 8800d066be28 8109e6fa [ 74.248175] 880118d48000 8800d58f5c08 880036e380a8 [ 74.249483] Call Trace: [ 74.249872] [] dump_stack+0x45/0x57 [ 74.250703] [] warn_slowpath_common+0x8a/0xc0 [ 74.251655] [] warn_slowpath_null+0x1a/0x20 [ 74.252585] [] sk_clear_memalloc+0x51/0x80 [ 74.253519] [] xs_disable_swap+0x42/0x80 [sunrpc] [ 74.254537] [] rpc_clnt_swap_deactivate+0x7e/0xc0 [sunrpc] [ 74.255610] [] nfs_swap_deactivate+0x27/0x30 [nfs] [ 74.256582] [] destroy_swap_extents+0x74/0x80 [ 74.257496] [] SyS_swapoff+0x222/0x5c0 [ 74.258318] [] ? syscall_trace_leave+0xc7/0x140 [ 74.259253] [] system_call_fastpath+0x12/0x71 [ 74.260158] ---[ end trace 2530722966429f10 ]--- The warning in question was unnecessary but with Jeff's series the rules are also clearer. This patch removes the warning and updates the comment to explain why sk_mem_reclaim() may still be called. [jlayton: remove if (sk->sk_forward_alloc) conditional. As Leon points out that it's not needed.] Cc: Leon Romanovsky Signed-off-by: Mel Gorman Signed-off-by: Jeff Layton --- net/core/sock.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 292f42228bfb..469d6039c7f5 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -354,15 +354,12 @@ void sk_clear_memalloc(struct sock *sk) /* * SOCK_MEMALLOC is allowed to ignore rmem limits to ensure forward -* progress of swapping. However, if SOCK_MEMALLOC is cleared while -* it has rmem allocations there is a risk that the user of the -* socket cannot make forward progress due to exceeding the rmem -* limits. By rights, sk_clear_memalloc() should only be called -* on sockets being torn down but warn and reset the accounting if -* that assumption breaks. +* progress of swapping. SOCK_MEMALLOC may be cleared while +* it has rmem allocations due to the last swapfile being deactivated +* but there is a risk that the socket is unusable due to exceeding +* the rmem limits. Reclaim the reserves and obey rmem limits again. */ - if (WARN_ON(sk->sk_forward_alloc)) - sk_mem_reclaim(sk); + sk_mem_reclaim(sk); } EXPORT_SYMBOL_GPL(sk_clear_memalloc); -- 2.4.2 -- 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/5] net: phy: broadcom: define pseudo-PHY address
Hi David, This patch series converts existing in-tree users of the Broadcom pseudo-PHY address (30) used to configure MDIO-connected switches to share a constant in a shared header files. Thanks! Florian Fainelli (5): net: phy: broadcom: include phy.h for brcmphy.h net: phy: broadcom: define Broadcom pseudo-PHY address in brcmphy.h b44: Utilize BRCM_PSEUDO_PHY_ADDR bgmac: Utilize BRCM_PSEUDO_PHY_ADDR net: dsa: bcm_sf2: Utilize BRCM_PSEUDO_PHY_ADDR drivers/net/dsa/bcm_sf2.c | 7 --- drivers/net/ethernet/broadcom/b44.h | 8 ++-- drivers/net/ethernet/broadcom/bgmac.h | 3 ++- include/linux/brcmphy.h | 7 +++ 4 files changed, 19 insertions(+), 6 deletions(-) -- 2.1.0 -- 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/5] net: phy: broadcom: define Broadcom pseudo-PHY address in brcmphy.h
Define the pseudo-PHY address (30) which is used by all Broadcom Ethernet switches in a shared header file. Signed-off-by: Florian Fainelli --- include/linux/brcmphy.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index abb6106f839d..697ca7795bd9 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -3,6 +3,11 @@ #include +/* All Broadcom Ethernet switches have a pseudo-PHY at address 30 which is used + * to configure the switch internal registers via MDIO accesses. + */ +#define BRCM_PSEUDO_PHY_ADDR 30 + #define PHY_ID_BCM506100x0143bd60 #define PHY_ID_BCM50610M 0x0143bd70 #define PHY_ID_BCM5241 0x0143bc30 -- 2.1.0 -- 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/5] net: phy: broadcom: include phy.h for brcmphy.h
We utilize inline functions from the PHY library, make sure that we do include phy.h in brcmphy.h in order for the code including brcmphy.h not to have to resolve this inclusion dependency. Fixes: 705314797b8b ("net: phy: broadcom: move shadow 0x1C register accessors to brcmphy.h") Signed-off-by: Florian Fainelli --- include/linux/brcmphy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 656da2a12ffe..abb6106f839d 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -1,6 +1,8 @@ #ifndef _LINUX_BRCMPHY_H #define _LINUX_BRCMPHY_H +#include + #define PHY_ID_BCM506100x0143bd60 #define PHY_ID_BCM50610M 0x0143bd70 #define PHY_ID_BCM5241 0x0143bc30 -- 2.1.0 -- 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 4/5] bgmac: Utilize BRCM_PSEUDO_PHY_ADDR
What BGMAC defines as BGMAC_PHY_NOREGS is in fact the Broadcom Ethernet switches' pseudo-PHY address (30), utilize the newly introduced constant from brcmphy.h Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/bgmac.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h index db27febbb215..4fbb093e0d84 100644 --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h @@ -13,6 +13,7 @@ dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) #include +#include #include #define BGMAC_DEV_CTL 0x000 @@ -349,7 +350,7 @@ #define BGMAC_DESC_CTL0_SOF0x8000 /* Start of frame */ #define BGMAC_DESC_CTL1_LEN0x1FFF -#define BGMAC_PHY_NOREGS 0x1E +#define BGMAC_PHY_NOREGS BRCM_PSEUDO_PHY_ADDR #define BGMAC_PHY_MASK 0x1F #define BGMAC_MAX_TX_RINGS 4 -- 2.1.0 -- 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/5] b44: Utilize BRCM_PSEUDO_PHY_ADDR
What B44 has been locally using as B44_PHY_ADDR_NO_LOCAL_PHY is in fact the Broadcom Ethernet switches pseudo-PHY address (30). Update the header to use the newly introduced constant and update comments so they are within 80 columns and consistent. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/b44.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h index 3e9c3fc7591b..65d88d7c5581 100644 --- a/drivers/net/ethernet/broadcom/b44.h +++ b/drivers/net/ethernet/broadcom/b44.h @@ -1,6 +1,8 @@ #ifndef _B44_H #define _B44_H +#include + /* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */ #defineB44_DEVCTRL 0xUL /* Device Control */ #define DEVCTRL_MPM 0x0040 /* Magic Packet PME Enable (B0 only) */ @@ -281,8 +283,10 @@ struct ring_info { }; #define B44_MCAST_TABLE_SIZE 32 -#define B44_PHY_ADDR_NO_LOCAL_PHY 30 /* no local phy regs */ -#define B44_PHY_ADDR_NO_PHY31 /* no phy present at all */ +/* no local phy regs, e.g: Broadcom switches pseudo-PHY */ +#define B44_PHY_ADDR_NO_LOCAL_PHY BRCM_PSEUDO_PHY_ADDR +/* no phy present at all */ +#define B44_PHY_ADDR_NO_PHY31 #define B44_MDC_RATIO 500 #defineB44_STAT_REG_DECLARE\ -- 2.1.0 -- 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 5/5] net: dsa: bcm_sf2: Utilize BRCM_PSEUDO_PHY_ADDR
Utilize the newly introduced BRCM_PSEUDO_PHY_ADDR constant from brcmphy.h instead of open-coding the Broadcom Ethernet switches pseudo-PHY address (30). Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 103fde3da476..972982f8bea7 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "bcm_sf2.h" #include "bcm_sf2_regs.h" @@ -697,7 +698,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) /* Include the pseudo-PHY address and the broadcast PHY address to * divert reads towards our workaround */ - ds->phys_mii_mask |= ((1 << 30) | (1 << 0)); + ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0)); rev = reg_readl(priv, REG_SWITCH_REVISION); priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) & @@ -782,7 +783,7 @@ static int bcm_sf2_sw_phy_read(struct dsa_switch *ds, int addr, int regnum) */ switch (addr) { case 0: - case 30: + case BRCM_PSEUDO_PHY_ADDR: return bcm_sf2_sw_indir_rw(ds, 1, addr, regnum, 0); default: return 0x; @@ -797,7 +798,7 @@ static int bcm_sf2_sw_phy_write(struct dsa_switch *ds, int addr, int regnum, */ switch (addr) { case 0: - case 30: + case BRCM_PSEUDO_PHY_ADDR: bcm_sf2_sw_indir_rw(ds, 0, addr, regnum, val); break; } -- 2.1.0 -- 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 2/3 v2] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Tue, Jun 9, 2015 at 11:47 PM, Andy Gospodarek wrote: > /* /proc/sys/net/ipv4/netfilter */ > diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c > index 7e7746a..c9d0a0e 100644 > --- a/kernel/sysctl_binary.c > +++ b/kernel/sysctl_binary.c > @@ -253,6 +253,7 @@ static const struct bin_table > bin_net_ipv4_conf_vars_table[] = { > { CTL_INT, NET_IPV4_CONF_NOPOLICY, > "disable_policy" }, > { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, > "force_igmp_version" }, > { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, > "promote_secondaries" }, > + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, > "ignore_routes_with_linkdown" }, Would "route_ignore_linkdown_nexthops" be a more accurate name? The patch marks link-downed nexthops to be ignored, not the route, correct? s/NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN/NET_IPV4_CONF_ROUTE_IGNORE_LINKDOWN_NEXTHOPS -- 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 2/3 v2] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 7:12 PM, Scott Feldman wrote: > On Tue, Jun 9, 2015 at 11:47 PM, Andy Gospodarek > wrote: > >> /* /proc/sys/net/ipv4/netfilter */ >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c >> index 7e7746a..c9d0a0e 100644 >> --- a/kernel/sysctl_binary.c >> +++ b/kernel/sysctl_binary.c >> @@ -253,6 +253,7 @@ static const struct bin_table >> bin_net_ipv4_conf_vars_table[] = { >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, >> "disable_policy" }, >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, >> "force_igmp_version" }, >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, >> "promote_secondaries" }, >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, >> "ignore_routes_with_linkdown" }, > > Would "route_ignore_linkdown_nexthops" be a more accurate name? The > patch marks link-downed nexthops to be ignored, not the route, > correct? > > s/NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN/NET_IPV4_CONF_ROUTE_IGNORE_LINKDOWN_NEXTHOPS Something like that. Not sure I like my suggestion. If dev is nexthop dev in route, and dev is link down, exclude nexthop in route lookup. route_exclude_if_linkdown_nexthop_dev? -- 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 2/3 v2] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 07:18:59PM -0700, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 7:12 PM, Scott Feldman wrote: > > On Tue, Jun 9, 2015 at 11:47 PM, Andy Gospodarek > > wrote: > > > >> /* /proc/sys/net/ipv4/netfilter */ > >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c > >> index 7e7746a..c9d0a0e 100644 > >> --- a/kernel/sysctl_binary.c > >> +++ b/kernel/sysctl_binary.c > >> @@ -253,6 +253,7 @@ static const struct bin_table > >> bin_net_ipv4_conf_vars_table[] = { > >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, > >> "disable_policy" }, > >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, > >> "force_igmp_version" }, > >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, > >> "promote_secondaries" }, > >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, > >> "ignore_routes_with_linkdown" }, > > > > Would "route_ignore_linkdown_nexthops" be a more accurate name? The > > patch marks link-downed nexthops to be ignored, not the route, > > correct? > > > > s/NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN/NET_IPV4_CONF_ROUTE_IGNORE_LINKDOWN_NEXTHOPS > > Something like that. Not sure I like my suggestion. If dev is > nexthop dev in route, and dev is link down, exclude nexthop in route > lookup. I actually played around with a bunch of different names and this was as short as I could get it while still conveying the point. I'm getting ready to submit v3, so speak now if you really do hate the name proposed in v2. > route_exclude_if_linkdown_nexthop_dev? Not bad, but you see what I mean about it being a mouthful. :) -- 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 v3] changes to make ipv4 routing table aware of next-hop link status
This series adds the ability to have the Linux kernel track whether or not a particular route should be used based on the link-status of the interface associated with the next-hop. Before this patch any link-failure on an interface that was serving as a gateway for some systems could result in those systems being isolated from the rest of the network as the stack would continue to attempt to send frames out of an interface that is actually linked-down. When the kernel is responsible for all forwarding, it should also be responsible for taking action when the traffic can no longer be forwarded -- there is no real need to outsource link-monitoring to userspace anymore. This feature is only enabled with the new per-interface or ipv4 global sysctls called 'ignore_routes_with_linkdown'. net.ipv4.conf.all.ignore_routes_with_linkdown = 0 net.ipv4.conf.default.ignore_routes_with_linkdown = 0 net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 ... When the above sysctls are set, the kernel will not only report to userspace that the link is down, but it will also report to userspace that a route is dead. This will signal to userspace that the route will not be selected. With the new sysctls set, the following behavior can be observed (interface p8p1 is link-down): # ip route show default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 dead linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 # ip route get 90.0.0.1 90.0.0.1 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache # ip route get 80.0.0.1 local 80.0.0.1 dev lo src 80.0.0.1 cache # ip route get 80.0.0.2 80.0.0.2 via 10.0.5.2 dev p9p1 src 10.0.5.15 cache While the route does remain in the table (so it can be modified if needed rather than being wiped away as it would be if IFF_UP was cleared), the proper next-hop is chosen automatically when the link is down. Now interface p8p1 is linked-up: # ip route show default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 # ip route get 90.0.0.1 90.0.0.1 via 80.0.0.2 dev p8p1 src 80.0.0.1 cache # ip route get 80.0.0.1 local 80.0.0.1 dev lo src 80.0.0.1 cache # ip route get 80.0.0.2 80.0.0.2 dev p8p1 src 80.0.0.1 cache and the output changes to what one would expect. If the global or interface sysctl is not set, the following output would be expected when p8p1 is down: # ip route show default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 linkdown 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 If the dead flag does not appear there should be no expectation that the kernel would skip using this route due to link being down. v2: Split kernel changes into 2 patches: first to add linkdown flag and second to add new sysctl settings. Also took suggestion from Alex to simplify code by only checking sysctl during fib lookup and suggestion from Scott to add a per-interface sysctl. Added iproute2 patch to recognize and print linkdown flag. v3: Code cleanups along with reverse-path checks suggested by Alex and small fixes related to problems found when multipath was disabled. Though there were some that preferred not to have a configuration option and to make this behavior the default when it was discussed in Ottawa earlier this year since "it was time to do this." I wanted to propose the config option to preserve the current behavior for those that desire it. I'll happily remove it if Dave and Linus approve. An IPv6 implementation is also needed (DECnet too!), but I wanted to start with the IPv4 implementation to get people comfortable with the idea before moving forward. If this is accepted the IPv6 implementation can be posted shortly. There was also a request for switchdev support for this, but that will be posted as a followup as switchdev does not currently handle dead next-hops in a multi-path case and I felt that infra needed to be added first. FWIW, we have been running the original version of this series with a global sysctl and our customers have been happily using a backported version for IPv4 and IPv6 for >6 months. Andy Gospodarek (3): net: track link-status of ipv4 nexthops net: ipv4 sysctl option to ignore routes when nexthop link is down iproute2: add support to print 'linkdown' nexthop flag include/li
[PATCH net-next 3/3 v3] iproute2: add support to print 'linkdown' nexthop flag
Signed-off-by: Andy Gospodaerk Signed-off-by: Dinesh Dutt --- ip/iproute.c | 4 1 file changed, 4 insertions(+) diff --git a/ip/iproute.c b/ip/iproute.c index 3795baf..3369c49 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -451,6 +451,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) fprintf(fp, "offload "); if (r->rtm_flags & RTM_F_NOTIFY) fprintf(fp, "notify "); + if (r->rtm_flags & RTNH_F_LINKDOWN) + fprintf(fp, "linkdown "); if (tb[RTA_MARK]) { unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]); if (mark) { @@ -670,6 +672,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) fprintf(fp, " onlink"); if (nh->rtnh_flags & RTNH_F_PERVASIVE) fprintf(fp, " pervasive"); + if (nh->rtnh_flags & RTNH_F_LINKDOWN) + fprintf(fp, " linkdown"); len -= NLMSG_ALIGN(nh->rtnh_len); nh = RTNH_NEXT(nh); } -- 1.9.3 -- 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 v3] net: ipv4 sysctl option to ignore routes when nexthop link is down
This feature is only enabled with the new per-interface or ipv4 global sysctls called 'ignore_routes_with_linkdown'. net.ipv4.conf.all.ignore_routes_with_linkdown = 0 net.ipv4.conf.default.ignore_routes_with_linkdown = 0 net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 ... When the above sysctls are set, will report to userspace that a route is dead and will no longer resolve to this nexthop when performing a fib lookup. This will signal to userspace that the route will not be selected. The signalling of a RTNH_F_DEAD is only passed to userspace if the sysctl is enabled and link is down. This was done as without it the netlink listeners would have no idea whether or not a nexthop would be selected. The kernel only sets RTNH_F_DEAD internally if the inteface has IFF_UP cleared. With the new sysctl set, the following behavior can be observed (interface p8p1 is link-down): default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 dead linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 90.0.0.1 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache local 80.0.0.1 dev lo src 80.0.0.1 cache 80.0.0.2 via 10.0.5.2 dev p9p1 src 10.0.5.15 cache While the route does remain in the table (so it can be modified if needed rather than being wiped away as it would be if IFF_UP was cleared), the proper next-hop is chosen automatically when the link is down. Now interface p8p1 is linked-up: default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 90.0.0.1 via 80.0.0.2 dev p8p1 src 80.0.0.1 cache local 80.0.0.1 dev lo src 80.0.0.1 cache 80.0.0.2 dev p8p1 src 80.0.0.1 cache and the output changes to what one would expect. If the sysctl is not set, the following output would be expected when p8p1 is down: default via 10.0.5.2 dev p9p1 10.0.5.0/24 dev p9p1 proto kernel scope link src 10.0.5.15 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 linkdown 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 1 linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 metric 2 Since the dead flag does not appear, there should be no expectation that the kernel would skip using this route due to link being down. v2: Split kernel changes into 2 patches, this actually makes a behavioral change if the sysctl is set. Also took suggestion from Alex to simplify code by only checking sysctl during fib lookup and suggestion from Scott to add a per-interface sysctl. v3: Code clean-ups to make it more readable and efficient as well as a reverse path check fix. Signed-off-by: Andy Gospodarek Signed-off-by: Dinesh Dutt --- include/linux/inetdevice.h| 3 +++ include/net/fib_rules.h | 3 ++- include/net/ip_fib.h | 16 +--- include/uapi/linux/ip.h | 1 + include/uapi/linux/sysctl.h | 1 + kernel/sysctl_binary.c| 1 + net/ipv4/devinet.c| 2 ++ net/ipv4/fib_frontend.c | 6 +++--- net/ipv4/fib_rules.c | 5 +++-- net/ipv4/fib_semantics.c | 29 - net/ipv4/fib_trie.c | 7 +++ net/ipv4/netfilter/ipt_rpfilter.c | 2 +- net/ipv4/route.c | 10 +- 13 files changed, 62 insertions(+), 24 deletions(-) diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 0a21fbe..a4328ce 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -120,6 +120,9 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) || (!IN_DEV_FORWARD(in_dev) && \ IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) +#define IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev) \ + IN_DEV_CONF_GET((in_dev), IGNORE_ROUTES_WITH_LINKDOWN) + #define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) #define IN_DEV_ARP_ACCEPT(in_dev) IN_DEV_ORCONF((in_dev), ARP_ACCEPT) #define IN_DEV_ARP_ANNOUNCE(in_dev)IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 6d67383..903a55e 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -36,7 +36,8 @@ struct fib_lookup_arg { void*result; struct fib_rule *rule; int flags; -#define FIB_LOOKUP_NOREF 1 +#define FIB_LOOKUP_NOREF 1 +#define FIB_LOOKUP_IGNORE_LINKSTATE2 }; struct fib_rules_ops { diff --git a/include
[PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are reachable via an interface where carrier is off. No action is taken, but additional flags are passed to userspace to indicate carrier status. This also includes a cleanup to fib_disable_ip to more clearly indicate what event made the function call to replace the more cryptic force option previously used. v2: Split out kernel functionality into 2 patches, this patch simply sets and clears new nexthop flag RTNH_F_LINKDOWN. v3: Cleanups suggested by Alex as well as a bug noticed in fib_sync_down_dev and fib_sync_up when multipath was not enabled. Signed-off-by: Andy Gospodarek Signed-off-by: Dinesh Dutt --- include/net/ip_fib.h | 4 +-- include/uapi/linux/rtnetlink.h | 3 +++ net/ipv4/fib_frontend.c| 22 ++-- net/ipv4/fib_semantics.c | 59 -- 4 files changed, 65 insertions(+), 23 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 54271ed..f73d27c 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -305,9 +305,9 @@ void fib_flush_external(struct net *net); /* Exported by fib_semantics.c */ int ip_fib_check_default(__be32 gw, struct net_device *dev); -int fib_sync_down_dev(struct net_device *dev, int force); +int fib_sync_down_dev(struct net_device *dev, unsigned long event); int fib_sync_down_addr(struct net *net, __be32 local); -int fib_sync_up(struct net_device *dev); +int fib_sync_up(struct net_device *dev, unsigned int nh_flags); void fib_select_multipath(struct fib_result *res); /* Exported by fib_trie.c */ diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 17fb02f..8ab874a 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h @@ -338,6 +338,9 @@ struct rtnexthop { #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ #define RTNH_F_ONLINK 4 /* Gateway is forced on link*/ #define RTNH_F_OFFLOAD 8 /* offloaded route */ +#define RTNH_F_LINKDOWN16 /* carrier-down on nexthop */ + +#define RTNH_F_COMPARE_MASK(RTNH_F_DEAD | RTNH_F_LINKDOWN) /* used as mask for route comparisons */ /* Macros to handle hexthops */ diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 872494e..872defb 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1063,9 +1063,9 @@ static void nl_fib_lookup_exit(struct net *net) net->ipv4.fibnl = NULL; } -static void fib_disable_ip(struct net_device *dev, int force) +static void fib_disable_ip(struct net_device *dev, unsigned long event) { - if (fib_sync_down_dev(dev, force)) + if (fib_sync_down_dev(dev, event)) fib_flush(dev_net(dev)); rt_cache_flush(dev_net(dev)); arp_ifdown(dev); @@ -1081,7 +1081,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, case NETDEV_UP: fib_add_ifaddr(ifa); #ifdef CONFIG_IP_ROUTE_MULTIPATH - fib_sync_up(dev); + fib_sync_up(dev, RTNH_F_DEAD); #endif atomic_inc(&net->ipv4.dev_addr_genid); rt_cache_flush(dev_net(dev)); @@ -1093,7 +1093,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, /* Last address was deleted from this interface. * Disable IP. */ - fib_disable_ip(dev, 1); + fib_disable_ip(dev, event); } else { rt_cache_flush(dev_net(dev)); } @@ -1107,9 +1107,10 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct in_device *in_dev; struct net *net = dev_net(dev); + unsigned flags; if (event == NETDEV_UNREGISTER) { - fib_disable_ip(dev, 2); + fib_disable_ip(dev, event); rt_flush_dev(dev); return NOTIFY_DONE; } @@ -1124,16 +1125,21 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo fib_add_ifaddr(ifa); } endfor_ifa(in_dev); #ifdef CONFIG_IP_ROUTE_MULTIPATH - fib_sync_up(dev); + fib_sync_up(dev, RTNH_F_DEAD); #endif atomic_inc(&net->ipv4.dev_addr_genid); rt_cache_flush(net); break; case NETDEV_DOWN: - fib_disable_ip(dev, 0); + fib_disable_ip(dev, event); break; - case NETDEV_CHANGEMTU: case NETDEV_CHANGE: + flags = dev_get_flags(dev); + if (flags & (IFF_RUNNING|IFF_LOWER_UP)) + fib_sync_up(dev, RTNH_F_LINKDOWN); + else +
Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek wrote: > @@ -1129,7 +1142,15 @@ int fib_sync_down_dev(struct net_device *dev, int > force) > dead++; > else if (nexthop_nh->nh_dev == dev && > nexthop_nh->nh_scope != scope) { > - nexthop_nh->nh_flags |= RTNH_F_DEAD; > + switch (event) { > + case NETDEV_DOWN: > + case NETDEV_UNREGISTER: > + nexthop_nh->nh_flags |= RTNH_F_DEAD; > + /* fall through */ > + case NETDEV_CHANGE: > + nexthop_nh->nh_flags |= > RTNH_F_LINKDOWN; > + break; > + } > #ifdef CONFIG_IP_ROUTE_MULTIPATH > spin_lock_bh(&fib_multipath_lock); > fi->fib_power -= nexthop_nh->nh_power; > @@ -1139,14 +1160,22 @@ int fib_sync_down_dev(struct net_device *dev, int > force) > dead++; > } > #ifdef CONFIG_IP_ROUTE_MULTIPATH > - if (force > 1 && nexthop_nh->nh_dev == dev) { > + if (event == NETDEV_UNREGISTER && nexthop_nh->nh_dev > == dev) { > dead = fi->fib_nhs; > break; > } > #endif > } endfor_nexthops(fi) > if (dead == fi->fib_nhs) { > - fi->fib_flags |= RTNH_F_DEAD; > + switch (event) { > + case NETDEV_DOWN: > + case NETDEV_UNREGISTER: > + fi->fib_flags |= RTNH_F_DEAD; > + /* fall through */ > + case NETDEV_CHANGE: > + fi->fib_flags |= RTNH_F_LINKDOWN; RTNH_F_LINKDOWN is to mark linkdown nexthop devswhy is the route fi being marked RTNH_F_LINKDOWN? The RTNH_F_LINKDOWN comment says: #define RTNH_F_LINKDOWN16 /* carrier-down on nexthop */ It's a per-nh flag, not per-route flag, correct? Can you show an ECMP example with only a subset of the nexthops dev linkdowned? Show the ip route output after going thru some link down/up events on some of the nexthops devs. -- 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 2/3 v2] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 7:23 PM, Andy Gospodarek wrote: > On Wed, Jun 10, 2015 at 07:18:59PM -0700, Scott Feldman wrote: >> On Wed, Jun 10, 2015 at 7:12 PM, Scott Feldman wrote: >> > On Tue, Jun 9, 2015 at 11:47 PM, Andy Gospodarek >> > wrote: >> > >> >> /* /proc/sys/net/ipv4/netfilter */ >> >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c >> >> index 7e7746a..c9d0a0e 100644 >> >> --- a/kernel/sysctl_binary.c >> >> +++ b/kernel/sysctl_binary.c >> >> @@ -253,6 +253,7 @@ static const struct bin_table >> >> bin_net_ipv4_conf_vars_table[] = { >> >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, >> >> "disable_policy" }, >> >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, >> >> "force_igmp_version" }, >> >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, >> >> "promote_secondaries" }, >> >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, >> >> "ignore_routes_with_linkdown" }, >> > >> > Would "route_ignore_linkdown_nexthops" be a more accurate name? The >> > patch marks link-downed nexthops to be ignored, not the route, >> > correct? >> > >> > s/NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN/NET_IPV4_CONF_ROUTE_IGNORE_LINKDOWN_NEXTHOPS >> >> Something like that. Not sure I like my suggestion. If dev is >> nexthop dev in route, and dev is link down, exclude nexthop in route >> lookup. > > I actually played around with a bunch of different names and this was as > short as I could get it while still conveying the point. I'm getting > ready to submit v3, so speak now if you really do hate the name proposed > in v2. > >> route_exclude_if_linkdown_nexthop_dev? > > Not bad, but you see what I mean about it being a mouthful. :) I think I'd rather see clarity over brevity in this case. The current name makes the attr sound like a route property but it's really a prop of the dev when the dev is a nexthop in a route and the dev link is down. -- 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 2/3 v3] net: ipv4 sysctl option to ignore routes when nexthop link is down
Hi, Andy Gospodarek wrote: > This feature is only enabled with the new per-interface or ipv4 global > sysctls called 'ignore_routes_with_linkdown'. > > net.ipv4.conf.all.ignore_routes_with_linkdown = 0 > net.ipv4.conf.default.ignore_routes_with_linkdown = 0 > net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 : > Signed-off-by: Andy Gospodarek > Signed-off-by: Dinesh Dutt > --- : > diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c > index 7e7746a..c9d0a0e 100644 > --- a/kernel/sysctl_binary.c > +++ b/kernel/sysctl_binary.c > @@ -253,6 +253,7 @@ static const struct bin_table > bin_net_ipv4_conf_vars_table[] = { > { CTL_INT, NET_IPV4_CONF_NOPOLICY, > "disable_policy" }, > { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, > "force_igmp_version" }, > { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, > "promote_secondaries" }, > + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, > "ignore_routes_with_linkdown" }, > {} > }; > Please do not add new binary sysctl knob. Thank you. -- Hideaki Yoshifuji Technical Division, MIRACLE LINUX CORPORATION -- 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 2/3 v3] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 7:57 PM, YOSHIFUJI Hideaki wrote: > Hi, > > Andy Gospodarek wrote: >> This feature is only enabled with the new per-interface or ipv4 global >> sysctls called 'ignore_routes_with_linkdown'. >> >> net.ipv4.conf.all.ignore_routes_with_linkdown = 0 >> net.ipv4.conf.default.ignore_routes_with_linkdown = 0 >> net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 > : >> Signed-off-by: Andy Gospodarek >> Signed-off-by: Dinesh Dutt >> --- > : >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c >> index 7e7746a..c9d0a0e 100644 >> --- a/kernel/sysctl_binary.c >> +++ b/kernel/sysctl_binary.c >> @@ -253,6 +253,7 @@ static const struct bin_table >> bin_net_ipv4_conf_vars_table[] = { >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, >> "disable_policy" }, >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, >> "force_igmp_version" }, >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, >> "promote_secondaries" }, >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, >> "ignore_routes_with_linkdown" }, >> {} >> }; >> > > Please do not add new binary sysctl knob. Thank you. Reason? -- 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 3/3 v3] iproute2: add support to print 'linkdown' nexthop flag
On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek wrote: > Signed-off-by: Andy Gospodaerk > Signed-off-by: Dinesh Dutt > > --- > ip/iproute.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/ip/iproute.c b/ip/iproute.c > index 3795baf..3369c49 100644 > --- a/ip/iproute.c > +++ b/ip/iproute.c > @@ -451,6 +451,8 @@ int print_route(const struct sockaddr_nl *who, struct > nlmsghdr *n, void *arg) > fprintf(fp, "offload "); > if (r->rtm_flags & RTM_F_NOTIFY) > fprintf(fp, "notify "); > + if (r->rtm_flags & RTNH_F_LINKDOWN) > + fprintf(fp, "linkdown "); This seems confusing for ECMP case where only some nexthop devs are RTNH_F_LINKDOWN? Why mark entire route "linkdown" when it still has viable nexthop devs for ECMP? > if (tb[RTA_MARK]) { > unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]); > if (mark) { > @@ -670,6 +672,8 @@ int print_route(const struct sockaddr_nl *who, struct > nlmsghdr *n, void *arg) > fprintf(fp, " onlink"); > if (nh->rtnh_flags & RTNH_F_PERVASIVE) > fprintf(fp, " pervasive"); > + if (nh->rtnh_flags & RTNH_F_LINKDOWN) > + fprintf(fp, " linkdown"); > len -= NLMSG_ALIGN(nh->rtnh_len); > nh = RTNH_NEXT(nh); > } > -- > 1.9.3 > -- 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 0/3 v3] changes to make ipv4 routing table aware of next-hop link status
On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek wrote: > There was also a request for switchdev support for this, but that will be > posted as a followup as switchdev does not currently handle dead > next-hops in a multi-path case and I felt that infra needed to be added > first. That's not true. switchdev_fib_ipv4_add() passes *fi and all of the nexthops for the route are hanging off of that, including the nh->flags where you're setting LINKDOWN. Multipath is not different than singlepath in that regard. Same API for both. switchdev support should be added for this NEW feature, especially since you're using the feature to offload to a switch device. -- 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 3/3 v3] iproute2: add support to print 'linkdown' nexthop flag
On Wed, Jun 10, 2015 at 08:02:26PM -0700, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek > wrote: > > Signed-off-by: Andy Gospodaerk > > Signed-off-by: Dinesh Dutt > > > > --- > > ip/iproute.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/ip/iproute.c b/ip/iproute.c > > index 3795baf..3369c49 100644 > > --- a/ip/iproute.c > > +++ b/ip/iproute.c > > @@ -451,6 +451,8 @@ int print_route(const struct sockaddr_nl *who, struct > > nlmsghdr *n, void *arg) > > fprintf(fp, "offload "); > > if (r->rtm_flags & RTM_F_NOTIFY) > > fprintf(fp, "notify "); > > + if (r->rtm_flags & RTNH_F_LINKDOWN) > > + fprintf(fp, "linkdown "); > > This seems confusing for ECMP case where only some nexthop devs are > RTNH_F_LINKDOWN? Why mark entire route "linkdown" when it still has > viable nexthop devs for ECMP? This is no different than what happens when nexthops are marked dead today. This situation happens when a route's nexthop has IFF_UP cleared. > > > > if (tb[RTA_MARK]) { > > unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]); > > if (mark) { > > @@ -670,6 +672,8 @@ int print_route(const struct sockaddr_nl *who, struct > > nlmsghdr *n, void *arg) > > fprintf(fp, " onlink"); > > if (nh->rtnh_flags & RTNH_F_PERVASIVE) > > fprintf(fp, " pervasive"); > > + if (nh->rtnh_flags & RTNH_F_LINKDOWN) > > + fprintf(fp, " linkdown"); > > len -= NLMSG_ALIGN(nh->rtnh_len); > > nh = RTNH_NEXT(nh); > > } > > -- > > 1.9.3 > > -- 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 0/3 v3] changes to make ipv4 routing table aware of next-hop link status
On Wed, Jun 10, 2015 at 08:07:10PM -0700, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek > wrote: > > > There was also a request for switchdev support for this, but that will be > > posted as a followup as switchdev does not currently handle dead > > next-hops in a multi-path case and I felt that infra needed to be added > > first. > > That's not true. switchdev_fib_ipv4_add() passes *fi and all of the > nexthops for the route are hanging off of that, including the > nh->flags where you're setting LINKDOWN. Multipath is not different > than singlepath in that regard. Same API for both. The API is the same, but I did not see a path that would take a multipath route and update the dead nexthops when an interface is taken down with switchdev or rocker today. I could be wrong (and I will test again), but create a multipath route with nexthops on swp1 and swp2 and then call 'ip link set swp1 down' and let me know if you see rocker's ECMP routes get updated so only the nexthop on swp2 will be used. -- 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 1/3 v3] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 07:53:59PM -0700, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek > wrote: > > > @@ -1129,7 +1142,15 @@ int fib_sync_down_dev(struct net_device *dev, int > > force) > > dead++; > > else if (nexthop_nh->nh_dev == dev && > > nexthop_nh->nh_scope != scope) { > > - nexthop_nh->nh_flags |= RTNH_F_DEAD; > > + switch (event) { > > + case NETDEV_DOWN: > > + case NETDEV_UNREGISTER: > > + nexthop_nh->nh_flags |= RTNH_F_DEAD; > > + /* fall through */ > > + case NETDEV_CHANGE: > > + nexthop_nh->nh_flags |= > > RTNH_F_LINKDOWN; > > + break; > > + } > > #ifdef CONFIG_IP_ROUTE_MULTIPATH > > spin_lock_bh(&fib_multipath_lock); > > fi->fib_power -= nexthop_nh->nh_power; > > @@ -1139,14 +1160,22 @@ int fib_sync_down_dev(struct net_device *dev, int > > force) > > dead++; > > } > > #ifdef CONFIG_IP_ROUTE_MULTIPATH > > - if (force > 1 && nexthop_nh->nh_dev == dev) { > > + if (event == NETDEV_UNREGISTER && > > nexthop_nh->nh_dev == dev) { > > dead = fi->fib_nhs; > > break; > > } > > #endif > > } endfor_nexthops(fi) > > if (dead == fi->fib_nhs) { > > - fi->fib_flags |= RTNH_F_DEAD; > > + switch (event) { > > + case NETDEV_DOWN: > > + case NETDEV_UNREGISTER: > > + fi->fib_flags |= RTNH_F_DEAD; > > + /* fall through */ > > + case NETDEV_CHANGE: > > + fi->fib_flags |= RTNH_F_LINKDOWN; > > RTNH_F_LINKDOWN is to mark linkdown nexthop devswhy is the route > fi being marked RTNH_F_LINKDOWN? > > The RTNH_F_LINKDOWN comment says: > > #define RTNH_F_LINKDOWN16 /* carrier-down on nexthop */ This is done with the dead flag already. I'm actually following the precedent already set there. > It's a per-nh flag, not per-route flag, correct? > > Can you show an ECMP example with only a subset of the nexthops dev > linkdowned? Show the ip route output after going thru some link > down/up events on some of the nexthops devs. Sure! This is exactly what I've been using for testing. # ip route show 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 90.0.0.0/24 via 70.0.0.2 dev p7p1 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 100.0.0.0/24 nexthop via 70.0.0.2 dev p7p1 weight 1 nexthop via 80.0.0.2 dev p8p1 weight 1 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 # # take p8p1 link down # ip route show 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 dead linkdown 100.0.0.0/24 nexthop via 70.0.0.2 dev p7p1 weight 1 nexthop via 80.0.0.2 dev p8p1 weight 1 dead linkdown 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 # ip route get 100.0.0.2 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache # ip route get 100.0.0.2 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache # # take p8p1 link up # ip route show 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 90.0.0.0/24 via 70.0.0.2 dev p7p1 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 100.0.0.0/24 nexthop via 70.0.0.2 dev p7p1 weight 1 nexthop via 80.0.0.2 dev p8p1 weight 1 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 # ip route show 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache # ip route get 100.0.0.2 100.0.0.2 via 80.0.0.2 dev p8p1 src 80.0.0.1 cache # ip route get 100.0.0.2 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 cache # ip route get 100.0.0.2 100.0.0.2 via 80.0.0.2 dev p8p1 src 80.0.0.1 cache # # you can see the round robin happening # # take all ports p8p1 and p7p1 down # ip route show 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 dead linkdown 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown 90.0.0.0/24 via 70.0.0.2 dev p7p1 dead linkdown 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 dead linkd
Re: [PATCH net-next 0/3 v3] changes to make ipv4 routing table aware of next-hop link status
On Wed, Jun 10, 2015 at 11:19:29PM -0400, Andy Gospodarek wrote: > On Wed, Jun 10, 2015 at 08:07:10PM -0700, Scott Feldman wrote: > > On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek > > wrote: > > > > > There was also a request for switchdev support for this, but that will be > > > posted as a followup as switchdev does not currently handle dead > > > next-hops in a multi-path case and I felt that infra needed to be added > > > first. > > > > That's not true. switchdev_fib_ipv4_add() passes *fi and all of the > > nexthops for the route are hanging off of that, including the > > nh->flags where you're setting LINKDOWN. Multipath is not different > > than singlepath in that regard. Same API for both. > > The API is the same, but I did not see a path that would take a > multipath route and update the dead nexthops when an interface is taken > down with switchdev or rocker today. > > I could be wrong (and I will test again), but create a multipath route > with nexthops on swp1 and swp2 and then call 'ip link set swp1 down' and > let me know if you see rocker's ECMP routes get updated so only the > nexthop on swp2 will be used. > Scott, as I stated before I have every intention of adding switchdev as well as ipv6 support and at this point I hope people know I'm good fot it. Since I'm already on v3 of the ipv4 support that is looking like a good idea. :) I'm sure you can empathize as you have organically grown the switchdev support in the kernel. -- 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 2/3 v3] net: ipv4 sysctl option to ignore routes when nexthop link is down
On Wed, Jun 10, 2015 at 08:00:14PM -0700, Scott Feldman wrote: > On Wed, Jun 10, 2015 at 7:57 PM, YOSHIFUJI Hideaki > wrote: > > Hi, > > > > Andy Gospodarek wrote: > >> This feature is only enabled with the new per-interface or ipv4 global > >> sysctls called 'ignore_routes_with_linkdown'. > >> > >> net.ipv4.conf.all.ignore_routes_with_linkdown = 0 > >> net.ipv4.conf.default.ignore_routes_with_linkdown = 0 > >> net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 > > : > >> Signed-off-by: Andy Gospodarek > >> Signed-off-by: Dinesh Dutt > >> --- > > : > >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c > >> index 7e7746a..c9d0a0e 100644 > >> --- a/kernel/sysctl_binary.c > >> +++ b/kernel/sysctl_binary.c > >> @@ -253,6 +253,7 @@ static const struct bin_table > >> bin_net_ipv4_conf_vars_table[] = { > >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, > >> "disable_policy" }, > >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, > >> "force_igmp_version" }, > >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, > >> "promote_secondaries" }, > >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, > >> "ignore_routes_with_linkdown" }, > >> {} > >> }; > >> > > > > Please do not add new binary sysctl knob. Thank you. > > Reason? I'll echo Scott's request here. I realize than an abundance of them is bad, but (to me) this one seems useful. Unless of course we want to make this proposed behavior the default. :-) -- 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 1/3 v3] net: track link-status of ipv4 nexthops
On Wed, Jun 10, 2015 at 8:28 PM, Andy Gospodarek wrote: > On Wed, Jun 10, 2015 at 07:53:59PM -0700, Scott Feldman wrote: >> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek >> wrote: >> >> > @@ -1129,7 +1142,15 @@ int fib_sync_down_dev(struct net_device *dev, int >> > force) >> > dead++; >> > else if (nexthop_nh->nh_dev == dev && >> > nexthop_nh->nh_scope != scope) { >> > - nexthop_nh->nh_flags |= RTNH_F_DEAD; >> > + switch (event) { >> > + case NETDEV_DOWN: >> > + case NETDEV_UNREGISTER: >> > + nexthop_nh->nh_flags |= >> > RTNH_F_DEAD; >> > + /* fall through */ >> > + case NETDEV_CHANGE: >> > + nexthop_nh->nh_flags |= >> > RTNH_F_LINKDOWN; >> > + break; >> > + } >> > #ifdef CONFIG_IP_ROUTE_MULTIPATH >> > spin_lock_bh(&fib_multipath_lock); >> > fi->fib_power -= nexthop_nh->nh_power; >> > @@ -1139,14 +1160,22 @@ int fib_sync_down_dev(struct net_device *dev, int >> > force) >> > dead++; >> > } >> > #ifdef CONFIG_IP_ROUTE_MULTIPATH >> > - if (force > 1 && nexthop_nh->nh_dev == dev) { >> > + if (event == NETDEV_UNREGISTER && >> > nexthop_nh->nh_dev == dev) { >> > dead = fi->fib_nhs; >> > break; >> > } >> > #endif >> > } endfor_nexthops(fi) >> > if (dead == fi->fib_nhs) { >> > - fi->fib_flags |= RTNH_F_DEAD; >> > + switch (event) { >> > + case NETDEV_DOWN: >> > + case NETDEV_UNREGISTER: >> > + fi->fib_flags |= RTNH_F_DEAD; >> > + /* fall through */ >> > + case NETDEV_CHANGE: >> > + fi->fib_flags |= RTNH_F_LINKDOWN; >> >> RTNH_F_LINKDOWN is to mark linkdown nexthop devswhy is the route >> fi being marked RTNH_F_LINKDOWN? >> >> The RTNH_F_LINKDOWN comment says: >> >> #define RTNH_F_LINKDOWN16 /* carrier-down on nexthop */ > > This is done with the dead flag already. I'm actually following the > precedent already set there. > >> It's a per-nh flag, not per-route flag, correct? >> >> Can you show an ECMP example with only a subset of the nexthops dev >> linkdowned? Show the ip route output after going thru some link >> down/up events on some of the nexthops devs. > > Sure! This is exactly what I've been using for testing. > > # ip route show > 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 > 90.0.0.0/24 via 70.0.0.2 dev p7p1 > 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 > 100.0.0.0/24 > nexthop via 70.0.0.2 dev p7p1 weight 1 > nexthop via 80.0.0.2 dev p8p1 weight 1 > 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 > # # take p8p1 link down > # ip route show > 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 dead linkdown > 90.0.0.0/24 via 70.0.0.2 dev p7p1 > 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 dead linkdown > 100.0.0.0/24 > nexthop via 70.0.0.2 dev p7p1 weight 1 > nexthop via 80.0.0.2 dev p8p1 weight 1 dead linkdown > 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 > # ip route get 100.0.0.2 > 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 > cache > # ip route get 100.0.0.2 > 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 > cache > # # take p8p1 link up > # ip route show > 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.0.1 > 80.0.0.0/24 dev p8p1 proto kernel scope link src 80.0.0.1 > 90.0.0.0/24 via 70.0.0.2 dev p7p1 > 90.0.0.0/24 via 80.0.0.2 dev p8p1 metric 10 > 100.0.0.0/24 > nexthop via 70.0.0.2 dev p7p1 weight 1 > nexthop via 80.0.0.2 dev p8p1 weight 1 > 192.168.56.0/24 dev p2p1 proto kernel scope link src 192.168.56.2 > # ip route show > 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 > cache > # ip route get 100.0.0.2 > 100.0.0.2 via 80.0.0.2 dev p8p1 src 80.0.0.1 > cache > # ip route get 100.0.0.2 > 100.0.0.2 via 70.0.0.2 dev p7p1 src 70.0.0.1 > cache > # ip route get 100.0.0.2 > 100.0.0.2 via 80.0.0.2 dev p8p1 src 80.0.0.1 > cache > # # you can see the round robin happening > # # take all ports p8p1 and p7p1 down > # ip route show > 70.0.0.0/24 dev p7p1 proto kernel scope link src 70.0.
Re: [PATCH net-next 2/3 v3] net: ipv4 sysctl option to ignore routes when nexthop link is down
From: Andy Gospodarek Date: Wed, 10 Jun 2015 23:36:21 -0400 > On Wed, Jun 10, 2015 at 08:00:14PM -0700, Scott Feldman wrote: >> On Wed, Jun 10, 2015 at 7:57 PM, YOSHIFUJI Hideaki >> wrote: >> > Hi, >> > >> > Andy Gospodarek wrote: >> >> This feature is only enabled with the new per-interface or ipv4 global >> >> sysctls called 'ignore_routes_with_linkdown'. >> >> >> >> net.ipv4.conf.all.ignore_routes_with_linkdown = 0 >> >> net.ipv4.conf.default.ignore_routes_with_linkdown = 0 >> >> net.ipv4.conf.lo.ignore_routes_with_linkdown = 0 >> > : >> >> Signed-off-by: Andy Gospodarek >> >> Signed-off-by: Dinesh Dutt >> >> --- >> > : >> >> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c >> >> index 7e7746a..c9d0a0e 100644 >> >> --- a/kernel/sysctl_binary.c >> >> +++ b/kernel/sysctl_binary.c >> >> @@ -253,6 +253,7 @@ static const struct bin_table >> >> bin_net_ipv4_conf_vars_table[] = { >> >> { CTL_INT, NET_IPV4_CONF_NOPOLICY, >> >> "disable_policy" }, >> >> { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, >> >> "force_igmp_version" }, >> >> { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, >> >> "promote_secondaries" }, >> >> + { CTL_INT, NET_IPV4_CONF_IGNORE_ROUTES_WITH_LINKDOWN, >> >> "ignore_routes_with_linkdown" }, >> >> {} >> >> }; >> >> >> > >> > Please do not add new binary sysctl knob. Thank you. >> >> Reason? > > I'll echo Scott's request here. I realize than an abundance of them is > bad, but (to me) this one seems useful. Unless of course we want to > make this proposed behavior the default. :-) Kernel wide, new binary sysctl's are verboten. Everyone should be accessing sysctls via their name. You have to remove this. -- 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: pull-request: can-next 2015-05-06
From: Marc Kleine-Budde Date: Tue, 9 Jun 2015 09:45:29 +0200 > this is a pull request of a two patches for net-next. > > The first patch is by Tomas Krcka, he fixes the (currently unused) > register address for acceptance filters. Oliver Hartkopp contributes a > patch for the cangw, where an optional UID is added to reference > routing jobs. Pulled, thanks Marc. -- 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] bridge: make br_fdb_delete also check if the port matches
From: Nikolay Aleksandrov Date: Tue, 9 Jun 2015 03:34:13 -0700 > Before this patch the user-specified bridge port was ignored when > deleting an fdb entry and thus one could delete an entry that belonged > to any port. > Example (eth0 and eth1 are br0 ports): > bridge fdb add 00:11:22:33:44:55 dev eth0 master > bridge fdb del 00:11:22:33:44:55 dev eth1 master > (succeeds) > > after the patch: > bridge fdb add 00:11:22:33:44:55 dev eth0 master > bridge fdb del 00:11:22:33:44:55 dev eth1 master > RTNETLINK answers: No such file or directory > > Based on a patch by Wilson Kok. > > Reported-by: Wilson Kok > Signed-off-by: Nikolay Aleksandrov Applied, thanks. -- 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 1/1] bna: remove obsolete use of EXTRA_CFLAGS
From: Jiri Slaby Date: Tue, 9 Jun 2015 14:24:43 +0200 > EXTRA_CFLAGS should be used on the command line only. > > Since EXTRA_CFLAGS here add only a non-existant path to compiler > include paths (by -I), remove EXTRA_CFLAGS completely. > > Signed-off-by: Jiri Slaby Applied to net-next, thanks. -- 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 0/3] Add cim_ma_la, cim_pif_la and tx_rate debugfs entry
From: Hariprasad Shenai Date: Tue, 9 Jun 2015 18:27:49 +0530 > This patch series adds the following. > Add debugfs entry to dump CIM MA logic analyzer and CIM PIF logic analyzer > logs. > Also adds support to dump tx rate of the channels in the adapter > > This patch series has been created against net-next tree and includes > patches on cxgb4 driver. > > We have included all the maintainers of respective drivers. Kindly review > the change and let us know in case of any review comments. Series applied, thanks. -- 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