主頁 > 作業系統 > 網路驅動學習雜記

網路驅動學習雜記

2022-05-24 21:45:41 作業系統

ethtool

ethtool的使用

不帶選項,默認輸出協商速率、最大速率、連接狀態等資訊

-i | --driver 列印驅動資訊

--set-priv-flags 設定網卡的私有屬性,比如將link-down-on-close置為true后可以使用ifconfig down去關閉網卡連接

-a |--show-pause 查看以太網是否啟用暫停幀(Pause Frame),暫停幀主要用于MAC層的流控,

-A |--pause DEVNAME 設定tx、rx和自動協商模式是否開啟暫停幀

-K 是否開啟TCP的offload機制

-m 獲取網卡的EEPROM資訊

ethtool資料獲取流程

ethtool和內核的通信流程如下圖所示:

figure1 ethtool資料獲取流程圖

ethtool使用ioctl去操作網卡,需要指定ioctl的request code為SIOCETHTOOL,可以對網卡進行的操作都定義在ethtool.h中,常見的操作碼有

ETHTOOL_GLINKSETTINGS(獲取link狀態,協商速率)、ETHTOOL_GDRVINFO(獲取驅動資訊),用戶和內核使用struct ifreq交換通信資料,

在用戶態,ethtool的主要作業是

1、構造傳入內核的結構體,在原始碼中使用了自定義的命令格式去封裝了和內核一致的結構體,比如struct ethtool_link_settings,這個結構體在ethtool原始碼和內核的include/uapi/linux/ethtool.h中都存在一份,給struct ifreq的ifru_data賦值為struct ecmd

2、呼叫ioctl,把struct ifreq傳入內核

3、決議獲取的資料,構造命令輸出

在內核,ethtool的主要經過了通用層和驅動層,其中一些操作能夠在通用層完成,不能在通用層完成,就繼續把請求傳遞到驅動層,net_device中的ethtool_ops包含了所有能夠通過ethtool執行的操作,這個結構體在內核模塊插入的時候通過 SET_ETHTOOL_OPS 進行初始化,

//用戶態主要代碼
int ioctl(int fd, unsigned long request, ...);

struct {
	struct ethtool_link_settings req;
	__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
} ecmd;


struct ethtool_value {
	__u32	cmd;
	__u32	data;
};

//內核態主要代碼
struct ifreq {
	void __user *	ifru_data;
}


struct ethtool_ops {
	int	(*get_settings)(struct net_device *, struct ethtool_cmd *);
	int	(*set_settings)(struct net_device *, struct ethtool_cmd *);
	void	(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
	int	(*get_regs_len)(struct net_device *);
	void	(*get_regs)(struct net_device *, struct ethtool_regs *, void *);
	void	(*get_wol)(struct net_device *, struct ethtool_wolinfo *);
	int	(*set_wol)(struct net_device *, struct ethtool_wolinfo *);
	u32	(*get_msglevel)(struct net_device *);
	void	(*set_msglevel)(struct net_device *, u32);
	int	(*nway_reset)(struct net_device *);
	u32	(*get_link)(struct net_device *);
	int	(*get_eeprom_len)(struct net_device *);
	int	(*get_eeprom)(struct net_device *,
			      struct ethtool_eeprom *, u8 *);
	int	(*set_eeprom)(struct net_device *,
			      struct ethtool_eeprom *, u8 *);
	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
	void	(*get_ringparam)(struct net_device *,
				 struct ethtool_ringparam *);
	int	(*set_ringparam)(struct net_device *,
				 struct ethtool_ringparam *);
	void	(*get_pauseparam)(struct net_device *,
				  struct ethtool_pauseparam*);
	int	(*set_pauseparam)(struct net_device *,
				  struct ethtool_pauseparam*);
	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *);
	void	(*get_strings)(struct net_device *, u32 stringset, u8 *);
	int	(*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
	void	(*get_ethtool_stats)(struct net_device *,
				     struct ethtool_stats *, u64 *);
	int	(*begin)(struct net_device *);
	void	(*complete)(struct net_device *);
	u32	(*get_priv_flags)(struct net_device *);
	int	(*set_priv_flags)(struct net_device *, u32);
	int	(*get_sset_count)(struct net_device *, int);
	int	(*get_rxnfc)(struct net_device *,
			     struct ethtool_rxnfc *, u32 *rule_locs);
	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
	int	(*flash_device)(struct net_device *, struct ethtool_flash *);
	int	(*reset)(struct net_device *, u32 *);
	u32	(*get_rxfh_key_size)(struct net_device *);
	u32	(*get_rxfh_indir_size)(struct net_device *);
	int	(*get_rxfh)(struct net_device *, u32 *indir, u8 *key,
			    u8 *hfunc);
	int	(*set_rxfh)(struct net_device *, const u32 *indir,
			    const u8 *key, const u8 hfunc);
	int	(*get_rxfh_context)(struct net_device *, u32 *indir, u8 *key,
				    u8 *hfunc, u32 rss_context);
	int	(*set_rxfh_context)(struct net_device *, const u32 *indir,
				    const u8 *key, const u8 hfunc,
				    u32 *rss_context, bool delete);
	void	(*get_channels)(struct net_device *, struct ethtool_channels *);
	int	(*set_channels)(struct net_device *, struct ethtool_channels *);
	int	(*get_dump_flag)(struct net_device *, struct ethtool_dump *);
	int	(*get_dump_data)(struct net_device *,
				 struct ethtool_dump *, void *);
	int	(*set_dump)(struct net_device *, struct ethtool_dump *);
	int	(*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
	int     (*get_module_info)(struct net_device *,
				   struct ethtool_modinfo *);
	int     (*get_module_eeprom)(struct net_device *,
				     struct ethtool_eeprom *, u8 *);
	int	(*get_eee)(struct net_device *, struct ethtool_eee *);
	int	(*set_eee)(struct net_device *, struct ethtool_eee *);
	int	(*get_tunable)(struct net_device *,
			       const struct ethtool_tunable *, void *);
	int	(*set_tunable)(struct net_device *,
			       const struct ethtool_tunable *, const void *);
	int	(*get_per_queue_coalesce)(struct net_device *, u32,
					  struct ethtool_coalesce *);
	int	(*set_per_queue_coalesce)(struct net_device *, u32,
					  struct ethtool_coalesce *);
	int	(*get_link_ksettings)(struct net_device *,
				      struct ethtool_link_ksettings *);
	int	(*set_link_ksettings)(struct net_device *,
				      const struct ethtool_link_ksettings *);
	int	(*get_fecparam)(struct net_device *,
				      struct ethtool_fecparam *);
	int	(*set_fecparam)(struct net_device *,
				      struct ethtool_fecparam *);
	void	(*get_ethtool_phy_stats)(struct net_device *,
					 struct ethtool_stats *, u64 *);
};

資料收發流程

包傳輸流程

在網卡層面,資料的傳輸使用transmission(通信領域的專有名詞)表達,驅動的包傳輸程序,宏觀上講就是把內核協議堆疊構造好的IP報文向下傳遞給驅動層,然后

再次封裝成以太網幀并通過介質傳播出去的程序,封裝以太網幀頭的程序通過dev_hard_header呼叫header_ops->create完成(在協議堆疊層),傳輸程序在驅動

中完成,

啟動傳輸的介面時net_device中的ndo_start_xmit(老版本是hard_start_xmit),

netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev);

這個介面需要由驅動程式進行實作,通用的實作邏輯是:

1、給skb->data填充padding

2、設定dev->trans_start

3、設備的私有資料參考skb

4、執行設備相關的發送邏輯(設定暫存器等)

sk_buff

struct sk_buff是整個內核網路資料交換、傳輸的核心資料結構,

figure2 sk_buff結構圖

重要屬性

struct sk_buff {
    //發送或者接收該BUFFER的設備
	struct net_device *dev; 
    
    //操作buffer的指標
    unsigned char *head; 
    unsigned char *data;
    unsigned char *tail;
    unsigned char *end;
    
    //len是整個sk_buff的長度,等于tail-head;
    //data_len是sk_buff存盤的有效資料的長度,等于end-data
    unsigned int len;
	unsigned int data_len;
};

重要方法

skb_put給buffer尾部增加資料

skb_push給buffer頭部增加資料

skb_pull洗掉buffer頭部的資料

skb_reserve給buffer頭部預留len位元組的空間

unsigned char *skb_put(struct sk_buff *skb, int len);
unsigned char *skb_push(struct sk_buff *skb, int len);
unsigned char *skb_pull(struct sk_buff *skb, int len);
void skb_reserve(struct sk_buff *skb, int len);

img

figure3 sk_buff操作示意圖(參考[1])

流量控制

網卡的傳播佇列大小有限,當佇列達到上限的時候,驅動需要通知上層不要暫停發送新的資料包,這個作業由netif_stop_queue完成,

需要注意的是,如果在stop佇列之后,在之后的某個時間點(具體這個時間點怎么確定是設備相關的)需要重啟傳播佇列,重啟佇列使用netif_wake_queue完成,netif_tx_disable 主要在ndo_start_xmit之外的場景使用,它可以保證在disable函

數生效之后,內核不會在別的CPU上再次呼叫ndo_start_xmit使得disable失效,

static inline void netif_stop_queue(struct net_device *dev);
static inline void netif_wake_queue(struct net_device *dev);
static inline void netif_tx_disable(struct net_device *dev)

資料包傳播超時

當系統流量比較大時,資料包的發送可能會超時,當資料包傳播超時的時候會呼叫net_device->ndo_tx_timeout函式,在ndo_tx_timeout函式中,一般會執行一下操作:

1、補全缺失的中斷

2、重啟傳播佇列:netif_wake_queue

包接收流程

驅動接收包的程序是從PHY接收資料然后構造成sk_buf傳遞給上層的程序,接收包的方式有中斷和NAPI兩種方式,NAPI 是 Linux 上采用的一種提高網路處理效率

的技術,它的核心概念就是不采用中斷的方式讀取資料,而代之以首先采用中斷喚醒資料接收的服務程式,然后 POLL 的方法來輪詢資料,

常規的中斷處理程式流程:

1、給設備加鎖

2、從暫存器獲取中斷狀態

3、判斷中斷型別,tx中斷還是rx中斷

4、釋放設備鎖和sk_buffer占用的資源

/*
 * The typical interrupt entry point
 */
static void snull_regular_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
	int statusword;
	struct snull_priv *priv;
	struct snull_packet *pkt = NULL;

	struct net_device *dev = (struct net_device *)dev_id;

	/* Lock the device */
	priv = netdev_priv(dev);
	spin_lock(&priv->lock);
    
	/* retrieve statusword: real netdevices use I/O instructions */
	statusword = priv->status;
	priv->status = 0;
	if (statusword & SNULL_RX_INTR) {
		/* send it to snull_rx for handling */
		pkt = priv->rx_queue;
		if (pkt) {
			priv->rx_queue = pkt->next;
			snull_rx(dev, pkt);
		}
	}
	if (statusword & SNULL_TX_INTR) {
		/* a transmission is over: free the skb */
		priv->stats.tx_packets++;
		priv->stats.tx_bytes += priv->tx_packetlen;
		dev_kfree_skb(priv->skb);
	}

	/* Unlock the device and we are done */
	spin_unlock(&priv->lock);
	if (pkt) snull_release_buffer(pkt); /* Do this outside the lock! */
	return;
}

中斷處理函式

接受包的中斷處理

1、從接收佇列中獲取一個包

2、創建一個skb_buff,長度是datalen+2,2是給預留空間的

3、呼叫skb_reserve(2),給skb_buff中的data在頭部預留2兩個位元組,以太網頭部是14位元組,保留兩個位元組就IP頭部的起始地址就剛好16位元組對齊,

? 對齊之后,可以減少CPU訪問硬體Cache的次數,

CPUs often take a performance hit when accessing unaligned memory locations. The actual performance hit varies, it can be small if the hardware

handles it or large if we have to take an exception and fix it in software. Since an ethernet header is 14 bytes network drivers often end up with the

IP header at an unaligned offset. The IP header can be aligned by shifting the start of the packet by 2 bytes. Drivers should do this with

skb_reserve(skb, NET_IP_ALIGN);

3、并將上一步獲取到的包拷貝到skb中

4、設定skb結構

(1)dev:表示該包是由那個設備接收的

(2)protocol: sk_buff的protocol欄位是一個 __be16 型別的變數,表示每一層所用的協議,并且每一層該欄位的值都不同,在驅動中使用幫助函式

? eth_type_trans去給該欄位賦值,

skb->protocol = eth_type_trans(skb, dev);

(3)ip_summed:該欄位表示驅動接收的包是否經過校驗,可以取的值有:

CHECKSUM_HW : 表示包已經有硬體做過校驗,上層(網路層)可以跳過校驗,

CHECKSUM_NONE : 表示包沒有做過校驗,上層需要做校驗和

CHECKSUM_UNNECESSARY:表示不執行校驗,loopback設備執行這個選項

(4)更新統計資料,stats.rx_packets加1,stats.rx_bytes增加skb_buff中有效資料的長度

5、呼叫 netif_rx 通知內核已經接收了一個資料包并構造成了sk_buff,值得注意的是這是一個異步的程序

void netif_rx(struct sk_buff *skb);  

包傳播成功的中斷處理

在資料包成功從網卡傳播到介質上時,網卡會發送一個成功的中斷信號,對于這種中斷的處理比較簡單,主要的作業是

1、更新統計資料

2、釋放給sk_buff分配的空間

NAPI

NAPI是為了針對傳統中斷在處理大流量場景時,占用CPU太多導致的網路吞吐慢的問題,而提出的一種新的包接收模式,其核心思想是只使用中斷去通知CPU一個包接收階段的開始,一旦開始真正進行包傳輸就切換到輪詢(POLL)模式,輪詢在大流量(批處理)場景由于不涉及到中斷,具備較高的資料吞吐,

使用NAPI,我們需要在網卡驅動初始化的時候,初始化napi_struct結構,所有

/*
 * Structure for NAPI scheduling similar to tasklet but with weighting
 */
struct napi_struct {
	/* The poll_list must only be managed by the entity which
	 * changes the state of the NAPI_STATE_SCHED bit.  This means
	 * whoever atomically sets that bit can add this napi_struct
	 * to the per-CPU poll_list, and whoever clears that bit
	 * can remove from the list right before clearing the bit.
	 */
	struct list_head	poll_list;

	unsigned long		state;
	int			weight;
	unsigned long		gro_bitmask;
	int			(*poll)(struct napi_struct *, int);
#ifdef CONFIG_NETPOLL
	int			poll_owner;
#endif
	struct net_device	*dev;
	struct gro_list		gro_hash[GRO_HASH_BUCKETS];
	struct sk_buff		*skb;
	struct hrtimer		timer;
	struct list_head	dev_list;
	struct hlist_node	napi_hash_node;
	unsigned int		napi_id;
};

使用NAPI的中斷處理函式:

1、關閉中斷,停止接收新的中斷

2、使用napi_schedule調度poll函式執行

一個典型的poll函式的流程

1、獲取設備私有資料結構

struct snull_priv {
	struct net_device_stats stats;
	int status;
	struct snull_packet *ppool;
	struct snull_packet *rx_queue;
	int rx_int_enabled;
	int tx_packetlen;
	u8 *tx_packetdata;
	struct sk_buff *skb;
	spinlock_t lock;
};

2、loop接收佇列,當接收的包超過系統的budget的時候退出回圈

3、loop內邏輯
(1)從佇列中獲取包
(2)和常規中斷一致的流程

原始碼

__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
{
	unsigned short _service_access_point;
	const unsigned short *sap;
	const struct ethhdr *eth;

	skb->dev = dev;
	skb_reset_mac_header(skb);

	eth = (struct ethhdr *)skb->data;
	skb_pull_inline(skb, ETH_HLEN);

	if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
		if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
			skb->pkt_type = PACKET_BROADCAST;
		else
			skb->pkt_type = PACKET_MULTICAST;
	}
	else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
						   dev->dev_addr)))
		skb->pkt_type = PACKET_OTHERHOST;

	/*
	 * Some variants of DSA tagging don't have an ethertype field
	 * at all, so we check here whether one of those tagging
	 * variants has been configured on the receiving interface,
	 * and if so, set skb->protocol without looking at the packet.
	 */
	if (unlikely(netdev_uses_dsa(dev)))
		return htons(ETH_P_XDSA);

	if (likely(eth_proto_is_802_3(eth->h_proto)))
		return eth->h_proto;

	/*
	 *      This is a magic hack to spot IPX packets. Older Novell breaks
	 *      the protocol design and runs IPX over 802.3 without an 802.2 LLC
	 *      layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
	 *      won't work for fault tolerant netware but does for the rest.
	 */
	sap = skb_header_pointer(skb, 0, sizeof(*sap), &_service_access_point);
	if (sap && *sap == 0xFFFF)
		return htons(ETH_P_802_3);

	/*
	 *      Real 802.2 LLC
	 */
	return htons(ETH_P_802_2);
}



void snull_rx(struct net_device *dev, struct snull_packet *pkt)
{
	struct sk_buff *skb;
	struct snull_priv *priv = netdev_priv(dev);

	/*
	 * The packet has been retrieved from the transmission
	 * medium. Build an skb around it, so upper layers can handle it
	 */
	skb = dev_alloc_skb(pkt->datalen + 2);
	skb_reserve(skb, 2); /* align IP on 16B boundary */  
	memcpy(skb_put(skb, pkt->datalen), pkt->data, pkt->datalen);

	/* Write metadata, and then pass to the receive level */
	skb->dev = dev;
	skb->protocol = eth_type_trans(skb, dev);
	skb->ip_summed = CHECKSUM_UNNECESSARY; /* don't check it */
	priv->stats.rx_packets++;
	priv->stats.rx_bytes += pkt->datalen;
    
	
    (skb);
	return;
}

參考

[1] 深入理解linux網路技術內幕
[2] LDD3
[3] https://sites.google.com/site/emmoblin/smp-yan-jiu/napi
[4] https://blog.51cto.com/u_15127616/3436261

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/480986.html

標籤:其他

上一篇:VMware 虛擬機圖文安裝和配置 AlmaLinux OS 8.6 教程

下一篇:15-CubeMx+Keil+Proteus仿真STM32 - LCD1602

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more