Loading drivers/net/ethernet/sfc/efx.c +7 −1 Original line number Diff line number Diff line Loading @@ -585,7 +585,7 @@ static void efx_start_datapath(struct efx_nic *efx) EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + efx->type->rx_buffer_padding); rx_buf_len = (sizeof(struct efx_rx_page_state) + NET_IP_ALIGN + efx->rx_dma_len); efx->rx_ip_align + efx->rx_dma_len); if (rx_buf_len <= PAGE_SIZE) { efx->rx_scatter = efx->type->always_rx_scatter; efx->rx_buffer_order = 0; Loading Loading @@ -645,6 +645,8 @@ static void efx_start_datapath(struct efx_nic *efx) WARN_ON(channel->rx_pkt_n_frags); } efx_ptp_start_datapath(efx); if (netif_device_present(efx->net_dev)) netif_tx_wake_all_queues(efx->net_dev); } Loading @@ -659,6 +661,8 @@ static void efx_stop_datapath(struct efx_nic *efx) EFX_ASSERT_RESET_SERIALISED(efx); BUG_ON(efx->port_enabled); efx_ptp_stop_datapath(efx); /* Stop RX refill */ efx_for_each_channel(channel, efx) { efx_for_each_channel_rx_queue(rx_queue, channel) Loading Loading @@ -2542,6 +2546,8 @@ static int efx_init_struct(struct efx_nic *efx, efx->net_dev = net_dev; efx->rx_prefix_size = efx->type->rx_prefix_size; efx->rx_ip_align = NET_IP_ALIGN ? (efx->rx_prefix_size + NET_IP_ALIGN) % 4 : 0; efx->rx_packet_hash_offset = efx->type->rx_hash_offset - efx->type->rx_prefix_size; spin_lock_init(&efx->stats_lock); Loading drivers/net/ethernet/sfc/mcdi.c +29 −10 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ struct efx_mcdi_async_param { static void efx_mcdi_timeout_async(unsigned long context); static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, bool *was_attached_out); static bool efx_mcdi_poll_once(struct efx_nic *efx); static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) { Loading Loading @@ -237,6 +238,21 @@ static void efx_mcdi_read_response_header(struct efx_nic *efx) } } static bool efx_mcdi_poll_once(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi = efx_mcdi(efx); rmb(); if (!efx->type->mcdi_poll_response(efx)) return false; spin_lock_bh(&mcdi->iface_lock); efx_mcdi_read_response_header(efx); spin_unlock_bh(&mcdi->iface_lock); return true; } static int efx_mcdi_poll(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi = efx_mcdi(efx); Loading Loading @@ -272,18 +288,13 @@ static int efx_mcdi_poll(struct efx_nic *efx) time = jiffies; rmb(); if (efx->type->mcdi_poll_response(efx)) if (efx_mcdi_poll_once(efx)) break; if (time_after(time, finish)) return -ETIMEDOUT; } spin_lock_bh(&mcdi->iface_lock); efx_mcdi_read_response_header(efx); spin_unlock_bh(&mcdi->iface_lock); /* Return rc=0 like wait_event_timeout() */ return 0; } Loading Loading @@ -619,6 +630,16 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, rc = efx_mcdi_await_completion(efx); if (rc != 0) { netif_err(efx, hw, efx->net_dev, "MC command 0x%x inlen %d mode %d timed out\n", cmd, (int)inlen, mcdi->mode); if (mcdi->mode == MCDI_MODE_EVENTS && efx_mcdi_poll_once(efx)) { netif_err(efx, hw, efx->net_dev, "MCDI request was completed without an event\n"); rc = 0; } /* Close the race with efx_mcdi_ev_cpl() executing just too late * and completing a request we've just cancelled, by ensuring * that the seqno check therein fails. Loading @@ -627,11 +648,9 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, ++mcdi->seqno; ++mcdi->credits; spin_unlock_bh(&mcdi->iface_lock); } netif_err(efx, hw, efx->net_dev, "MC command 0x%x inlen %d mode %d timed out\n", cmd, (int)inlen, mcdi->mode); } else { if (rc == 0) { size_t hdr_len, data_len; /* At the very least we need a memory barrier here to ensure Loading drivers/net/ethernet/sfc/net_driver.h +3 −0 Original line number Diff line number Diff line Loading @@ -683,6 +683,8 @@ struct vfdi_status; * @n_channels: Number of channels in use * @n_rx_channels: Number of channels used for RX (= number of RX queues) * @n_tx_channels: Number of channels used for TX * @rx_ip_align: RX DMA address offset to have IP header aligned in * in accordance with NET_IP_ALIGN * @rx_dma_len: Current maximum RX DMA length * @rx_buffer_order: Order (log2) of number of pages for each RX buffer * @rx_buffer_truesize: Amortised allocation size of an RX buffer, Loading Loading @@ -816,6 +818,7 @@ struct efx_nic { unsigned rss_spread; unsigned tx_channel_offset; unsigned n_tx_channels; unsigned int rx_ip_align; unsigned int rx_dma_len; unsigned int rx_buffer_order; unsigned int rx_buffer_truesize; Loading drivers/net/ethernet/sfc/nic.h +2 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,8 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); void efx_ptp_start_datapath(struct efx_nic *efx); void efx_ptp_stop_datapath(struct efx_nic *efx); extern const struct efx_nic_type falcon_a1_nic_type; extern const struct efx_nic_type falcon_b0_nic_type; Loading drivers/net/ethernet/sfc/ptp.c +57 −9 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ struct efx_ptp_timeset { * @evt_list: List of MC receive events awaiting packets * @evt_free_list: List of free events * @evt_lock: Lock for manipulating evt_list and evt_free_list * @evt_overflow: Boolean indicating that event list has overflowed * @rx_evts: Instantiated events (on evt_list and evt_free_list) * @workwq: Work queue for processing pending PTP operations * @work: Work task Loading Loading @@ -270,6 +271,7 @@ struct efx_ptp_data { struct list_head evt_list; struct list_head evt_free_list; spinlock_t evt_lock; bool evt_overflow; struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS]; struct workqueue_struct *workwq; struct work_struct work; Loading Loading @@ -635,6 +637,11 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx) } } } /* If the event overflow flag is set and the event list is now empty * clear the flag to re-enable the overflow warning message. */ if (ptp->evt_overflow && list_empty(&ptp->evt_list)) ptp->evt_overflow = false; spin_unlock_bh(&ptp->evt_lock); } Loading Loading @@ -676,6 +683,11 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx, break; } } /* If the event overflow flag is set and the event list is now empty * clear the flag to re-enable the overflow warning message. */ if (ptp->evt_overflow && list_empty(&ptp->evt_list)) ptp->evt_overflow = false; spin_unlock_bh(&ptp->evt_lock); return rc; Loading Loading @@ -705,6 +717,7 @@ static bool efx_ptp_process_events(struct efx_nic *efx, struct sk_buff_head *q) __skb_queue_tail(q, skb); } else if (time_after(jiffies, match->expiry)) { match->state = PTP_PACKET_STATE_TIMED_OUT; if (net_ratelimit()) netif_warn(efx, rx_err, efx->net_dev, "PTP packet - no timestamp seen\n"); __skb_queue_tail(q, skb); Loading Loading @@ -788,9 +801,14 @@ fail: static int efx_ptp_stop(struct efx_nic *efx) { struct efx_ptp_data *ptp = efx->ptp_data; int rc = efx_ptp_disable(efx); struct list_head *cursor; struct list_head *next; int rc; if (ptp == NULL) return 0; rc = efx_ptp_disable(efx); if (ptp->rxfilter_installed) { efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, Loading @@ -809,11 +827,19 @@ static int efx_ptp_stop(struct efx_nic *efx) list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { list_move(cursor, &efx->ptp_data->evt_free_list); } ptp->evt_overflow = false; spin_unlock_bh(&efx->ptp_data->evt_lock); return rc; } static int efx_ptp_restart(struct efx_nic *efx) { if (efx->ptp_data && efx->ptp_data->enabled) return efx_ptp_start(efx); return 0; } static void efx_ptp_pps_worker(struct work_struct *work) { struct efx_ptp_data *ptp = Loading Loading @@ -901,6 +927,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) spin_lock_init(&ptp->evt_lock); for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++) list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list); ptp->evt_overflow = false; ptp->phc_clock_info.owner = THIS_MODULE; snprintf(ptp->phc_clock_info.name, Loading Loading @@ -989,7 +1016,11 @@ bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) skb->len >= PTP_MIN_LENGTH && skb->len <= MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM && likely(skb->protocol == htons(ETH_P_IP)) && skb_transport_header_was_set(skb) && skb_network_header_len(skb) >= sizeof(struct iphdr) && ip_hdr(skb)->protocol == IPPROTO_UDP && skb_headlen(skb) >= skb_transport_offset(skb) + sizeof(struct udphdr) && udp_hdr(skb)->dest == htons(PTP_EVENT_PORT); } Loading Loading @@ -1106,7 +1137,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, { if ((enable_wanted != efx->ptp_data->enabled) || (enable_wanted && (efx->ptp_data->mode != new_mode))) { int rc; int rc = 0; if (enable_wanted) { /* Change of mode requires disable */ Loading @@ -1123,6 +1154,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, * succeed. */ efx->ptp_data->mode = new_mode; if (netif_running(efx->net_dev)) rc = efx_ptp_start(efx); if (rc == 0) { rc = efx_ptp_synchronize(efx, Loading Loading @@ -1304,8 +1336,13 @@ static void ptp_event_rx(struct efx_nic *efx, struct efx_ptp_data *ptp) list_add_tail(&evt->link, &ptp->evt_list); queue_work(ptp->workwq, &ptp->work); } else { netif_err(efx, rx_err, efx->net_dev, "No free PTP event"); } else if (!ptp->evt_overflow) { /* Log a warning message and set the event overflow flag. * The message won't be logged again until the event queue * becomes empty. */ netif_err(efx, rx_err, efx->net_dev, "PTP event queue overflow\n"); ptp->evt_overflow = true; } spin_unlock_bh(&ptp->evt_lock); } Loading Loading @@ -1398,7 +1435,7 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) if (rc != 0) return rc; ptp_data->current_adjfreq = delta; ptp_data->current_adjfreq = adjustment_ns; return 0; } Loading @@ -1413,7 +1450,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, 0); MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, ptp_data->current_adjfreq); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec); return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), Loading Loading @@ -1500,3 +1537,14 @@ void efx_ptp_probe(struct efx_nic *efx) efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] = &efx_ptp_channel_type; } void efx_ptp_start_datapath(struct efx_nic *efx) { if (efx_ptp_restart(efx)) netif_err(efx, drv, efx->net_dev, "Failed to restart PTP.\n"); } void efx_ptp_stop_datapath(struct efx_nic *efx) { efx_ptp_stop(efx); } Loading
drivers/net/ethernet/sfc/efx.c +7 −1 Original line number Diff line number Diff line Loading @@ -585,7 +585,7 @@ static void efx_start_datapath(struct efx_nic *efx) EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + efx->type->rx_buffer_padding); rx_buf_len = (sizeof(struct efx_rx_page_state) + NET_IP_ALIGN + efx->rx_dma_len); efx->rx_ip_align + efx->rx_dma_len); if (rx_buf_len <= PAGE_SIZE) { efx->rx_scatter = efx->type->always_rx_scatter; efx->rx_buffer_order = 0; Loading Loading @@ -645,6 +645,8 @@ static void efx_start_datapath(struct efx_nic *efx) WARN_ON(channel->rx_pkt_n_frags); } efx_ptp_start_datapath(efx); if (netif_device_present(efx->net_dev)) netif_tx_wake_all_queues(efx->net_dev); } Loading @@ -659,6 +661,8 @@ static void efx_stop_datapath(struct efx_nic *efx) EFX_ASSERT_RESET_SERIALISED(efx); BUG_ON(efx->port_enabled); efx_ptp_stop_datapath(efx); /* Stop RX refill */ efx_for_each_channel(channel, efx) { efx_for_each_channel_rx_queue(rx_queue, channel) Loading Loading @@ -2542,6 +2546,8 @@ static int efx_init_struct(struct efx_nic *efx, efx->net_dev = net_dev; efx->rx_prefix_size = efx->type->rx_prefix_size; efx->rx_ip_align = NET_IP_ALIGN ? (efx->rx_prefix_size + NET_IP_ALIGN) % 4 : 0; efx->rx_packet_hash_offset = efx->type->rx_hash_offset - efx->type->rx_prefix_size; spin_lock_init(&efx->stats_lock); Loading
drivers/net/ethernet/sfc/mcdi.c +29 −10 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ struct efx_mcdi_async_param { static void efx_mcdi_timeout_async(unsigned long context); static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, bool *was_attached_out); static bool efx_mcdi_poll_once(struct efx_nic *efx); static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) { Loading Loading @@ -237,6 +238,21 @@ static void efx_mcdi_read_response_header(struct efx_nic *efx) } } static bool efx_mcdi_poll_once(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi = efx_mcdi(efx); rmb(); if (!efx->type->mcdi_poll_response(efx)) return false; spin_lock_bh(&mcdi->iface_lock); efx_mcdi_read_response_header(efx); spin_unlock_bh(&mcdi->iface_lock); return true; } static int efx_mcdi_poll(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi = efx_mcdi(efx); Loading Loading @@ -272,18 +288,13 @@ static int efx_mcdi_poll(struct efx_nic *efx) time = jiffies; rmb(); if (efx->type->mcdi_poll_response(efx)) if (efx_mcdi_poll_once(efx)) break; if (time_after(time, finish)) return -ETIMEDOUT; } spin_lock_bh(&mcdi->iface_lock); efx_mcdi_read_response_header(efx); spin_unlock_bh(&mcdi->iface_lock); /* Return rc=0 like wait_event_timeout() */ return 0; } Loading Loading @@ -619,6 +630,16 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, rc = efx_mcdi_await_completion(efx); if (rc != 0) { netif_err(efx, hw, efx->net_dev, "MC command 0x%x inlen %d mode %d timed out\n", cmd, (int)inlen, mcdi->mode); if (mcdi->mode == MCDI_MODE_EVENTS && efx_mcdi_poll_once(efx)) { netif_err(efx, hw, efx->net_dev, "MCDI request was completed without an event\n"); rc = 0; } /* Close the race with efx_mcdi_ev_cpl() executing just too late * and completing a request we've just cancelled, by ensuring * that the seqno check therein fails. Loading @@ -627,11 +648,9 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, ++mcdi->seqno; ++mcdi->credits; spin_unlock_bh(&mcdi->iface_lock); } netif_err(efx, hw, efx->net_dev, "MC command 0x%x inlen %d mode %d timed out\n", cmd, (int)inlen, mcdi->mode); } else { if (rc == 0) { size_t hdr_len, data_len; /* At the very least we need a memory barrier here to ensure Loading
drivers/net/ethernet/sfc/net_driver.h +3 −0 Original line number Diff line number Diff line Loading @@ -683,6 +683,8 @@ struct vfdi_status; * @n_channels: Number of channels in use * @n_rx_channels: Number of channels used for RX (= number of RX queues) * @n_tx_channels: Number of channels used for TX * @rx_ip_align: RX DMA address offset to have IP header aligned in * in accordance with NET_IP_ALIGN * @rx_dma_len: Current maximum RX DMA length * @rx_buffer_order: Order (log2) of number of pages for each RX buffer * @rx_buffer_truesize: Amortised allocation size of an RX buffer, Loading Loading @@ -816,6 +818,7 @@ struct efx_nic { unsigned rss_spread; unsigned tx_channel_offset; unsigned n_tx_channels; unsigned int rx_ip_align; unsigned int rx_dma_len; unsigned int rx_buffer_order; unsigned int rx_buffer_truesize; Loading
drivers/net/ethernet/sfc/nic.h +2 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,8 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); void efx_ptp_start_datapath(struct efx_nic *efx); void efx_ptp_stop_datapath(struct efx_nic *efx); extern const struct efx_nic_type falcon_a1_nic_type; extern const struct efx_nic_type falcon_b0_nic_type; Loading
drivers/net/ethernet/sfc/ptp.c +57 −9 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ struct efx_ptp_timeset { * @evt_list: List of MC receive events awaiting packets * @evt_free_list: List of free events * @evt_lock: Lock for manipulating evt_list and evt_free_list * @evt_overflow: Boolean indicating that event list has overflowed * @rx_evts: Instantiated events (on evt_list and evt_free_list) * @workwq: Work queue for processing pending PTP operations * @work: Work task Loading Loading @@ -270,6 +271,7 @@ struct efx_ptp_data { struct list_head evt_list; struct list_head evt_free_list; spinlock_t evt_lock; bool evt_overflow; struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS]; struct workqueue_struct *workwq; struct work_struct work; Loading Loading @@ -635,6 +637,11 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx) } } } /* If the event overflow flag is set and the event list is now empty * clear the flag to re-enable the overflow warning message. */ if (ptp->evt_overflow && list_empty(&ptp->evt_list)) ptp->evt_overflow = false; spin_unlock_bh(&ptp->evt_lock); } Loading Loading @@ -676,6 +683,11 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx, break; } } /* If the event overflow flag is set and the event list is now empty * clear the flag to re-enable the overflow warning message. */ if (ptp->evt_overflow && list_empty(&ptp->evt_list)) ptp->evt_overflow = false; spin_unlock_bh(&ptp->evt_lock); return rc; Loading Loading @@ -705,6 +717,7 @@ static bool efx_ptp_process_events(struct efx_nic *efx, struct sk_buff_head *q) __skb_queue_tail(q, skb); } else if (time_after(jiffies, match->expiry)) { match->state = PTP_PACKET_STATE_TIMED_OUT; if (net_ratelimit()) netif_warn(efx, rx_err, efx->net_dev, "PTP packet - no timestamp seen\n"); __skb_queue_tail(q, skb); Loading Loading @@ -788,9 +801,14 @@ fail: static int efx_ptp_stop(struct efx_nic *efx) { struct efx_ptp_data *ptp = efx->ptp_data; int rc = efx_ptp_disable(efx); struct list_head *cursor; struct list_head *next; int rc; if (ptp == NULL) return 0; rc = efx_ptp_disable(efx); if (ptp->rxfilter_installed) { efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, Loading @@ -809,11 +827,19 @@ static int efx_ptp_stop(struct efx_nic *efx) list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { list_move(cursor, &efx->ptp_data->evt_free_list); } ptp->evt_overflow = false; spin_unlock_bh(&efx->ptp_data->evt_lock); return rc; } static int efx_ptp_restart(struct efx_nic *efx) { if (efx->ptp_data && efx->ptp_data->enabled) return efx_ptp_start(efx); return 0; } static void efx_ptp_pps_worker(struct work_struct *work) { struct efx_ptp_data *ptp = Loading Loading @@ -901,6 +927,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) spin_lock_init(&ptp->evt_lock); for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++) list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list); ptp->evt_overflow = false; ptp->phc_clock_info.owner = THIS_MODULE; snprintf(ptp->phc_clock_info.name, Loading Loading @@ -989,7 +1016,11 @@ bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) skb->len >= PTP_MIN_LENGTH && skb->len <= MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM && likely(skb->protocol == htons(ETH_P_IP)) && skb_transport_header_was_set(skb) && skb_network_header_len(skb) >= sizeof(struct iphdr) && ip_hdr(skb)->protocol == IPPROTO_UDP && skb_headlen(skb) >= skb_transport_offset(skb) + sizeof(struct udphdr) && udp_hdr(skb)->dest == htons(PTP_EVENT_PORT); } Loading Loading @@ -1106,7 +1137,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, { if ((enable_wanted != efx->ptp_data->enabled) || (enable_wanted && (efx->ptp_data->mode != new_mode))) { int rc; int rc = 0; if (enable_wanted) { /* Change of mode requires disable */ Loading @@ -1123,6 +1154,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, * succeed. */ efx->ptp_data->mode = new_mode; if (netif_running(efx->net_dev)) rc = efx_ptp_start(efx); if (rc == 0) { rc = efx_ptp_synchronize(efx, Loading Loading @@ -1304,8 +1336,13 @@ static void ptp_event_rx(struct efx_nic *efx, struct efx_ptp_data *ptp) list_add_tail(&evt->link, &ptp->evt_list); queue_work(ptp->workwq, &ptp->work); } else { netif_err(efx, rx_err, efx->net_dev, "No free PTP event"); } else if (!ptp->evt_overflow) { /* Log a warning message and set the event overflow flag. * The message won't be logged again until the event queue * becomes empty. */ netif_err(efx, rx_err, efx->net_dev, "PTP event queue overflow\n"); ptp->evt_overflow = true; } spin_unlock_bh(&ptp->evt_lock); } Loading Loading @@ -1398,7 +1435,7 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) if (rc != 0) return rc; ptp_data->current_adjfreq = delta; ptp_data->current_adjfreq = adjustment_ns; return 0; } Loading @@ -1413,7 +1450,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, 0); MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, ptp_data->current_adjfreq); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec); return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), Loading Loading @@ -1500,3 +1537,14 @@ void efx_ptp_probe(struct efx_nic *efx) efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] = &efx_ptp_channel_type; } void efx_ptp_start_datapath(struct efx_nic *efx) { if (efx_ptp_restart(efx)) netif_err(efx, drv, efx->net_dev, "Failed to restart PTP.\n"); } void efx_ptp_stop_datapath(struct efx_nic *efx) { efx_ptp_stop(efx); }